From f563932e46eda77010e4b83d81daa737c07567fb Mon Sep 17 00:00:00 2001 From: HCLonely Date: Mon, 6 Mar 2023 10:04:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:Opquests=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Release.yml | 6 +- dist/auto-task-v4-for-giveawaysu.all.user.js | 6 +- dist/auto-task-v4-for-giveawaysu.user.js | 6 +- dist/auto-task-v4.all.user.js | 10508 +++++++++------- dist/auto-task-v4.compatibility.all.user.js | 14 +- dist/auto-task-v4.compatibility.user.js | 14 +- dist/auto-task-v4.user.js | 10508 +++++++++------- doc/docs/logs/README.md | 6 + package.json | 4 +- .../auto-task-v4-for-giveawaysu.all.user.js | 6 +- page/dist/auto-task-v4-for-giveawaysu.user.js | 6 +- page/dist/auto-task-v4.all.user.js | 10508 +++++++++------- .../auto-task-v4.compatibility.all.user.js | 14 +- page/dist/auto-task-v4.compatibility.user.js | 14 +- page/dist/auto-task-v4.user.js | 10508 +++++++++------- page/package.json | 4 +- src/scripts/website/Opquests.ts | 31 +- 17 files changed, 23767 insertions(+), 18396 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 91bbab8..82fdf3a 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -21,9 +21,9 @@ jobs: uses: softprops/action-gh-release@v1 with: prerelease: false - tag_name: v4.2.31 - name: 4.2.31 - body: '- 优化:twitch完整性检查' + tag_name: v4.2.32 + name: 4.2.32 + body: '- 优化:Opquests验证任务流程' files: |- dist/auto-task-v4-for-giveawaysu.user.js dist/auto-task-v4.compatibility.user.js diff --git a/dist/auto-task-v4-for-giveawaysu.all.user.js b/dist/auto-task-v4-for-giveawaysu.all.user.js index e606c38..2b0361d 100644 --- a/dist/auto-task-v4-for-giveawaysu.all.user.js +++ b/dist/auto-task-v4-for-giveawaysu.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4-for-giveawaysu // @namespace auto-task-v4-for-giveawaysu -// @version 4.2.31 +// @version 4.2.32 // @description 赠Key站自动任务 // @author HCLonely // @license MIT @@ -87,7 +87,7 @@ var runtime=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); -!function(){var __webpack_modules__={400:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o{var{isDenied:text,isConfirmed}=isConfirmed;isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):text&&(text=`错误链接: [url=${window.location.href}]${window.location.href}[/url] +!function(){var __webpack_modules__={400:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o{var{isDenied:text,isConfirmed}=isConfirmed;isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):text&&(text=`错误链接: [url=${window.location.href}]${window.location.href}[/url] 环境: @@ -104,4 +104,4 @@ console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); `+error.stack)}async function httpRequest_httpRequest(options){var times=1{options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest_httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError_throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}}const tools_httpRequest=httpRequest_httpRequest;function delay(){let time=0{setTimeout(()=>{resolve(!0)},time)})}const scripts_echoLog=_ref=>{let{type,text,html,id}=_ref;const emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{var _ele$;let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ ${text}]...
  • `);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ - ${null===text||void 0===text?void 0:text.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}};const defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};var for_giveawaysu=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,for_giveawaysu);const languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en";const i18n=function(key){for(var _languages$language,_len=arguments.length,argvs=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)argvs[_key-1]=arguments[_key];return null!==(_languages$language=languages[language])&&void 0!==_languages$language&&_languages$language[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key};var social_Social=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0{var{isConfirmed,isDenied}=isDenied;return!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)}))return this.#initialized=!1,"skip";return globalOptions.doTask.discord.servers||globalOptions.undoTask.discord.servers?!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)):(this.#initialized=!1,"skip")}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=null===(auth=GM_getValue("discordAuth"))||void 0===auth?void 0:auth.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{const logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId});var _data$response,_data$response$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;logStatus.success();var guild=String(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$guild=_data$response.guild)||void 0===_data$response$guild?void 0:_data$response$guild.id);return guild&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(!guild)return!1;const logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});return"Success"===result&&204===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{const logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId});var guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var _data$response2,_data$response2$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;{const guild=null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$guild=_data$response2.guild)||void 0===_data$response2$guild?void 0:_data$response2$guild.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle(serverLinks){var{doTask=!0,serverLinks=[]}=serverLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/invite\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}};var for_giveawaysu=JSON.stringify({users:[]});const social_Instagram=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.instagram};#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(){var name=0{return null===(_link$match=_link$match.match(/https:\/\/www\.instagram\.com\/(.+)?\//))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}};for_giveawaysu=JSON.stringify({reddits:[]});const social_Reddit=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.reddit};#auth;#initialized=!1;async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{const logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{const newTab=GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(){var _data$responseText$ma,beta=0{var name=null===(name=userName.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/))||void 0===name?void 0:name[1],userName=null===(userName=userName.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/))||void 0===userName?void 0:userName[1];return userName?name||userName:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}};for_giveawaysu=JSON.stringify({channels:[]});const social_Twitch=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.twitch};#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(GM_setValue("twitchAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")});var _data$response,_data$response$,_data$response$$data,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response=data.response)&&void 0!==_data$response&&null!==(_data$response$=_data$response[0])&&void 0!==_data$response$&&null!==(_data$response$$data=_data$response$.data)&&void 0!==_data$response$$data&&_data$response$$data.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(){var isFirst=!(0{const newTab=GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel(doTask){var{name,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(!channelId)return!1;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name});var _data$response3,_data$response4,_data$response4$0$err,_data$response4$0$err2,followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+((null==data||null===(_data$response4=data.response)||void 0===_data$response4||null===(_data$response4$0$err=_data$response4[0].errors)||void 0===_data$response4$0$err||null===(_data$response4$0$err2=_data$response4$0$err[0])||void 0===_data$response4$0$err2?void 0:_data$response4$0$err2.message)||`${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`)),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{const logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name});var channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var _data$response5,_data$response5$,_data$response5$$data,_data$response5$$data2,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const channelId=null===(_data$response5=data.response)||void 0===_data$response5||null===(_data$response5$=_data$response5[0])||void 0===_data$response5$||null===(_data$response5$$data=_data$response5$.data)||void 0===_data$response5$$data||null===(_data$response5$$data2=_data$response5$$data.user)||void 0===_data$response5$$data2?void 0:_data$response5$$data2.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle(channelLinks){var{doTask=!0,channelLinks=[]}=channelLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/))||void 0===_link$match?void 0:_link$match[2]});if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}};for_giveawaysu=JSON.stringify({names:[]});const social_Vk=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.vk};#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});var _data$responseText$ma;return"Success"===result?null!==data&&void 0!==data&&data.finalUrl.includes("vk.com/login")?(logStatus.error("Error:"+i18n("loginVk"),!0),!1):200===(null===data||void 0===data?void 0:data.status)?(this.#username=(null===(_data$responseText$ma=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1])||"",logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam){var doTask=!(2{return null===(_link$match=_link$match.match(/https:\/\/vk\.com\/([^/]+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}};for_giveawaysu=JSON.stringify({channels:[],likes:[]});class Youtube extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.youtube};#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(GM_setValue("youtubeAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://www.youtube.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("youtubeAuth");auth?(this.#auth=auth,logStatus.success(),this.#verifyAuth().then(result=>{resolve(result)})):(logStatus.error("Error: Update youtube auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}#getInfo(link,type){return async function(link,type){try{const logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};{var _data$responseText$ma,_ref;if(data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube"))return logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0};var apiKey=null===(_data$responseText$ma=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],context=(null===(_ref=data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))||void 0===_ref?void 0:_ref[1])||"{}";const{client,request}=JSON.parse(context);if(apiKey&&client&&request){if(client.hl="en","channel"===type){var _data$responseText$ma2,channelId=null===(_data$responseText$ma2=data.responseText.match(//))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return channelId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{})}if("likeVideo"!==type)return logStatus.error("Error: Unknown type"),{};var _data$responseText$ma3,_data$responseText$ma4,videoId=null===(_data$responseText$ma3=data.responseText.match(//))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],likeParams=null===(_data$responseText$ma4=data.responseText.match(/"likeParams":"(.*?)"/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1];return videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})}return logStatus.error('Error: Parameter "apiKey" not found!'),{}}}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}}(link,type)}async#toggleChannel(verify){var{link,doTask=!0,verify=!1}=verify;try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)return scripts_echoLog({html:i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&channelId))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":null==client?void 0:client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:null==request?void 0:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&(/"subscribed": true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed": false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo(doTask){var{link,doTask=!0}=doTask;try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)return scripts_echoLog({html:""+i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&videoId&&likeParams))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;const logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle(videoLinks){var{doTask=!0,channelLinks=[],videoLinks=[]}=videoLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>{var _link$match;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match?void 0:_link$match[1]:link});if(0{var _link$match2;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match2=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match2?void 0:_link$match2[1]:link});if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}for_giveawaysu=JSON.stringify({groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]});const social_Steam=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.steam};#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";async init(){var type=0/g)].map(search=>search[1]);return currentArea&&0{const checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){const{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}const logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)});var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/account/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==(null==data?void 0:data.status)||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),"CN";var currentArea=(await this.#getAreaInfo())["currentArea"];return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{const logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})});return"Success"===result?200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;var groupId=await this.#getGroupId(groupName);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{const logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName});var _data$responseText$ma6,groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma6=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/))||void 0===_data$responseText$ma6?void 0:_data$responseText$ma6[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{const logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes('id="publicGroupJoin"'))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma7;logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]);var groupId=null===(_data$responseText$ma7=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma7?void 0:_data$responseText$ma7[1];return groupId&&this.#setCache("officialGroup",gameId,groupId),!0}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;var groupId=await this.#getOfficialGroupId(gameId);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId});var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{const logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId});var _data$responseText$ma8,groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma8=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma8?void 0:_data$responseText$ma8[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{var _data$response2;const logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response2=data.response)||void 0===_data$response2?void 0:_data$response2.success))return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)?"CN"===this.#area&&dataR.responseText.includes('id="error_box"')?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId)):(!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"'))?(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1):(logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{var _data$response3;if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;const logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.success))return logStatus.success(),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==(null===dataR||void 0===dataR?void 0:dataR.status))return logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));const result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{if(!doTask&&this.whiteList.follows.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId};doTask||(requestData.unfollow="1");var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)});if("Success"===result&&200===(null==data?void 0:data.status)&&"true"===data.responseText)return logStatus.success(),!0;var followed=await this.#isFollowedGame(gameId);return"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{const{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId){var doTask=!(1/))||void 0===_data$responseText$ma10?void 0:_data$responseText$ma10[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{const logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id});var _data$response6,{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?(200===(null==data?void 0:data.status)&&1===(null===(_data$response6=data.response)||void 0===_data$response6?void 0:_data$response6.success)?logStatus.success():logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!0):(logStatus.error(result+`:${statusText}(${status})`),!0)}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId){var doTask=!(1{return null===(_link$match=_link$match.match(/groups\/(.+)\/?/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/games\/(.+)\/?/))||void 0===_link$match2?void 0:_link$match2[1]});if(0{return null===(_link$match3=_link$match3.match(/app\/([\d]+)/))||void 0===_link$match3?void 0:_link$match3[1]});if(0{return null===(_link$match4=_link$match4.match(/app\/([\d]+)/))||void 0===_link$match4?void 0:_link$match4[1]});if(0{return null===(_link$match5=_link$match5.match(/app\/([\d]+)/))||void 0===_link$match5?void 0:_link$match5[1]});if(0{return null===(_link$match6=_link$match6.match(/\?id=([\d]+)/))||void 0===_link$match6?void 0:_link$match6[1]});if(0{return null===(_link$match7=_link$match7.match(/\?id=([\d]+)/))||void 0===_link$match7?void 0:_link$match7[1]});if(doTask&&0{return null===(_link$match8=_link$match8.match(/curator\/([\d]+)/))||void 0===_link$match8?void 0:_link$match8[1]}),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,_link$match9=>{return null===(_link$match9=_link$match9.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/))||void 0===_link$match9?void 0:_link$match9.slice(1,3).join("/")});if(0{var _link$match10;return _link$match11.includes("store.steampowered.com")?null===(_link$match10=_link$match11.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/))||void 0===_link$match10?void 0:_link$match10.slice(1,3).join("/"):null===(_link$match11=_link$match11.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))||void 0===_link$match11?void 0:_link$match11.slice(1,3).join("/")});if(doTask&&0{return null===(_link$match12=_link$match12.match(/app\/([\d]+)/))||void 0===_link$match12?void 0:_link$match12[1]});if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}};const Giveawaysu=class{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[];var tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(const task of tasks)pro.push(new Promise(resolve=>{const td=$(task).find('td:not(".hidden")');var colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])');const taskDes=0{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(taskDes.attr("href")).then(taskLink=>taskLink?(taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),void resolve(!0)):resolve(!1)).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?(0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=null===(giveawayId=window.location.href.match(/\/view\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{const pro=[],tasks=this.undoneTasks;var steamLength,steamCommunityLength;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init()))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),!tasks.steam||0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0{var _tasks$steam,_tasks$steam$type;return["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&(null===(_tasks$steam=tasks.steam)||void 0===_tasks$steam||null===(_tasks$steam$type=_tasks$steam[type])||void 0===_tasks$steam$type?void 0:_tasks$steam$type.length)||0}).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(const data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){const result={};for(var[social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{if(!this.initialized&&!this.init())return!1;if(!await this.#classifyTask())return!1;if(!await this.#initSocial())return!1;const pro=[];var tasks=this.undoneTasks;return"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var href;for(const task of $("#actions tr")){const $task=$(task);if("adjs"!==$task.attr("data-action-id")){const icon=$task.find("i.glyphicon-refresh"),button=icon.parent();"A"!==button.prop("tagName")?icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)):(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href))}}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}};var _LocalStorage$getItem2,for_giveawaysu=__webpack_require__(821);if(window.STYLE=GM_addStyle(for_giveawaysu.Z+`.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;height:.25em;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}`),"discord.com"===window.location.hostname){const LocalStorage=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=null===LocalStorage||void 0===LocalStorage||null===(discordAuth=LocalStorage.getItem("token"))||void 0===discordAuth?void 0:discordAuth.replace(/^"|"$/g,"");discordAuth&&0{var _commonOptions,_commonOptions$header;if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(_commonOptions=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:_commonOptions,clientId:null===(_commonOptions=commonOptions)||void 0===_commonOptions||null===(_commonOptions$header=_commonOptions.headers)||void 0===_commonOptions$header?void 0:_commonOptions$header["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"twitter.com"===window.location.hostname&&"#auth"===window.location.hash){var PAPISID=external_Cookies_namespaceObject.get("ct0");const isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&PAPISID?(GM_setValue("twitterAuth",{ct0:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((PAPISID=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){const betaButton=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}()}(); \ No newline at end of file + ${null===text||void 0===text?void 0:text.replace("u_","")}]...`);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},getRedirectLink=async link=>{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError_throwError(error,"getRedirectLink"),null}};const defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};for_giveawaysu=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,for_giveawaysu);const languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en";const i18n=function(key){for(var _languages$language,_len=arguments.length,argvs=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)argvs[_key-1]=arguments[_key];return null!==(_languages$language=languages[language])&&void 0!==_languages$language&&_languages$language[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key};for_giveawaysu=class{constructor(){var obj,key,value;value=void 0,(key="tasks")in(obj=this)?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value}getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0{const newTab=GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=null===(auth=GM_getValue("discordAuth"))||void 0===auth?void 0:auth.auth;auth?(_classPrivateFieldSet(this,_auth,{auth:auth}),logStatus.success(),resolve(await _classPrivateMethodGet(this,_verifyAuth,_verifyAuth2).call(this))):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async function _joinServer2(inviteId){try{const logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId});var _data$response,_data$response$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:_classPrivateFieldGet(this,_auth).auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;logStatus.success();var guild=String(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$guild=_data$response.guild)||void 0===_data$response$guild?void 0:_data$response$guild.id);return guild&&(_classPrivateMethodGet(this,_setCache,_setCache2).call(this,inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async function _leaveServer2(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await _classPrivateMethodGet(this,_getGuild,_getGuild2).call(this,inviteId);if(!guild)return!1;const logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:_classPrivateFieldGet(this,_auth).auth}});return"Success"===result&&204===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async function _getGuild2(inviteId){try{const logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId});var guild=_classPrivateFieldGet(this,_cache)[inviteId];if(guild)return logStatus.success(),guild;var _data$response2,_data$response2$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;{const guild=null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$guild=_data$response2.guild)||void 0===_data$response2$guild?void 0:_data$response2$guild.id;return guild?(logStatus.success(),_classPrivateMethodGet(this,_setCache,_setCache2).call(this,inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}function _setCache2(inviteId,guild){try{_classPrivateFieldGet(this,_cache)[inviteId]=guild,GM_setValue("discordCache",_classPrivateFieldGet(this,_cache))}catch(error){throwError_throwError(error,"Discord.setCache")}}const social_Discord=class extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),_classPrivateMethodInitSpec(this,_setCache),_classPrivateMethodInitSpec(this,_getGuild),_classPrivateMethodInitSpec(this,_leaveServer),_classPrivateMethodInitSpec(this,_joinServer),_classPrivateMethodInitSpec(this,_updateAuth),_classPrivateMethodInitSpec(this,_verifyAuth),Discord_defineProperty(this,"tasks",JSON.parse(defaultTasks)),Discord_defineProperty(this,"whiteList",{...JSON.parse(defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.discord}),_classPrivateFieldInitSpec(this,_auth,{writable:!0,value:GM_getValue("discordAuth")||{}}),_classPrivateFieldInitSpec(this,_cache,{writable:!0,value:GM_getValue("discordCache")||{}}),_classPrivateFieldInitSpec(this,_initialized,{writable:!0,value:!1})}async init(){try{if(!GM_getValue("dontRemindDiscordAgain"))if(!await external_Swal_default().fire({title:i18n("discordImportantNotice"),text:i18n("discordImportantNoticeText"),showCancelButton:!0,showDenyButton:!0,confirmButtonText:i18n("continue"),cancelButtonText:i18n("skipDiscordTask"),denyButtonText:i18n("continueAndDontRemindAgain")}).then(isDenied=>{var{isConfirmed,isDenied}=isDenied;return!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)}))return _classPrivateFieldSet(this,_initialized,!1),"skip";return globalOptions.doTask.discord.servers||globalOptions.undoTask.discord.servers?!!_classPrivateFieldGet(this,_initialized)||(_classPrivateFieldGet(this,_auth).auth?await _classPrivateMethodGet(this,_verifyAuth,_verifyAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),_classPrivateFieldSet(this,_initialized,!0),!0):(GM_setValue("discordAuth",{auth:null}),await _classPrivateMethodGet(this,_updateAuth,_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),_classPrivateFieldSet(this,_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1)):!!await _classPrivateMethodGet(this,_updateAuth,_updateAuth2).call(this)&&(_classPrivateFieldSet(this,_initialized,!0),!0)):(_classPrivateFieldSet(this,_initialized,!1),"skip")}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async toggle(serverLinks){var{doTask=!0,serverLinks=[]}=serverLinks;try{if(!_classPrivateFieldGet(this,_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/invite\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}};function Instagram_classPrivateMethodInitSpec(obj,privateSet){Instagram_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Instagram_classPrivateFieldInitSpec(obj,privateMap,value){Instagram_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Instagram_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Instagram_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Instagram_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Instagram_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Instagram_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Instagram_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Instagram_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Instagram_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Instagram_defaultTasks=JSON.stringify({users:[]});var Instagram_cache=new WeakMap,Instagram_auth=new WeakMap,Instagram_initialized=new WeakMap,_getUserInfo=new WeakSet,_followUser=new WeakSet,_unfollowUser=new WeakSet,Instagram_setCache=new WeakSet;async function _getUserInfo2(){var name=0{return null===(_link$match=_link$match.match(/https:\/\/www\.instagram\.com\/(.+)?\//))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}};function Reddit_classPrivateMethodInitSpec(obj,privateSet){Reddit_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Reddit_classPrivateFieldInitSpec(obj,privateMap,value){Reddit_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Reddit_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Reddit_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Reddit_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Reddit_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Reddit_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Reddit_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Reddit_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Reddit_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Reddit_defaultTasks=JSON.stringify({reddits:[]});var Reddit_auth=new WeakMap,Reddit_initialized=new WeakMap,_useBeta=new WeakSet,Reddit_updateAuth=new WeakSet;async function _useBeta2(){try{const logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{const newTab=GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{logStatus.success(),resolve(await Reddit_classPrivateMethodGet(this,Reddit_updateAuth,Reddit_updateAuth2).call(this,!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async function Reddit_updateAuth2(){var _data$responseText$ma,beta=0{var name=null===(name=userName.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/))||void 0===name?void 0:name[1],userName=null===(userName=userName.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/))||void 0===userName?void 0:userName[1];return userName?name||userName:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}};function Twitch_classPrivateMethodInitSpec(obj,privateSet){Twitch_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Twitch_classPrivateFieldInitSpec(obj,privateMap,value){Twitch_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Twitch_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Twitch_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Twitch_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Twitch_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Twitch_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Twitch_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Twitch_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Twitch_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Twitch_defaultTasks=JSON.stringify({channels:[]});var Twitch_auth=new WeakMap,Twitch_cache=new WeakMap,Twitch_initialized=new WeakMap,_integrityToken=new WeakMap,Twitch_verifyAuth=new WeakSet,_integrity=new WeakSet,Twitch_updateAuth=new WeakSet,_toggleChannel=new WeakSet,_getChannelId=new WeakSet,Twitch_setCache=new WeakSet;async function Twitch_verifyAuth2(isFirst){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")});var _data$response,_data$response$,_data$response$$data,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response=data.response)&&void 0!==_data$response&&null!==(_data$response$=_data$response[0])&&void 0!==_data$response$&&null!==(_data$response$$data=_data$response$.data)&&void 0!==_data$response$$data&&_data$response$$data.currentUser?(await Twitch_classPrivateMethodGet(this,_integrity,_integrity2).call(this,isFirst),logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async function _integrity2(){var isFirst=!(0{const newTab=GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(Twitch_classPrivateFieldSet(this,Twitch_auth,auth),logStatus.success(),resolve(await Twitch_classPrivateMethodGet(this,Twitch_verifyAuth,Twitch_verifyAuth2).call(this,isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async function _toggleChannel2(doTask){var{name,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await Twitch_classPrivateMethodGet(this,_getChannelId,_getChannelId2).call(this,name);if(!channelId)return!1;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name});var _data$response3,_data$response4,_data$response4$0$err,_data$response4$0$err2,followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId,"Client-Version":Twitch_classPrivateFieldGet(this,Twitch_auth).clientVersion,"X-Device-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).deviceId,"Client-Session-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientSessionId,"Client-Integrity":Twitch_classPrivateFieldGet(this,_integrityToken)},data:doTask?followData:unfollowData});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+((null==data||null===(_data$response4=data.response)||void 0===_data$response4||null===(_data$response4$0$err=_data$response4[0].errors)||void 0===_data$response4$0$err||null===(_data$response4$0$err2=_data$response4$0$err[0])||void 0===_data$response4$0$err2?void 0:_data$response4$0$err2.message)||`${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`)),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async function _getChannelId2(name){try{const logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name});var channelId=Twitch_classPrivateFieldGet(this,Twitch_cache)[name];if(channelId)return logStatus.success(),channelId;var _data$response5,_data$response5$,_data$response5$$data,_data$response5$$data2,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const channelId=null===(_data$response5=data.response)||void 0===_data$response5||null===(_data$response5$=_data$response5[0])||void 0===_data$response5$||null===(_data$response5$$data=_data$response5$.data)||void 0===_data$response5$$data||null===(_data$response5$$data2=_data$response5$$data.user)||void 0===_data$response5$$data2?void 0:_data$response5$$data2.id;return channelId?(Twitch_classPrivateMethodGet(this,Twitch_setCache,Twitch_setCache2).call(this,name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}function Twitch_setCache2(name,id){try{Twitch_classPrivateFieldGet(this,Twitch_cache)[name]=id,GM_setValue("twitchCache",Twitch_classPrivateFieldGet(this,Twitch_cache))}catch(error){throwError_throwError(error,"Twitch.setCache")}}const social_Twitch=class extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),Twitch_classPrivateMethodInitSpec(this,Twitch_setCache),Twitch_classPrivateMethodInitSpec(this,_getChannelId),Twitch_classPrivateMethodInitSpec(this,_toggleChannel),Twitch_classPrivateMethodInitSpec(this,Twitch_updateAuth),Twitch_classPrivateMethodInitSpec(this,_integrity),Twitch_classPrivateMethodInitSpec(this,Twitch_verifyAuth),Twitch_defineProperty(this,"tasks",JSON.parse(Twitch_defaultTasks)),Twitch_defineProperty(this,"whiteList",{...JSON.parse(Twitch_defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.twitch}),Twitch_classPrivateFieldInitSpec(this,Twitch_auth,{writable:!0,value:GM_getValue("twitchAuth")||{}}),Twitch_classPrivateFieldInitSpec(this,Twitch_cache,{writable:!0,value:GM_getValue("twitchCache")||{}}),Twitch_classPrivateFieldInitSpec(this,Twitch_initialized,{writable:!0,value:!1}),Twitch_classPrivateFieldInitSpec(this,_integrityToken,{writable:!0,value:void 0})}async init(){try{return Twitch_classPrivateFieldGet(this,Twitch_initialized)?!0:Twitch_classPrivateFieldGet(this,Twitch_auth).authToken&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientId&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientVersion&&Twitch_classPrivateFieldGet(this,Twitch_auth).deviceId&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientSessionId?await Twitch_classPrivateMethodGet(this,Twitch_verifyAuth,Twitch_verifyAuth2).call(this,!0)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0):(GM_setValue("twitchAuth",null),await Twitch_classPrivateMethodGet(this,Twitch_updateAuth,Twitch_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1)):!!await Twitch_classPrivateMethodGet(this,Twitch_updateAuth,Twitch_updateAuth2).call(this)&&(Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async toggle(channelLinks){var{doTask=!0,channelLinks=[]}=channelLinks;try{if(!Twitch_classPrivateFieldGet(this,Twitch_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/))||void 0===_link$match?void 0:_link$match[2]});if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}};function Vk_classPrivateMethodInitSpec(obj,privateSet){Vk_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Vk_classPrivateFieldInitSpec(obj,privateMap,value){Vk_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Vk_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Vk_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Vk_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Vk_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Vk_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Vk_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Vk_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Vk_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Vk_defaultTasks=JSON.stringify({names:[]});var _username=new WeakMap,Vk_cache=new WeakMap,Vk_initialized=new WeakMap,Vk_verifyAuth=new WeakSet,_toggleGroup=new WeakSet,_togglePublic=new WeakSet,_sendWall=new WeakSet,_deleteWall=new WeakSet,_getId=new WeakSet,_toggleVk=new WeakSet,Vk_setCache=new WeakSet;async function Vk_verifyAuth2(){try{const logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});var _data$responseText$ma;return"Success"===result?null!==data&&void 0!==data&&data.finalUrl.includes("vk.com/login")?(logStatus.error("Error:"+i18n("loginVk"),!0),!1):200===(null===data||void 0===data?void 0:data.status)?(Vk_classPrivateFieldSet(this,_username,(null===(_data$responseText$ma=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1])||""),logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async function _toggleGroup2(name,dataParam){var doTask=!(2{return null===(_link$match=_link$match.match(/https:\/\/vk\.com\/([^/]+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}};function Youtube_classPrivateMethodInitSpec(obj,privateSet){Youtube_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Youtube_classPrivateFieldInitSpec(obj,privateMap,value){Youtube_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Youtube_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Youtube_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Youtube_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Youtube_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Youtube_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Youtube_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Youtube_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Youtube_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Youtube_defaultTasks=JSON.stringify({channels:[],likes:[]}),getInfo=async function(link,type){try{const logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};{var _data$responseText$ma,_ref;if(data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube"))return logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0};var apiKey=null===(_data$responseText$ma=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],context=(null===(_ref=data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))||void 0===_ref?void 0:_ref[1])||"{}";const{client,request}=JSON.parse(context);if(apiKey&&client&&request){if(client.hl="en","channel"===type){var _data$responseText$ma2,channelId=null===(_data$responseText$ma2=data.responseText.match(//))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return channelId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{})}if("likeVideo"!==type)return logStatus.error("Error: Unknown type"),{};var _data$responseText$ma3,_data$responseText$ma4,videoId=null===(_data$responseText$ma3=data.responseText.match(//))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],likeParams=null===(_data$responseText$ma4=data.responseText.match(/"likeParams":"(.*?)"/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1];return videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})}return logStatus.error('Error: Parameter "apiKey" not found!'),{}}}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}};var Youtube_auth=new WeakMap,Youtube_initialized=new WeakMap,_verifyChannel=new WeakMap,Youtube_verifyAuth=new WeakSet,Youtube_updateAuth=new WeakSet,_getInfo=new WeakSet,Youtube_toggleChannel=new WeakSet,_toggleLikeVideo=new WeakSet;class Youtube extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),Youtube_classPrivateMethodInitSpec(this,_toggleLikeVideo),Youtube_classPrivateMethodInitSpec(this,Youtube_toggleChannel),Youtube_classPrivateMethodInitSpec(this,_getInfo),Youtube_classPrivateMethodInitSpec(this,Youtube_updateAuth),Youtube_classPrivateMethodInitSpec(this,Youtube_verifyAuth),Youtube_defineProperty(this,"tasks",JSON.parse(Youtube_defaultTasks)),Youtube_defineProperty(this,"whiteList",{...JSON.parse(Youtube_defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.youtube}),Youtube_classPrivateFieldInitSpec(this,Youtube_auth,{writable:!0,value:GM_getValue("youtubeAuth")||{}}),Youtube_classPrivateFieldInitSpec(this,Youtube_initialized,{writable:!0,value:!1}),Youtube_classPrivateFieldInitSpec(this,_verifyChannel,{writable:!0,value:"https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel})}async init(){try{return Youtube_classPrivateFieldGet(this,Youtube_initialized)?!0:Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID?await Youtube_classPrivateMethodGet(this,Youtube_verifyAuth,Youtube_verifyAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0):(GM_setValue("youtubeAuth",null),await Youtube_classPrivateMethodGet(this,Youtube_updateAuth,Youtube_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1)):!!await Youtube_classPrivateMethodGet(this,Youtube_updateAuth,Youtube_updateAuth2).call(this)&&(Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async toggle(videoLinks){var{doTask=!0,channelLinks=[],videoLinks=[]}=videoLinks;try{if(!Youtube_classPrivateFieldGet(this,Youtube_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>{var _link$match;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match?void 0:_link$match[1]:link});if(0{var _link$match2;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match2=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match2?void 0:_link$match2[1]:link});if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}async function Youtube_verifyAuth2(){try{return await Youtube_classPrivateMethodGet(this,Youtube_toggleChannel,Youtube_toggleChannel2).call(this,{link:Youtube_classPrivateFieldGet(this,_verifyChannel),doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async function Youtube_updateAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://www.youtube.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("youtubeAuth");auth?(Youtube_classPrivateFieldSet(this,Youtube_auth,auth),logStatus.success(),Youtube_classPrivateMethodGet(this,Youtube_verifyAuth,Youtube_verifyAuth2).call(this).then(result=>{resolve(result)})):(logStatus.error("Error: Update youtube auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}function _getInfo2(link,type){return getInfo(link,type)}async function Youtube_toggleChannel2(verify){var{link,doTask=!0,verify=!1}=verify;try{var{params,needLogin}=await Youtube_classPrivateMethodGet(this,_getInfo,_getInfo2).call(this,link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)return scripts_echoLog({html:i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&channelId))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":null==client?void 0:client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:null==request?void 0:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&(/"subscribed": true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed": false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async function _toggleLikeVideo2(doTask){var{link,doTask=!0}=doTask;try{var{params,needLogin}=await Youtube_classPrivateMethodGet(this,_getInfo,_getInfo2).call(this,link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)return scripts_echoLog({html:""+i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&videoId&&likeParams))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;const logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}function Steam_classPrivateMethodInitSpec(obj,privateSet){Steam_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Steam_classPrivateFieldInitSpec(obj,privateMap,value){Steam_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Steam_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Steam_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Steam_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Steam_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Steam_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Steam_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Steam_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Steam_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Steam_defaultTasks=JSON.stringify({groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]});var Steam_cache=new WeakMap,Steam_auth=new WeakMap,_storeInitialized=new WeakMap,_communityInitialized=new WeakMap,_area=new WeakMap,_areaStatus=new WeakMap,_refreshStoreToken=new WeakSet,_setStoreToken=new WeakSet,_updateStoreAuth=new WeakSet,_updateCommunityAuth=new WeakSet,_getAreaInfo=new WeakSet,_changeArea=new WeakSet,_joinGroup=new WeakSet,_leaveGroup=new WeakSet,_getGroupId=new WeakSet,_joinOfficialGroup=new WeakSet,_leaveOfficialGroup=new WeakSet,_getOfficialGroupId=new WeakSet,_addToWishlist=new WeakSet,_removeFromWishlist=new WeakSet,_toggleFollowGame=new WeakSet,_isFollowedGame=new WeakSet,_toggleForum=new WeakSet,_getForumId=new WeakSet,_toggleFavoriteWorkshop=new WeakSet,_getWorkshopAppId=new WeakSet,_voteUpWorkshop=new WeakSet,_toggleCurator=new WeakSet,_toggleCuratorLike=new WeakSet,_getAnnouncementParams=new WeakSet,_likeAnnouncement=new WeakSet,_appid2subid=new WeakSet,_getLicenses=new WeakSet,_addLicense=new WeakSet,_addFreeLicense=new WeakSet,_requestPlayTestAccess=new WeakSet,Steam_setCache=new WeakSet;async function _refreshStoreToken2(){try{const logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n("steamStore"))}),formData=new FormData;formData.append("redir","https://store.steampowered.com/");var _data$response,{result,statusText,status,data}=await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/"},data:formData});return"Success"===result?null!=data&&null!==(_data$response=data.response)&&void 0!==_data$response&&_data$response.success?await Steam_classPrivateMethodGet(this,_setStoreToken,_setStoreToken2).call(this,data.response)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshStoreToken"),!1}}async function _setStoreToken2(param){try{const logStatus=scripts_echoLog({text:i18n("settingToken",i18n("steamStore"))}),formData=new FormData;formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth);var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/login/settoken",method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/login"},data:formData});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async function _updateStoreAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma2;if(!data.responseText.includes("data-miniprofile="))return await Steam_classPrivateMethodGet(this,_refreshStoreToken,_refreshStoreToken2).call(this),logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1;var storeSessionID=null===(_data$responseText$ma2=data.responseText.match(/g_sessionID = "(.+?)";/))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return storeSessionID?(Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async function _updateCommunityAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma3,_data$responseText$ma4,_data$responseText$ma5;if(data.responseText.includes('href="https://steamcommunity.com/login/home/'))return logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1;var steam64Id=null===(_data$responseText$ma3=data.responseText.match(/g_steamID = "(.+?)";/))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],communitySessionID=null===(_data$responseText$ma4=data.responseText.match(/g_sessionID = "(.+?)";/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1],userName=null===(_data$responseText$ma5=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//))||void 0===_data$responseText$ma5?void 0:_data$responseText$ma5[1];return(steam64Id&&(Steam_classPrivateFieldGet(this,Steam_auth).steam64Id=steam64Id),userName&&(Steam_classPrivateFieldGet(this,Steam_auth).userName=userName),communitySessionID)?(Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID=communitySessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1)}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async function _getAreaInfo2(){try{const logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};var _data$responseText$ma6,currentArea=null===(_data$responseText$ma6=data.responseText.match(//g)].map(search=>search[1]);return currentArea&&0{const checker=setInterval(()=>{"waiting"!==Steam_classPrivateFieldGet(this,_areaStatus)&&(clearInterval(checker),resolve(!0))})}),Steam_classPrivateFieldGet(this,_area)===area||!area&&"CN"!==Steam_classPrivateFieldGet(this,_area))return!0;Steam_classPrivateFieldSet(this,_areaStatus,"waiting");let aimedArea=area;if(!aimedArea){const{currentArea,areas}=await Steam_classPrivateMethodGet(this,_getAreaInfo,_getAreaInfo2).call(this);if(!currentArea||!areas)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),!1;if("CN"!==currentArea)return Steam_classPrivateFieldSet(this,_areaStatus,"skip"),scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return Steam_classPrivateFieldSet(this,_areaStatus,"noAnotherArea"),scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}const logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)});var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/account/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID})});if("Success"!==result)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==(null==data?void 0:data.status)||"true"!==data.responseText)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),"CN";var currentArea=(await Steam_classPrivateMethodGet(this,_getAreaInfo,_getAreaInfo2).call(this))["currentArea"];return currentArea===aimedArea?(Steam_classPrivateFieldSet(this,_areaStatus,"success"),logStatus.success(),currentArea):(Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error("Error: change country filed"),"CN")}catch(error){return Steam_classPrivateFieldSet(this,_areaStatus,"error"),throwError_throwError(error,"Steam.changeArea"),!1}}async function _joinGroup2(groupName){try{const logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID})});return"Success"===result?200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async function _leaveGroup2(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;var groupId=await Steam_classPrivateMethodGet(this,_getGroupId,_getGroupId2).call(this,groupName);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this,Steam_auth).userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,action:"leaveGroup",groupId:groupId})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async function _getGroupId2(groupName){try{const logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName});var _data$responseText$ma7,groupId=Steam_classPrivateFieldGet(this,Steam_cache).group[groupName];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma7=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/))||void 0===_data$responseText$ma7?void 0:_data$responseText$ma7[1];return groupId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async function _joinOfficialGroup2(gameId){try{const logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes('id="publicGroupJoin"'))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma8;logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]);var groupId=null===(_data$responseText$ma8=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma8?void 0:_data$responseText$ma8[1];return groupId&&Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"officialGroup",gameId,groupId),!0}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async function _leaveOfficialGroup2(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;var groupId=await Steam_classPrivateMethodGet(this,_getOfficialGroupId,_getOfficialGroupId2).call(this,gameId);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId});var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this,Steam_auth).userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async function _getOfficialGroupId2(gameId){try{const logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId});var _data$responseText$ma9,groupId=Steam_classPrivateFieldGet(this,Steam_cache).officialGroup[gameId];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma9=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma9?void 0:_data$responseText$ma9[1];return groupId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async function _addToWishlist2(gameId){try{var _data$response2;const logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response2=data.response)||void 0===_data$response2?void 0:_data$response2.success))return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)?"CN"===Steam_classPrivateFieldGet(this,_area)&&dataR.responseText.includes('id="error_box"')?(logStatus.warning(i18n("changeAreaNotice")),!!await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this)&&await Steam_classPrivateMethodGet(this,_addToWishlist,_addToWishlist2).call(this,gameId)):(!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"'))?(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1):(logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async function _removeFromWishlist2(gameId){try{var _data$response3;if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;const logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.success))return logStatus.success(),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==(null===dataR||void 0===dataR?void 0:dataR.status))return logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1;if("CN"===Steam_classPrivateFieldGet(this,_area)&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));const result=await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this);return result&&"CN"!==result&&"skip"!==result?await Steam_classPrivateMethodGet(this,_removeFromWishlist,_removeFromWishlist2).call(this,gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async function _toggleFollowGame2(gameId,doTask){try{if(!doTask&&this.whiteList.follows.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId};doTask||(requestData.unfollow="1");var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)});if("Success"===result&&200===(null==data?void 0:data.status)&&"true"===data.responseText)return logStatus.success(),!0;var followed=await Steam_classPrivateMethodGet(this,_isFollowedGame,_isFollowedGame2).call(this,gameId);return"CN"===Steam_classPrivateFieldGet(this,_area)&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this)&&await Steam_classPrivateMethodGet(this,_removeFromWishlist,_removeFromWishlist2).call(this,gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async function _isFollowedGame2(gameId){try{const{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&("CN"===Steam_classPrivateFieldGet(this,_area)&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async function _toggleForum2(gameId){var doTask=!(1/))||void 0===_data$responseText$ma11?void 0:_data$responseText$ma11[1];return appId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async function _voteUpWorkshop2(id){try{const logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id});var _data$response6,{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID})});return"Success"===result?(200===(null==data?void 0:data.status)&&1===(null===(_data$response6=data.response)||void 0===_data$response6?void 0:_data$response6.success)?logStatus.success():logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!0):(logStatus.error(result+`:${statusText}(${status})`),!0)}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async function _toggleCurator2(curatorId){var doTask=!(1{return null===(_link$match=_link$match.match(/groups\/(.+)\/?/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/games\/(.+)\/?/))||void 0===_link$match2?void 0:_link$match2[1]});if(0{return null===(_link$match3=_link$match3.match(/app\/([\d]+)/))||void 0===_link$match3?void 0:_link$match3[1]});if(0{return null===(_link$match4=_link$match4.match(/app\/([\d]+)/))||void 0===_link$match4?void 0:_link$match4[1]});if(0{return null===(_link$match5=_link$match5.match(/app\/([\d]+)/))||void 0===_link$match5?void 0:_link$match5[1]});if(0{return null===(_link$match6=_link$match6.match(/\?id=([\d]+)/))||void 0===_link$match6?void 0:_link$match6[1]});if(0{return null===(_link$match7=_link$match7.match(/\?id=([\d]+)/))||void 0===_link$match7?void 0:_link$match7[1]});if(doTask&&0{return null===(_link$match8=_link$match8.match(/curator\/([\d]+)/))||void 0===_link$match8?void 0:_link$match8[1]}),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,_link$match9=>{return null===(_link$match9=_link$match9.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/))||void 0===_link$match9?void 0:_link$match9.slice(1,3).join("/")});if(0{var _link$match10;return _link$match11.includes("store.steampowered.com")?null===(_link$match10=_link$match11.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/))||void 0===_link$match10?void 0:_link$match10.slice(1,3).join("/"):null===(_link$match11=_link$match11.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))||void 0===_link$match11?void 0:_link$match11.slice(1,3).join("/")});if(doTask&&0{return null===(_link$match12=_link$match12.match(/app\/([\d]+)/))||void 0===_link$match12?void 0:_link$match12[1]});if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==Steam_classPrivateFieldGet(this,_area)&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this,"CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}};function Giveawaysu_classPrivateMethodInitSpec(obj,privateSet){!function(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}(obj,privateSet),privateSet.add(obj)}function Giveawaysu_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Giveawaysu_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}const Giveawaysu_defaultTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};var _classifyTask=new WeakSet,_checkLogin=new WeakSet,_checkLeftKey=new WeakSet,_getGiveawayId=new WeakSet,_bind=new WeakSet,_initSocial=new WeakSet,_uniqueTasks=new WeakSet,_toggleTask=new WeakSet;async function _classifyTask2(){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[];var tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(const task of tasks)pro.push(new Promise(resolve=>{const td=$(task).find('td:not(".hidden")');var colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])');const taskDes=0taskLink?(taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),void resolve(!0)):resolve(!1)).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=Giveawaysu_classPrivateMethodGet(this,_uniqueTasks,_uniqueTasks2).call(this,this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}function _checkLogin2(){try{return globalOptions.other.checkLogin?(0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async function _checkLeftKey2(){try{return globalOptions.other.checkLeftKey?(0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}function _getGiveawayId2(){var giveawayId=null===(giveawayId=window.location.href.match(/\/view\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async function _bind2(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async function _initSocial2(){try{const pro=[],tasks=this.undoneTasks;var steamLength,steamCommunityLength;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"discord",this.social.discord.init()))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"youtube",this.social.youtube.init()))),!tasks.steam||0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0{var _tasks$steam,_tasks$steam$type;return["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&(null===(_tasks$steam=tasks.steam)||void 0===_tasks$steam||null===(_tasks$steam$type=_tasks$steam[type])||void 0===_tasks$steam$type?void 0:_tasks$steam$type.length)||0}).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"steamStore",this.social.steam.init("store"))),0{let checked=!0;for(const data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}function _uniqueTasks2(allTasks){const result={};for(var[social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async function _toggleTask2(){try{if(!this.initialized&&!this.init())return!1;if(!await Giveawaysu_classPrivateMethodGet(this,_classifyTask,_classifyTask2).call(this))return!1;if(!await Giveawaysu_classPrivateMethodGet(this,_initSocial,_initSocial2).call(this))return!1;const pro=[];var tasks=this.undoneTasks;return"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}const Giveawaysu=class{constructor(){Giveawaysu_classPrivateMethodInitSpec(this,_toggleTask),Giveawaysu_classPrivateMethodInitSpec(this,_uniqueTasks),Giveawaysu_classPrivateMethodInitSpec(this,_initSocial),Giveawaysu_classPrivateMethodInitSpec(this,_bind),Giveawaysu_classPrivateMethodInitSpec(this,_getGiveawayId),Giveawaysu_classPrivateMethodInitSpec(this,_checkLeftKey),Giveawaysu_classPrivateMethodInitSpec(this,_checkLogin),Giveawaysu_classPrivateMethodInitSpec(this,_classifyTask),Giveawaysu_defineProperty(this,"undoneTasks",Giveawaysu_defaultTasks),Giveawaysu_defineProperty(this,"giveawayId",void 0),Giveawaysu_defineProperty(this,"socialInitialized",{discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0}),Giveawaysu_defineProperty(this,"initialized",!1),Giveawaysu_defineProperty(this,"social",{})}static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{Giveawaysu_classPrivateMethodGet(this,_checkLogin,_checkLogin2).call(this)||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await Giveawaysu_classPrivateMethodGet(this,_checkLeftKey,_checkLeftKey2).call(this)||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!Giveawaysu_classPrivateMethodGet(this,_getGiveawayId,_getGiveawayId2).call(this)&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await Giveawaysu_classPrivateMethodGet(this,_toggleTask,_toggleTask2).call(this)}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var href;for(const task of $("#actions tr")){const $task=$(task);if("adjs"!==$task.attr("data-action-id")){const icon=$task.find("i.glyphicon-refresh"),button=icon.parent();"A"!==button.prop("tagName")?icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)):(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href))}}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}};var _LocalStorage$getItem2,for_giveawaysu=__webpack_require__(821);if(window.STYLE=GM_addStyle(for_giveawaysu.Z+`.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;height:.25em;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}`),"discord.com"===window.location.hostname){const LocalStorage=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=null===LocalStorage||void 0===LocalStorage||null===(discordAuth=LocalStorage.getItem("token"))||void 0===discordAuth?void 0:discordAuth.replace(/^"|"$/g,"");discordAuth&&0{var _commonOptions,_commonOptions$header;if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(_commonOptions=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:_commonOptions,clientId:null===(_commonOptions=commonOptions)||void 0===_commonOptions||null===(_commonOptions$header=_commonOptions.headers)||void 0===_commonOptions$header?void 0:_commonOptions$header["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"twitter.com"===window.location.hostname&&"#auth"===window.location.hash){var PAPISID=external_Cookies_namespaceObject.get("ct0");const isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&PAPISID?(GM_setValue("twitterAuth",{ct0:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((PAPISID=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){const betaButton=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}()}(); \ No newline at end of file diff --git a/dist/auto-task-v4-for-giveawaysu.user.js b/dist/auto-task-v4-for-giveawaysu.user.js index 0d240a7..53650b5 100644 --- a/dist/auto-task-v4-for-giveawaysu.user.js +++ b/dist/auto-task-v4-for-giveawaysu.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4-for-giveawaysu // @namespace auto-task-v4-for-giveawaysu -// @version 4.2.31 +// @version 4.2.32 // @description 赠Key站自动任务 // @author HCLonely // @license MIT @@ -67,7 +67,7 @@ console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); -!function(){var __webpack_modules__={400:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o{var{isDenied:text,isConfirmed}=isConfirmed;isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):text&&(text=`错误链接: [url=${window.location.href}]${window.location.href}[/url] +!function(){var __webpack_modules__={400:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o{var{isDenied:text,isConfirmed}=isConfirmed;isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):text&&(text=`错误链接: [url=${window.location.href}]${window.location.href}[/url] 环境: @@ -84,4 +84,4 @@ console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); `+error.stack)}async function httpRequest_httpRequest(options){var times=1{options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest_httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError_throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}}const tools_httpRequest=httpRequest_httpRequest;function delay(){let time=0{setTimeout(()=>{resolve(!0)},time)})}const scripts_echoLog=_ref=>{let{type,text,html,id}=_ref;const emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{var _ele$;let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ ${text}]...
  • `);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ - ${null===text||void 0===text?void 0:text.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}};const defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};var for_giveawaysu=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,for_giveawaysu);const languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en";const i18n=function(key){for(var _languages$language,_len=arguments.length,argvs=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)argvs[_key-1]=arguments[_key];return null!==(_languages$language=languages[language])&&void 0!==_languages$language&&_languages$language[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key};var social_Social=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0{var{isConfirmed,isDenied}=isDenied;return!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)}))return this.#initialized=!1,"skip";return globalOptions.doTask.discord.servers||globalOptions.undoTask.discord.servers?!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)):(this.#initialized=!1,"skip")}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=null===(auth=GM_getValue("discordAuth"))||void 0===auth?void 0:auth.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{const logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId});var _data$response,_data$response$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;logStatus.success();var guild=String(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$guild=_data$response.guild)||void 0===_data$response$guild?void 0:_data$response$guild.id);return guild&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(!guild)return!1;const logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});return"Success"===result&&204===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{const logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId});var guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var _data$response2,_data$response2$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;{const guild=null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$guild=_data$response2.guild)||void 0===_data$response2$guild?void 0:_data$response2$guild.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle(serverLinks){var{doTask=!0,serverLinks=[]}=serverLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/invite\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}};var for_giveawaysu=JSON.stringify({users:[]});const social_Instagram=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.instagram};#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(){var name=0{return null===(_link$match=_link$match.match(/https:\/\/www\.instagram\.com\/(.+)?\//))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}};for_giveawaysu=JSON.stringify({reddits:[]});const social_Reddit=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.reddit};#auth;#initialized=!1;async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{const logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{const newTab=GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(){var _data$responseText$ma,beta=0{var name=null===(name=userName.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/))||void 0===name?void 0:name[1],userName=null===(userName=userName.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/))||void 0===userName?void 0:userName[1];return userName?name||userName:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}};for_giveawaysu=JSON.stringify({channels:[]});const social_Twitch=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.twitch};#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(GM_setValue("twitchAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")});var _data$response,_data$response$,_data$response$$data,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response=data.response)&&void 0!==_data$response&&null!==(_data$response$=_data$response[0])&&void 0!==_data$response$&&null!==(_data$response$$data=_data$response$.data)&&void 0!==_data$response$$data&&_data$response$$data.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(){var isFirst=!(0{const newTab=GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel(doTask){var{name,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(!channelId)return!1;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name});var _data$response3,_data$response4,_data$response4$0$err,_data$response4$0$err2,followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+((null==data||null===(_data$response4=data.response)||void 0===_data$response4||null===(_data$response4$0$err=_data$response4[0].errors)||void 0===_data$response4$0$err||null===(_data$response4$0$err2=_data$response4$0$err[0])||void 0===_data$response4$0$err2?void 0:_data$response4$0$err2.message)||`${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`)),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{const logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name});var channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var _data$response5,_data$response5$,_data$response5$$data,_data$response5$$data2,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const channelId=null===(_data$response5=data.response)||void 0===_data$response5||null===(_data$response5$=_data$response5[0])||void 0===_data$response5$||null===(_data$response5$$data=_data$response5$.data)||void 0===_data$response5$$data||null===(_data$response5$$data2=_data$response5$$data.user)||void 0===_data$response5$$data2?void 0:_data$response5$$data2.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle(channelLinks){var{doTask=!0,channelLinks=[]}=channelLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/))||void 0===_link$match?void 0:_link$match[2]});if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}};for_giveawaysu=JSON.stringify({names:[]});const social_Vk=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.vk};#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});var _data$responseText$ma;return"Success"===result?null!==data&&void 0!==data&&data.finalUrl.includes("vk.com/login")?(logStatus.error("Error:"+i18n("loginVk"),!0),!1):200===(null===data||void 0===data?void 0:data.status)?(this.#username=(null===(_data$responseText$ma=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1])||"",logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam){var doTask=!(2{return null===(_link$match=_link$match.match(/https:\/\/vk\.com\/([^/]+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}};for_giveawaysu=JSON.stringify({channels:[],likes:[]});class Youtube extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.youtube};#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(GM_setValue("youtubeAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://www.youtube.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("youtubeAuth");auth?(this.#auth=auth,logStatus.success(),this.#verifyAuth().then(result=>{resolve(result)})):(logStatus.error("Error: Update youtube auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}#getInfo(link,type){return async function(link,type){try{const logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};{var _data$responseText$ma,_ref;if(data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube"))return logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0};var apiKey=null===(_data$responseText$ma=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],context=(null===(_ref=data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))||void 0===_ref?void 0:_ref[1])||"{}";const{client,request}=JSON.parse(context);if(apiKey&&client&&request){if(client.hl="en","channel"===type){var _data$responseText$ma2,channelId=null===(_data$responseText$ma2=data.responseText.match(//))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return channelId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{})}if("likeVideo"!==type)return logStatus.error("Error: Unknown type"),{};var _data$responseText$ma3,_data$responseText$ma4,videoId=null===(_data$responseText$ma3=data.responseText.match(//))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],likeParams=null===(_data$responseText$ma4=data.responseText.match(/"likeParams":"(.*?)"/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1];return videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})}return logStatus.error('Error: Parameter "apiKey" not found!'),{}}}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}}(link,type)}async#toggleChannel(verify){var{link,doTask=!0,verify=!1}=verify;try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)return scripts_echoLog({html:i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&channelId))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":null==client?void 0:client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:null==request?void 0:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&(/"subscribed": true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed": false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo(doTask){var{link,doTask=!0}=doTask;try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)return scripts_echoLog({html:""+i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&videoId&&likeParams))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;const logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle(videoLinks){var{doTask=!0,channelLinks=[],videoLinks=[]}=videoLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>{var _link$match;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match?void 0:_link$match[1]:link});if(0{var _link$match2;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match2=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match2?void 0:_link$match2[1]:link});if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}for_giveawaysu=JSON.stringify({groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]});const social_Steam=class extends social_Social{tasks=JSON.parse(for_giveawaysu);whiteList={...JSON.parse(for_giveawaysu),...null===(for_giveawaysu=GM_getValue("whiteList"))||void 0===for_giveawaysu?void 0:for_giveawaysu.steam};#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";async init(){var type=0/g)].map(search=>search[1]);return currentArea&&0{const checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){const{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}const logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)});var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/account/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==(null==data?void 0:data.status)||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),"CN";var currentArea=(await this.#getAreaInfo())["currentArea"];return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{const logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})});return"Success"===result?200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;var groupId=await this.#getGroupId(groupName);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{const logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName});var _data$responseText$ma6,groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma6=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/))||void 0===_data$responseText$ma6?void 0:_data$responseText$ma6[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{const logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes('id="publicGroupJoin"'))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma7;logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]);var groupId=null===(_data$responseText$ma7=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma7?void 0:_data$responseText$ma7[1];return groupId&&this.#setCache("officialGroup",gameId,groupId),!0}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;var groupId=await this.#getOfficialGroupId(gameId);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId});var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{const logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId});var _data$responseText$ma8,groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma8=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma8?void 0:_data$responseText$ma8[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{var _data$response2;const logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response2=data.response)||void 0===_data$response2?void 0:_data$response2.success))return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)?"CN"===this.#area&&dataR.responseText.includes('id="error_box"')?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId)):(!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"'))?(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1):(logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{var _data$response3;if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;const logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.success))return logStatus.success(),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==(null===dataR||void 0===dataR?void 0:dataR.status))return logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));const result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{if(!doTask&&this.whiteList.follows.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId};doTask||(requestData.unfollow="1");var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)});if("Success"===result&&200===(null==data?void 0:data.status)&&"true"===data.responseText)return logStatus.success(),!0;var followed=await this.#isFollowedGame(gameId);return"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{const{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId){var doTask=!(1/))||void 0===_data$responseText$ma10?void 0:_data$responseText$ma10[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{const logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id});var _data$response6,{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?(200===(null==data?void 0:data.status)&&1===(null===(_data$response6=data.response)||void 0===_data$response6?void 0:_data$response6.success)?logStatus.success():logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!0):(logStatus.error(result+`:${statusText}(${status})`),!0)}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId){var doTask=!(1{return null===(_link$match=_link$match.match(/groups\/(.+)\/?/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/games\/(.+)\/?/))||void 0===_link$match2?void 0:_link$match2[1]});if(0{return null===(_link$match3=_link$match3.match(/app\/([\d]+)/))||void 0===_link$match3?void 0:_link$match3[1]});if(0{return null===(_link$match4=_link$match4.match(/app\/([\d]+)/))||void 0===_link$match4?void 0:_link$match4[1]});if(0{return null===(_link$match5=_link$match5.match(/app\/([\d]+)/))||void 0===_link$match5?void 0:_link$match5[1]});if(0{return null===(_link$match6=_link$match6.match(/\?id=([\d]+)/))||void 0===_link$match6?void 0:_link$match6[1]});if(0{return null===(_link$match7=_link$match7.match(/\?id=([\d]+)/))||void 0===_link$match7?void 0:_link$match7[1]});if(doTask&&0{return null===(_link$match8=_link$match8.match(/curator\/([\d]+)/))||void 0===_link$match8?void 0:_link$match8[1]}),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,_link$match9=>{return null===(_link$match9=_link$match9.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/))||void 0===_link$match9?void 0:_link$match9.slice(1,3).join("/")});if(0{var _link$match10;return _link$match11.includes("store.steampowered.com")?null===(_link$match10=_link$match11.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/))||void 0===_link$match10?void 0:_link$match10.slice(1,3).join("/"):null===(_link$match11=_link$match11.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))||void 0===_link$match11?void 0:_link$match11.slice(1,3).join("/")});if(doTask&&0{return null===(_link$match12=_link$match12.match(/app\/([\d]+)/))||void 0===_link$match12?void 0:_link$match12[1]});if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}};const Giveawaysu=class{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[];var tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(const task of tasks)pro.push(new Promise(resolve=>{const td=$(task).find('td:not(".hidden")');var colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])');const taskDes=0{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(taskDes.attr("href")).then(taskLink=>taskLink?(taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),void resolve(!0)):resolve(!1)).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?(0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=null===(giveawayId=window.location.href.match(/\/view\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{const pro=[],tasks=this.undoneTasks;var steamLength,steamCommunityLength;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init()))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),!tasks.steam||0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0{var _tasks$steam,_tasks$steam$type;return["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&(null===(_tasks$steam=tasks.steam)||void 0===_tasks$steam||null===(_tasks$steam$type=_tasks$steam[type])||void 0===_tasks$steam$type?void 0:_tasks$steam$type.length)||0}).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(const data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){const result={};for(var[social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{if(!this.initialized&&!this.init())return!1;if(!await this.#classifyTask())return!1;if(!await this.#initSocial())return!1;const pro=[];var tasks=this.undoneTasks;return"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var href;for(const task of $("#actions tr")){const $task=$(task);if("adjs"!==$task.attr("data-action-id")){const icon=$task.find("i.glyphicon-refresh"),button=icon.parent();"A"!==button.prop("tagName")?icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)):(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href))}}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}};var _LocalStorage$getItem2,for_giveawaysu=__webpack_require__(821);if(window.STYLE=GM_addStyle(for_giveawaysu.Z+GM_getResourceText("style")),"discord.com"===window.location.hostname){const LocalStorage=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=null===LocalStorage||void 0===LocalStorage||null===(discordAuth=LocalStorage.getItem("token"))||void 0===discordAuth?void 0:discordAuth.replace(/^"|"$/g,"");discordAuth&&0{var _commonOptions,_commonOptions$header;if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(_commonOptions=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:_commonOptions,clientId:null===(_commonOptions=commonOptions)||void 0===_commonOptions||null===(_commonOptions$header=_commonOptions.headers)||void 0===_commonOptions$header?void 0:_commonOptions$header["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"twitter.com"===window.location.hostname&&"#auth"===window.location.hash){var PAPISID=external_Cookies_namespaceObject.get("ct0");const isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&PAPISID?(GM_setValue("twitterAuth",{ct0:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((PAPISID=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){const betaButton=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}()}(); \ No newline at end of file + ${null===text||void 0===text?void 0:text.replace("u_","")}]...`);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},getRedirectLink=async link=>{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError_throwError(error,"getRedirectLink"),null}};const defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};for_giveawaysu=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,for_giveawaysu);const languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en";const i18n=function(key){for(var _languages$language,_len=arguments.length,argvs=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)argvs[_key-1]=arguments[_key];return null!==(_languages$language=languages[language])&&void 0!==_languages$language&&_languages$language[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key};for_giveawaysu=class{constructor(){var obj,key,value;value=void 0,(key="tasks")in(obj=this)?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value}getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0{const newTab=GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=null===(auth=GM_getValue("discordAuth"))||void 0===auth?void 0:auth.auth;auth?(_classPrivateFieldSet(this,_auth,{auth:auth}),logStatus.success(),resolve(await _classPrivateMethodGet(this,_verifyAuth,_verifyAuth2).call(this))):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async function _joinServer2(inviteId){try{const logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId});var _data$response,_data$response$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:_classPrivateFieldGet(this,_auth).auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;logStatus.success();var guild=String(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$guild=_data$response.guild)||void 0===_data$response$guild?void 0:_data$response$guild.id);return guild&&(_classPrivateMethodGet(this,_setCache,_setCache2).call(this,inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async function _leaveServer2(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await _classPrivateMethodGet(this,_getGuild,_getGuild2).call(this,inviteId);if(!guild)return!1;const logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:_classPrivateFieldGet(this,_auth).auth}});return"Success"===result&&204===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async function _getGuild2(inviteId){try{const logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId});var guild=_classPrivateFieldGet(this,_cache)[inviteId];if(guild)return logStatus.success(),guild;var _data$response2,_data$response2$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;{const guild=null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$guild=_data$response2.guild)||void 0===_data$response2$guild?void 0:_data$response2$guild.id;return guild?(logStatus.success(),_classPrivateMethodGet(this,_setCache,_setCache2).call(this,inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}function _setCache2(inviteId,guild){try{_classPrivateFieldGet(this,_cache)[inviteId]=guild,GM_setValue("discordCache",_classPrivateFieldGet(this,_cache))}catch(error){throwError_throwError(error,"Discord.setCache")}}const social_Discord=class extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),_classPrivateMethodInitSpec(this,_setCache),_classPrivateMethodInitSpec(this,_getGuild),_classPrivateMethodInitSpec(this,_leaveServer),_classPrivateMethodInitSpec(this,_joinServer),_classPrivateMethodInitSpec(this,_updateAuth),_classPrivateMethodInitSpec(this,_verifyAuth),Discord_defineProperty(this,"tasks",JSON.parse(defaultTasks)),Discord_defineProperty(this,"whiteList",{...JSON.parse(defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.discord}),_classPrivateFieldInitSpec(this,_auth,{writable:!0,value:GM_getValue("discordAuth")||{}}),_classPrivateFieldInitSpec(this,_cache,{writable:!0,value:GM_getValue("discordCache")||{}}),_classPrivateFieldInitSpec(this,_initialized,{writable:!0,value:!1})}async init(){try{if(!GM_getValue("dontRemindDiscordAgain"))if(!await external_Swal_default().fire({title:i18n("discordImportantNotice"),text:i18n("discordImportantNoticeText"),showCancelButton:!0,showDenyButton:!0,confirmButtonText:i18n("continue"),cancelButtonText:i18n("skipDiscordTask"),denyButtonText:i18n("continueAndDontRemindAgain")}).then(isDenied=>{var{isConfirmed,isDenied}=isDenied;return!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)}))return _classPrivateFieldSet(this,_initialized,!1),"skip";return globalOptions.doTask.discord.servers||globalOptions.undoTask.discord.servers?!!_classPrivateFieldGet(this,_initialized)||(_classPrivateFieldGet(this,_auth).auth?await _classPrivateMethodGet(this,_verifyAuth,_verifyAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),_classPrivateFieldSet(this,_initialized,!0),!0):(GM_setValue("discordAuth",{auth:null}),await _classPrivateMethodGet(this,_updateAuth,_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),_classPrivateFieldSet(this,_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1)):!!await _classPrivateMethodGet(this,_updateAuth,_updateAuth2).call(this)&&(_classPrivateFieldSet(this,_initialized,!0),!0)):(_classPrivateFieldSet(this,_initialized,!1),"skip")}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async toggle(serverLinks){var{doTask=!0,serverLinks=[]}=serverLinks;try{if(!_classPrivateFieldGet(this,_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/invite\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}};function Instagram_classPrivateMethodInitSpec(obj,privateSet){Instagram_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Instagram_classPrivateFieldInitSpec(obj,privateMap,value){Instagram_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Instagram_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Instagram_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Instagram_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Instagram_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Instagram_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Instagram_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Instagram_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Instagram_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Instagram_defaultTasks=JSON.stringify({users:[]});var Instagram_cache=new WeakMap,Instagram_auth=new WeakMap,Instagram_initialized=new WeakMap,_getUserInfo=new WeakSet,_followUser=new WeakSet,_unfollowUser=new WeakSet,Instagram_setCache=new WeakSet;async function _getUserInfo2(){var name=0{return null===(_link$match=_link$match.match(/https:\/\/www\.instagram\.com\/(.+)?\//))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}};function Reddit_classPrivateMethodInitSpec(obj,privateSet){Reddit_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Reddit_classPrivateFieldInitSpec(obj,privateMap,value){Reddit_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Reddit_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Reddit_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Reddit_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Reddit_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Reddit_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Reddit_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Reddit_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Reddit_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Reddit_defaultTasks=JSON.stringify({reddits:[]});var Reddit_auth=new WeakMap,Reddit_initialized=new WeakMap,_useBeta=new WeakSet,Reddit_updateAuth=new WeakSet;async function _useBeta2(){try{const logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{const newTab=GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{logStatus.success(),resolve(await Reddit_classPrivateMethodGet(this,Reddit_updateAuth,Reddit_updateAuth2).call(this,!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async function Reddit_updateAuth2(){var _data$responseText$ma,beta=0{var name=null===(name=userName.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/))||void 0===name?void 0:name[1],userName=null===(userName=userName.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/))||void 0===userName?void 0:userName[1];return userName?name||userName:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}};function Twitch_classPrivateMethodInitSpec(obj,privateSet){Twitch_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Twitch_classPrivateFieldInitSpec(obj,privateMap,value){Twitch_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Twitch_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Twitch_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Twitch_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Twitch_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Twitch_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Twitch_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Twitch_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Twitch_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Twitch_defaultTasks=JSON.stringify({channels:[]});var Twitch_auth=new WeakMap,Twitch_cache=new WeakMap,Twitch_initialized=new WeakMap,_integrityToken=new WeakMap,Twitch_verifyAuth=new WeakSet,_integrity=new WeakSet,Twitch_updateAuth=new WeakSet,_toggleChannel=new WeakSet,_getChannelId=new WeakSet,Twitch_setCache=new WeakSet;async function Twitch_verifyAuth2(isFirst){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")});var _data$response,_data$response$,_data$response$$data,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response=data.response)&&void 0!==_data$response&&null!==(_data$response$=_data$response[0])&&void 0!==_data$response$&&null!==(_data$response$$data=_data$response$.data)&&void 0!==_data$response$$data&&_data$response$$data.currentUser?(await Twitch_classPrivateMethodGet(this,_integrity,_integrity2).call(this,isFirst),logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async function _integrity2(){var isFirst=!(0{const newTab=GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(Twitch_classPrivateFieldSet(this,Twitch_auth,auth),logStatus.success(),resolve(await Twitch_classPrivateMethodGet(this,Twitch_verifyAuth,Twitch_verifyAuth2).call(this,isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async function _toggleChannel2(doTask){var{name,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await Twitch_classPrivateMethodGet(this,_getChannelId,_getChannelId2).call(this,name);if(!channelId)return!1;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name});var _data$response3,_data$response4,_data$response4$0$err,_data$response4$0$err2,followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId,"Client-Version":Twitch_classPrivateFieldGet(this,Twitch_auth).clientVersion,"X-Device-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).deviceId,"Client-Session-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientSessionId,"Client-Integrity":Twitch_classPrivateFieldGet(this,_integrityToken)},data:doTask?followData:unfollowData});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+((null==data||null===(_data$response4=data.response)||void 0===_data$response4||null===(_data$response4$0$err=_data$response4[0].errors)||void 0===_data$response4$0$err||null===(_data$response4$0$err2=_data$response4$0$err[0])||void 0===_data$response4$0$err2?void 0:_data$response4$0$err2.message)||`${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`)),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async function _getChannelId2(name){try{const logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name});var channelId=Twitch_classPrivateFieldGet(this,Twitch_cache)[name];if(channelId)return logStatus.success(),channelId;var _data$response5,_data$response5$,_data$response5$$data,_data$response5$$data2,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+Twitch_classPrivateFieldGet(this,Twitch_auth).authToken,"Client-Id":Twitch_classPrivateFieldGet(this,Twitch_auth).clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const channelId=null===(_data$response5=data.response)||void 0===_data$response5||null===(_data$response5$=_data$response5[0])||void 0===_data$response5$||null===(_data$response5$$data=_data$response5$.data)||void 0===_data$response5$$data||null===(_data$response5$$data2=_data$response5$$data.user)||void 0===_data$response5$$data2?void 0:_data$response5$$data2.id;return channelId?(Twitch_classPrivateMethodGet(this,Twitch_setCache,Twitch_setCache2).call(this,name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}function Twitch_setCache2(name,id){try{Twitch_classPrivateFieldGet(this,Twitch_cache)[name]=id,GM_setValue("twitchCache",Twitch_classPrivateFieldGet(this,Twitch_cache))}catch(error){throwError_throwError(error,"Twitch.setCache")}}const social_Twitch=class extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),Twitch_classPrivateMethodInitSpec(this,Twitch_setCache),Twitch_classPrivateMethodInitSpec(this,_getChannelId),Twitch_classPrivateMethodInitSpec(this,_toggleChannel),Twitch_classPrivateMethodInitSpec(this,Twitch_updateAuth),Twitch_classPrivateMethodInitSpec(this,_integrity),Twitch_classPrivateMethodInitSpec(this,Twitch_verifyAuth),Twitch_defineProperty(this,"tasks",JSON.parse(Twitch_defaultTasks)),Twitch_defineProperty(this,"whiteList",{...JSON.parse(Twitch_defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.twitch}),Twitch_classPrivateFieldInitSpec(this,Twitch_auth,{writable:!0,value:GM_getValue("twitchAuth")||{}}),Twitch_classPrivateFieldInitSpec(this,Twitch_cache,{writable:!0,value:GM_getValue("twitchCache")||{}}),Twitch_classPrivateFieldInitSpec(this,Twitch_initialized,{writable:!0,value:!1}),Twitch_classPrivateFieldInitSpec(this,_integrityToken,{writable:!0,value:void 0})}async init(){try{return Twitch_classPrivateFieldGet(this,Twitch_initialized)?!0:Twitch_classPrivateFieldGet(this,Twitch_auth).authToken&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientId&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientVersion&&Twitch_classPrivateFieldGet(this,Twitch_auth).deviceId&&Twitch_classPrivateFieldGet(this,Twitch_auth).clientSessionId?await Twitch_classPrivateMethodGet(this,Twitch_verifyAuth,Twitch_verifyAuth2).call(this,!0)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0):(GM_setValue("twitchAuth",null),await Twitch_classPrivateMethodGet(this,Twitch_updateAuth,Twitch_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1)):!!await Twitch_classPrivateMethodGet(this,Twitch_updateAuth,Twitch_updateAuth2).call(this)&&(Twitch_classPrivateFieldSet(this,Twitch_initialized,!0),!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async toggle(channelLinks){var{doTask=!0,channelLinks=[]}=channelLinks;try{if(!Twitch_classPrivateFieldGet(this,Twitch_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/))||void 0===_link$match?void 0:_link$match[2]});if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}};function Vk_classPrivateMethodInitSpec(obj,privateSet){Vk_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Vk_classPrivateFieldInitSpec(obj,privateMap,value){Vk_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Vk_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Vk_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Vk_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Vk_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Vk_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Vk_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Vk_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Vk_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Vk_defaultTasks=JSON.stringify({names:[]});var _username=new WeakMap,Vk_cache=new WeakMap,Vk_initialized=new WeakMap,Vk_verifyAuth=new WeakSet,_toggleGroup=new WeakSet,_togglePublic=new WeakSet,_sendWall=new WeakSet,_deleteWall=new WeakSet,_getId=new WeakSet,_toggleVk=new WeakSet,Vk_setCache=new WeakSet;async function Vk_verifyAuth2(){try{const logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});var _data$responseText$ma;return"Success"===result?null!==data&&void 0!==data&&data.finalUrl.includes("vk.com/login")?(logStatus.error("Error:"+i18n("loginVk"),!0),!1):200===(null===data||void 0===data?void 0:data.status)?(Vk_classPrivateFieldSet(this,_username,(null===(_data$responseText$ma=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1])||""),logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async function _toggleGroup2(name,dataParam){var doTask=!(2{return null===(_link$match=_link$match.match(/https:\/\/vk\.com\/([^/]+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}};function Youtube_classPrivateMethodInitSpec(obj,privateSet){Youtube_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Youtube_classPrivateFieldInitSpec(obj,privateMap,value){Youtube_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Youtube_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Youtube_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Youtube_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Youtube_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Youtube_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Youtube_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Youtube_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Youtube_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Youtube_defaultTasks=JSON.stringify({channels:[],likes:[]}),getInfo=async function(link,type){try{const logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};{var _data$responseText$ma,_ref;if(data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube"))return logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0};var apiKey=null===(_data$responseText$ma=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],context=(null===(_ref=data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))||void 0===_ref?void 0:_ref[1])||"{}";const{client,request}=JSON.parse(context);if(apiKey&&client&&request){if(client.hl="en","channel"===type){var _data$responseText$ma2,channelId=null===(_data$responseText$ma2=data.responseText.match(//))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return channelId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{})}if("likeVideo"!==type)return logStatus.error("Error: Unknown type"),{};var _data$responseText$ma3,_data$responseText$ma4,videoId=null===(_data$responseText$ma3=data.responseText.match(//))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],likeParams=null===(_data$responseText$ma4=data.responseText.match(/"likeParams":"(.*?)"/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1];return videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})}return logStatus.error('Error: Parameter "apiKey" not found!'),{}}}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}};var Youtube_auth=new WeakMap,Youtube_initialized=new WeakMap,_verifyChannel=new WeakMap,Youtube_verifyAuth=new WeakSet,Youtube_updateAuth=new WeakSet,_getInfo=new WeakSet,Youtube_toggleChannel=new WeakSet,_toggleLikeVideo=new WeakSet;class Youtube extends for_giveawaysu{constructor(){var _GM_getValue;super(...arguments),Youtube_classPrivateMethodInitSpec(this,_toggleLikeVideo),Youtube_classPrivateMethodInitSpec(this,Youtube_toggleChannel),Youtube_classPrivateMethodInitSpec(this,_getInfo),Youtube_classPrivateMethodInitSpec(this,Youtube_updateAuth),Youtube_classPrivateMethodInitSpec(this,Youtube_verifyAuth),Youtube_defineProperty(this,"tasks",JSON.parse(Youtube_defaultTasks)),Youtube_defineProperty(this,"whiteList",{...JSON.parse(Youtube_defaultTasks),...null===(_GM_getValue=GM_getValue("whiteList"))||void 0===_GM_getValue?void 0:_GM_getValue.youtube}),Youtube_classPrivateFieldInitSpec(this,Youtube_auth,{writable:!0,value:GM_getValue("youtubeAuth")||{}}),Youtube_classPrivateFieldInitSpec(this,Youtube_initialized,{writable:!0,value:!1}),Youtube_classPrivateFieldInitSpec(this,_verifyChannel,{writable:!0,value:"https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel})}async init(){try{return Youtube_classPrivateFieldGet(this,Youtube_initialized)?!0:Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID?await Youtube_classPrivateMethodGet(this,Youtube_verifyAuth,Youtube_verifyAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0):(GM_setValue("youtubeAuth",null),await Youtube_classPrivateMethodGet(this,Youtube_updateAuth,Youtube_updateAuth2).call(this)?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1)):!!await Youtube_classPrivateMethodGet(this,Youtube_updateAuth,Youtube_updateAuth2).call(this)&&(Youtube_classPrivateFieldSet(this,Youtube_initialized,!0),!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async toggle(videoLinks){var{doTask=!0,channelLinks=[],videoLinks=[]}=videoLinks;try{if(!Youtube_classPrivateFieldGet(this,Youtube_initialized))return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>{var _link$match;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match?void 0:_link$match[1]:link});if(0{var _link$match2;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match2=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match2?void 0:_link$match2[1]:link});if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}async function Youtube_verifyAuth2(){try{return await Youtube_classPrivateMethodGet(this,Youtube_toggleChannel,Youtube_toggleChannel2).call(this,{link:Youtube_classPrivateFieldGet(this,_verifyChannel),doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async function Youtube_updateAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://www.youtube.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("youtubeAuth");auth?(Youtube_classPrivateFieldSet(this,Youtube_auth,auth),logStatus.success(),Youtube_classPrivateMethodGet(this,Youtube_verifyAuth,Youtube_verifyAuth2).call(this).then(result=>{resolve(result)})):(logStatus.error("Error: Update youtube auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}function _getInfo2(link,type){return getInfo(link,type)}async function Youtube_toggleChannel2(verify){var{link,doTask=!0,verify=!1}=verify;try{var{params,needLogin}=await Youtube_classPrivateMethodGet(this,_getInfo,_getInfo2).call(this,link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)return scripts_echoLog({html:i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&channelId))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":null==client?void 0:client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:null==request?void 0:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&(/"subscribed": true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed": false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async function _toggleLikeVideo2(doTask){var{link,doTask=!0}=doTask;try{var{params,needLogin}=await Youtube_classPrivateMethodGet(this,_getInfo,_getInfo2).call(this,link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)return scripts_echoLog({html:""+i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&videoId&&likeParams))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;const logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this,Youtube_auth).PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}function Steam_classPrivateMethodInitSpec(obj,privateSet){Steam_checkPrivateRedeclaration(obj,privateSet),privateSet.add(obj)}function Steam_classPrivateFieldInitSpec(obj,privateMap,value){Steam_checkPrivateRedeclaration(obj,privateMap),privateMap.set(obj,value)}function Steam_checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Steam_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Steam_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function Steam_classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,Steam_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function Steam_classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,Steam_classExtractFieldDescriptor(receiver,privateMap,"get"))}function Steam_classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}const Steam_defaultTasks=JSON.stringify({groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]});var Steam_cache=new WeakMap,Steam_auth=new WeakMap,_storeInitialized=new WeakMap,_communityInitialized=new WeakMap,_area=new WeakMap,_areaStatus=new WeakMap,_refreshStoreToken=new WeakSet,_setStoreToken=new WeakSet,_updateStoreAuth=new WeakSet,_updateCommunityAuth=new WeakSet,_getAreaInfo=new WeakSet,_changeArea=new WeakSet,_joinGroup=new WeakSet,_leaveGroup=new WeakSet,_getGroupId=new WeakSet,_joinOfficialGroup=new WeakSet,_leaveOfficialGroup=new WeakSet,_getOfficialGroupId=new WeakSet,_addToWishlist=new WeakSet,_removeFromWishlist=new WeakSet,_toggleFollowGame=new WeakSet,_isFollowedGame=new WeakSet,_toggleForum=new WeakSet,_getForumId=new WeakSet,_toggleFavoriteWorkshop=new WeakSet,_getWorkshopAppId=new WeakSet,_voteUpWorkshop=new WeakSet,_toggleCurator=new WeakSet,_toggleCuratorLike=new WeakSet,_getAnnouncementParams=new WeakSet,_likeAnnouncement=new WeakSet,_appid2subid=new WeakSet,_getLicenses=new WeakSet,_addLicense=new WeakSet,_addFreeLicense=new WeakSet,_requestPlayTestAccess=new WeakSet,Steam_setCache=new WeakSet;async function _refreshStoreToken2(){try{const logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n("steamStore"))}),formData=new FormData;formData.append("redir","https://store.steampowered.com/");var _data$response,{result,statusText,status,data}=await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/"},data:formData});return"Success"===result?null!=data&&null!==(_data$response=data.response)&&void 0!==_data$response&&_data$response.success?await Steam_classPrivateMethodGet(this,_setStoreToken,_setStoreToken2).call(this,data.response)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshStoreToken"),!1}}async function _setStoreToken2(param){try{const logStatus=scripts_echoLog({text:i18n("settingToken",i18n("steamStore"))}),formData=new FormData;formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth);var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/login/settoken",method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/login"},data:formData});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async function _updateStoreAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma2;if(!data.responseText.includes("data-miniprofile="))return await Steam_classPrivateMethodGet(this,_refreshStoreToken,_refreshStoreToken2).call(this),logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1;var storeSessionID=null===(_data$responseText$ma2=data.responseText.match(/g_sessionID = "(.+?)";/))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return storeSessionID?(Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async function _updateCommunityAuth2(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma3,_data$responseText$ma4,_data$responseText$ma5;if(data.responseText.includes('href="https://steamcommunity.com/login/home/'))return logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1;var steam64Id=null===(_data$responseText$ma3=data.responseText.match(/g_steamID = "(.+?)";/))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],communitySessionID=null===(_data$responseText$ma4=data.responseText.match(/g_sessionID = "(.+?)";/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1],userName=null===(_data$responseText$ma5=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//))||void 0===_data$responseText$ma5?void 0:_data$responseText$ma5[1];return(steam64Id&&(Steam_classPrivateFieldGet(this,Steam_auth).steam64Id=steam64Id),userName&&(Steam_classPrivateFieldGet(this,Steam_auth).userName=userName),communitySessionID)?(Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID=communitySessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1)}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async function _getAreaInfo2(){try{const logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};var _data$responseText$ma6,currentArea=null===(_data$responseText$ma6=data.responseText.match(//g)].map(search=>search[1]);return currentArea&&0{const checker=setInterval(()=>{"waiting"!==Steam_classPrivateFieldGet(this,_areaStatus)&&(clearInterval(checker),resolve(!0))})}),Steam_classPrivateFieldGet(this,_area)===area||!area&&"CN"!==Steam_classPrivateFieldGet(this,_area))return!0;Steam_classPrivateFieldSet(this,_areaStatus,"waiting");let aimedArea=area;if(!aimedArea){const{currentArea,areas}=await Steam_classPrivateMethodGet(this,_getAreaInfo,_getAreaInfo2).call(this);if(!currentArea||!areas)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),!1;if("CN"!==currentArea)return Steam_classPrivateFieldSet(this,_areaStatus,"skip"),scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return Steam_classPrivateFieldSet(this,_areaStatus,"noAnotherArea"),scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}const logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)});var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/account/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID})});if("Success"!==result)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==(null==data?void 0:data.status)||"true"!==data.responseText)return Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),"CN";var currentArea=(await Steam_classPrivateMethodGet(this,_getAreaInfo,_getAreaInfo2).call(this))["currentArea"];return currentArea===aimedArea?(Steam_classPrivateFieldSet(this,_areaStatus,"success"),logStatus.success(),currentArea):(Steam_classPrivateFieldSet(this,_areaStatus,"error"),logStatus.error("Error: change country filed"),"CN")}catch(error){return Steam_classPrivateFieldSet(this,_areaStatus,"error"),throwError_throwError(error,"Steam.changeArea"),!1}}async function _joinGroup2(groupName){try{const logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID})});return"Success"===result?200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async function _leaveGroup2(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;var groupId=await Steam_classPrivateMethodGet(this,_getGroupId,_getGroupId2).call(this,groupName);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this,Steam_auth).userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,action:"leaveGroup",groupId:groupId})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async function _getGroupId2(groupName){try{const logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName});var _data$responseText$ma7,groupId=Steam_classPrivateFieldGet(this,Steam_cache).group[groupName];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma7=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/))||void 0===_data$responseText$ma7?void 0:_data$responseText$ma7[1];return groupId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async function _joinOfficialGroup2(gameId){try{const logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes('id="publicGroupJoin"'))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma8;logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]);var groupId=null===(_data$responseText$ma8=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma8?void 0:_data$responseText$ma8[1];return groupId&&Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"officialGroup",gameId,groupId),!0}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async function _leaveOfficialGroup2(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;var groupId=await Steam_classPrivateMethodGet(this,_getOfficialGroupId,_getOfficialGroupId2).call(this,gameId);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId});var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this,Steam_auth).userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async function _getOfficialGroupId2(gameId){try{const logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId});var _data$responseText$ma9,groupId=Steam_classPrivateFieldGet(this,Steam_cache).officialGroup[gameId];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma9=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma9?void 0:_data$responseText$ma9[1];return groupId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async function _addToWishlist2(gameId){try{var _data$response2;const logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response2=data.response)||void 0===_data$response2?void 0:_data$response2.success))return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)?"CN"===Steam_classPrivateFieldGet(this,_area)&&dataR.responseText.includes('id="error_box"')?(logStatus.warning(i18n("changeAreaNotice")),!!await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this)&&await Steam_classPrivateMethodGet(this,_addToWishlist,_addToWishlist2).call(this,gameId)):(!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"'))?(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1):(logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async function _removeFromWishlist2(gameId){try{var _data$response3;if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;const logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.success))return logStatus.success(),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==(null===dataR||void 0===dataR?void 0:dataR.status))return logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1;if("CN"===Steam_classPrivateFieldGet(this,_area)&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));const result=await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this);return result&&"CN"!==result&&"skip"!==result?await Steam_classPrivateMethodGet(this,_removeFromWishlist,_removeFromWishlist2).call(this,gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async function _toggleFollowGame2(gameId,doTask){try{if(!doTask&&this.whiteList.follows.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:Steam_classPrivateFieldGet(this,Steam_auth).storeSessionID,appid:gameId};doTask||(requestData.unfollow="1");var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)});if("Success"===result&&200===(null==data?void 0:data.status)&&"true"===data.responseText)return logStatus.success(),!0;var followed=await Steam_classPrivateMethodGet(this,_isFollowedGame,_isFollowedGame2).call(this,gameId);return"CN"===Steam_classPrivateFieldGet(this,_area)&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this)&&await Steam_classPrivateMethodGet(this,_removeFromWishlist,_removeFromWishlist2).call(this,gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async function _isFollowedGame2(gameId){try{const{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&("CN"===Steam_classPrivateFieldGet(this,_area)&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async function _toggleForum2(gameId){var doTask=!(1/))||void 0===_data$responseText$ma11?void 0:_data$responseText$ma11[1];return appId?(Steam_classPrivateMethodGet(this,Steam_setCache,Steam_setCache2).call(this,"workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async function _voteUpWorkshop2(id){try{const logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id});var _data$response6,{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:Steam_classPrivateFieldGet(this,Steam_auth).communitySessionID})});return"Success"===result?(200===(null==data?void 0:data.status)&&1===(null===(_data$response6=data.response)||void 0===_data$response6?void 0:_data$response6.success)?logStatus.success():logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!0):(logStatus.error(result+`:${statusText}(${status})`),!0)}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async function _toggleCurator2(curatorId){var doTask=!(1{return null===(_link$match=_link$match.match(/groups\/(.+)\/?/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/games\/(.+)\/?/))||void 0===_link$match2?void 0:_link$match2[1]});if(0{return null===(_link$match3=_link$match3.match(/app\/([\d]+)/))||void 0===_link$match3?void 0:_link$match3[1]});if(0{return null===(_link$match4=_link$match4.match(/app\/([\d]+)/))||void 0===_link$match4?void 0:_link$match4[1]});if(0{return null===(_link$match5=_link$match5.match(/app\/([\d]+)/))||void 0===_link$match5?void 0:_link$match5[1]});if(0{return null===(_link$match6=_link$match6.match(/\?id=([\d]+)/))||void 0===_link$match6?void 0:_link$match6[1]});if(0{return null===(_link$match7=_link$match7.match(/\?id=([\d]+)/))||void 0===_link$match7?void 0:_link$match7[1]});if(doTask&&0{return null===(_link$match8=_link$match8.match(/curator\/([\d]+)/))||void 0===_link$match8?void 0:_link$match8[1]}),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,_link$match9=>{return null===(_link$match9=_link$match9.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/))||void 0===_link$match9?void 0:_link$match9.slice(1,3).join("/")});if(0{var _link$match10;return _link$match11.includes("store.steampowered.com")?null===(_link$match10=_link$match11.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/))||void 0===_link$match10?void 0:_link$match10.slice(1,3).join("/"):null===(_link$match11=_link$match11.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))||void 0===_link$match11?void 0:_link$match11.slice(1,3).join("/")});if(doTask&&0{return null===(_link$match12=_link$match12.match(/app\/([\d]+)/))||void 0===_link$match12?void 0:_link$match12[1]});if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==Steam_classPrivateFieldGet(this,_area)&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await Steam_classPrivateMethodGet(this,_changeArea,_changeArea2).call(this,"CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}};function Giveawaysu_classPrivateMethodInitSpec(obj,privateSet){!function(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}(obj,privateSet),privateSet.add(obj)}function Giveawaysu_defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function Giveawaysu_classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}const Giveawaysu_defaultTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};var _classifyTask=new WeakSet,_checkLogin=new WeakSet,_checkLeftKey=new WeakSet,_getGiveawayId=new WeakSet,_bind=new WeakSet,_initSocial=new WeakSet,_uniqueTasks=new WeakSet,_toggleTask=new WeakSet;async function _classifyTask2(){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[];var tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(const task of tasks)pro.push(new Promise(resolve=>{const td=$(task).find('td:not(".hidden")');var colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])');const taskDes=0taskLink?(taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),void resolve(!0)):resolve(!1)).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=Giveawaysu_classPrivateMethodGet(this,_uniqueTasks,_uniqueTasks2).call(this,this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}function _checkLogin2(){try{return globalOptions.other.checkLogin?(0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async function _checkLeftKey2(){try{return globalOptions.other.checkLeftKey?(0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}function _getGiveawayId2(){var giveawayId=null===(giveawayId=window.location.href.match(/\/view\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async function _bind2(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async function _initSocial2(){try{const pro=[],tasks=this.undoneTasks;var steamLength,steamCommunityLength;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"discord",this.social.discord.init()))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"youtube",this.social.youtube.init()))),!tasks.steam||0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0{var _tasks$steam,_tasks$steam$type;return["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&(null===(_tasks$steam=tasks.steam)||void 0===_tasks$steam||null===(_tasks$steam$type=_tasks$steam[type])||void 0===_tasks$steam$type?void 0:_tasks$steam$type.length)||0}).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(Giveawaysu_classPrivateMethodGet(this,_bind,_bind2).call(this,"steamStore",this.social.steam.init("store"))),0{let checked=!0;for(const data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}function _uniqueTasks2(allTasks){const result={};for(var[social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async function _toggleTask2(){try{if(!this.initialized&&!this.init())return!1;if(!await Giveawaysu_classPrivateMethodGet(this,_classifyTask,_classifyTask2).call(this))return!1;if(!await Giveawaysu_classPrivateMethodGet(this,_initSocial,_initSocial2).call(this))return!1;const pro=[];var tasks=this.undoneTasks;return"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}const Giveawaysu=class{constructor(){Giveawaysu_classPrivateMethodInitSpec(this,_toggleTask),Giveawaysu_classPrivateMethodInitSpec(this,_uniqueTasks),Giveawaysu_classPrivateMethodInitSpec(this,_initSocial),Giveawaysu_classPrivateMethodInitSpec(this,_bind),Giveawaysu_classPrivateMethodInitSpec(this,_getGiveawayId),Giveawaysu_classPrivateMethodInitSpec(this,_checkLeftKey),Giveawaysu_classPrivateMethodInitSpec(this,_checkLogin),Giveawaysu_classPrivateMethodInitSpec(this,_classifyTask),Giveawaysu_defineProperty(this,"undoneTasks",Giveawaysu_defaultTasks),Giveawaysu_defineProperty(this,"giveawayId",void 0),Giveawaysu_defineProperty(this,"socialInitialized",{discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0}),Giveawaysu_defineProperty(this,"initialized",!1),Giveawaysu_defineProperty(this,"social",{})}static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{Giveawaysu_classPrivateMethodGet(this,_checkLogin,_checkLogin2).call(this)||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await Giveawaysu_classPrivateMethodGet(this,_checkLeftKey,_checkLeftKey2).call(this)||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!Giveawaysu_classPrivateMethodGet(this,_getGiveawayId,_getGiveawayId2).call(this)&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await Giveawaysu_classPrivateMethodGet(this,_toggleTask,_toggleTask2).call(this)}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var href;for(const task of $("#actions tr")){const $task=$(task);if("adjs"!==$task.attr("data-action-id")){const icon=$task.find("i.glyphicon-refresh"),button=icon.parent();"A"!==button.prop("tagName")?icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)):(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href))}}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}};var _LocalStorage$getItem2,for_giveawaysu=__webpack_require__(821);if(window.STYLE=GM_addStyle(for_giveawaysu.Z+GM_getResourceText("style")),"discord.com"===window.location.hostname){const LocalStorage=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=null===LocalStorage||void 0===LocalStorage||null===(discordAuth=LocalStorage.getItem("token"))||void 0===discordAuth?void 0:discordAuth.replace(/^"|"$/g,"");discordAuth&&0{var _commonOptions,_commonOptions$header;if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(_commonOptions=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:_commonOptions,clientId:null===(_commonOptions=commonOptions)||void 0===_commonOptions||null===(_commonOptions$header=_commonOptions.headers)||void 0===_commonOptions$header?void 0:_commonOptions$header["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"twitter.com"===window.location.hostname&&"#auth"===window.location.hash){var PAPISID=external_Cookies_namespaceObject.get("ct0");const isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&PAPISID?(GM_setValue("twitterAuth",{ct0:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((PAPISID=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:PAPISID}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){const betaButton=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}()}(); \ No newline at end of file diff --git a/dist/auto-task-v4.all.user.js b/dist/auto-task-v4.all.user.js index d8b1743..884d309 100644 --- a/dist/auto-task-v4.all.user.js +++ b/dist/auto-task-v4.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4 // @namespace auto-task-v4 -// @version 4.2.31 +// @version 4.2.32 // @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。 // @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites. // @author HCLonely @@ -1781,8 +1781,23 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); }); console.log('%c%s', 'color:white;background:red', `Auto-Task[Error]: ${name}\n${error.stack}`); } + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } class Social { - tasks; + constructor() { + _defineProperty(this, 'tasks', void 0); + } getRealParams(name, links, doTask, link2param) { try { let realParams = []; @@ -1800,20 +1815,110 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } } const social_Social = Social; - var _GM_getValue; + function _classPrivateMethodInitSpec(obj, privateSet) { + _checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function _classPrivateFieldInitSpec(obj, privateMap, value) { + _checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function _checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Discord_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function _classPrivateFieldGet(receiver, privateMap) { + var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'get'); + return _classApplyDescriptorGet(receiver, descriptor); + } + function _classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + function _classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = _classExtractFieldDescriptor(receiver, privateMap, 'set'); + _classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function _classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function _classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } const defaultTasksTemplate = { servers: [] }; const defaultTasks = JSON.stringify(defaultTasksTemplate); + var _auth = new WeakMap(); + var _cache = new WeakMap(); + var _initialized = new WeakMap(); + var _verifyAuth = new WeakSet(); + var _updateAuth = new WeakSet(); + var _joinServer = new WeakSet(); + var _leaveServer = new WeakSet(); + var _getGuild = new WeakSet(); + var _setCache = new WeakSet(); class Discord extends social_Social { - tasks = JSON.parse(defaultTasks); - whiteList = { - ...JSON.parse(defaultTasks), - ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.discord - }; - #auth = GM_getValue('discordAuth') || {}; - #cache = GM_getValue('discordCache') || {}; - #initialized = false; + constructor() { + var _GM_getValue; + super(...arguments); + _classPrivateMethodInitSpec(this, _setCache); + _classPrivateMethodInitSpec(this, _getGuild); + _classPrivateMethodInitSpec(this, _leaveServer); + _classPrivateMethodInitSpec(this, _joinServer); + _classPrivateMethodInitSpec(this, _updateAuth); + _classPrivateMethodInitSpec(this, _verifyAuth); + Discord_defineProperty(this, 'tasks', JSON.parse(defaultTasks)); + Discord_defineProperty(this, 'whiteList', { + ...JSON.parse(defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.discord + }); + _classPrivateFieldInitSpec(this, _auth, { + writable: true, + value: GM_getValue('discordAuth') || {} + }); + _classPrivateFieldInitSpec(this, _cache, { + writable: true, + value: GM_getValue('discordCache') || {} + }); + _classPrivateFieldInitSpec(this, _initialized, { + writable: true, + value: false + }); + } async init() { try { if (!GM_getValue('dontRemindDiscordAgain')) { @@ -1840,36 +1945,36 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; }); if (!result) { - this.#initialized = false; + _classPrivateFieldSet(this, _initialized, false); return 'skip'; } } if (!globalOptions.doTask.discord.servers && !globalOptions.undoTask.discord.servers) { - this.#initialized = false; + _classPrivateFieldSet(this, _initialized, false); return 'skip'; } - if (this.#initialized) { + if (_classPrivateFieldGet(this, _initialized)) { return true; } - if (!this.#auth.auth) { - if (await this.#updateAuth()) { - this.#initialized = true; + if (!_classPrivateFieldGet(this, _auth).auth) { + if (await _classPrivateMethodGet(this, _updateAuth, _updateAuth2).call(this)) { + _classPrivateFieldSet(this, _initialized, true); return true; } return false; } - const isVerified = await this.#verifyAuth(); + const isVerified = await _classPrivateMethodGet(this, _verifyAuth, _verifyAuth2).call(this); if (isVerified) { scripts_echoLog({}).success(i18n('initSuccess', 'Discord')); - this.#initialized = true; + _classPrivateFieldSet(this, _initialized, true); return true; } GM_setValue('discordAuth', { auth: null }); - if (await this.#updateAuth()) { + if (await _classPrivateMethodGet(this, _updateAuth, _updateAuth2).call(this)) { scripts_echoLog({}).success(i18n('initSuccess', 'Discord')); - this.#initialized = true; + _classPrivateFieldSet(this, _initialized, true); return true; } scripts_echoLog({}).error(i18n('initFailed', 'Discord')); @@ -1879,194 +1984,13 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - async #verifyAuth() { - try { - const logStatus = scripts_echoLog({ - text: i18n('verifyingAuth', 'Discord') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://discord.com/api/v6/users/@me', - method: 'HEAD', - headers: { - authorization: this.#auth.auth - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Discord.verifyAuth'); - return false; - } - } - async #updateAuth() { - try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', 'Discord') - }); - return await new Promise(resolve => { - const newTab = GM_openInTab('https://discord.com/channels/@me#auth', { - active: true, - insert: true, - setParent: true - }); - newTab.onclose = async () => { - var _GM_getValue2; - const auth = (_GM_getValue2 = GM_getValue('discordAuth')) === null || _GM_getValue2 === void 0 ? void 0 : _GM_getValue2.auth; - if (auth) { - this.#auth = { - auth: auth - }; - logStatus.success(); - resolve(await this.#verifyAuth()); - } else { - logStatus.error('Error: Update discord auth failed!'); - resolve(false); - } - }; - }); - } catch (error) { - throwError(error, 'Discord.updateAuth'); - return false; - } - } - async #joinServer(inviteId) { - try { - const logStatus = scripts_echoLog({ - type: 'joiningDiscordServer', - text: inviteId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://discord.com/api/v9/invites/${inviteId}`, - method: 'POST', - dataType: 'json', - headers: { - authorization: this.#auth.auth, - origin: 'https://discord.com', - referer: `https://discord.com/invite/${inviteId}` - } - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$response, _data$response$guild; - logStatus.success(); - const guild = String((_data$response = data.response) === null || _data$response === void 0 ? void 0 : (_data$response$guild = _data$response.guild) === null || _data$response$guild === void 0 ? void 0 : _data$response$guild.id); - if (guild) { - this.#setCache(inviteId, guild); - this.tasks.servers = unique([ ...this.tasks.servers, inviteId ]); - } - return true; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Discord.joinServer'); - return false; - } - } - async #leaveServer(inviteId) { - try { - if (this.whiteList.servers.includes(inviteId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Discord.leaveServer', - id: inviteId - }); - return true; - } - const guild = await this.#getGuild(inviteId); - if (!guild) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'leavingDiscordServer', - text: guild - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://discord.com/api/v9/users/@me/guilds/${guild}`, - method: 'DELETE', - headers: { - authorization: this.#auth.auth - } - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 204) { - logStatus.success(); - return true; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Discord.leaveServer'); - return false; - } - } - async #getGuild(inviteId) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingDiscordGuild', - text: inviteId - }); - const guild = this.#cache[inviteId]; - if (guild) { - logStatus.success(); - return guild; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://discord.com/api/v9/invites/${inviteId}`, - responseType: 'json', - method: 'GET' - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$response2, _data$response2$guild; - const guild = (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$guild = _data$response2.guild) === null || _data$response2$guild === void 0 ? void 0 : _data$response2$guild.id; - if (guild) { - logStatus.success(); - this.#setCache(inviteId, guild); - return guild; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Discord.getGuild'); - return false; - } - } async toggle(_ref2) { let { doTask = true, serverLinks = [] } = _ref2; try { - if (!this.#initialized) { + if (!_classPrivateFieldGet(this, _initialized)) { scripts_echoLog({ text: i18n('needInit') }); @@ -2086,9 +2010,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (realServers.length > 0) { for (const server of realServers) { if (doTask) { - prom.push(this.#joinServer(server)); + prom.push(_classPrivateMethodGet(this, _joinServer, _joinServer2).call(this, server)); } else { - prom.push(this.#leaveServer(server)); + prom.push(_classPrivateMethodGet(this, _leaveServer, _leaveServer2).call(this, server)); } await delay(1e3); } @@ -2100,203 +2024,312 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #setCache(inviteId, guild) { - try { - this.#cache[inviteId] = guild; - GM_setValue('discordCache', this.#cache); - } catch (error) { - throwError(error, 'Discord.setCache'); - } - } } - const social_Discord = Discord; - var Instagram_GM_getValue; - const Instagram_defaultTasksTemplate = { - users: [] - }; - const Instagram_defaultTasks = JSON.stringify(Instagram_defaultTasksTemplate); - class Instagram extends social_Social { - tasks = JSON.parse(Instagram_defaultTasks); - whiteList = { - ...JSON.parse(Instagram_defaultTasks), - ...(Instagram_GM_getValue = GM_getValue('whiteList')) === null || Instagram_GM_getValue === void 0 ? void 0 : Instagram_GM_getValue.instagram - }; - #cache = GM_getValue('instagramCache') || {}; - #auth = {}; - #initialized = false; - async init() { - try { - if (this.#initialized) { - return true; + async function _verifyAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('verifyingAuth', 'Discord') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://discord.com/api/v6/users/@me', + method: 'HEAD', + headers: { + authorization: _classPrivateFieldGet(this, _auth).auth } - const isVerified = await this.#getUserInfo(); - if (isVerified) { - scripts_echoLog({}).success(i18n('initSuccess', 'Instagram')); - this.#initialized = true; + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); return true; } - scripts_echoLog({}).error(i18n('initFailed', 'Instagram')); - return false; - } catch (error) { - throwError(error, 'Instagram.init'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Discord.verifyAuth'); + return false; } - async #getUserInfo() { - let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'instagram'; - try { - const logStatus = scripts_echoLog({ - type: name === 'instagram' ? 'verifyingInsAuth' : 'gettingInsUserId', - text: name - }); - const userId = this.#cache[name]; - if (userId && name !== 'instagram') { - logStatus.success(); - return userId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://www.instagram.com/${name}/`, - method: 'GET' - }); - if (result === 'Success') { - if (data !== null && data !== void 0 && data.finalUrl.includes('accounts/login')) { - logStatus.error(`Error:${i18n('loginIns')}`, true); - return false; - } else if (data !== null && data !== void 0 && data.finalUrl.includes('www.instagram.com/challenge')) { - logStatus.error(`Error:${i18n('insBanned')}`); - return false; - } - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma, _data$responseText$ma2, _data$responseText$ma3; - const csrftoken = (_data$responseText$ma = data.responseText.match(/"csrf_token":"(.+?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; - const hash = (_data$responseText$ma2 = data.responseText.match(/"rollout_hash":"(.+?)"/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; - if (name === 'instagram') { - if (csrftoken && hash) { - this.#auth = { - csrftoken: csrftoken, - hash: hash - }; - return true; - } - return false; - } - const id = (_data$responseText$ma3 = data.responseText.match(/"profilePage_([\d]+?)"/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; - if (id) { - this.#setCache(name, id); - logStatus.success(); - return id; - } - logStatus.error('Error: Get ins data error!'); - return false; + } + async function _updateAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', 'Discord') + }); + return await new Promise(resolve => { + const newTab = GM_openInTab('https://discord.com/channels/@me#auth', { + active: true, + insert: true, + setParent: true + }); + newTab.onclose = async () => { + var _GM_getValue2; + const auth = (_GM_getValue2 = GM_getValue('discordAuth')) === null || _GM_getValue2 === void 0 ? void 0 : _GM_getValue2.auth; + if (auth) { + _classPrivateFieldSet(this, _auth, { + auth: auth + }); + logStatus.success(); + resolve(await _classPrivateMethodGet(this, _verifyAuth, _verifyAuth2).call(this)); + } else { + logStatus.error('Error: Update discord auth failed!'); + resolve(false); } - logStatus.error(`${result}:${statusText}(${status})`); - return false; + }; + }); + } catch (error) { + throwError(error, 'Discord.updateAuth'); + return false; + } + } + async function _joinServer2(inviteId) { + try { + const logStatus = scripts_echoLog({ + type: 'joiningDiscordServer', + text: inviteId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://discord.com/api/v9/invites/${inviteId}`, + method: 'POST', + dataType: 'json', + headers: { + authorization: _classPrivateFieldGet(this, _auth).auth, + origin: 'https://discord.com', + referer: `https://discord.com/invite/${inviteId}` } - return false; - } catch (error) { - throwError(error, 'Instagram.getUserInfo'); - return false; + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$response, _data$response$guild; + logStatus.success(); + const guild = String((_data$response = data.response) === null || _data$response === void 0 ? void 0 : (_data$response$guild = _data$response.guild) === null || _data$response$guild === void 0 ? void 0 : _data$response$guild.id); + if (guild) { + _classPrivateMethodGet(this, _setCache, _setCache2).call(this, inviteId, guild); + this.tasks.servers = unique([ ...this.tasks.servers, inviteId ]); + } + return true; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Discord.joinServer'); + return false; } - async #followUser(name) { - try { - const id = await this.#getUserInfo(name); - if (!id) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'followingIns', - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://www.instagram.com/web/friendships/${id}/follow/`, - method: 'POST', - dataType: 'json', - headers: { - 'x-csrftoken': this.#auth.csrftoken, - origin: 'https://www.instagram.com', - referer: `https://www.instagram.com/${name}/`, - 'content-type': 'application/x-www-form-urlencoded', - 'sec-fetch-site': 'same-origin', - 'x-instagram-ajax': this.#auth.hash - } + } + async function _leaveServer2(inviteId) { + try { + if (this.whiteList.servers.includes(inviteId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Discord.leaveServer', + id: inviteId }); - if (result === 'Success') { - var _data$response, _data$response2; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.result) === 'following') { - logStatus.success(); - this.tasks.users = unique([ ...this.tasks.users, name ]); - return true; - } - logStatus.error(`Error:${(data === null || data === void 0 ? void 0 : (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : _data$response2.feedback_message) || `${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`}`); - return false; + return true; + } + const guild = await _classPrivateMethodGet(this, _getGuild, _getGuild2).call(this, inviteId); + if (!guild) { + return false; + } + const logStatus = scripts_echoLog({ + type: 'leavingDiscordServer', + text: guild + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://discord.com/api/v9/users/@me/guilds/${guild}`, + method: 'DELETE', + headers: { + authorization: _classPrivateFieldGet(this, _auth).auth + } + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 204) { + logStatus.success(); + return true; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Discord.leaveServer'); + return false; + } + } + async function _getGuild2(inviteId) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingDiscordGuild', + text: inviteId + }); + const guild = _classPrivateFieldGet(this, _cache)[inviteId]; + if (guild) { + logStatus.success(); + return guild; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://discord.com/api/v9/invites/${inviteId}`, + responseType: 'json', + method: 'GET' + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$response2, _data$response2$guild; + const guild = (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$guild = _data$response2.guild) === null || _data$response2$guild === void 0 ? void 0 : _data$response2$guild.id; + if (guild) { + logStatus.success(); + _classPrivateMethodGet(this, _setCache, _setCache2).call(this, inviteId, guild); + return guild; } logStatus.error(`${result}:${statusText}(${status})`); return false; - } catch (error) { - throwError(error, 'Instagram.followUser'); - return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Discord.getGuild'); + return false; + } + } + function _setCache2(inviteId, guild) { + try { + _classPrivateFieldGet(this, _cache)[inviteId] = guild; + GM_setValue('discordCache', _classPrivateFieldGet(this, _cache)); + } catch (error) { + throwError(error, 'Discord.setCache'); + } + } + const social_Discord = Discord; + function Instagram_classPrivateMethodInitSpec(obj, privateSet) { + Instagram_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Instagram_classPrivateFieldInitSpec(obj, privateMap, value) { + Instagram_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Instagram_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Instagram_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Instagram_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Instagram_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Instagram_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Instagram_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Instagram_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Instagram_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Instagram_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Instagram_classApplyDescriptorGet(receiver, descriptor); + } + function Instagram_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Instagram_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Instagram_defaultTasksTemplate = { + users: [] + }; + const Instagram_defaultTasks = JSON.stringify(Instagram_defaultTasksTemplate); + var Instagram_cache = new WeakMap(); + var Instagram_auth = new WeakMap(); + var Instagram_initialized = new WeakMap(); + var _getUserInfo = new WeakSet(); + var _followUser = new WeakSet(); + var _unfollowUser = new WeakSet(); + var Instagram_setCache = new WeakSet(); + class Instagram extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Instagram_classPrivateMethodInitSpec(this, Instagram_setCache); + Instagram_classPrivateMethodInitSpec(this, _unfollowUser); + Instagram_classPrivateMethodInitSpec(this, _followUser); + Instagram_classPrivateMethodInitSpec(this, _getUserInfo); + Instagram_defineProperty(this, 'tasks', JSON.parse(Instagram_defaultTasks)); + Instagram_defineProperty(this, 'whiteList', { + ...JSON.parse(Instagram_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.instagram + }); + Instagram_classPrivateFieldInitSpec(this, Instagram_cache, { + writable: true, + value: GM_getValue('instagramCache') || {} + }); + Instagram_classPrivateFieldInitSpec(this, Instagram_auth, { + writable: true, + value: {} + }); + Instagram_classPrivateFieldInitSpec(this, Instagram_initialized, { + writable: true, + value: false + }); } - async #unfollowUser(name) { + async init() { try { - if (this.whiteList.users.includes(name)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Instagram.unfollowUser', - id: name - }); + if (Instagram_classPrivateFieldGet(this, Instagram_initialized)) { return true; } - const id = await this.#getUserInfo(name); - if (!id) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'unfollowingIns', - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://www.instagram.com/web/friendships/${id}/unfollow/`, - method: 'POST', - dataType: 'json', - headers: { - 'x-csrftoken': this.#auth.csrftoken, - origin: 'https://www.instagram.com', - referer: `https://www.instagram.com/${name}/`, - 'content-type': 'application/x-www-form-urlencoded', - 'sec-fetch-site': 'same-origin', - 'x-instagram-ajax': this.#auth.hash - } - }); - if (result === 'Success') { - var _data$response3; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.status) === 'ok') { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + const isVerified = await Instagram_classPrivateMethodGet(this, _getUserInfo, _getUserInfo2).call(this); + if (isVerified) { + scripts_echoLog({}).success(i18n('initSuccess', 'Instagram')); + Instagram_classPrivateFieldSet(this, Instagram_initialized, true); + return true; } - logStatus.error(`${result}:${statusText}(${status})`); + scripts_echoLog({}).error(i18n('initFailed', 'Instagram')); return false; } catch (error) { - throwError(error, 'Instagram.unfollowUser'); + throwError(error, 'Instagram.init'); return false; } } @@ -2306,7 +2339,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); userLinks = [] } = _ref; try { - if (!this.#initialized) { + if (!Instagram_classPrivateFieldGet(this, Instagram_initialized)) { scripts_echoLog({ text: i18n('needInit') }); @@ -2326,9 +2359,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (realUsers.length > 0) { for (const username of realUsers) { if (doTask) { - prom.push(this.#followUser(username)); + prom.push(Instagram_classPrivateMethodGet(this, _followUser, _followUser2).call(this, username)); } else { - prom.push(this.#unfollowUser(username)); + prom.push(Instagram_classPrivateMethodGet(this, _unfollowUser, _unfollowUser2).call(this, username)); } await delay(1e3); } @@ -2340,136 +2373,300 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #setCache(name, id) { - try { - this.#cache[name] = id; - GM_setValue('instagramCache', this.#cache); - } catch (error) { - throwError(error, 'Instagram.setCache'); - } - } } - const social_Instagram = Instagram; - var Reddit_GM_getValue; - const Reddit_defaultTasksTemplate = { - reddits: [] - }; - const Reddit_defaultTasks = JSON.stringify(Reddit_defaultTasksTemplate); - class Reddit extends social_Social { - tasks = JSON.parse(Reddit_defaultTasks); - whiteList = { - ...JSON.parse(Reddit_defaultTasks), - ...(Reddit_GM_getValue = GM_getValue('whiteList')) === null || Reddit_GM_getValue === void 0 ? void 0 : Reddit_GM_getValue.reddit - }; - #auth; - #initialized = false; - async init() { - try { - if (this.#initialized) { - return true; - } - const isVerified = await this.#updateAuth(); - if (isVerified) { - scripts_echoLog({}).success(i18n('initSuccess', 'Reddit')); - this.#initialized = true; - return true; - } - scripts_echoLog({}).error(i18n('initFailed', 'Reddit')); - return false; - } catch (error) { - throwError(error, 'Reddit.init'); - return false; - } - } - async #useBeta() { - try { - const logStatus = scripts_echoLog({ - text: i18n('changingRedditVersion') - }); - GM_setValue('redditAuth', null); - return await new Promise(resolve => { - const newTab = GM_openInTab('https://www.reddit.com/#auth', { - active: true, - insert: true, - setParent: true - }); - newTab.onclose = async () => { - logStatus.success(); - resolve(await this.#updateAuth(true)); - }; - }); - } catch (error) { - throwError(error, 'Reddit.useBeta'); - return false; + async function _getUserInfo2() { + let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'instagram'; + try { + const logStatus = scripts_echoLog({ + type: name === 'instagram' ? 'verifyingInsAuth' : 'gettingInsUserId', + text: name + }); + const userId = Instagram_classPrivateFieldGet(this, Instagram_cache)[name]; + if (userId && name !== 'instagram') { + logStatus.success(); + return userId; } - } - async #updateAuth() { - let beta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', 'Reddit') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://www.reddit.com/', - method: 'GET', - nochche: true, - headers: { - 'Cache-Control': 'no-cache' - } - }); - if (result === 'Success') { - if (data !== null && data !== void 0 && data.responseText.includes('www.reddit.com/login/')) { - logStatus.error(`Error:${i18n('loginReddit')}`, true); - return false; - } - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma; - if (data.responseText.includes('redesign-beta-optin-btn') && !beta) { - return await this.#useBeta(); - } - const accessToken = (_data$responseText$ma = data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; - if (accessToken) { - this.#auth = { - token: accessToken - }; - logStatus.success(); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://www.instagram.com/${name}/`, + method: 'GET' + }); + if (result === 'Success') { + if (data !== null && data !== void 0 && data.finalUrl.includes('accounts/login')) { + logStatus.error(`Error:${i18n('loginIns')}`, true); + return false; + } else if (data !== null && data !== void 0 && data.finalUrl.includes('www.instagram.com/challenge')) { + logStatus.error(`Error:${i18n('insBanned')}`); + return false; + } + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma, _data$responseText$ma2, _data$responseText$ma3; + const csrftoken = (_data$responseText$ma = data.responseText.match(/"csrf_token":"(.+?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; + const hash = (_data$responseText$ma2 = data.responseText.match(/"rollout_hash":"(.+?)"/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; + if (name === 'instagram') { + if (csrftoken && hash) { + Instagram_classPrivateFieldSet(this, Instagram_auth, { + csrftoken: csrftoken, + hash: hash + }); return true; } - logStatus.error('Error: Parameter "accessToken" not found!'); return false; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + const id = (_data$responseText$ma3 = data.responseText.match(/"profilePage_([\d]+?)"/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; + if (id) { + Instagram_classPrivateMethodGet(this, Instagram_setCache, Instagram_setCache2).call(this, name, id); + logStatus.success(); + return id; + } + logStatus.error('Error: Get ins data error!'); return false; } logStatus.error(`${result}:${statusText}(${status})`); return false; - } catch (error) { - throwError(error, 'Reddit.updateAuth'); - return false; } + return false; + } catch (error) { + throwError(error, 'Instagram.getUserInfo'); + return false; } - async toggleTask(_ref) { - let { - name, - doTask = true - } = _ref; - try { - if (!doTask && this.whiteList.reddits.includes(name)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Reddit.undoTask', - id: name - }); - return true; + } + async function _followUser2(name) { + try { + const id = await Instagram_classPrivateMethodGet(this, _getUserInfo, _getUserInfo2).call(this, name); + if (!id) { + return false; + } + const logStatus = scripts_echoLog({ + type: 'followingIns', + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://www.instagram.com/web/friendships/${id}/follow/`, + method: 'POST', + dataType: 'json', + headers: { + 'x-csrftoken': Instagram_classPrivateFieldGet(this, Instagram_auth).csrftoken, + origin: 'https://www.instagram.com', + referer: `https://www.instagram.com/${name}/`, + 'content-type': 'application/x-www-form-urlencoded', + 'sec-fetch-site': 'same-origin', + 'x-instagram-ajax': Instagram_classPrivateFieldGet(this, Instagram_auth).hash } - let type = doTask ? 'joiningReddit' : 'leavingReddit'; - if (/^u_/.test(name)) { - type = doTask ? 'followingRedditUser' : 'unfollowingRedditUser'; + }); + if (result === 'Success') { + var _data$response, _data$response2; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.result) === 'following') { + logStatus.success(); + this.tasks.users = unique([ ...this.tasks.users, name ]); + return true; + } + logStatus.error(`Error:${(data === null || data === void 0 ? void 0 : (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : _data$response2.feedback_message) || `${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`}`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Instagram.followUser'); + return false; + } + } + async function _unfollowUser2(name) { + try { + if (this.whiteList.users.includes(name)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Instagram.unfollowUser', + id: name + }); + return true; + } + const id = await Instagram_classPrivateMethodGet(this, _getUserInfo, _getUserInfo2).call(this, name); + if (!id) { + return false; + } + const logStatus = scripts_echoLog({ + type: 'unfollowingIns', + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://www.instagram.com/web/friendships/${id}/unfollow/`, + method: 'POST', + dataType: 'json', + headers: { + 'x-csrftoken': Instagram_classPrivateFieldGet(this, Instagram_auth).csrftoken, + origin: 'https://www.instagram.com', + referer: `https://www.instagram.com/${name}/`, + 'content-type': 'application/x-www-form-urlencoded', + 'sec-fetch-site': 'same-origin', + 'x-instagram-ajax': Instagram_classPrivateFieldGet(this, Instagram_auth).hash + } + }); + if (result === 'Success') { + var _data$response3; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.status) === 'ok') { + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Instagram.unfollowUser'); + return false; + } + } + function Instagram_setCache2(name, id) { + try { + Instagram_classPrivateFieldGet(this, Instagram_cache)[name] = id; + GM_setValue('instagramCache', Instagram_classPrivateFieldGet(this, Instagram_cache)); + } catch (error) { + throwError(error, 'Instagram.setCache'); + } + } + const social_Instagram = Instagram; + function Reddit_classPrivateMethodInitSpec(obj, privateSet) { + Reddit_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Reddit_classPrivateFieldInitSpec(obj, privateMap, value) { + Reddit_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Reddit_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Reddit_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Reddit_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Reddit_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Reddit_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Reddit_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Reddit_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Reddit_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Reddit_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Reddit_classApplyDescriptorGet(receiver, descriptor); + } + function Reddit_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Reddit_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Reddit_defaultTasksTemplate = { + reddits: [] + }; + const Reddit_defaultTasks = JSON.stringify(Reddit_defaultTasksTemplate); + var Reddit_auth = new WeakMap(); + var Reddit_initialized = new WeakMap(); + var _useBeta = new WeakSet(); + var Reddit_updateAuth = new WeakSet(); + class Reddit extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Reddit_classPrivateMethodInitSpec(this, Reddit_updateAuth); + Reddit_classPrivateMethodInitSpec(this, _useBeta); + Reddit_defineProperty(this, 'tasks', JSON.parse(Reddit_defaultTasks)); + Reddit_defineProperty(this, 'whiteList', { + ...JSON.parse(Reddit_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.reddit + }); + Reddit_classPrivateFieldInitSpec(this, Reddit_auth, { + writable: true, + value: void 0 + }); + Reddit_classPrivateFieldInitSpec(this, Reddit_initialized, { + writable: true, + value: false + }); + } + async init() { + try { + if (Reddit_classPrivateFieldGet(this, Reddit_initialized)) { + return true; + } + const isVerified = await Reddit_classPrivateMethodGet(this, Reddit_updateAuth, Reddit_updateAuth2).call(this); + if (isVerified) { + scripts_echoLog({}).success(i18n('initSuccess', 'Reddit')); + Reddit_classPrivateFieldSet(this, Reddit_initialized, true); + return true; + } + scripts_echoLog({}).error(i18n('initFailed', 'Reddit')); + return false; + } catch (error) { + throwError(error, 'Reddit.init'); + return false; + } + } + async toggleTask(_ref) { + let { + name, + doTask = true + } = _ref; + try { + if (!doTask && this.whiteList.reddits.includes(name)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Reddit.undoTask', + id: name + }); + return true; + } + let type = doTask ? 'joiningReddit' : 'leavingReddit'; + if (/^u_/.test(name)) { + type = doTask ? 'followingRedditUser' : 'unfollowingRedditUser'; } const logStatus = scripts_echoLog({ type: type, @@ -2484,7 +2681,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); url: 'https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1', method: 'POST', headers: { - authorization: `Bearer ${this.#auth.token}`, + authorization: `Bearer ${Reddit_classPrivateFieldGet(this, Reddit_auth).token}`, 'content-type': 'application/x-www-form-urlencoded' }, data: $.param({ @@ -2517,7 +2714,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); redditLinks = [] } = _ref2; try { - if (!this.#initialized) { + if (!Reddit_classPrivateFieldGet(this, Reddit_initialized)) { scripts_echoLog({ text: i18n('needInit') }); @@ -2556,44 +2753,210 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } } } + async function _useBeta2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('changingRedditVersion') + }); + GM_setValue('redditAuth', null); + return await new Promise(resolve => { + const newTab = GM_openInTab('https://www.reddit.com/#auth', { + active: true, + insert: true, + setParent: true + }); + newTab.onclose = async () => { + logStatus.success(); + resolve(await Reddit_classPrivateMethodGet(this, Reddit_updateAuth, Reddit_updateAuth2).call(this, true)); + }; + }); + } catch (error) { + throwError(error, 'Reddit.useBeta'); + return false; + } + } + async function Reddit_updateAuth2() { + let beta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', 'Reddit') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://www.reddit.com/', + method: 'GET', + nochche: true, + headers: { + 'Cache-Control': 'no-cache' + } + }); + if (result === 'Success') { + if (data !== null && data !== void 0 && data.responseText.includes('www.reddit.com/login/')) { + logStatus.error(`Error:${i18n('loginReddit')}`, true); + return false; + } + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma; + if (data.responseText.includes('redesign-beta-optin-btn') && !beta) { + return await Reddit_classPrivateMethodGet(this, _useBeta, _useBeta2).call(this); + } + const accessToken = (_data$responseText$ma = data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; + if (accessToken) { + Reddit_classPrivateFieldSet(this, Reddit_auth, { + token: accessToken + }); + logStatus.success(); + return true; + } + logStatus.error('Error: Parameter "accessToken" not found!'); + return false; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Reddit.updateAuth'); + return false; + } + } const social_Reddit = Reddit; - var Twitch_GM_getValue; + function Twitch_classPrivateMethodInitSpec(obj, privateSet) { + Twitch_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Twitch_classPrivateFieldInitSpec(obj, privateMap, value) { + Twitch_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Twitch_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Twitch_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Twitch_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Twitch_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Twitch_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Twitch_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Twitch_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Twitch_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Twitch_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Twitch_classApplyDescriptorGet(receiver, descriptor); + } + function Twitch_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Twitch_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } const Twitch_defaultTasksTemplate = { channels: [] }; const Twitch_defaultTasks = JSON.stringify(Twitch_defaultTasksTemplate); + var Twitch_auth = new WeakMap(); + var Twitch_cache = new WeakMap(); + var Twitch_initialized = new WeakMap(); + var _integrityToken = new WeakMap(); + var Twitch_verifyAuth = new WeakSet(); + var _integrity = new WeakSet(); + var Twitch_updateAuth = new WeakSet(); + var _toggleChannel = new WeakSet(); + var _getChannelId = new WeakSet(); + var Twitch_setCache = new WeakSet(); class Twitch extends social_Social { - tasks = JSON.parse(Twitch_defaultTasks); - whiteList = { - ...JSON.parse(Twitch_defaultTasks), - ...(Twitch_GM_getValue = GM_getValue('whiteList')) === null || Twitch_GM_getValue === void 0 ? void 0 : Twitch_GM_getValue.twitch - }; - #auth = GM_getValue('twitchAuth') || {}; - #cache = GM_getValue('twitchCache') || {}; - #initialized = false; - #integrityToken; + constructor() { + var _GM_getValue; + super(...arguments); + Twitch_classPrivateMethodInitSpec(this, Twitch_setCache); + Twitch_classPrivateMethodInitSpec(this, _getChannelId); + Twitch_classPrivateMethodInitSpec(this, _toggleChannel); + Twitch_classPrivateMethodInitSpec(this, Twitch_updateAuth); + Twitch_classPrivateMethodInitSpec(this, _integrity); + Twitch_classPrivateMethodInitSpec(this, Twitch_verifyAuth); + Twitch_defineProperty(this, 'tasks', JSON.parse(Twitch_defaultTasks)); + Twitch_defineProperty(this, 'whiteList', { + ...JSON.parse(Twitch_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.twitch + }); + Twitch_classPrivateFieldInitSpec(this, Twitch_auth, { + writable: true, + value: GM_getValue('twitchAuth') || {} + }); + Twitch_classPrivateFieldInitSpec(this, Twitch_cache, { + writable: true, + value: GM_getValue('twitchCache') || {} + }); + Twitch_classPrivateFieldInitSpec(this, Twitch_initialized, { + writable: true, + value: false + }); + Twitch_classPrivateFieldInitSpec(this, _integrityToken, { + writable: true, + value: void 0 + }); + } async init() { try { - if (this.#initialized) { + if (Twitch_classPrivateFieldGet(this, Twitch_initialized)) { return true; } - if (!this.#auth.authToken || !this.#auth.clientId || !this.#auth.clientVersion || !this.#auth.deviceId || !this.#auth.clientSessionId) { - if (await this.#updateAuth()) { - this.#initialized = true; + if (!Twitch_classPrivateFieldGet(this, Twitch_auth).authToken || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientId || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientVersion || !Twitch_classPrivateFieldGet(this, Twitch_auth).deviceId || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientSessionId) { + if (await Twitch_classPrivateMethodGet(this, Twitch_updateAuth, Twitch_updateAuth2).call(this)) { + Twitch_classPrivateFieldSet(this, Twitch_initialized, true); return true; } return false; } - const isVerified = await this.#verifyAuth(true); + const isVerified = await Twitch_classPrivateMethodGet(this, Twitch_verifyAuth, Twitch_verifyAuth2).call(this, true); if (isVerified) { scripts_echoLog({}).success(i18n('initSuccess', 'Twitch')); - this.#initialized = true; + Twitch_classPrivateFieldSet(this, Twitch_initialized, true); return true; } GM_setValue('twitchAuth', null); - if (await this.#updateAuth()) { + if (await Twitch_classPrivateMethodGet(this, Twitch_updateAuth, Twitch_updateAuth2).call(this)) { scripts_echoLog({}).success(i18n('initSuccess', 'Twitch')); - this.#initialized = true; + Twitch_classPrivateFieldSet(this, Twitch_initialized, true); return true; } scripts_echoLog({}).error(i18n('initFailed', 'Twitch')); @@ -2603,198 +2966,435 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - async #verifyAuth(isFirst) { + async toggle(_ref) { + let { + doTask = true, + channelLinks = [] + } = _ref; try { - const logStatus = scripts_echoLog({ - text: i18n('verifyingAuth', 'Twitch') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://gql.twitch.tv/gql', - method: 'POST', - dataType: 'json', - headers: { - Authorization: `OAuth ${this.#auth.authToken}`, - 'Client-Id': this.#auth.clientId - }, - data: '[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,' + '"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]' - }); - if (result === 'Success') { - var _data$response, _data$response$, _data$response$$data; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response = data.response) !== null && _data$response !== void 0 && (_data$response$ = _data$response[0]) !== null && _data$response$ !== void 0 && (_data$response$$data = _data$response$.data) !== null && _data$response$$data !== void 0 && _data$response$$data.currentUser) { - await this.#integrity(isFirst); - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + if (!Twitch_classPrivateFieldGet(this, Twitch_initialized)) { + scripts_echoLog({ + text: i18n('needInit') + }); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Twitch.verifyAuth'); - return false; - } - } - async #integrity() { - let isFirst = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - let ct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - try { - const logStatus = scripts_echoLog({ - text: i18n('checkingTwitchIntegrity') - }); - if (isFirst && (!this.#auth.authToken || !this.#auth.clientId || !this.#auth.clientVersion || !this.#auth.deviceId || !this.#auth.clientSessionId)) { - return await this.#updateAuth(false); - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://gql.twitch.tv/integrity', - method: 'POST', - dataType: 'json', - anonymous: true, - headers: { - Origin: 'https://www.twitch.tv', - Referer: 'https://www.twitch.tv/', - Authorization: `OAuth ${this.#auth.authToken}`, - 'Client-Id': this.#auth.clientId, - 'Client-Version': this.#auth.clientVersion, - 'X-Device-Id': this.#auth.deviceId, - 'Client-Session-Id': this.#auth.clientSessionId, - 'x-kpsdk-ct': ct - } - }); - if (result === 'Success') { - var _data$responseHeaders, _data$response2; - if (!ct && data !== null && data !== void 0 && (_data$responseHeaders = data.responseHeaders) !== null && _data$responseHeaders !== void 0 && _data$responseHeaders['x-kpsdk-ct']) { - return await this.#integrity(isFirst, data.responseHeaders['x-kpsdk-ct']); - } - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.token) { - this.#integrityToken = data.response.token; - logStatus.success(); - return true; + const prom = []; + if (doTask && !globalOptions.doTask.twitch.channels || !doTask && !globalOptions.undoTask.twitch.channels) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'twitch.channels' + }); + } else { + const realChannels = this.getRealParams('channels', channelLinks, doTask, link => { + var _link$match; + return (_link$match = link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[2]; + }); + if (realChannels.length > 0) { + for (const channel of realChannels) { + prom.push(Twitch_classPrivateMethodGet(this, _toggleChannel, _toggleChannel2).call(this, { + name: channel, + doTask: doTask + })); + await delay(1e3); + } } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; + return Promise.all(prom).then(() => true); } catch (error) { - throwError(error, 'Twitch.integrity'); + throwError(error, 'Twitch.toggle'); return false; } } - async #updateAuth() { - let isFirst = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', 'Twitch') - }); - return await new Promise(resolve => { - const newTab = GM_openInTab('https://www.twitch.tv/#auth', { - active: true, - insert: true, - setParent: true - }); - newTab.onclose = async () => { - const auth = GM_getValue('twitchAuth'); - if (auth) { - this.#auth = auth; - logStatus.success(); - resolve(await this.#verifyAuth(isFirst)); - } else { - logStatus.error('Error: Update twitch auth failed!'); - resolve(false); - } - }; - }); - } catch (error) { - throwError(error, 'Twitch.updateAuth'); + } + async function Twitch_verifyAuth2(isFirst) { + try { + const logStatus = scripts_echoLog({ + text: i18n('verifyingAuth', 'Twitch') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://gql.twitch.tv/gql', + method: 'POST', + dataType: 'json', + headers: { + Authorization: `OAuth ${Twitch_classPrivateFieldGet(this, Twitch_auth).authToken}`, + 'Client-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientId + }, + data: '[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,' + '"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]' + }); + if (result === 'Success') { + var _data$response, _data$response$, _data$response$$data; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response = data.response) !== null && _data$response !== void 0 && (_data$response$ = _data$response[0]) !== null && _data$response$ !== void 0 && (_data$response$$data = _data$response$.data) !== null && _data$response$$data !== void 0 && _data$response$$data.currentUser) { + await Twitch_classPrivateMethodGet(this, _integrity, _integrity2).call(this, isFirst); + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitch.verifyAuth'); + return false; } - async #toggleChannel(_ref) { - let { - name, - doTask = true - } = _ref; - try { - if (!doTask && this.whiteList.channels.includes(name)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Twitch.unfollowChannel', - id: name - }); - return true; + } + async function _integrity2() { + let isFirst = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + let ct = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + try { + const logStatus = scripts_echoLog({ + text: i18n('checkingTwitchIntegrity') + }); + if (isFirst && (!Twitch_classPrivateFieldGet(this, Twitch_auth).authToken || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientId || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientVersion || !Twitch_classPrivateFieldGet(this, Twitch_auth).deviceId || !Twitch_classPrivateFieldGet(this, Twitch_auth).clientSessionId)) { + return await Twitch_classPrivateMethodGet(this, Twitch_updateAuth, Twitch_updateAuth2).call(this, false); + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://gql.twitch.tv/integrity', + method: 'POST', + dataType: 'json', + anonymous: true, + headers: { + Origin: 'https://www.twitch.tv', + Referer: 'https://www.twitch.tv/', + Authorization: `OAuth ${Twitch_classPrivateFieldGet(this, Twitch_auth).authToken}`, + 'Client-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientId, + 'Client-Version': Twitch_classPrivateFieldGet(this, Twitch_auth).clientVersion, + 'X-Device-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).deviceId, + 'Client-Session-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientSessionId, + 'x-kpsdk-ct': ct } - const channelId = await this.#getChannelId(name); - if (!channelId) { - return false; + }); + if (result === 'Success') { + var _data$responseHeaders, _data$response2; + if (!ct && data !== null && data !== void 0 && (_data$responseHeaders = data.responseHeaders) !== null && _data$responseHeaders !== void 0 && _data$responseHeaders['x-kpsdk-ct']) { + return await Twitch_classPrivateMethodGet(this, _integrity, _integrity2).call(this, isFirst, data.responseHeaders['x-kpsdk-ct']); } - const logStatus = scripts_echoLog({ - type: `${doTask ? '' : 'un'}followingTwitchChannel`, - text: name - }); - const followData = `[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"${channelId}` + '"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]'; - const unfollowData = `[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},` + '"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]'; - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://gql.twitch.tv/gql', - method: 'POST', - dataType: 'json', - anonymous: true, - headers: { - Origin: 'https://www.twitch.tv', - Referer: 'https://www.twitch.tv/', - Authorization: `OAuth ${this.#auth.authToken}`, - 'Client-Id': this.#auth.clientId, - 'Client-Version': this.#auth.clientVersion, - 'X-Device-Id': this.#auth.deviceId, - 'Client-Session-Id': this.#auth.clientSessionId, - 'Client-Integrity': this.#integrityToken - }, - data: doTask ? followData : unfollowData + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.token) { + Twitch_classPrivateFieldSet(this, _integrityToken, data.response.token); + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitch.integrity'); + return false; + } + } + async function Twitch_updateAuth2() { + let isFirst = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', 'Twitch') + }); + return await new Promise(resolve => { + const newTab = GM_openInTab('https://www.twitch.tv/#auth', { + active: true, + insert: true, + setParent: true + }); + newTab.onclose = async () => { + const auth = GM_getValue('twitchAuth'); + if (auth) { + Twitch_classPrivateFieldSet(this, Twitch_auth, auth); + logStatus.success(); + resolve(await Twitch_classPrivateMethodGet(this, Twitch_verifyAuth, Twitch_verifyAuth2).call(this, isFirst)); + } else { + logStatus.error('Error: Update twitch auth failed!'); + resolve(false); + } + }; + }); + } catch (error) { + throwError(error, 'Twitch.updateAuth'); + return false; + } + } + async function _toggleChannel2(_ref2) { + let { + name, + doTask = true + } = _ref2; + try { + if (!doTask && this.whiteList.channels.includes(name)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Twitch.unfollowChannel', + id: name }); - if (result === 'Success') { - var _data$response3, _data$response4, _data$response4$0$err, _data$response4$0$err2; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response3 = data.response) !== null && _data$response3 !== void 0 && _data$response3[0] && !data.response[0].errors) { + return true; + } + const channelId = await Twitch_classPrivateMethodGet(this, _getChannelId, _getChannelId2).call(this, name); + if (!channelId) { + return false; + } + const logStatus = scripts_echoLog({ + type: `${doTask ? '' : 'un'}followingTwitchChannel`, + text: name + }); + const followData = `[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"${channelId}` + '"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]'; + const unfollowData = `[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},` + '"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]'; + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://gql.twitch.tv/gql', + method: 'POST', + dataType: 'json', + anonymous: true, + headers: { + Origin: 'https://www.twitch.tv', + Referer: 'https://www.twitch.tv/', + Authorization: `OAuth ${Twitch_classPrivateFieldGet(this, Twitch_auth).authToken}`, + 'Client-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientId, + 'Client-Version': Twitch_classPrivateFieldGet(this, Twitch_auth).clientVersion, + 'X-Device-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).deviceId, + 'Client-Session-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientSessionId, + 'Client-Integrity': Twitch_classPrivateFieldGet(this, _integrityToken) + }, + data: doTask ? followData : unfollowData + }); + if (result === 'Success') { + var _data$response3, _data$response4, _data$response4$0$err, _data$response4$0$err2; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (_data$response3 = data.response) !== null && _data$response3 !== void 0 && _data$response3[0] && !data.response[0].errors) { + logStatus.success(); + if (doTask) { + this.tasks.channels = unique([ ...this.tasks.channels, name ]); + } + return true; + } + logStatus.error(`Error:${(data === null || data === void 0 ? void 0 : (_data$response4 = data.response) === null || _data$response4 === void 0 ? void 0 : (_data$response4$0$err = _data$response4[0].errors) === null || _data$response4$0$err === void 0 ? void 0 : (_data$response4$0$err2 = _data$response4$0$err[0]) === null || _data$response4$0$err2 === void 0 ? void 0 : _data$response4$0$err2.message) || `${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`}`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitch.toggleChannel'); + return false; + } + } + async function _getChannelId2(name) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingTwitchChannelId', + text: name + }); + const channelId = Twitch_classPrivateFieldGet(this, Twitch_cache)[name]; + if (channelId) { + logStatus.success(); + return channelId; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://gql.twitch.tv/gql', + method: 'POST', + headers: { + Authorization: `OAuth ${Twitch_classPrivateFieldGet(this, Twitch_auth).authToken}`, + 'Client-Id': Twitch_classPrivateFieldGet(this, Twitch_auth).clientId + }, + responseType: 'json', + data: `[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},` + '"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$response5, _data$response5$, _data$response5$$data, _data$response5$$data2; + const channelId = (_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : (_data$response5$ = _data$response5[0]) === null || _data$response5$ === void 0 ? void 0 : (_data$response5$$data = _data$response5$.data) === null || _data$response5$$data === void 0 ? void 0 : (_data$response5$$data2 = _data$response5$$data.user) === null || _data$response5$$data2 === void 0 ? void 0 : _data$response5$$data2.id; + if (channelId) { + Twitch_classPrivateMethodGet(this, Twitch_setCache, Twitch_setCache2).call(this, name, String(channelId)); logStatus.success(); - if (doTask) { - this.tasks.channels = unique([ ...this.tasks.channels, name ]); - } + return channelId; + } + logStatus.error(`Error:${data.statusText}(${data.status})`); + return false; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitch.getChannelId'); + return false; + } + } + function Twitch_setCache2(name, id) { + try { + Twitch_classPrivateFieldGet(this, Twitch_cache)[name] = id; + GM_setValue('twitchCache', Twitch_classPrivateFieldGet(this, Twitch_cache)); + } catch (error) { + throwError(error, 'Twitch.setCache'); + } + } + const social_Twitch = Twitch; + function Twitter_classPrivateMethodInitSpec(obj, privateSet) { + Twitter_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Twitter_classPrivateFieldInitSpec(obj, privateMap, value) { + Twitter_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Twitter_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Twitter_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Twitter_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Twitter_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Twitter_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Twitter_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Twitter_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Twitter_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Twitter_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Twitter_classApplyDescriptorGet(receiver, descriptor); + } + function Twitter_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Twitter_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Twitter_defaultTasksTemplate = { + users: [], + retweets: [], + likes: [] + }; + const Twitter_defaultTasks = JSON.stringify(Twitter_defaultTasksTemplate); + var _verifyId = new WeakMap(); + var Twitter_auth = new WeakMap(); + var Twitter_cache = new WeakMap(); + var Twitter_initialized = new WeakMap(); + var Twitter_verifyAuth = new WeakSet(); + var Twitter_updateAuth = new WeakSet(); + var _toggleUser = new WeakSet(); + var _toggleRetweet = new WeakSet(); + var Twitter_setCache = new WeakSet(); + class Twitter extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Twitter_classPrivateMethodInitSpec(this, Twitter_setCache); + Twitter_classPrivateMethodInitSpec(this, _toggleRetweet); + Twitter_classPrivateMethodInitSpec(this, _toggleUser); + Twitter_classPrivateMethodInitSpec(this, Twitter_updateAuth); + Twitter_classPrivateMethodInitSpec(this, Twitter_verifyAuth); + Twitter_defineProperty(this, 'tasks', JSON.parse(Twitter_defaultTasks)); + Twitter_defineProperty(this, 'whiteList', { + ...JSON.parse(Twitter_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.twitter + }); + Twitter_classPrivateFieldInitSpec(this, _verifyId, { + writable: true, + value: globalOptions.other.twitterVerifyId + }); + Twitter_classPrivateFieldInitSpec(this, Twitter_auth, { + writable: true, + value: GM_getValue('twitterAuth') || {} + }); + Twitter_classPrivateFieldInitSpec(this, Twitter_cache, { + writable: true, + value: GM_getValue('twitterCache') || {} + }); + Twitter_classPrivateFieldInitSpec(this, Twitter_initialized, { + writable: true, + value: false + }); + } + async init() { + try { + if (Twitter_classPrivateFieldGet(this, Twitter_initialized)) { + return true; + } + if (!Twitter_classPrivateFieldGet(this, Twitter_auth).ct0) { + if (await Twitter_classPrivateMethodGet(this, Twitter_updateAuth, Twitter_updateAuth2).call(this)) { + Twitter_classPrivateFieldSet(this, Twitter_initialized, true); return true; } - logStatus.error(`Error:${(data === null || data === void 0 ? void 0 : (_data$response4 = data.response) === null || _data$response4 === void 0 ? void 0 : (_data$response4$0$err = _data$response4[0].errors) === null || _data$response4$0$err === void 0 ? void 0 : (_data$response4$0$err2 = _data$response4$0$err[0]) === null || _data$response4$0$err2 === void 0 ? void 0 : _data$response4$0$err2.message) || `${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`}`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); + const isVerified = await Twitter_classPrivateMethodGet(this, Twitter_verifyAuth, Twitter_verifyAuth2).call(this); + if (isVerified) { + scripts_echoLog({}).success(i18n('initSuccess', 'Twitter')); + Twitter_classPrivateFieldSet(this, Twitter_initialized, true); + return true; + } + GM_setValue('twitterAuth', null); + if (await Twitter_classPrivateMethodGet(this, Twitter_updateAuth, Twitter_updateAuth2).call(this)) { + scripts_echoLog({}).success(i18n('initSuccess', 'Twitter')); + Twitter_classPrivateFieldSet(this, Twitter_initialized, true); + return true; + } + scripts_echoLog({}).error(i18n('initFailed', 'Twitter')); return false; } catch (error) { - throwError(error, 'Twitch.toggleChannel'); + throwError(error, 'Twitter.init'); return false; } } - async #getChannelId(name) { + async userName2id(name) { try { const logStatus = scripts_echoLog({ - type: 'gettingTwitchChannelId', + type: 'gettingTwitterUserId', text: name }); - const channelId = this.#cache[name]; - if (channelId) { + const userId = Twitter_classPrivateFieldGet(this, Twitter_cache)[name]; + if (userId) { logStatus.success(); - return channelId; + return userId; } const { result, @@ -2802,23 +3402,32 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); status, data } = await tools_httpRequest({ - url: 'https://gql.twitch.tv/gql', - method: 'POST', + url: 'https://api.twitter.com/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName' + `?variables=%7B%22screen_name%22%3A%22${name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`, + method: 'GET', headers: { - Authorization: `OAuth ${this.#auth.authToken}`, - 'Client-Id': this.#auth.clientId + authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', + 'content-type': 'application/json', + referer: `https://twitter.com/${name}`, + 'x-csrf-token': Twitter_classPrivateFieldGet(this, Twitter_auth).ct0 }, - responseType: 'json', - data: `[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},` + '"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]' + responseType: 'json' }); if (result === 'Success') { if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$response5, _data$response5$, _data$response5$$data, _data$response5$$data2; - const channelId = (_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : (_data$response5$ = _data$response5[0]) === null || _data$response5$ === void 0 ? void 0 : (_data$response5$$data = _data$response5$.data) === null || _data$response5$$data === void 0 ? void 0 : (_data$response5$$data2 = _data$response5$$data.user) === null || _data$response5$$data2 === void 0 ? void 0 : _data$response5$$data2.id; - if (channelId) { - this.#setCache(name, String(channelId)); + var _response, _response$data, _response$data$user, _response$data$user$r; + let response = data.response || (typeof data.responseText === 'object' ? data.responseText : null); + if (!response) { + try { + response = JSON.parse(data.responseText); + } catch (error) { + response = null; + } + } + const userId = String((_response = response) === null || _response === void 0 ? void 0 : (_response$data = _response.data) === null || _response$data === void 0 ? void 0 : (_response$data$user = _response$data.user) === null || _response$data$user === void 0 ? void 0 : (_response$data$user$r = _response$data$user.result) === null || _response$data$user$r === void 0 ? void 0 : _response$data$user$r.rest_id); + if (userId) { + Twitter_classPrivateMethodGet(this, Twitter_setCache, Twitter_setCache2).call(this, name, userId); logStatus.success(); - return channelId; + return userId; } logStatus.error(`Error:${data.statusText}(${data.status})`); return false; @@ -2829,37 +3438,58 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.error(`${result}:${statusText}(${status})`); return false; } catch (error) { - throwError(error, 'Twitch.getChannelId'); + throwError(error, 'Twitter.getUserId'); return false; } } - async toggle(_ref2) { + async toggle(_ref) { let { doTask = true, - channelLinks = [] - } = _ref2; + userLinks = [], + retweetLinks = [] + } = _ref; try { - if (!this.#initialized) { + if (!Twitter_classPrivateFieldGet(this, Twitter_initialized)) { scripts_echoLog({ text: i18n('needInit') }); return false; } const prom = []; - if (doTask && !globalOptions.doTask.twitch.channels || !doTask && !globalOptions.undoTask.twitch.channels) { + if (doTask && !globalOptions.doTask.twitter.users || !doTask && !globalOptions.undoTask.twitter.users) { scripts_echoLog({ type: 'globalOptionsSkip', - text: 'twitch.channels' + text: 'twitter.users' }); } else { - const realChannels = this.getRealParams('channels', channelLinks, doTask, link => { + const realUsers = this.getRealParams('users', userLinks, doTask, link => { var _link$match; - return (_link$match = link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[2]; + return (_link$match = link.match(/https:\/\/twitter\.com\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; }); - if (realChannels.length > 0) { - for (const channel of realChannels) { - prom.push(this.#toggleChannel({ - name: channel, + if (realUsers.length > 0) { + for (const user of realUsers) { + prom.push(Twitter_classPrivateMethodGet(this, _toggleUser, _toggleUser2).call(this, { + name: user, + doTask: doTask + })); + await delay(1e3); + } + } + } + if (doTask && !globalOptions.doTask.twitter.retweets || !doTask && !globalOptions.undoTask.twitter.retweets) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'twitter.retweets' + }); + } else { + const realRetweets = this.getRealParams('retweets', retweetLinks, doTask, link => { + var _link$match2; + return (_link$match2 = link.match(/https:\/\/twitter\.com\/.*?\/status\/([\d]+)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; + }); + if (realRetweets.length > 0) { + for (const retweet of realRetweets) { + prom.push(Twitter_classPrivateMethodGet(this, _toggleRetweet, _toggleRetweet2).call(this, { + retweetId: retweet, doTask: doTask })); await delay(1e3); @@ -2868,826 +3498,1037 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } return Promise.all(prom).then(() => true); } catch (error) { - throwError(error, 'Twitch.toggle'); + throwError(error, 'Twitter.toggle'); return false; } } - #setCache(name, id) { - try { - this.#cache[name] = id; - GM_setValue('twitchCache', this.#cache); - } catch (error) { - throwError(error, 'Twitch.setCache'); - } + } + async function Twitter_verifyAuth2() { + try { + return await Twitter_classPrivateMethodGet(this, _toggleUser, _toggleUser2).call(this, { + name: 'verify', + doTask: true, + verify: true + }); + } catch (error) { + throwError(error, 'Twitter.verifyAuth'); + return false; } } - const social_Twitch = Twitch; - var Twitter_GM_getValue; - const Twitter_defaultTasksTemplate = { - users: [], - retweets: [], - likes: [] - }; - const Twitter_defaultTasks = JSON.stringify(Twitter_defaultTasksTemplate); - class Twitter extends social_Social { - tasks = JSON.parse(Twitter_defaultTasks); - whiteList = { - ...JSON.parse(Twitter_defaultTasks), - ...(Twitter_GM_getValue = GM_getValue('whiteList')) === null || Twitter_GM_getValue === void 0 ? void 0 : Twitter_GM_getValue.twitter - }; - #verifyId = globalOptions.other.twitterVerifyId; - #auth = GM_getValue('twitterAuth') || {}; - #cache = GM_getValue('twitterCache') || {}; - #initialized = false; - async init() { - try { - if (this.#initialized) { - return true; - } - if (!this.#auth.ct0) { - if (await this.#updateAuth()) { - this.#initialized = true; - return true; + async function Twitter_updateAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', 'Twitter') + }); + return await new Promise(resolve => { + const newTab = GM_openInTab('https://twitter.com/settings/account?k#auth', { + active: true, + insert: true, + setParent: true + }); + newTab.onclose = async () => { + const auth = GM_getValue('twitterAuth'); + if (auth) { + Twitter_classPrivateFieldSet(this, Twitter_auth, auth); + logStatus.success(); + resolve(await Twitter_classPrivateMethodGet(this, Twitter_verifyAuth, Twitter_verifyAuth2).call(this)); + } else { + logStatus.error('Error: Update twitter auth failed!'); + resolve(false); + } + }; + }); + } catch (error) { + throwError(error, 'Twitter.updateToken'); + return false; + } + } + async function _toggleUser2(_ref2) { + let { + name, + doTask = true, + verify = false + } = _ref2; + try { + if (!doTask && !verify && this.whiteList.users.includes(name)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Twitter.unfollowUser', + id: name + }); + return true; + } + const userId = verify ? Twitter_classPrivateFieldGet(this, _verifyId) : await this.userName2id(name); + if (!userId) { + return false; + } + const logStatus = verify ? scripts_echoLog({ + text: i18n('verifyingAuth', 'Twitter') + }) : scripts_echoLog({ + type: `${doTask ? '' : 'un'}followingTwitterUser`, + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://api.twitter.com/1.1/friendships/${doTask ? 'create' : 'destroy'}.json`, + method: 'POST', + headers: { + authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', + 'Content-Type': 'application/x-www-form-urlencoded', + 'x-csrf-token': Twitter_classPrivateFieldGet(this, Twitter_auth).ct0 + }, + responseType: 'json', + data: $.param({ + include_profile_interstitial_type: 1, + include_blocking: 1, + include_blocked_by: 1, + include_followed_by: 1, + include_want_retweets: 1, + include_mute_edge: 1, + include_can_dm: 1, + include_can_media_tag: 1, + skip_status: 1, + id: userId + }) + }); + if (result === 'Success') { + var _data$response, _data$response$errors, _data$response$errors2; + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); + if (doTask && !verify) { + this.tasks.users = unique([ ...this.tasks.users, name ]); } - return false; - } - const isVerified = await this.#verifyAuth(); - if (isVerified) { - scripts_echoLog({}).success(i18n('initSuccess', 'Twitter')); - this.#initialized = true; return true; } - GM_setValue('twitterAuth', null); - if (await this.#updateAuth()) { - scripts_echoLog({}).success(i18n('initSuccess', 'Twitter')); - this.#initialized = true; + if (verify && (data === null || data === void 0 ? void 0 : data.status) === 403 && ((_data$response = data.response) === null || _data$response === void 0 ? void 0 : (_data$response$errors = _data$response.errors) === null || _data$response$errors === void 0 ? void 0 : (_data$response$errors2 = _data$response$errors[0]) === null || _data$response$errors2 === void 0 ? void 0 : _data$response$errors2.code) === 158) { + logStatus.success(); return true; } - scripts_echoLog({}).error(i18n('initFailed', 'Twitter')); - return false; - } catch (error) { - throwError(error, 'Twitter.init'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitter.toggleUser'); + return false; } - async #verifyAuth() { - try { - return await this.#toggleUser({ - name: 'verify', - doTask: true, - verify: true + } + async function _toggleRetweet2(_ref3) { + let { + retweetId, + doTask = true + } = _ref3; + try { + if (!doTask && this.whiteList.retweets.includes(retweetId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Twitter.unretweet', + id: retweetId }); - } catch (error) { - throwError(error, 'Twitter.verifyAuth'); + return true; + } + const logStatus = scripts_echoLog({ + type: `${doTask ? '' : 'un'}retweetting`, + text: retweetId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://api.twitter.com/1.1/statuses/${doTask ? '' : 'un'}retweet.json`, + method: 'POST', + headers: { + authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', + 'Content-Type': 'application/x-www-form-urlencoded', + 'x-csrf-token': Twitter_classPrivateFieldGet(this, Twitter_auth).ct0 + }, + data: $.param({ + tweet_mode: 'extended', + id: retweetId + }), + responseType: 'json' + }); + if (result === 'Success') { + var _data$response2, _data$response2$error, _data$response2$error2; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 || (data === null || data === void 0 ? void 0 : data.status) === 403 && ((_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$error = _data$response2.errors) === null || _data$response2$error === void 0 ? void 0 : (_data$response2$error2 = _data$response2$error[0]) === null || _data$response2$error2 === void 0 ? void 0 : _data$response2$error2.code) === 327) { + logStatus.success(); + if (doTask) { + this.tasks.retweets = unique([ ...this.tasks.retweets, retweetId ]); + } + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Twitter.toggleRetweet'); + return false; + } + } + function Twitter_setCache2(name, id) { + try { + Twitter_classPrivateFieldGet(this, Twitter_cache)[name] = id; + GM_setValue('twitterCache', Twitter_classPrivateFieldGet(this, Twitter_cache)); + } catch (error) { + throwError(error, 'Twitter.setCache'); + } + } + const social_Twitter = Twitter; + function Vk_classPrivateMethodInitSpec(obj, privateSet) { + Vk_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Vk_classPrivateFieldInitSpec(obj, privateMap, value) { + Vk_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Vk_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Vk_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Vk_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Vk_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Vk_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Vk_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Vk_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Vk_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Vk_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Vk_classApplyDescriptorGet(receiver, descriptor); + } + function Vk_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Vk_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Vk_defaultTasksTemplate = { + names: [] + }; + const Vk_defaultTasks = JSON.stringify(Vk_defaultTasksTemplate); + var _username = new WeakMap(); + var Vk_cache = new WeakMap(); + var Vk_initialized = new WeakMap(); + var Vk_verifyAuth = new WeakSet(); + var _toggleGroup = new WeakSet(); + var _togglePublic = new WeakSet(); + var _sendWall = new WeakSet(); + var _deleteWall = new WeakSet(); + var _getId = new WeakSet(); + var _toggleVk = new WeakSet(); + var Vk_setCache = new WeakSet(); + class Vk extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Vk_classPrivateMethodInitSpec(this, Vk_setCache); + Vk_classPrivateMethodInitSpec(this, _toggleVk); + Vk_classPrivateMethodInitSpec(this, _getId); + Vk_classPrivateMethodInitSpec(this, _deleteWall); + Vk_classPrivateMethodInitSpec(this, _sendWall); + Vk_classPrivateMethodInitSpec(this, _togglePublic); + Vk_classPrivateMethodInitSpec(this, _toggleGroup); + Vk_classPrivateMethodInitSpec(this, Vk_verifyAuth); + Vk_defineProperty(this, 'tasks', JSON.parse(Vk_defaultTasks)); + Vk_defineProperty(this, 'whiteList', { + ...JSON.parse(Vk_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.vk + }); + Vk_classPrivateFieldInitSpec(this, _username, { + writable: true, + value: '' + }); + Vk_classPrivateFieldInitSpec(this, Vk_cache, { + writable: true, + value: GM_getValue('vkCache') || {} + }); + Vk_classPrivateFieldInitSpec(this, Vk_initialized, { + writable: true, + value: false + }); } - async #updateAuth() { + async init() { try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', 'Twitter') - }); - return await new Promise(resolve => { - const newTab = GM_openInTab('https://twitter.com/settings/account?k#auth', { - active: true, - insert: true, - setParent: true - }); - newTab.onclose = async () => { - const auth = GM_getValue('twitterAuth'); - if (auth) { - this.#auth = auth; - logStatus.success(); - resolve(await this.#verifyAuth()); - } else { - logStatus.error('Error: Update twitter auth failed!'); - resolve(false); - } - }; - }); + if (Vk_classPrivateFieldGet(this, Vk_initialized)) { + return true; + } + const isVerified = await Vk_classPrivateMethodGet(this, Vk_verifyAuth, Vk_verifyAuth2).call(this); + if (isVerified) { + scripts_echoLog({}).success(i18n('initSuccess', 'Vk')); + Vk_classPrivateFieldSet(this, Vk_initialized, true); + return true; + } + scripts_echoLog({}).error(i18n('initFailed', 'Vk')); + return false; } catch (error) { - throwError(error, 'Twitter.updateToken'); + throwError(error, 'Vk.init'); return false; } } - async #toggleUser(_ref) { + async toggle(_ref) { let { - name, doTask = true, - verify = false + nameLinks = [] } = _ref; try { - if (!doTask && !verify && this.whiteList.users.includes(name)) { + if (!Vk_classPrivateFieldGet(this, Vk_initialized)) { scripts_echoLog({ - type: 'whiteList', - text: 'Twitter.unfollowUser', - id: name + text: i18n('needInit') }); - return true; - } - const userId = verify ? this.#verifyId : await this.userName2id(name); - if (!userId) { return false; } - const logStatus = verify ? scripts_echoLog({ - text: i18n('verifyingAuth', 'Twitter') - }) : scripts_echoLog({ - type: `${doTask ? '' : 'un'}followingTwitterUser`, - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://api.twitter.com/1.1/friendships/${doTask ? 'create' : 'destroy'}.json`, - method: 'POST', - headers: { - authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', - 'Content-Type': 'application/x-www-form-urlencoded', - 'x-csrf-token': this.#auth.ct0 - }, - responseType: 'json', - data: $.param({ - include_profile_interstitial_type: 1, - include_blocking: 1, - include_blocked_by: 1, - include_followed_by: 1, - include_want_retweets: 1, - include_mute_edge: 1, - include_can_dm: 1, - include_can_media_tag: 1, - skip_status: 1, - id: userId - }) - }); - if (result === 'Success') { - var _data$response, _data$response$errors, _data$response$errors2; - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - logStatus.success(); - if (doTask && !verify) { - this.tasks.users = unique([ ...this.tasks.users, name ]); + const prom = []; + if (doTask && !globalOptions.doTask.vk.names || !doTask && !globalOptions.undoTask.vk.names) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'vk.names' + }); + } else { + const realNames = this.getRealParams('names', nameLinks, doTask, link => { + var _link$match; + return (_link$match = link.match(/https:\/\/vk\.com\/([^/]+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; + }); + if (realNames.length > 0) { + for (const name of realNames) { + prom.push(Vk_classPrivateMethodGet(this, _toggleVk, _toggleVk2).call(this, { + name: name, + doTask: doTask + })); + await delay(1e3); } - return true; - } - if (verify && (data === null || data === void 0 ? void 0 : data.status) === 403 && ((_data$response = data.response) === null || _data$response === void 0 ? void 0 : (_data$response$errors = _data$response.errors) === null || _data$response$errors === void 0 ? void 0 : (_data$response$errors2 = _data$response$errors[0]) === null || _data$response$errors2 === void 0 ? void 0 : _data$response$errors2.code) === 158) { - logStatus.success(); - return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; + return Promise.all(prom).then(() => true); } catch (error) { - throwError(error, 'Twitter.toggleUser'); + throwError(error, 'Vk.toggle'); return false; } } - async userName2id(name) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingTwitterUserId', - text: name - }); - const userId = this.#cache[name]; - if (userId) { - logStatus.success(); - return userId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://api.twitter.com/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName' + `?variables=%7B%22screen_name%22%3A%22${name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`, - method: 'GET', - headers: { - authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', - 'content-type': 'application/json', - referer: `https://twitter.com/${name}`, - 'x-csrf-token': this.#auth.ct0 - }, - responseType: 'json' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _response, _response$data, _response$data$user, _response$data$user$r; - let response = data.response || (typeof data.responseText === 'object' ? data.responseText : null); - if (!response) { - try { - response = JSON.parse(data.responseText); - } catch (error) { - response = null; + } + async function Vk_verifyAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('verifyAuth', 'Vk') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://vk.com/im', + method: 'GET' + }); + if (result === 'Success') { + if (data !== null && data !== void 0 && data.finalUrl.includes('vk.com/login')) { + logStatus.error(`Error:${i18n('loginVk')}`, true); + return false; + } + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma; + Vk_classPrivateFieldSet(this, _username, ((_data$responseText$ma = data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]) || ''); + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.verifyAuth'); + return false; + } + } + async function _toggleGroup2(name, dataParam) { + let doTask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + try { + const logStatus = scripts_echoLog({ + type: doTask ? 'joiningVkGroup' : 'leavingVkGroup', + text: name + }); + if (dataParam.groupAct === 'enter' && !doTask || dataParam.groupAct === 'leave' && doTask) { + logStatus.success(); + return true; + } + const reqData = { + act: doTask ? 'enter' : 'leave', + al: 1, + gid: dataParam.groupId, + hash: dataParam.groupHash + }; + if (doTask) { + reqData.context = '_'; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://vk.com/al_groups.php', + method: 'POST', + headers: { + origin: 'https://vk.com', + referer: `https://vk.com/${name}`, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: $.param(reqData) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); + if (doTask) { + this.tasks.names = unique([ ...this.tasks.names, name ]); + } + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.toggleGroup'); + return false; + } + } + async function _togglePublic2(name, dataParam) { + let doTask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + try { + const logStatus = scripts_echoLog({ + type: doTask ? 'joiningVkPublic' : 'leavingVkPublic', + text: name + }); + if (dataParam.publicJoined && doTask || !dataParam.publicJoined && !doTask) { + logStatus.success(); + return true; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://vk.com/al_public.php', + method: 'POST', + headers: { + origin: 'https://vk.com', + referer: `https://vk.com/${name}`, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: $.param({ + act: doTask ? 'a_enter' : 'a_leave', + al: 1, + pid: dataParam.publicPid, + hash: dataParam.publicHash + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); + if (doTask) { + this.tasks.names = unique([ ...this.tasks.names, name ]); + } + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.togglePublic'); + return false; + } + } + async function _sendWall2(name) { + try { + const logStatus = scripts_echoLog({ + type: 'sendingVkWall', + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://vk.com/like.php', + method: 'POST', + headers: { + origin: 'https://vk.com', + referer: `https://vk.com/${name}`, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: $.param({ + act: 'publish_box', + al: 1, + object: name + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma2; + const hash = (_data$responseText$ma2 = data.responseText.match(/shHash:[\s]*'(.*?)'/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; + if (hash) { + const { + result: resultR, + statusText: statusTextR, + status: statusR, + data: dataR + } = await tools_httpRequest({ + url: 'https://vk.com/like.php', + method: 'POST', + headers: { + origin: 'https://vk.com', + referer: `https://vk.com/${name}`, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: $.param({ + Message: '', + act: 'a_do_publish', + al: 1, + close_comments: 0, + friends_only: 0, + from: 'box', + hash: hash, + list: '', + mark_as_ads: 0, + mute_notifications: 0, + object: name, + ret_data: 1, + to: 0 + }) + }); + if (resultR === 'Success') { + if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { + var _dataR$responseText, _jsonData$payload, _jsonData$payload$, _jsonData$payload$$; + const jsonData = JSON.parse(((_dataR$responseText = dataR.responseText) === null || _dataR$responseText === void 0 ? void 0 : _dataR$responseText.replace('\x3c!--', '')) || '{}'); + if ((jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload = jsonData.payload) === null || _jsonData$payload === void 0 ? void 0 : (_jsonData$payload$ = _jsonData$payload[1]) === null || _jsonData$payload$ === void 0 ? void 0 : (_jsonData$payload$$ = _jsonData$payload$[1]) === null || _jsonData$payload$$ === void 0 ? void 0 : _jsonData$payload$$.share_my) === true) { + var _jsonData$payload2, _jsonData$payload2$, _jsonData$payload2$$, _jsonData$payload3, _jsonData$payload3$, _jsonData$payload3$$; + logStatus.success(); + const postId = String(jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload2 = jsonData.payload) === null || _jsonData$payload2 === void 0 ? void 0 : (_jsonData$payload2$ = _jsonData$payload2[1]) === null || _jsonData$payload2$ === void 0 ? void 0 : (_jsonData$payload2$$ = _jsonData$payload2$[1]) === null || _jsonData$payload2$$ === void 0 ? void 0 : _jsonData$payload2$$.post_id); + const ownerId = String(jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload3 = jsonData.payload) === null || _jsonData$payload3 === void 0 ? void 0 : (_jsonData$payload3$ = _jsonData$payload3[1]) === null || _jsonData$payload3$ === void 0 ? void 0 : (_jsonData$payload3$$ = _jsonData$payload3$[1]) === null || _jsonData$payload3$$ === void 0 ? void 0 : _jsonData$payload3$$.owner_id); + if (postId && ownerId) { + Vk_classPrivateMethodGet(this, Vk_setCache, Vk_setCache2).call(this, name, `${ownerId}_${postId}`); + } + this.tasks.names = unique([ ...this.tasks.names, name ]); + return true; + } } + logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); + return false; } - const userId = String((_response = response) === null || _response === void 0 ? void 0 : (_response$data = _response.data) === null || _response$data === void 0 ? void 0 : (_response$data$user = _response$data.user) === null || _response$data$user === void 0 ? void 0 : (_response$data$user$r = _response$data$user.result) === null || _response$data$user$r === void 0 ? void 0 : _response$data$user$r.rest_id); - if (userId) { - this.#setCache(name, userId); - logStatus.success(); - return userId; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); + logStatus.error(`${resultR}:${statusTextR}(${statusR})`); return false; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error('Error: Get "hash" failed'); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Twitter.getUserId'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.sendWall'); + return false; } - async #toggleRetweet(_ref2) { - let { - retweetId, - doTask = true - } = _ref2; - try { - if (!doTask && this.whiteList.retweets.includes(retweetId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Twitter.unretweet', - id: retweetId - }); - return true; - } - const logStatus = scripts_echoLog({ - type: `${doTask ? '' : 'un'}retweetting`, - text: retweetId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://api.twitter.com/1.1/statuses/${doTask ? '' : 'un'}retweet.json`, - method: 'POST', - headers: { - authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA', - 'Content-Type': 'application/x-www-form-urlencoded', - 'x-csrf-token': this.#auth.ct0 - }, - data: $.param({ - tweet_mode: 'extended', - id: retweetId - }), - responseType: 'json' - }); - if (result === 'Success') { - var _data$response2, _data$response2$error, _data$response2$error2; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 || (data === null || data === void 0 ? void 0 : data.status) === 403 && ((_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$error = _data$response2.errors) === null || _data$response2$error === void 0 ? void 0 : (_data$response2$error2 = _data$response2$error[0]) === null || _data$response2$error2 === void 0 ? void 0 : _data$response2$error2.code) === 327) { + } + async function _deleteWall2(name, dataParams) { + try { + const logStatus = scripts_echoLog({ + type: 'deletingVkWall', + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://vk.com/al_wall.php?act=delete', + method: 'POST', + headers: { + origin: 'https://vk.com', + referer: `https://vk.com/${Vk_classPrivateFieldGet(this, _username)}?w=wall${Vk_classPrivateFieldGet(this, Vk_cache)[name]}%2Fall`, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: $.param({ + act: 'delete', + al: 1, + confirm: 0, + from: 'wkview', + hash: dataParams.wallHash, + post: Vk_classPrivateFieldGet(this, Vk_cache)[name] + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText, _jsonData$payload4, _jsonData$payload4$; + const jsonData = JSON.parse(((_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : _data$responseText.replace('\x3c!--', '')) || '{}'); + if (jsonData !== null && jsonData !== void 0 && (_jsonData$payload4 = jsonData.payload) !== null && _jsonData$payload4 !== void 0 && (_jsonData$payload4$ = _jsonData$payload4[1]) !== null && _jsonData$payload4$ !== void 0 && _jsonData$payload4$[1]) { logStatus.success(); - if (doTask) { - this.tasks.retweets = unique([ ...this.tasks.retweets, retweetId ]); - } return true; } logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Twitter.toggleRetweet'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.deleteWall'); + return false; } - async toggle(_ref3) { - let { - doTask = true, - userLinks = [], - retweetLinks = [] - } = _ref3; - try { - if (!this.#initialized) { - scripts_echoLog({ - text: i18n('needInit') - }); - return false; + } + async function _getId2(name, doTask) { + try { + let url = `https://vk.com/${name}`; + if (/^wall-/.test(name)) { + if (doTask) { + return { + type: 'sendWall' + }; } - const prom = []; - if (doTask && !globalOptions.doTask.twitter.users || !doTask && !globalOptions.undoTask.twitter.users) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'twitter.users' - }); - } else { - const realUsers = this.getRealParams('users', userLinks, doTask, link => { - var _link$match; - return (_link$match = link.match(/https:\/\/twitter\.com\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; - }); - if (realUsers.length > 0) { - for (const user of realUsers) { - prom.push(this.#toggleUser({ - name: user, - doTask: doTask - })); - await delay(1e3); - } - } + if (!Vk_classPrivateFieldGet(this, Vk_cache)[name]) { + return { + type: 'unSupport' + }; } - if (doTask && !globalOptions.doTask.twitter.retweets || !doTask && !globalOptions.undoTask.twitter.retweets) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'twitter.retweets' - }); - } else { - const realRetweets = this.getRealParams('retweets', retweetLinks, doTask, link => { - var _link$match2; - return (_link$match2 = link.match(/https:\/\/twitter\.com\/.*?\/status\/([\d]+)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; - }); - if (realRetweets.length > 0) { - for (const retweet of realRetweets) { - prom.push(this.#toggleRetweet({ - retweetId: retweet, - doTask: doTask - })); - await delay(1e3); + url = `https://vk.com/${Vk_classPrivateFieldGet(this, _username)}?w=wall${Vk_classPrivateFieldGet(this, Vk_cache)[name]}`; + } + const logStatus = scripts_echoLog({ + type: 'gettingVkId', + text: name + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: url, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma3, _data$responseText$ma4; + const [ , groupAct, groupId, , groupHash ] = data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/) || []; + const publicHash = (_data$responseText$ma3 = data.responseText.match(/"enterHash":"(.*?)"/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; + const publicPid = (_data$responseText$ma4 = data.responseText.match(/"public_id":([\d]+?),/)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; + const publicJoined = !data.responseText.includes('Public.subscribe'); + if (groupAct && groupId && groupHash) { + logStatus.success(); + return { + groupAct: groupAct, + groupId: groupId, + groupHash: groupHash, + type: 'group' + }; + } else if (publicHash && publicPid) { + logStatus.success(); + return { + publicHash: publicHash, + publicPid: publicPid, + publicJoined: publicJoined, + type: 'public' + }; + } else if (data.responseText.includes('wall.deletePost') && !doTask) { + var _data$responseText$ma5; + const wallHash = (_data$responseText$ma5 = data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1]; + if (wallHash) { + logStatus.success(); + return { + type: 'deleteWall', + wallHash: wallHash + }; } + } else if (name.includes('wall') && doTask) { + logStatus.success(); + return { + type: 'sendWall' + }; } + logStatus.error('Error: Parameters not found!'); + return false; } - return Promise.all(prom).then(() => true); - } catch (error) { - throwError(error, 'Twitter.toggle'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } - } - #setCache(name, id) { - try { - this.#cache[name] = id; - GM_setValue('twitterCache', this.#cache); - } catch (error) { - throwError(error, 'Twitter.setCache'); - } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Vk.getId'); + return false; } } - const social_Twitter = Twitter; - var Vk_GM_getValue; - const Vk_defaultTasksTemplate = { - names: [] - }; - const Vk_defaultTasks = JSON.stringify(Vk_defaultTasksTemplate); - class Vk extends social_Social { - tasks = JSON.parse(Vk_defaultTasks); - whiteList = { - ...JSON.parse(Vk_defaultTasks), - ...(Vk_GM_getValue = GM_getValue('whiteList')) === null || Vk_GM_getValue === void 0 ? void 0 : Vk_GM_getValue.vk - }; - #username = ''; - #cache = GM_getValue('vkCache') || {}; - #initialized = false; - async init() { - try { - if (this.#initialized) { - return true; - } - const isVerified = await this.#verifyAuth(); - if (isVerified) { - scripts_echoLog({}).success(i18n('initSuccess', 'Vk')); - this.#initialized = true; - return true; - } - scripts_echoLog({}).error(i18n('initFailed', 'Vk')); + async function _toggleVk2(_ref2) { + let { + name, + doTask = true + } = _ref2; + try { + if (!doTask && this.whiteList.names.includes(name)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Vk.undoTask', + id: name + }); + return true; + } + const formatName = name.replace(/\/$/, ''); + const data = await Vk_classPrivateMethodGet(this, _getId, _getId2).call(this, formatName, doTask); + if (!data) { return false; - } catch (error) { - throwError(error, 'Vk.init'); + } + switch (data.type) { + case 'group': + return await Vk_classPrivateMethodGet(this, _toggleGroup, _toggleGroup2).call(this, formatName, data, doTask); + + case 'public': + return await Vk_classPrivateMethodGet(this, _togglePublic, _togglePublic2).call(this, formatName, data, doTask); + + case 'sendWall': + return doTask ? await Vk_classPrivateMethodGet(this, _sendWall, _sendWall2).call(this, formatName) : true; + + case 'deleteWall': + return doTask ? true : await Vk_classPrivateMethodGet(this, _deleteWall, _deleteWall2).call(this, formatName, data); + + default: return false; } + } catch (error) { + throwError(error, 'Vk.toggleVk'); + return false; } - async #verifyAuth() { - try { - const logStatus = scripts_echoLog({ - text: i18n('verifyAuth', 'Vk') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://vk.com/im', - method: 'GET' - }); - if (result === 'Success') { - if (data !== null && data !== void 0 && data.finalUrl.includes('vk.com/login')) { - logStatus.error(`Error:${i18n('loginVk')}`, true); - return false; + } + function Vk_setCache2(name, postId) { + try { + Vk_classPrivateFieldGet(this, Vk_cache)[name] = postId; + GM_setValue('vkCache', Vk_classPrivateFieldGet(this, Vk_cache)); + } catch (error) { + throwError(error, 'Vk.setCache'); + } + } + const social_Vk = Vk; + function Youtube_classPrivateMethodInitSpec(obj, privateSet) { + Youtube_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Youtube_classPrivateFieldInitSpec(obj, privateMap, value) { + Youtube_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Youtube_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Youtube_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Youtube_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Youtube_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Youtube_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Youtube_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; + } + } + function Youtube_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Youtube_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Youtube_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Youtube_classApplyDescriptorGet(receiver, descriptor); + } + function Youtube_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Youtube_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Youtube_defaultTasksTemplate = { + channels: [], + likes: [] + }; + const Youtube_defaultTasks = JSON.stringify(Youtube_defaultTasksTemplate); + const getInfo = async function(link, type) { + try { + const logStatus = scripts_echoLog({ + text: i18n('gettingYtbToken') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: link, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma, _ref; + if (data.responseText.includes('accounts.google.com/ServiceLogin?service=youtube')) { + logStatus.error(`Error:${i18n('loginYtb')}`, true); + return { + needLogin: true + }; } - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma; - this.#username = ((_data$responseText$ma = data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]) || ''; - logStatus.success(); - return true; + const apiKey = (_data$responseText$ma = data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; + const context = ((_ref = data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/) || data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/)) === null || _ref === void 0 ? void 0 : _ref[1]) || '{}'; + const { + client, + request + } = JSON.parse(context); + if (apiKey && client && request) { + client.hl = 'en'; + if (type === 'channel') { + var _data$responseText$ma2; + const channelId = (_data$responseText$ma2 = data.responseText.match(//)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; + if (channelId) { + logStatus.success(); + return { + params: { + apiKey: apiKey, + client: client, + request: request, + channelId: channelId + } + }; + } + logStatus.error('Error: Get "channelId" failed!'); + return {}; + } else if (type === 'likeVideo') { + var _data$responseText$ma3, _data$responseText$ma4; + const videoId = (_data$responseText$ma3 = data.responseText.match(//)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; + const likeParams = (_data$responseText$ma4 = data.responseText.match(/"likeParams":"(.*?)"/)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; + if (videoId) { + logStatus.success(); + return { + params: { + apiKey: apiKey, + client: client, + request: request, + videoId: videoId, + likeParams: likeParams + } + }; + } + logStatus.error('Error: Get "videoId" failed!'); + return {}; + } + logStatus.error('Error: Unknown type'); + return {}; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + logStatus.error('Error: Parameter "apiKey" not found!'); + return {}; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Vk.verifyAuth'); - return false; + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return {}; } + logStatus.error(`${result}:${statusText}(${status})`); + return {}; + } catch (error) { + throwError(error, 'Youtube.getInfo'); + return {}; + } + }; + var Youtube_auth = new WeakMap(); + var Youtube_initialized = new WeakMap(); + var _verifyChannel = new WeakMap(); + var Youtube_verifyAuth = new WeakSet(); + var Youtube_updateAuth = new WeakSet(); + var _getInfo = new WeakSet(); + var Youtube_toggleChannel = new WeakSet(); + var _toggleLikeVideo = new WeakSet(); + class Youtube extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Youtube_classPrivateMethodInitSpec(this, _toggleLikeVideo); + Youtube_classPrivateMethodInitSpec(this, Youtube_toggleChannel); + Youtube_classPrivateMethodInitSpec(this, _getInfo); + Youtube_classPrivateMethodInitSpec(this, Youtube_updateAuth); + Youtube_classPrivateMethodInitSpec(this, Youtube_verifyAuth); + Youtube_defineProperty(this, 'tasks', JSON.parse(Youtube_defaultTasks)); + Youtube_defineProperty(this, 'whiteList', { + ...JSON.parse(Youtube_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.youtube + }); + Youtube_classPrivateFieldInitSpec(this, Youtube_auth, { + writable: true, + value: GM_getValue('youtubeAuth') || {} + }); + Youtube_classPrivateFieldInitSpec(this, Youtube_initialized, { + writable: true, + value: false + }); + Youtube_classPrivateFieldInitSpec(this, _verifyChannel, { + writable: true, + value: `https://www.youtube.com/channel/${globalOptions.other.youtubeVerifyChannel}` + }); } - async #toggleGroup(name, dataParam) { - let doTask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + async init() { try { - const logStatus = scripts_echoLog({ - type: doTask ? 'joiningVkGroup' : 'leavingVkGroup', - text: name - }); - if (dataParam.groupAct === 'enter' && !doTask || dataParam.groupAct === 'leave' && doTask) { - logStatus.success(); + if (Youtube_classPrivateFieldGet(this, Youtube_initialized)) { return true; } - const reqData = { - act: doTask ? 'enter' : 'leave', - al: 1, - gid: dataParam.groupId, - hash: dataParam.groupHash - }; - if (doTask) { - reqData.context = '_'; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://vk.com/al_groups.php', - method: 'POST', - headers: { - origin: 'https://vk.com', - referer: `https://vk.com/${name}`, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: $.param(reqData) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - logStatus.success(); - if (doTask) { - this.tasks.names = unique([ ...this.tasks.names, name ]); - } + if (!Youtube_classPrivateFieldGet(this, Youtube_auth).PAPISID) { + if (await Youtube_classPrivateMethodGet(this, Youtube_updateAuth, Youtube_updateAuth2).call(this)) { + Youtube_classPrivateFieldSet(this, Youtube_initialized, true); return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); + const isVerified = await Youtube_classPrivateMethodGet(this, Youtube_verifyAuth, Youtube_verifyAuth2).call(this); + if (isVerified) { + scripts_echoLog({}).success(i18n('initSuccess', 'Youtube')); + Youtube_classPrivateFieldSet(this, Youtube_initialized, true); + return true; + } + GM_setValue('youtubeAuth', null); + if (await Youtube_classPrivateMethodGet(this, Youtube_updateAuth, Youtube_updateAuth2).call(this)) { + scripts_echoLog({}).success(i18n('initSuccess', 'Youtube')); + Youtube_classPrivateFieldSet(this, Youtube_initialized, true); + return true; + } + scripts_echoLog({}).error(i18n('initFailed', 'Youtube')); return false; } catch (error) { - throwError(error, 'Vk.toggleGroup'); + throwError(error, 'Youtube.init'); return false; } } - async #togglePublic(name, dataParam) { - let doTask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + async toggle(_ref2) { + let { + doTask = true, + channelLinks = [], + videoLinks = [] + } = _ref2; try { - const logStatus = scripts_echoLog({ - type: doTask ? 'joiningVkPublic' : 'leavingVkPublic', - text: name - }); - if (dataParam.publicJoined && doTask || !dataParam.publicJoined && !doTask) { - logStatus.success(); - return true; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://vk.com/al_public.php', - method: 'POST', - headers: { - origin: 'https://vk.com', - referer: `https://vk.com/${name}`, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: $.param({ - act: doTask ? 'a_enter' : 'a_leave', - al: 1, - pid: dataParam.publicPid, - hash: dataParam.publicHash - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - logStatus.success(); - if (doTask) { - this.tasks.names = unique([ ...this.tasks.names, name ]); - } - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Vk.togglePublic'); - return false; - } - } - async #sendWall(name) { - try { - const logStatus = scripts_echoLog({ - type: 'sendingVkWall', - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://vk.com/like.php', - method: 'POST', - headers: { - origin: 'https://vk.com', - referer: `https://vk.com/${name}`, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: $.param({ - act: 'publish_box', - al: 1, - object: name - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma2; - const hash = (_data$responseText$ma2 = data.responseText.match(/shHash:[\s]*'(.*?)'/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; - if (hash) { - const { - result: resultR, - statusText: statusTextR, - status: statusR, - data: dataR - } = await tools_httpRequest({ - url: 'https://vk.com/like.php', - method: 'POST', - headers: { - origin: 'https://vk.com', - referer: `https://vk.com/${name}`, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: $.param({ - Message: '', - act: 'a_do_publish', - al: 1, - close_comments: 0, - friends_only: 0, - from: 'box', - hash: hash, - list: '', - mark_as_ads: 0, - mute_notifications: 0, - object: name, - ret_data: 1, - to: 0 - }) - }); - if (resultR === 'Success') { - if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { - var _dataR$responseText, _jsonData$payload, _jsonData$payload$, _jsonData$payload$$; - const jsonData = JSON.parse(((_dataR$responseText = dataR.responseText) === null || _dataR$responseText === void 0 ? void 0 : _dataR$responseText.replace('\x3c!--', '')) || '{}'); - if ((jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload = jsonData.payload) === null || _jsonData$payload === void 0 ? void 0 : (_jsonData$payload$ = _jsonData$payload[1]) === null || _jsonData$payload$ === void 0 ? void 0 : (_jsonData$payload$$ = _jsonData$payload$[1]) === null || _jsonData$payload$$ === void 0 ? void 0 : _jsonData$payload$$.share_my) === true) { - var _jsonData$payload2, _jsonData$payload2$, _jsonData$payload2$$, _jsonData$payload3, _jsonData$payload3$, _jsonData$payload3$$; - logStatus.success(); - const postId = String(jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload2 = jsonData.payload) === null || _jsonData$payload2 === void 0 ? void 0 : (_jsonData$payload2$ = _jsonData$payload2[1]) === null || _jsonData$payload2$ === void 0 ? void 0 : (_jsonData$payload2$$ = _jsonData$payload2$[1]) === null || _jsonData$payload2$$ === void 0 ? void 0 : _jsonData$payload2$$.post_id); - const ownerId = String(jsonData === null || jsonData === void 0 ? void 0 : (_jsonData$payload3 = jsonData.payload) === null || _jsonData$payload3 === void 0 ? void 0 : (_jsonData$payload3$ = _jsonData$payload3[1]) === null || _jsonData$payload3$ === void 0 ? void 0 : (_jsonData$payload3$$ = _jsonData$payload3$[1]) === null || _jsonData$payload3$$ === void 0 ? void 0 : _jsonData$payload3$$.owner_id); - if (postId && ownerId) { - this.#setCache(name, `${ownerId}_${postId}`); - } - this.tasks.names = unique([ ...this.tasks.names, name ]); - return true; - } - } - logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); - return false; - } - logStatus.error(`${resultR}:${statusTextR}(${statusR})`); - return false; - } - logStatus.error('Error: Get "hash" failed'); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Vk.sendWall'); - return false; - } - } - async #deleteWall(name, dataParams) { - try { - const logStatus = scripts_echoLog({ - type: 'deletingVkWall', - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://vk.com/al_wall.php?act=delete', - method: 'POST', - headers: { - origin: 'https://vk.com', - referer: `https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: $.param({ - act: 'delete', - al: 1, - confirm: 0, - from: 'wkview', - hash: dataParams.wallHash, - post: this.#cache[name] - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText, _jsonData$payload4, _jsonData$payload4$; - const jsonData = JSON.parse(((_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : _data$responseText.replace('\x3c!--', '')) || '{}'); - if (jsonData !== null && jsonData !== void 0 && (_jsonData$payload4 = jsonData.payload) !== null && _jsonData$payload4 !== void 0 && (_jsonData$payload4$ = _jsonData$payload4[1]) !== null && _jsonData$payload4$ !== void 0 && _jsonData$payload4$[1]) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Vk.deleteWall'); - return false; - } - } - async #getId(name, doTask) { - try { - let url = `https://vk.com/${name}`; - if (/^wall-/.test(name)) { - if (doTask) { - return { - type: 'sendWall' - }; - } - if (!this.#cache[name]) { - return { - type: 'unSupport' - }; - } - url = `https://vk.com/${this.#username}?w=wall${this.#cache[name]}`; - } - const logStatus = scripts_echoLog({ - type: 'gettingVkId', - text: name - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: url, - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma3, _data$responseText$ma4; - const [ , groupAct, groupId, , groupHash ] = data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/) || []; - const publicHash = (_data$responseText$ma3 = data.responseText.match(/"enterHash":"(.*?)"/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; - const publicPid = (_data$responseText$ma4 = data.responseText.match(/"public_id":([\d]+?),/)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; - const publicJoined = !data.responseText.includes('Public.subscribe'); - if (groupAct && groupId && groupHash) { - logStatus.success(); - return { - groupAct: groupAct, - groupId: groupId, - groupHash: groupHash, - type: 'group' - }; - } else if (publicHash && publicPid) { - logStatus.success(); - return { - publicHash: publicHash, - publicPid: publicPid, - publicJoined: publicJoined, - type: 'public' - }; - } else if (data.responseText.includes('wall.deletePost') && !doTask) { - var _data$responseText$ma5; - const wallHash = (_data$responseText$ma5 = data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1]; - if (wallHash) { - logStatus.success(); - return { - type: 'deleteWall', - wallHash: wallHash - }; - } - } else if (name.includes('wall') && doTask) { - logStatus.success(); - return { - type: 'sendWall' - }; - } - logStatus.error('Error: Parameters not found!'); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Vk.getId'); - return false; - } - } - async #toggleVk(_ref) { - let { - name, - doTask = true - } = _ref; - try { - if (!doTask && this.whiteList.names.includes(name)) { + if (!Youtube_classPrivateFieldGet(this, Youtube_initialized)) { scripts_echoLog({ - type: 'whiteList', - text: 'Vk.undoTask', - id: name + text: i18n('needInit') }); - return true; - } - const formatName = name.replace(/\/$/, ''); - const data = await this.#getId(formatName, doTask); - if (!data) { - return false; - } - switch (data.type) { - case 'group': - return await this.#toggleGroup(formatName, data, doTask); - - case 'public': - return await this.#togglePublic(formatName, data, doTask); - - case 'sendWall': - return doTask ? await this.#sendWall(formatName) : true; - - case 'deleteWall': - return doTask ? true : await this.#deleteWall(formatName, data); - - default: return false; } - } catch (error) { - throwError(error, 'Vk.toggleVk'); - return false; - } - } - async toggle(_ref2) { - let { - doTask = true, - nameLinks = [] - } = _ref2; - try { - if (!this.#initialized) { + const prom = []; + if (doTask && !globalOptions.doTask.youtube.channels || !doTask && !globalOptions.undoTask.youtube.channels) { scripts_echoLog({ - text: i18n('needInit') + type: 'globalOptionsSkip', + text: 'youtube.channels' }); - return false; + } else { + const realChannels = this.getRealParams('channels', channelLinks, doTask, link => { + if (/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)) { + var _link$match; + return (_link$match = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; + } + return link; + }); + if (realChannels.length > 0) { + for (const channel of realChannels) { + prom.push(Youtube_classPrivateMethodGet(this, Youtube_toggleChannel, Youtube_toggleChannel2).call(this, { + link: channel, + doTask: doTask + })); + await delay(1e3); + } + } } - const prom = []; - if (doTask && !globalOptions.doTask.vk.names || !doTask && !globalOptions.undoTask.vk.names) { + if (doTask && !globalOptions.doTask.youtube.likes || !doTask && !globalOptions.undoTask.youtube.likes) { scripts_echoLog({ type: 'globalOptionsSkip', - text: 'vk.names' + text: 'youtube.likes' }); } else { - const realNames = this.getRealParams('names', nameLinks, doTask, link => { - var _link$match; - return (_link$match = link.match(/https:\/\/vk\.com\/([^/]+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; + const realLikes = this.getRealParams('likes', videoLinks, doTask, link => { + if (/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)) { + var _link$match2; + return (_link$match2 = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; + } + return link; }); - if (realNames.length > 0) { - for (const name of realNames) { - prom.push(this.#toggleVk({ - name: name, + if (realLikes.length > 0) { + for (const video of realLikes) { + prom.push(Youtube_classPrivateMethodGet(this, _toggleLikeVideo, _toggleLikeVideo2).call(this, { + link: video, doTask: doTask })); await delay(1e3); @@ -3696,282 +4537,524 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } return Promise.all(prom).then(() => true); } catch (error) { - throwError(error, 'Vk.toggle'); + throwError(error, 'Youtube.toggle'); return false; } } - #setCache(name, postId) { - try { - this.#cache[name] = postId; - GM_setValue('vkCache', this.#cache); - } catch (error) { - throwError(error, 'Vk.setCache'); - } + } + async function Youtube_verifyAuth2() { + try { + return await Youtube_classPrivateMethodGet(this, Youtube_toggleChannel, Youtube_toggleChannel2).call(this, { + link: Youtube_classPrivateFieldGet(this, _verifyChannel), + doTask: true, + verify: true + }); + } catch (error) { + throwError(error, 'Youtube.verifyAuth'); + return false; } } - const social_Vk = Vk; - var Youtube_GM_getValue; - const Youtube_defaultTasksTemplate = { - channels: [], - likes: [] - }; - const Youtube_defaultTasks = JSON.stringify(Youtube_defaultTasksTemplate); - const getInfo = async function(link, type) { + async function Youtube_updateAuth2() { try { const logStatus = scripts_echoLog({ - text: i18n('gettingYtbToken') + text: i18n('updatingAuth', 'Youtube') }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: link, - method: 'GET' + return await new Promise(resolve => { + const newTab = GM_openInTab('https://www.youtube.com/#auth', { + active: true, + insert: true, + setParent: true + }); + newTab.onclose = async () => { + const auth = GM_getValue('youtubeAuth'); + if (auth) { + Youtube_classPrivateFieldSet(this, Youtube_auth, auth); + logStatus.success(); + Youtube_classPrivateMethodGet(this, Youtube_verifyAuth, Youtube_verifyAuth2).call(this).then(result => { + resolve(result); + }); + } else { + logStatus.error('Error: Update youtube auth failed!'); + resolve(false); + } + }; }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma, _ref; - if (data.responseText.includes('accounts.google.com/ServiceLogin?service=youtube')) { - logStatus.error(`Error:${i18n('loginYtb')}`, true); - return { - needLogin: true - }; + } catch (error) { + throwError(error, 'Discord.updateAuth'); + return false; + } + } + function _getInfo2(link, type) { + return getInfo(link, type); + } + async function Youtube_toggleChannel2(_ref3) { + let { + link, + doTask = true, + verify = false + } = _ref3; + try { + const { + params, + needLogin + } = await Youtube_classPrivateMethodGet(this, _getInfo, _getInfo2).call(this, link, 'channel'); + const { + apiKey, + client, + request, + channelId + } = params || {}; + if (needLogin) { + scripts_echoLog({ + html: i18n('loginYtb') + }); + return false; + } + if (!(apiKey && client && request && channelId)) { + scripts_echoLog({ + text: '"getYtbToken" failed' + }); + return false; + } + if (!doTask && !verify && this.whiteList.channels.includes(channelId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Youtube.unfollowChannel', + id: channelId + }); + return true; + } + const logStatus = verify ? scripts_echoLog({ + text: i18n('verifyingAuth', 'Youtube') + }) : scripts_echoLog({ + type: doTask ? 'followingYtbChannel' : 'unfollowingYtbChannel', + text: channelId + }); + const nowTime = parseInt(String(new Date().getTime() / 1e3), 10); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://www.youtube.com/youtubei/v1/subscription/${doTask ? '' : 'un'}subscribe?key=${apiKey}`, + method: 'POST', + headers: { + origin: 'https://www.youtube.com', + referer: `https://www.youtube.com/channel/${channelId}`, + 'content-type': 'application/json', + 'x-goog-authuser': '0', + 'x-goog-visitor-id': client === null || client === void 0 ? void 0 : client.visitorData, + 'x-origin': 'https://www.youtube.com', + authorization: `SAPISIDHASH ${nowTime}_${sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this, Youtube_auth).PAPISID} https://www.youtube.com`)}` + }, + data: JSON.stringify({ + context: { + client: client, + request: { + sessionId: request === null || request === void 0 ? void 0 : request.sessionId, + internalExperimentFlags: [], + consistencyTokenJars: [] + }, + user: {} + }, + channelIds: [ channelId ], + params: doTask ? 'EgIIAhgA' : 'CgIIAhgA' + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + if (doTask && (/"subscribed": true/.test(data.responseText) || data.responseText.includes('The subscription already exists')) || !doTask && /"subscribed": false/.test(data.responseText)) { + logStatus.success(); + if (doTask && !verify) { + this.tasks.channels = unique([ ...this.tasks.channels, link ]); + } + return true; } - const apiKey = (_data$responseText$ma = data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; - const context = ((_ref = data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/) || data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/)) === null || _ref === void 0 ? void 0 : _ref[1]) || '{}'; - const { - client, - request - } = JSON.parse(context); - if (apiKey && client && request) { - client.hl = 'en'; - if (type === 'channel') { - var _data$responseText$ma2; - const channelId = (_data$responseText$ma2 = data.responseText.match(//)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; - if (channelId) { - logStatus.success(); - return { - params: { - apiKey: apiKey, - client: client, - request: request, - channelId: channelId - } - }; - } - logStatus.error('Error: Get "channelId" failed!'); - return {}; - } else if (type === 'likeVideo') { - var _data$responseText$ma3, _data$responseText$ma4; - const videoId = (_data$responseText$ma3 = data.responseText.match(//)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; - const likeParams = (_data$responseText$ma4 = data.responseText.match(/"likeParams":"(.*?)"/)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; - if (videoId) { - logStatus.success(); - return { - params: { - apiKey: apiKey, - client: client, - request: request, - videoId: videoId, - likeParams: likeParams - } - }; - } - logStatus.error('Error: Get "videoId" failed!'); - return {}; + if (verify && data.responseText.includes('You may not subscribe to yourself')) { + logStatus.success(); + return true; + } + logStatus.error(i18n('tryUpdateYtbAuth'), true); + return false; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Youtube.toggleChannel'); + return false; + } + } + async function _toggleLikeVideo2(_ref4) { + let { + link, + doTask = true + } = _ref4; + try { + const { + params, + needLogin + } = await Youtube_classPrivateMethodGet(this, _getInfo, _getInfo2).call(this, link, 'likeVideo'); + const { + apiKey, + client, + request, + videoId, + likeParams + } = params || {}; + if (needLogin) { + scripts_echoLog({ + html: `${i18n('loginYtb')}` + }); + return false; + } + if (!(apiKey && client && request && videoId && likeParams)) { + scripts_echoLog({ + text: '"getYtbToken" failed' + }); + return false; + } + if (!doTask && this.whiteList.likes.includes(videoId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Youtube.unlikeVideo', + id: videoId + }); + return true; + } + const logStatus = scripts_echoLog({ + type: doTask ? 'likingYtbVideo' : 'unlikingYtbVideo', + text: videoId + }); + const nowTime = parseInt(String(new Date().getTime() / 1e3), 10); + const likeVideoData = { + context: { + client: client, + request: { + sessionId: request.sessionId, + internalExperimentFlags: [], + consistencyTokenJars: [] + }, + user: {} + }, + target: { + videoId: videoId + } + }; + if (doTask) { + if (likeParams) { + likeVideoData.params = likeParams; + } else { + logStatus.error('Empty likeParams'); + return false; + } + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://www.youtube.com/youtubei/v1/like/${doTask ? '' : 'remove'}like?key=${apiKey}`, + method: 'POST', + headers: { + origin: 'https://www.youtube.com', + referer: `https://www.youtube.com/watch?v=${videoId}`, + 'content-type': 'application/json', + 'x-goog-authuser': '0', + 'x-goog-visitor-id': client.visitorData, + 'x-origin': 'https://www.youtube.com', + authorization: `SAPISIDHASH ${nowTime}_${sha1(`${nowTime} ${Youtube_classPrivateFieldGet(this, Youtube_auth).PAPISID} https://www.youtube.com`)}` + }, + data: JSON.stringify(likeVideoData) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + if (doTask && data.responseText.includes('Added to Liked videos') || !doTask && (data.responseText.includes('Removed from Liked videos') || data.responseText.includes('Dislike removed'))) { + logStatus.success(); + if (doTask) { + this.tasks.likes = unique([ ...this.tasks.likes, link ]); } - logStatus.error('Error: Unknown type'); - return {}; + return true; } - logStatus.error('Error: Parameter "apiKey" not found!'); - return {}; + logStatus.error(i18n('tryUpdateYtbAuth'), true); + return false; } logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return {}; + return false; } logStatus.error(`${result}:${statusText}(${status})`); - return {}; + return false; } catch (error) { - throwError(error, 'Youtube.getInfo'); - return {}; + throwError(error, 'Youtube.toggleLikeVideo'); + return false; + } + } + function Steam_classPrivateMethodInitSpec(obj, privateSet) { + Steam_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Steam_classPrivateFieldInitSpec(obj, privateMap, value) { + Steam_checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + function Steam_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Steam_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Steam_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + function Steam_classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = Steam_classExtractFieldDescriptor(receiver, privateMap, 'set'); + Steam_classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function Steam_classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError('attempted to set read only private field'); + } + descriptor.value = value; } + } + function Steam_classPrivateFieldGet(receiver, privateMap) { + var descriptor = Steam_classExtractFieldDescriptor(receiver, privateMap, 'get'); + return Steam_classApplyDescriptorGet(receiver, descriptor); + } + function Steam_classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError('attempted to ' + action + ' private field on non-instance'); + } + return privateMap.get(receiver); + } + function Steam_classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + const Steam_defaultTasksTemplate = { + groups: [], + officialGroups: [], + wishlists: [], + follows: [], + forums: [], + workshops: [], + workshopVotes: [], + curators: [], + curatorLikes: [], + announcements: [], + licenses: [], + playtests: [] }; - class Youtube extends social_Social { - tasks = JSON.parse(Youtube_defaultTasks); - whiteList = { - ...JSON.parse(Youtube_defaultTasks), - ...(Youtube_GM_getValue = GM_getValue('whiteList')) === null || Youtube_GM_getValue === void 0 ? void 0 : Youtube_GM_getValue.youtube - }; - #auth = GM_getValue('youtubeAuth') || {}; - #initialized = false; - #verifyChannel = `https://www.youtube.com/channel/${globalOptions.other.youtubeVerifyChannel}`; + const Steam_defaultTasks = JSON.stringify(Steam_defaultTasksTemplate); + var Steam_cache = new WeakMap(); + var Steam_auth = new WeakMap(); + var _storeInitialized = new WeakMap(); + var _communityInitialized = new WeakMap(); + var _area = new WeakMap(); + var _areaStatus = new WeakMap(); + var _refreshStoreToken = new WeakSet(); + var _setStoreToken = new WeakSet(); + var _updateStoreAuth = new WeakSet(); + var _updateCommunityAuth = new WeakSet(); + var _getAreaInfo = new WeakSet(); + var _changeArea = new WeakSet(); + var _joinGroup = new WeakSet(); + var _leaveGroup = new WeakSet(); + var _getGroupId = new WeakSet(); + var _joinOfficialGroup = new WeakSet(); + var _leaveOfficialGroup = new WeakSet(); + var _getOfficialGroupId = new WeakSet(); + var _addToWishlist = new WeakSet(); + var _removeFromWishlist = new WeakSet(); + var _toggleFollowGame = new WeakSet(); + var _isFollowedGame = new WeakSet(); + var _toggleForum = new WeakSet(); + var _getForumId = new WeakSet(); + var _toggleFavoriteWorkshop = new WeakSet(); + var _getWorkshopAppId = new WeakSet(); + var _voteUpWorkshop = new WeakSet(); + var _toggleCurator = new WeakSet(); + var _toggleCuratorLike = new WeakSet(); + var _getAnnouncementParams = new WeakSet(); + var _likeAnnouncement = new WeakSet(); + var _appid2subid = new WeakSet(); + var _getLicenses = new WeakSet(); + var _addLicense = new WeakSet(); + var _addFreeLicense = new WeakSet(); + var _requestPlayTestAccess = new WeakSet(); + var Steam_setCache = new WeakSet(); + class Steam extends social_Social { + constructor() { + var _GM_getValue; + super(...arguments); + Steam_classPrivateMethodInitSpec(this, Steam_setCache); + Steam_classPrivateMethodInitSpec(this, _requestPlayTestAccess); + Steam_classPrivateMethodInitSpec(this, _addFreeLicense); + Steam_classPrivateMethodInitSpec(this, _addLicense); + Steam_classPrivateMethodInitSpec(this, _getLicenses); + Steam_classPrivateMethodInitSpec(this, _appid2subid); + Steam_classPrivateMethodInitSpec(this, _likeAnnouncement); + Steam_classPrivateMethodInitSpec(this, _getAnnouncementParams); + Steam_classPrivateMethodInitSpec(this, _toggleCuratorLike); + Steam_classPrivateMethodInitSpec(this, _toggleCurator); + Steam_classPrivateMethodInitSpec(this, _voteUpWorkshop); + Steam_classPrivateMethodInitSpec(this, _getWorkshopAppId); + Steam_classPrivateMethodInitSpec(this, _toggleFavoriteWorkshop); + Steam_classPrivateMethodInitSpec(this, _getForumId); + Steam_classPrivateMethodInitSpec(this, _toggleForum); + Steam_classPrivateMethodInitSpec(this, _isFollowedGame); + Steam_classPrivateMethodInitSpec(this, _toggleFollowGame); + Steam_classPrivateMethodInitSpec(this, _removeFromWishlist); + Steam_classPrivateMethodInitSpec(this, _addToWishlist); + Steam_classPrivateMethodInitSpec(this, _getOfficialGroupId); + Steam_classPrivateMethodInitSpec(this, _leaveOfficialGroup); + Steam_classPrivateMethodInitSpec(this, _joinOfficialGroup); + Steam_classPrivateMethodInitSpec(this, _getGroupId); + Steam_classPrivateMethodInitSpec(this, _leaveGroup); + Steam_classPrivateMethodInitSpec(this, _joinGroup); + Steam_classPrivateMethodInitSpec(this, _changeArea); + Steam_classPrivateMethodInitSpec(this, _getAreaInfo); + Steam_classPrivateMethodInitSpec(this, _updateCommunityAuth); + Steam_classPrivateMethodInitSpec(this, _updateStoreAuth); + Steam_classPrivateMethodInitSpec(this, _setStoreToken); + Steam_classPrivateMethodInitSpec(this, _refreshStoreToken); + Steam_defineProperty(this, 'tasks', JSON.parse(Steam_defaultTasks)); + Steam_defineProperty(this, 'whiteList', { + ...JSON.parse(Steam_defaultTasks), + ...(_GM_getValue = GM_getValue('whiteList')) === null || _GM_getValue === void 0 ? void 0 : _GM_getValue.steam + }); + Steam_classPrivateFieldInitSpec(this, Steam_cache, { + writable: true, + value: { + ...{ + group: {}, + officialGroup: {}, + forum: {}, + workshop: {}, + curator: {} + }, + ...GM_getValue('steamCache') + } + }); + Steam_classPrivateFieldInitSpec(this, Steam_auth, { + writable: true, + value: {} + }); + Steam_classPrivateFieldInitSpec(this, _storeInitialized, { + writable: true, + value: false + }); + Steam_classPrivateFieldInitSpec(this, _communityInitialized, { + writable: true, + value: false + }); + Steam_classPrivateFieldInitSpec(this, _area, { + writable: true, + value: 'CN' + }); + Steam_classPrivateFieldInitSpec(this, _areaStatus, { + writable: true, + value: 'end' + }); + } async init() { + let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all'; try { - if (this.#initialized) { + if (type === 'store') { + if (Steam_classPrivateFieldGet(this, _storeInitialized)) { + return true; + } + Steam_classPrivateFieldSet(this, _storeInitialized, await Steam_classPrivateMethodGet(this, _updateStoreAuth, _updateStoreAuth2).call(this)); + if (!Steam_classPrivateFieldGet(this, _storeInitialized)) { + scripts_echoLog({}).error(i18n('initFailed', 'Steam')); + return false; + } + scripts_echoLog({}).success(i18n('initSuccess', 'SteamStore')); return true; } - if (!this.#auth.PAPISID) { - if (await this.#updateAuth()) { - this.#initialized = true; + if (type === 'community') { + if (Steam_classPrivateFieldGet(this, _communityInitialized)) { return true; } - return false; - } - const isVerified = await this.#verifyAuth(); - if (isVerified) { - scripts_echoLog({}).success(i18n('initSuccess', 'Youtube')); - this.#initialized = true; + Steam_classPrivateFieldSet(this, _communityInitialized, await Steam_classPrivateMethodGet(this, _updateCommunityAuth, _updateCommunityAuth2).call(this)); + if (!Steam_classPrivateFieldGet(this, _communityInitialized)) { + scripts_echoLog({}).error(i18n('initFailed', 'Steam')); + return false; + } + scripts_echoLog({}).success(i18n('initSuccess', 'SteamCommunity')); return true; } - GM_setValue('youtubeAuth', null); - if (await this.#updateAuth()) { - scripts_echoLog({}).success(i18n('initSuccess', 'Youtube')); - this.#initialized = true; + Steam_classPrivateFieldSet(this, _storeInitialized, await Steam_classPrivateMethodGet(this, _updateStoreAuth, _updateStoreAuth2).call(this)); + Steam_classPrivateFieldSet(this, _communityInitialized, await Steam_classPrivateMethodGet(this, _updateCommunityAuth, _updateCommunityAuth2).call(this)); + if (Steam_classPrivateFieldGet(this, _storeInitialized) && Steam_classPrivateFieldGet(this, _communityInitialized)) { + scripts_echoLog({}).success(i18n('initSuccess', 'Steam')); return true; } - scripts_echoLog({}).error(i18n('initFailed', 'Youtube')); - return false; - } catch (error) { - throwError(error, 'Youtube.init'); + scripts_echoLog({}).error(i18n('initFailed', 'Steam')); return false; - } - } - async #verifyAuth() { - try { - return await this.#toggleChannel({ - link: this.#verifyChannel, - doTask: true, - verify: true - }); } catch (error) { - throwError(error, 'Youtube.verifyAuth'); + throwError(error, 'Steam.init'); return false; } } - async #updateAuth() { + async getCuratorId(path, name) { try { const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', 'Youtube') - }); - return await new Promise(resolve => { - const newTab = GM_openInTab('https://www.youtube.com/#auth', { - active: true, - insert: true, - setParent: true - }); - newTab.onclose = async () => { - const auth = GM_getValue('youtubeAuth'); - if (auth) { - this.#auth = auth; - logStatus.success(); - this.#verifyAuth().then(result => { - resolve(result); - }); - } else { - logStatus.error('Error: Update youtube auth failed!'); - resolve(false); - } - }; + type: 'gettingCuratorId', + text: `${path}/${name}` }); - } catch (error) { - throwError(error, 'Discord.updateAuth'); - return false; - } - } - #getInfo(link, type) { - return getInfo(link, type); - } - async #toggleChannel(_ref2) { - let { - link, - doTask = true, - verify = false - } = _ref2; - try { - const { - params, - needLogin - } = await this.#getInfo(link, 'channel'); - const { - apiKey, - client, - request, - channelId - } = params || {}; - if (needLogin) { - scripts_echoLog({ - html: i18n('loginYtb') - }); - return false; - } - if (!(apiKey && client && request && channelId)) { - scripts_echoLog({ - text: '"getYtbToken" failed' - }); - return false; - } - if (!doTask && !verify && this.whiteList.channels.includes(channelId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Youtube.unfollowChannel', - id: channelId - }); - return true; + const curatorId = Steam_classPrivateFieldGet(this, Steam_cache).curator[`${path}/${name}`]; + if (curatorId) { + logStatus.success(); + return curatorId; } - const logStatus = verify ? scripts_echoLog({ - text: i18n('verifyingAuth', 'Youtube') - }) : scripts_echoLog({ - type: doTask ? 'followingYtbChannel' : 'unfollowingYtbChannel', - text: channelId - }); - const nowTime = parseInt(String(new Date().getTime() / 1e3), 10); const { result, statusText, status, data } = await tools_httpRequest({ - url: `https://www.youtube.com/youtubei/v1/subscription/${doTask ? '' : 'un'}subscribe?key=${apiKey}`, - method: 'POST', + url: `https://store.steampowered.com/${path}/${name}`, + method: 'GET', headers: { - origin: 'https://www.youtube.com', - referer: `https://www.youtube.com/channel/${channelId}`, - 'content-type': 'application/json', - 'x-goog-authuser': '0', - 'x-goog-visitor-id': client === null || client === void 0 ? void 0 : client.visitorData, - 'x-origin': 'https://www.youtube.com', - authorization: `SAPISIDHASH ${nowTime}_${sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)}` - }, - data: JSON.stringify({ - context: { - client: client, - request: { - sessionId: request === null || request === void 0 ? void 0 : request.sessionId, - internalExperimentFlags: [], - consistencyTokenJars: [] - }, - user: {} - }, - channelIds: [ channelId ], - params: doTask ? 'EgIIAhgA' : 'CgIIAhgA' - }) + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + } }); if (result === 'Success') { if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - if (doTask && (/"subscribed": true/.test(data.responseText) || data.responseText.includes('The subscription already exists')) || !doTask && /"subscribed": false/.test(data.responseText)) { - logStatus.success(); - if (doTask && !verify) { - this.tasks.channels = unique([ ...this.tasks.channels, link ]); - } - return true; - } - if (verify && data.responseText.includes('You may not subscribe to yourself')) { + var _data$responseText$ma; + const curatorId = (_data$responseText$ma = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; + if (curatorId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'curator', `${path}/${name}`, curatorId); logStatus.success(); - return true; + return curatorId; } - logStatus.error(i18n('tryUpdateYtbAuth'), true); + logStatus.error(`Error:${data.statusText}(${data.status})`); return false; } logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); @@ -3980,2067 +5063,1791 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.error(`${result}:${statusText}(${status})`); return false; } catch (error) { - throwError(error, 'Youtube.toggleChannel'); + throwError(error, 'Steam.getCuratorID'); return false; } } - async #toggleLikeVideo(_ref3) { + async toggle(_ref) { let { - link, - doTask = true - } = _ref3; + doTask = true, + groupLinks = [], + officialGroupLinks = [], + wishlistLinks = [], + followLinks = [], + forumLinks = [], + workshopLinks = [], + workshopVoteLinks = [], + curatorLinks = [], + curatorLikeLinks = [], + announcementLinks = [], + licenseLinks = [], + playtestLinks = [] + } = _ref; try { - const { - params, - needLogin - } = await this.#getInfo(link, 'likeVideo'); - const { - apiKey, - client, - request, - videoId, - likeParams - } = params || {}; - if (needLogin) { + if ([ ...groupLinks, ...officialGroupLinks, ...forumLinks, ...workshopLinks, ...workshopVoteLinks ].length > 0 && !Steam_classPrivateFieldGet(this, _communityInitialized)) { scripts_echoLog({ - html: `${i18n('loginYtb')}` + text: i18n('needInit') }); return false; } - if (!(apiKey && client && request && videoId && likeParams)) { + if ([ ...wishlistLinks, ...followLinks, ...curatorLinks, ...curatorLikeLinks, ...announcementLinks, ...licenseLinks, ...playtestLinks ].length > 0 && !Steam_classPrivateFieldGet(this, _storeInitialized)) { scripts_echoLog({ - text: '"getYtbToken" failed' + text: i18n('needInit') }); return false; } - if (!doTask && this.whiteList.likes.includes(videoId)) { + const prom = []; + if (doTask && !globalOptions.doTask.steam.groups || !doTask && !globalOptions.undoTask.steam.groups) { scripts_echoLog({ - type: 'whiteList', - text: 'Youtube.unlikeVideo', - id: videoId + type: 'globalOptionsSkip', + text: 'steam.groups' }); - return true; - } - const logStatus = scripts_echoLog({ - type: doTask ? 'likingYtbVideo' : 'unlikingYtbVideo', - text: videoId - }); - const nowTime = parseInt(String(new Date().getTime() / 1e3), 10); - const likeVideoData = { - context: { - client: client, - request: { - sessionId: request.sessionId, - internalExperimentFlags: [], - consistencyTokenJars: [] - }, - user: {} - }, - target: { - videoId: videoId + } else { + const realGroups = this.getRealParams('groups', groupLinks, doTask, link => { + var _link$match; + return (_link$match = link.match(/groups\/(.+)\/?/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; + }); + if (realGroups.length > 0) { + for (const group of realGroups) { + if (doTask) { + prom.push(Steam_classPrivateMethodGet(this, _joinGroup, _joinGroup2).call(this, group)); + } else { + prom.push(Steam_classPrivateMethodGet(this, _leaveGroup, _leaveGroup2).call(this, group)); + } + await delay(1e3); + } } - }; - if (doTask) { - if (likeParams) { - likeVideoData.params = likeParams; - } else { - logStatus.error('Empty likeParams'); - return false; + } + if (doTask && !globalOptions.doTask.steam.officialGroups || !doTask && !globalOptions.undoTask.steam.officialGroups) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.officialGroups' + }); + } else { + const realOfficialGroups = this.getRealParams('officialGroups', officialGroupLinks, doTask, link => { + var _link$match2; + return (_link$match2 = link.match(/games\/(.+)\/?/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; + }); + if (realOfficialGroups.length > 0) { + for (const officialGroup of realOfficialGroups) { + if (doTask) { + prom.push(Steam_classPrivateMethodGet(this, _joinOfficialGroup, _joinOfficialGroup2).call(this, officialGroup)); + } else { + prom.push(Steam_classPrivateMethodGet(this, _leaveOfficialGroup, _leaveOfficialGroup2).call(this, officialGroup)); + } + await delay(1e3); + } } } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://www.youtube.com/youtubei/v1/like/${doTask ? '' : 'remove'}like?key=${apiKey}`, - method: 'POST', - headers: { - origin: 'https://www.youtube.com', - referer: `https://www.youtube.com/watch?v=${videoId}`, - 'content-type': 'application/json', - 'x-goog-authuser': '0', - 'x-goog-visitor-id': client.visitorData, - 'x-origin': 'https://www.youtube.com', - authorization: `SAPISIDHASH ${nowTime}_${sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)}` - }, - data: JSON.stringify(likeVideoData) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - if (doTask && data.responseText.includes('Added to Liked videos') || !doTask && (data.responseText.includes('Removed from Liked videos') || data.responseText.includes('Dislike removed'))) { - logStatus.success(); + if (doTask && !globalOptions.doTask.steam.wishlists || !doTask && !globalOptions.undoTask.steam.wishlists) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.wishlists' + }); + } else { + const realWishlists = this.getRealParams('wishlists', wishlistLinks, doTask, link => { + var _link$match3; + return (_link$match3 = link.match(/app\/([\d]+)/)) === null || _link$match3 === void 0 ? void 0 : _link$match3[1]; + }); + if (realWishlists.length > 0) { + for (const game of realWishlists) { if (doTask) { - this.tasks.likes = unique([ ...this.tasks.likes, link ]); + prom.push(Steam_classPrivateMethodGet(this, _addToWishlist, _addToWishlist2).call(this, game)); + } else { + prom.push(Steam_classPrivateMethodGet(this, _removeFromWishlist, _removeFromWishlist2).call(this, game)); } - return true; + await delay(1e3); } - logStatus.error(i18n('tryUpdateYtbAuth'), true); - return false; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Youtube.toggleLikeVideo'); - return false; - } - } - async toggle(_ref4) { - let { - doTask = true, - channelLinks = [], - videoLinks = [] - } = _ref4; - try { - if (!this.#initialized) { + if (doTask && !globalOptions.doTask.steam.follows || !doTask && !globalOptions.undoTask.steam.follows) { scripts_echoLog({ - text: i18n('needInit') + type: 'globalOptionsSkip', + text: 'steam.follows' }); - return false; + } else { + const realFollows = this.getRealParams('follows', followLinks, doTask, link => { + var _link$match4; + return (_link$match4 = link.match(/app\/([\d]+)/)) === null || _link$match4 === void 0 ? void 0 : _link$match4[1]; + }); + if (realFollows.length > 0) { + for (const game of realFollows) { + prom.push(Steam_classPrivateMethodGet(this, _toggleFollowGame, _toggleFollowGame2).call(this, game, doTask)); + await delay(1e3); + } + } } - const prom = []; - if (doTask && !globalOptions.doTask.youtube.channels || !doTask && !globalOptions.undoTask.youtube.channels) { + if (doTask && !globalOptions.doTask.steam.forums || !doTask && !globalOptions.undoTask.steam.forums) { scripts_echoLog({ type: 'globalOptionsSkip', - text: 'youtube.channels' + text: 'steam.forums' }); } else { - const realChannels = this.getRealParams('channels', channelLinks, doTask, link => { - if (/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)) { - var _link$match; - return (_link$match = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; + const realForums = this.getRealParams('forums', forumLinks, doTask, link => { + var _link$match5; + return (_link$match5 = link.match(/app\/([\d]+)/)) === null || _link$match5 === void 0 ? void 0 : _link$match5[1]; + }); + if (realForums.length > 0) { + for (const forum of realForums) { + prom.push(Steam_classPrivateMethodGet(this, _toggleForum, _toggleForum2).call(this, forum, doTask)); + await delay(1e3); } - return link; + } + } + if (doTask && !globalOptions.doTask.steam.workshops || !doTask && !globalOptions.undoTask.steam.workshops) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.workshops' }); - if (realChannels.length > 0) { - for (const channel of realChannels) { - prom.push(this.#toggleChannel({ - link: channel, - doTask: doTask - })); + } else { + const realWorkshops = this.getRealParams('workshops', workshopLinks, doTask, link => { + var _link$match6; + return (_link$match6 = link.match(/\?id=([\d]+)/)) === null || _link$match6 === void 0 ? void 0 : _link$match6[1]; + }); + if (realWorkshops.length > 0) { + for (const workshop of realWorkshops) { + prom.push(Steam_classPrivateMethodGet(this, _toggleFavoriteWorkshop, _toggleFavoriteWorkshop2).call(this, workshop, doTask)); await delay(1e3); } } } - if (doTask && !globalOptions.doTask.youtube.likes || !doTask && !globalOptions.undoTask.youtube.likes) { + if (doTask && !globalOptions.doTask.steam.workshopVotes) { scripts_echoLog({ type: 'globalOptionsSkip', - text: 'youtube.likes' + text: 'steam.workshopVotes' }); } else { - const realLikes = this.getRealParams('likes', videoLinks, doTask, link => { - if (/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)) { - var _link$match2; - return (_link$match2 = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; + const realworkshopVotes = this.getRealParams('workshopVotes', workshopVoteLinks, doTask, link => { + var _link$match7; + return (_link$match7 = link.match(/\?id=([\d]+)/)) === null || _link$match7 === void 0 ? void 0 : _link$match7[1]; + }); + if (doTask && realworkshopVotes.length > 0) { + for (const workshop of realworkshopVotes) { + prom.push(Steam_classPrivateMethodGet(this, _voteUpWorkshop, _voteUpWorkshop2).call(this, workshop)); + await delay(1e3); } - return link; + } + } + if (doTask && !globalOptions.doTask.steam.curators || !doTask && !globalOptions.undoTask.steam.curators) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.curators' }); - if (realLikes.length > 0) { - for (const video of realLikes) { - prom.push(this.#toggleLikeVideo({ - link: video, - doTask: doTask - })); + } else { + const realCurators = this.getRealParams('curators', curatorLinks, doTask, link => { + var _link$match8; + return (_link$match8 = link.match(/curator\/([\d]+)/)) === null || _link$match8 === void 0 ? void 0 : _link$match8[1]; + }); + const realCuratorLikes = this.getRealParams('curatorLikes', curatorLikeLinks, doTask, link => { + var _link$match9; + return (_link$match9 = link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)) === null || _link$match9 === void 0 ? void 0 : _link$match9.slice(1, 3).join('/'); + }); + if (realCurators.length > 0) { + for (const curator of realCurators) { + prom.push(Steam_classPrivateMethodGet(this, _toggleCurator, _toggleCurator2).call(this, curator, doTask)); + await delay(1e3); + } + } + if (realCuratorLikes.length > 0) { + for (const curatorLike of realCuratorLikes) { + prom.push(Steam_classPrivateMethodGet(this, _toggleCuratorLike, _toggleCuratorLike2).call(this, curatorLike, doTask)); await delay(1e3); } } } - return Promise.all(prom).then(() => true); - } catch (error) { - throwError(error, 'Youtube.toggle'); - return false; - } - } - } - var Steam_GM_getValue; - const Steam_defaultTasksTemplate = { - groups: [], - officialGroups: [], - wishlists: [], - follows: [], - forums: [], - workshops: [], - workshopVotes: [], - curators: [], - curatorLikes: [], - announcements: [], - licenses: [], - playtests: [] - }; - const Steam_defaultTasks = JSON.stringify(Steam_defaultTasksTemplate); - class Steam extends social_Social { - tasks = JSON.parse(Steam_defaultTasks); - whiteList = { - ...JSON.parse(Steam_defaultTasks), - ...(Steam_GM_getValue = GM_getValue('whiteList')) === null || Steam_GM_getValue === void 0 ? void 0 : Steam_GM_getValue.steam - }; - #cache = { - ...{ - group: {}, - officialGroup: {}, - forum: {}, - workshop: {}, - curator: {} - }, - ...GM_getValue('steamCache') - }; - #auth = {}; - #storeInitialized = false; - #communityInitialized = false; - #area = 'CN'; - #areaStatus = 'end'; - async init() { - let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all'; - try { - if (type === 'store') { - if (this.#storeInitialized) { - return true; - } - this.#storeInitialized = await this.#updateStoreAuth(); - if (!this.#storeInitialized) { - scripts_echoLog({}).error(i18n('initFailed', 'Steam')); - return false; + if (doTask && !globalOptions.doTask.steam.announcements) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.announcements' + }); + } else { + const realAnnouncements = this.getRealParams('announcements', announcementLinks, doTask, link => { + var _link$match11; + if (link.includes('store.steampowered.com')) { + var _link$match10; + return (_link$match10 = link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/)) === null || _link$match10 === void 0 ? void 0 : _link$match10.slice(1, 3).join('/'); + } + return (_link$match11 = link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/)) === null || _link$match11 === void 0 ? void 0 : _link$match11.slice(1, 3).join('/'); + }); + if (doTask && realAnnouncements.length > 0) { + for (const id of realAnnouncements) { + prom.push(Steam_classPrivateMethodGet(this, _likeAnnouncement, _likeAnnouncement2).call(this, id)); + await delay(1e3); + } } - scripts_echoLog({}).success(i18n('initSuccess', 'SteamStore')); - return true; } - if (type === 'community') { - if (this.#communityInitialized) { - return true; + if (doTask && !globalOptions.doTask.steam.licenses) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.licenses' + }); + } else if (doTask && globalOptions.doTask.steam.licenses && licenseLinks.length > 0) { + for (const id of licenseLinks) { + prom.push(Steam_classPrivateMethodGet(this, _addLicense, _addLicense2).call(this, id)); + await delay(1e3); } - this.#communityInitialized = await this.#updateCommunityAuth(); - if (!this.#communityInitialized) { - scripts_echoLog({}).error(i18n('initFailed', 'Steam')); - return false; + } + if (doTask && !globalOptions.doTask.steam.playtests) { + scripts_echoLog({ + type: 'globalOptionsSkip', + text: 'steam.playtests' + }); + } else { + const realPlaytests = this.getRealParams('playtests', playtestLinks, doTask, link => { + var _link$match12; + return (_link$match12 = link.match(/app\/([\d]+)/)) === null || _link$match12 === void 0 ? void 0 : _link$match12[1]; + }); + if (doTask && globalOptions.doTask.steam.playtests && realPlaytests.length > 0) { + for (const id of realPlaytests) { + prom.push(Steam_classPrivateMethodGet(this, _requestPlayTestAccess, _requestPlayTestAccess2).call(this, id)); + await delay(1e3); + } } - scripts_echoLog({}).success(i18n('initSuccess', 'SteamCommunity')); - return true; } - this.#storeInitialized = await this.#updateStoreAuth(); - this.#communityInitialized = await this.#updateCommunityAuth(); - if (this.#storeInitialized && this.#communityInitialized) { - scripts_echoLog({}).success(i18n('initSuccess', 'Steam')); + return Promise.all(prom).then(async () => { + if (Steam_classPrivateFieldGet(this, _area) !== 'CN') { + scripts_echoLog({}).warning(i18n('steamFinishNotice')); + await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this, 'CN'); + } return true; - } - scripts_echoLog({}).error(i18n('initFailed', 'Steam')); - return false; + }); } catch (error) { - throwError(error, 'Steam.init'); + throwError(error, 'Steam.toggle'); return false; } } - async #refreshStoreToken() { - try { - const logStatus = scripts_echoLog({ - text: i18n('refreshingToken', i18n('steamStore')) - }); - const formData = new FormData(); - formData.append('redir', 'https://store.steampowered.com/'); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://login.steampowered.com/jwt/ajaxrefresh', - method: 'POST', - responseType: 'json', - headers: { - Host: 'login.steampowered.com', - Origin: 'https://store.steampowered.com', - Referer: 'https://store.steampowered.com/' - }, - data: formData - }); - if (result === 'Success') { - var _data$response; - if (data !== null && data !== void 0 && (_data$response = data.response) !== null && _data$response !== void 0 && _data$response.success) { - if (await this.#setStoreToken(data.response)) { - logStatus.success(); - return true; - } - logStatus.error('Error'); - return false; + } + async function _refreshStoreToken2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('refreshingToken', i18n('steamStore')) + }); + const formData = new FormData(); + formData.append('redir', 'https://store.steampowered.com/'); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://login.steampowered.com/jwt/ajaxrefresh', + method: 'POST', + responseType: 'json', + headers: { + Host: 'login.steampowered.com', + Origin: 'https://store.steampowered.com', + Referer: 'https://store.steampowered.com/' + }, + data: formData + }); + if (result === 'Success') { + var _data$response; + if (data !== null && data !== void 0 && (_data$response = data.response) !== null && _data$response !== void 0 && _data$response.success) { + if (await Steam_classPrivateMethodGet(this, _setStoreToken, _setStoreToken2).call(this, data.response)) { + logStatus.success(); + return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error('Error'); return false; } - logStatus.error(`${result}:${statusText}(${status})`); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; - } catch (error) { - throwError(error, 'Steam.refreshStoreToken'); + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.refreshStoreToken'); + return false; + } + } + async function _setStoreToken2(param) { + try { + const logStatus = scripts_echoLog({ + text: i18n('settingToken', i18n('steamStore')) + }); + const formData = new FormData(); + formData.append('steamID', param.steamID); + formData.append('nonce', param.nonce); + formData.append('redir', param.redir); + formData.append('auth', param.auth); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/login/settoken', + method: 'POST', + headers: { + Accept: 'application/json, text/plain, */*', + Host: 'store.steampowered.com', + Origin: 'https://store.steampowered.com', + Referer: 'https://store.steampowered.com/login' + }, + data: formData + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.setStoreToken'); + return false; } - async #setStoreToken(param) { - try { - const logStatus = scripts_echoLog({ - text: i18n('settingToken', i18n('steamStore')) - }); - const formData = new FormData(); - formData.append('steamID', param.steamID); - formData.append('nonce', param.nonce); - formData.append('redir', param.redir); - formData.append('auth', param.auth); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/login/settoken', - method: 'POST', - headers: { - Accept: 'application/json, text/plain, */*', - Host: 'store.steampowered.com', - Origin: 'https://store.steampowered.com', - Referer: 'https://store.steampowered.com/login' - }, - data: formData - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + } + async function _updateStoreAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', i18n('steamStore')) + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/', + method: 'GET', + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'Cache-Control': 'max-age=0', + 'Sec-Fetch-Dest': 'document', + 'Sec-Fetch-Mode': 'navigate', + 'Upgrade-Insecure-Requests': '1' + } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma2; + if (!data.responseText.includes('data-miniprofile=')) { + await Steam_classPrivateMethodGet(this, _refreshStoreToken, _refreshStoreToken2).call(this); + logStatus.error(`Error:${i18n('needLoginSteamStore')}`, true); + return false; + } + const storeSessionID = (_data$responseText$ma2 = data.responseText.match(/g_sessionID = "(.+?)";/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; + if (storeSessionID) { + Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID = storeSessionID; logStatus.success(); return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error('Error: Get "sessionID" failed'); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.setStoreToken'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.updateStoreAuth'); + return false; } - async #updateStoreAuth() { - try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', i18n('steamStore')) - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/', - method: 'GET', - headers: { - Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', - 'Cache-Control': 'max-age=0', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Upgrade-Insecure-Requests': '1' - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma; - if (!data.responseText.includes('data-miniprofile=')) { - await this.#refreshStoreToken(); - logStatus.error(`Error:${i18n('needLoginSteamStore')}`, true); - return false; - } - const storeSessionID = (_data$responseText$ma = data.responseText.match(/g_sessionID = "(.+?)";/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; - if (storeSessionID) { - this.#auth.storeSessionID = storeSessionID; - logStatus.success(); - return true; - } - logStatus.error('Error: Get "sessionID" failed'); + } + async function _updateCommunityAuth2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('updatingAuth', i18n('steamCommunity')) + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://steamcommunity.com/my', + method: 'GET', + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'Cache-Control': 'max-age=0', + 'Sec-Fetch-Dest': 'document', + 'Sec-Fetch-Mode': 'navigate', + 'Upgrade-Insecure-Requests': '1' + } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma3, _data$responseText$ma4, _data$responseText$ma5; + if (data.responseText.includes('href="https://steamcommunity.com/login/home/')) { + logStatus.error(`Error:${i18n('needLoginSteamCommunity')}`, true); return false; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + const steam64Id = (_data$responseText$ma3 = data.responseText.match(/g_steamID = "(.+?)";/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; + const communitySessionID = (_data$responseText$ma4 = data.responseText.match(/g_sessionID = "(.+?)";/)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; + const userName = (_data$responseText$ma5 = data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)) === null || _data$responseText$ma5 === void 0 ? void 0 : _data$responseText$ma5[1]; + if (steam64Id) { + Steam_classPrivateFieldGet(this, Steam_auth).steam64Id = steam64Id; + } + if (userName) { + Steam_classPrivateFieldGet(this, Steam_auth).userName = userName; + } + if (communitySessionID) { + Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID = communitySessionID; + logStatus.success(); + return true; + } + logStatus.error('Error: Get "sessionID" failed'); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.updateStoreAuth'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.updateCommunityAuth'); + return false; } - async #updateCommunityAuth() { - try { - const logStatus = scripts_echoLog({ - text: i18n('updatingAuth', i18n('steamCommunity')) - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://steamcommunity.com/my', - method: 'GET', - headers: { - Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', - 'Cache-Control': 'max-age=0', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Upgrade-Insecure-Requests': '1' - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma2, _data$responseText$ma3, _data$responseText$ma4; - if (data.responseText.includes('href="https://steamcommunity.com/login/home/')) { - logStatus.error(`Error:${i18n('needLoginSteamCommunity')}`, true); - return false; - } - const steam64Id = (_data$responseText$ma2 = data.responseText.match(/g_steamID = "(.+?)";/)) === null || _data$responseText$ma2 === void 0 ? void 0 : _data$responseText$ma2[1]; - const communitySessionID = (_data$responseText$ma3 = data.responseText.match(/g_sessionID = "(.+?)";/)) === null || _data$responseText$ma3 === void 0 ? void 0 : _data$responseText$ma3[1]; - const userName = (_data$responseText$ma4 = data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)) === null || _data$responseText$ma4 === void 0 ? void 0 : _data$responseText$ma4[1]; - if (steam64Id) { - this.#auth.steam64Id = steam64Id; - } - if (userName) { - this.#auth.userName = userName; - } - if (communitySessionID) { - this.#auth.communitySessionID = communitySessionID; - logStatus.success(); - return true; - } - logStatus.error('Error: Get "sessionID" failed'); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.updateCommunityAuth'); - return false; - } - } - async #getAreaInfo() { - try { - const logStatus = scripts_echoLog({ - text: i18n('gettingAreaInfo') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/cart/', - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma5; - const currentArea = (_data$responseText$ma5 = data.responseText.match(//g) ].map(search => search[1]); - if (currentArea && areas.length > 0) { - this.#area = currentArea; - logStatus.success(); - return { - currentArea: currentArea, - areas: areas - }; - } - logStatus.error('Error: get country info filed'); - return {}; + } + async function _getAreaInfo2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('gettingAreaInfo') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/cart/', + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma6; + const currentArea = (_data$responseText$ma6 = data.responseText.match(//g) ].map(search => search[1]); + if (currentArea && areas.length > 0) { + Steam_classPrivateFieldSet(this, _area, currentArea); + logStatus.success(); + return { + currentArea: currentArea, + areas: areas + }; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error('Error: get country info filed'); return {}; } - logStatus.error(`${result}:${statusText}(${status})`); - return {}; - } catch (error) { - throwError(error, 'Steam.getAreaInfo'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return {}; } + logStatus.error(`${result}:${statusText}(${status})`); + return {}; + } catch (error) { + throwError(error, 'Steam.getAreaInfo'); + return {}; } - async #changeArea(area) { - try { - if (this.#areaStatus === 'waiting') { - await new Promise(resolve => { - const checker = setInterval(() => { - if (this.#areaStatus !== 'waiting') { - clearInterval(checker); - resolve(true); - } - }); + } + async function _changeArea2(area) { + try { + if (Steam_classPrivateFieldGet(this, _areaStatus) === 'waiting') { + await new Promise(resolve => { + const checker = setInterval(() => { + if (Steam_classPrivateFieldGet(this, _areaStatus) !== 'waiting') { + clearInterval(checker); + resolve(true); + } }); - } - if (this.#area === area || !area && this.#area !== 'CN') { - return true; - } - this.#areaStatus = 'waiting'; - let aimedArea = area; - if (!aimedArea) { - const { - currentArea, - areas - } = await this.#getAreaInfo(); - if (!currentArea || !areas) { - this.#areaStatus = 'error'; - return false; - } - if (currentArea !== 'CN') { - this.#areaStatus = 'skip'; - scripts_echoLog({ - text: 'notNeededChangeArea' - }); - return 'skip'; - } - const anotherArea = areas.filter(area => area && area !== 'CN'); - if (!anotherArea || anotherArea.length === 0) { - this.#areaStatus = 'noAnotherArea'; - scripts_echoLog({ - text: 'noAnotherArea' - }); - return false; - } - [ aimedArea ] = anotherArea; - } - const logStatus = scripts_echoLog({ - text: i18n('changingArea', aimedArea) - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/account/setcountry', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - cc: aimedArea, - sessionid: this.#auth.storeSessionID - }) }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.responseText === 'true') { - const { - currentArea - } = await this.#getAreaInfo(); - if (currentArea === aimedArea) { - this.#areaStatus = 'success'; - logStatus.success(); - return currentArea; - } - this.#areaStatus = 'error'; - logStatus.error('Error: change country filed'); - return 'CN'; - } - this.#areaStatus = 'error'; - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return 'CN'; - } - this.#areaStatus = 'error'; - logStatus.error(`${result}:${statusText}(${status})`); - return 'CN'; - } catch (error) { - this.#areaStatus = 'error'; - throwError(error, 'Steam.changeArea'); - return false; } - } - async #joinGroup(groupName) { - try { - const logStatus = scripts_echoLog({ - type: 'joiningSteamGroup', - text: groupName - }); + if (Steam_classPrivateFieldGet(this, _area) === area || !area && Steam_classPrivateFieldGet(this, _area) !== 'CN') { + return true; + } + Steam_classPrivateFieldSet(this, _areaStatus, 'waiting'); + let aimedArea = area; + if (!aimedArea) { const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/groups/${groupName}`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - action: 'join', - sessionID: this.#auth.communitySessionID - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('grouppage_join_area')) { - logStatus.success(); - this.tasks.groups = unique([ ...this.tasks.groups, groupName ]); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + currentArea, + areas + } = await Steam_classPrivateMethodGet(this, _getAreaInfo, _getAreaInfo2).call(this); + if (!currentArea || !areas) { + Steam_classPrivateFieldSet(this, _areaStatus, 'error'); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.joinGroup'); - return false; - } - } - async #leaveGroup(groupName) { - try { - if (this.whiteList.groups.includes(groupName)) { + if (currentArea !== 'CN') { + Steam_classPrivateFieldSet(this, _areaStatus, 'skip'); scripts_echoLog({ - type: 'whiteList', - text: 'Steam.leaveGroup', - id: groupName + text: 'notNeededChangeArea' }); - return true; + return 'skip'; } - const groupId = await this.#getGroupId(groupName); - if (!groupId) { + const anotherArea = areas.filter(area => area && area !== 'CN'); + if (!anotherArea || anotherArea.length === 0) { + Steam_classPrivateFieldSet(this, _areaStatus, 'noAnotherArea'); + scripts_echoLog({ + text: 'noAnotherArea' + }); return false; } - const logStatus = scripts_echoLog({ - type: 'leavingSteamGroup', - text: groupName - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/id/${this.#auth.userName}/home_process`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - sessionID: this.#auth.communitySessionID, - action: 'leaveGroup', - groupId: groupId - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.finalUrl.includes('groups') && $(data.responseText.replace(//g, '').toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length === 0) { + [ aimedArea ] = anotherArea; + } + const logStatus = scripts_echoLog({ + text: i18n('changingArea', aimedArea) + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/account/setcountry', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + cc: aimedArea, + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.responseText === 'true') { + const { + currentArea + } = await Steam_classPrivateMethodGet(this, _getAreaInfo, _getAreaInfo2).call(this); + if (currentArea === aimedArea) { + Steam_classPrivateFieldSet(this, _areaStatus, 'success'); logStatus.success(); - return true; + return currentArea; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + Steam_classPrivateFieldSet(this, _areaStatus, 'error'); + logStatus.error('Error: change country filed'); + return 'CN'; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.leaveGroup'); - return false; + Steam_classPrivateFieldSet(this, _areaStatus, 'error'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return 'CN'; } + Steam_classPrivateFieldSet(this, _areaStatus, 'error'); + logStatus.error(`${result}:${statusText}(${status})`); + return 'CN'; + } catch (error) { + Steam_classPrivateFieldSet(this, _areaStatus, 'error'); + throwError(error, 'Steam.changeArea'); + return false; } - async #getGroupId(groupName) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingSteamGroupId', - text: groupName - }); - const groupId = this.#cache.group[groupName]; - if (groupId) { + } + async function _joinGroup2(groupName) { + try { + const logStatus = scripts_echoLog({ + type: 'joiningSteamGroup', + text: groupName + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/groups/${groupName}`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + action: 'join', + sessionID: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('grouppage_join_area')) { logStatus.success(); - return groupId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/groups/${groupName}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma6; - const groupId = (_data$responseText$ma6 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma6 === void 0 ? void 0 : _data$responseText$ma6[1]; - if (groupId) { - this.#setCache('group', groupName, groupId); - logStatus.success(); - return groupId; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + this.tasks.groups = unique([ ...this.tasks.groups, groupName ]); + return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.getGroupID'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.joinGroup'); + return false; } - async #joinOfficialGroup(gameId) { - try { - const logStatus = scripts_echoLog({ - type: 'joiningSteamOfficialGroup', - text: gameId + } + async function _leaveGroup2(groupName) { + try { + if (this.whiteList.groups.includes(groupName)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.leaveGroup', + id: groupName }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/games/${gameId}?action=join&sessionID=${this.#auth.communitySessionID}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('id="publicGroupJoin"')) { - var _data$responseText$ma7; - logStatus.success(); - this.tasks.officialGroups = unique([ ...this.tasks.officialGroups, gameId ]); - const groupId = (_data$responseText$ma7 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1]; - if (groupId) { - this.#setCache('officialGroup', gameId, groupId); - } - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.joinOfficialGroup'); - return false; + return true; } - } - async #leaveOfficialGroup(gameId) { - try { - if (this.whiteList.officialGroups.includes(gameId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.leaveOfficialGroup', - id: gameId - }); - return true; - } - const groupId = await this.#getOfficialGroupId(gameId); - if (!groupId) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'leavingSteamOfficialGroup', - text: gameId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/id/${this.#auth.userName}/home_process`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - sessionID: this.#auth.communitySessionID, - action: 'leaveGroup', - groupId: groupId - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - const { - result: resultR, - statusText: statusTextR, - status: statusR, - data: dataR - } = await tools_httpRequest({ - url: `https://steamcommunity.com/games/${gameId}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } - }); - if (resultR === 'Success') { - if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200 && dataR.responseText.includes('id="publicGroupJoin"')) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); - return false; - } - logStatus.error(`${resultR}:${statusTextR}(${statusR})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.leaveOfficialGroup'); + const groupId = await Steam_classPrivateMethodGet(this, _getGroupId, _getGroupId2).call(this, groupName); + if (!groupId) { return false; } - } - async #getOfficialGroupId(gameId) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingSteamOfficialGroupId', - text: gameId - }); - const groupId = this.#cache.officialGroup[gameId]; - if (groupId) { + const logStatus = scripts_echoLog({ + type: 'leavingSteamGroup', + text: groupName + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this, Steam_auth).userName}/home_process`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + sessionID: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID, + action: 'leaveGroup', + groupId: groupId + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.finalUrl.includes('groups') && $(data.responseText.replace(//g, '').toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length === 0) { logStatus.success(); - return groupId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/games/${gameId}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma8; - const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1]; - if (groupId) { - this.#setCache('officialGroup', gameId, groupId); - logStatus.success(); - return groupId; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.getGroupID'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.leaveGroup'); + return false; } - async #addToWishlist(gameId) { - try { - var _data$response2; - const logStatus = scripts_echoLog({ - type: 'addingToWishlist', - text: gameId - }); - const { - result, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/api/addtowishlist', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - sessionid: this.#auth.storeSessionID, - appid: gameId - }), - dataType: 'json' - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : _data$response2.success) === true) { - logStatus.success(); - this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); - return true; + } + async function _getGroupId2(groupName) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingSteamGroupId', + text: groupName + }); + const groupId = Steam_classPrivateFieldGet(this, Steam_cache).group[groupName]; + if (groupId) { + logStatus.success(); + return groupId; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/groups/${groupName}`, + method: 'GET', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } - const { - result: resultR, - statusText: statusTextR, - status: statusR, - data: dataR - } = await tools_httpRequest({ - url: `https://store.steampowered.com/app/${gameId}`, - method: 'GET' - }); - if (resultR === 'Success') { - if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { - if (this.#area === 'CN' && dataR.responseText.includes('id="error_box"')) { - logStatus.warning(i18n('changeAreaNotice')); - if (!await this.#changeArea()) { - return false; - } - return await this.#addToWishlist(gameId); - } - if (dataR.responseText.includes('class="queue_actions_ctn"') && dataR.responseText.includes('class="already_in_library"')) { - logStatus.success(); - this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); - return true; - } else if (dataR.responseText.includes('class="queue_actions_ctn"') && dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;') || !dataR.responseText.includes('class="queue_actions_ctn"')) { - logStatus.error(`Error:${dataR.statusText}(${dataR.status})`); - return false; - } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma7; + const groupId = (_data$responseText$ma7 = data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)) === null || _data$responseText$ma7 === void 0 ? void 0 : _data$responseText$ma7[1]; + if (groupId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'group', groupName, groupId); logStatus.success(); - this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); - return true; + return groupId; } - logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); + logStatus.error(`Error:${data.statusText}(${data.status})`); return false; } - logStatus.error(`${resultR}:${statusTextR}(${statusR})`); - return false; - } catch (error) { - throwError(error, 'Steam.addToWishlist'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.getGroupID'); + return false; } - async #removeFromWishlist(gameId) { - try { - var _data$response3; - if (this.whiteList.wishlists.includes(gameId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.removeFromWishlist', - id: gameId - }); - return true; + } + async function _joinOfficialGroup2(gameId) { + try { + const logStatus = scripts_echoLog({ + type: 'joiningSteamOfficialGroup', + text: gameId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/games/${gameId}?action=join&sessionID=${Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID}`, + method: 'GET', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } - const logStatus = scripts_echoLog({ - type: 'removingFromWishlist', - text: gameId - }); - const { - result, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/api/removefromwishlist', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - sessionid: this.#auth.storeSessionID, - appid: gameId - }), - dataType: 'json' - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.success) === true) { + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText.includes('id="publicGroupJoin"')) { + var _data$responseText$ma8; logStatus.success(); + this.tasks.officialGroups = unique([ ...this.tasks.officialGroups, gameId ]); + const groupId = (_data$responseText$ma8 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma8 === void 0 ? void 0 : _data$responseText$ma8[1]; + if (groupId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'officialGroup', gameId, groupId); + } return true; } - const { - result: resultR, - statusText: statusTextR, - status: statusR, - data: dataR - } = await tools_httpRequest({ - url: `https://store.steampowered.com/app/${gameId}`, - method: 'GET' + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.joinOfficialGroup'); + return false; + } + } + async function _leaveOfficialGroup2(gameId) { + try { + if (this.whiteList.officialGroups.includes(gameId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.leaveOfficialGroup', + id: gameId }); - if (resultR === 'Success') { - if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { - if (this.#area === 'CN' && dataR.responseText.includes('id="error_box"')) { - logStatus.warning(i18n('changeAreaNotice')); - const result = await this.#changeArea(); - if (!result || result === 'CN' || result === 'skip') { - return false; - } - return await this.#removeFromWishlist(gameId); + return true; + } + const groupId = await Steam_classPrivateMethodGet(this, _getOfficialGroupId, _getOfficialGroupId2).call(this, gameId); + if (!groupId) { + return false; + } + const logStatus = scripts_echoLog({ + type: 'leavingSteamOfficialGroup', + text: gameId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/id/${Steam_classPrivateFieldGet(this, Steam_auth).userName}/home_process`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + sessionID: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID, + action: 'leaveGroup', + groupId: groupId + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + const { + result: resultR, + statusText: statusTextR, + status: statusR, + data: dataR + } = await tools_httpRequest({ + url: `https://steamcommunity.com/games/${gameId}`, + method: 'GET', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } - if (dataR.responseText.includes('class="queue_actions_ctn"') && (dataR.responseText.includes('ds_owned_flag ds_flag') || dataR.responseText.includes('add_to_wishlist_area'))) { + }); + if (resultR === 'Success') { + if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200 && dataR.responseText.includes('id="publicGroupJoin"')) { logStatus.success(); return true; } - logStatus.error(`Error:${dataR.statusText}(${dataR.status})`); + logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); return false; } - logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); + logStatus.error(`${resultR}:${statusTextR}(${statusR})`); return false; } - logStatus.error(`${resultR}:${statusTextR}(${statusR})`); - return false; - } catch (error) { - throwError(error, 'Steam.removeFromWishlist'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.leaveOfficialGroup'); + return false; } - async #toggleFollowGame(gameId, doTask) { - try { - if (!doTask && this.whiteList.follows.includes(gameId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.unfollowGame', - id: gameId - }); - return true; - } - const logStatus = scripts_echoLog({ - type: `${doTask ? '' : 'un'}followingGame`, - text: gameId - }); - const requestData = { - sessionid: this.#auth.storeSessionID, - appid: gameId - }; - if (!doTask) { - requestData.unfollow = '1'; - } - const { - result, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/explore/followgame/', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param(requestData) - }); - if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && data.responseText === 'true') { - logStatus.success(); - return true; - } - const followed = await this.#isFollowedGame(gameId); - if (this.#area === 'CN' && followed === 'areaLocked') { - logStatus.warning(i18n('changeAreaNotice')); - if (!await this.#changeArea()) { - return false; - } - return await this.#removeFromWishlist(gameId); + } + async function _getOfficialGroupId2(gameId) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingSteamOfficialGroupId', + text: gameId + }); + const groupId = Steam_classPrivateFieldGet(this, Steam_cache).officialGroup[gameId]; + if (groupId) { + logStatus.success(); + return groupId; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/games/${gameId}`, + method: 'GET', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } - if (doTask === followed) { - logStatus.success(); - if (doTask) { - this.tasks.follows = unique([ ...this.tasks.follows, gameId ]); + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma9; + const groupId = (_data$responseText$ma9 = data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1]; + if (groupId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'officialGroup', gameId, groupId); + logStatus.success(); + return groupId; } - return true; + logStatus.error(`Error:${data.statusText}(${data.status})`); + return false; } logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; - } catch (error) { - throwError(error, 'Steam.toggleFollowGame'); - return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.getGroupID'); + return false; } - async #isFollowedGame(gameId) { - try { - const { - result, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/app/${gameId}`, - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) { - return 'areaLocked'; - } - if ($(data.responseText.replace(//g, '')).find('.queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active').css('display') !== 'none') { - return true; + } + async function _addToWishlist2(gameId) { + try { + var _data$response2; + const logStatus = scripts_echoLog({ + type: 'addingToWishlist', + text: gameId + }); + const { + result, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/api/addtowishlist', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + appid: gameId + }), + dataType: 'json' + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : _data$response2.success) === true) { + logStatus.success(); + this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); + return true; + } + const { + result: resultR, + statusText: statusTextR, + status: statusR, + data: dataR + } = await tools_httpRequest({ + url: `https://store.steampowered.com/app/${gameId}`, + method: 'GET' + }); + if (resultR === 'Success') { + if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && dataR.responseText.includes('id="error_box"')) { + logStatus.warning(i18n('changeAreaNotice')); + if (!await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this)) { + return false; } + return await Steam_classPrivateMethodGet(this, _addToWishlist, _addToWishlist2).call(this, gameId); + } + if (dataR.responseText.includes('class="queue_actions_ctn"') && dataR.responseText.includes('class="already_in_library"')) { + logStatus.success(); + this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); + return true; + } else if (dataR.responseText.includes('class="queue_actions_ctn"') && dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;') || !dataR.responseText.includes('class="queue_actions_ctn"')) { + logStatus.error(`Error:${dataR.statusText}(${dataR.status})`); return false; } - return false; + logStatus.success(); + this.tasks.wishlists = unique([ ...this.tasks.wishlists, gameId ]); + return true; } - return false; - } catch (error) { - throwError(error, 'Steam.isFollowedGame'); + logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); return false; } + logStatus.error(`${resultR}:${statusTextR}(${statusR})`); + return false; + } catch (error) { + throwError(error, 'Steam.addToWishlist'); + return false; } - async #toggleForum(gameId) { - let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - try { - if (!doTask && this.whiteList.forums.includes(gameId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.unsubscribeForum', - id: gameId - }); - return true; - } - const forumId = await this.#getForumId(gameId); - if (!forumId) { - return false; - } - const logStatus = scripts_echoLog({ - type: `${doTask ? '' : 'un'}subscribingForum`, - text: gameId - }); - const [ id, feature ] = forumId.split('_'); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/forum/${id}/General/${doTask ? '' : 'un'}subscribe/${feature || '0'}/`, - method: 'POST', - responseType: 'json', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - sessionid: this.#auth.communitySessionID - }) + } + async function _removeFromWishlist2(gameId) { + try { + var _data$response3; + if (this.whiteList.wishlists.includes(gameId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.removeFromWishlist', + id: gameId }); - if (result === 'Success') { - var _data$response4, _data$response5; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (((_data$response4 = data.response) === null || _data$response4 === void 0 ? void 0 : _data$response4.success) === 1 || ((_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : _data$response5.success) === 29)) { - if (doTask) { - this.tasks.forums = unique([ ...this.tasks.forums, gameId ]); - } - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return true; - } - logStatus.error(`${result}:${statusText}(${status})`); return true; - } catch (error) { - throwError(error, 'Steam.toggleForum'); + } + const logStatus = scripts_echoLog({ + type: 'removingFromWishlist', + text: gameId + }); + const { + result, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/api/removefromwishlist', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + appid: gameId + }), + dataType: 'json' + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.success) === true) { + logStatus.success(); return true; } - } - async #getForumId(gameId) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingForumId', - text: gameId - }); - const forumId = this.#cache.forum[gameId]; - if (forumId) { - logStatus.success(); - return forumId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/app/${gameId}/discussions/`, - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText, _data$responseText$ma9; - const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma9 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma9 === void 0 ? void 0 : _data$responseText$ma9[1]; - if (forumId) { - this.#setCache('forum', gameId, forumId); - logStatus.success(); - return forumId; + const { + result: resultR, + statusText: statusTextR, + status: statusR, + data: dataR + } = await tools_httpRequest({ + url: `https://store.steampowered.com/app/${gameId}`, + method: 'GET' + }); + if (resultR === 'Success') { + if ((dataR === null || dataR === void 0 ? void 0 : dataR.status) === 200) { + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && dataR.responseText.includes('id="error_box"')) { + logStatus.warning(i18n('changeAreaNotice')); + const result = await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this); + if (!result || result === 'CN' || result === 'skip') { + return false; } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; + return await Steam_classPrivateMethodGet(this, _removeFromWishlist, _removeFromWishlist2).call(this, gameId); } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + if (dataR.responseText.includes('class="queue_actions_ctn"') && (dataR.responseText.includes('ds_owned_flag ds_flag') || dataR.responseText.includes('add_to_wishlist_area'))) { + logStatus.success(); + return true; + } + logStatus.error(`Error:${dataR.statusText}(${dataR.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.getForumId'); + logStatus.error(`Error:${dataR === null || dataR === void 0 ? void 0 : dataR.statusText}(${dataR === null || dataR === void 0 ? void 0 : dataR.status})`); return false; } + logStatus.error(`${resultR}:${statusTextR}(${statusR})`); + return false; + } catch (error) { + throwError(error, 'Steam.removeFromWishlist'); + return false; } - async #toggleFavoriteWorkshop(id) { - let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - try { - if (!doTask && this.whiteList.workshops.includes(id)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.unfavoriteWorkshop', - id: id - }); - return true; - } - const appid = await this.#getWorkshopAppId(id); - if (!appid) { + } + async function _toggleFollowGame2(gameId, doTask) { + try { + if (!doTask && this.whiteList.follows.includes(gameId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.unfollowGame', + id: gameId + }); + return true; + } + const logStatus = scripts_echoLog({ + type: `${doTask ? '' : 'un'}followingGame`, + text: gameId + }); + const requestData = { + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + appid: gameId + }; + if (!doTask) { + requestData.unfollow = '1'; + } + const { + result, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/explore/followgame/', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param(requestData) + }); + if (result === 'Success' && (data === null || data === void 0 ? void 0 : data.status) === 200 && data.responseText === 'true') { + logStatus.success(); + return true; + } + const followed = await Steam_classPrivateMethodGet(this, _isFollowedGame, _isFollowedGame2).call(this, gameId); + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && followed === 'areaLocked') { + logStatus.warning(i18n('changeAreaNotice')); + if (!await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this)) { return false; } - const logStatus = scripts_echoLog({ - type: doTask ? 'favoritingWorkshop' : 'unfavoritingWorkshop', - text: id - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/sharedfiles/${doTask ? '' : 'un'}favorite`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - id: id, - appid: appid, - sessionid: this.#auth.communitySessionID - }) - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText) { - if (doTask) { - this.tasks.workshops = unique([ ...this.tasks.workshops, id ]); - } - logStatus.success(); + return await Steam_classPrivateMethodGet(this, _removeFromWishlist, _removeFromWishlist2).call(this, gameId); + } + if (doTask === followed) { + logStatus.success(); + if (doTask) { + this.tasks.follows = unique([ ...this.tasks.follows, gameId ]); + } + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; + } catch (error) { + throwError(error, 'Steam.toggleFollowGame'); + return false; + } + } + async function _isFollowedGame2(gameId) { + try { + const { + result, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/app/${gameId}`, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && data.responseText.includes('id="error_box"')) { + return 'areaLocked'; + } + if ($(data.responseText.replace(//g, '')).find('.queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active').css('display') !== 'none') { return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.toggleFavoriteWorkshop'); return false; } + return false; + } catch (error) { + throwError(error, 'Steam.isFollowedGame'); + return false; } - async #getWorkshopAppId(id) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingWorkshopAppId', - text: id + } + async function _toggleForum2(gameId) { + let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + try { + if (!doTask && this.whiteList.forums.includes(gameId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.unsubscribeForum', + id: gameId }); - const appId = this.#cache.workshop[id]; - if (appId) { - logStatus.success(); - return appId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://steamcommunity.com/sharedfiles/filedetails/?id=${id}`, - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma10; - const appId = (_data$responseText$ma10 = data.responseText.match(//)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1]; - if (appId) { - this.#setCache('workshop', id, appId); - logStatus.success(); - return appId; - } - logStatus.error('Error: getWorkshopAppId failed'); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.getWorkshopAppId'); + return true; + } + const forumId = await Steam_classPrivateMethodGet(this, _getForumId, _getForumId2).call(this, gameId); + if (!forumId) { return false; } - } - async #voteUpWorkshop(id) { - try { - const logStatus = scripts_echoLog({ - type: 'votingUpWorkshop', - text: id - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://steamcommunity.com/sharedfiles/voteup', - method: 'POST', - responseType: 'json', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - id: id, - sessionid: this.#auth.communitySessionID - }) - }); - if (result === 'Success') { - var _data$response6; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response6 = data.response) === null || _data$response6 === void 0 ? void 0 : _data$response6.success) === 1) { - logStatus.success(); - return true; + const logStatus = scripts_echoLog({ + type: `${doTask ? '' : 'un'}subscribingForum`, + text: gameId + }); + const [ id, feature ] = forumId.split('_'); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/forum/${id}/General/${doTask ? '' : 'un'}subscribe/${feature || '0'}/`, + method: 'POST', + responseType: 'json', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID + }) + }); + if (result === 'Success') { + var _data$response4, _data$response5; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (((_data$response4 = data.response) === null || _data$response4 === void 0 ? void 0 : _data$response4.success) === 1 || ((_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : _data$response5.success) === 29)) { + if (doTask) { + this.tasks.forums = unique([ ...this.tasks.forums, gameId ]); } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.success(); return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return true; - } catch (error) { - throwError(error, 'Steam.voteupWorkshop'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return true; } + logStatus.error(`${result}:${statusText}(${status})`); + return true; + } catch (error) { + throwError(error, 'Steam.toggleForum'); + return true; } - async #toggleCurator(curatorId) { - let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - try { - if (!doTask && this.whiteList.curators.includes(curatorId)) { - scripts_echoLog({ - type: 'whiteList', - text: 'Steam.unfollowCurator', - id: curatorId - }); - return true; - } - const logStatus = scripts_echoLog({ - type: doTask ? 'followingCurator' : 'unfollowingCurator', - text: curatorId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/curators/ajaxfollow', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $.param({ - clanid: curatorId, - sessionid: this.#auth.storeSessionID, - follow: doTask - }), - dataType: 'json' - }); - if (result === 'Success') { - var _data$response7, _data$response7$succe, _data$response8; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response7 = data.response) === null || _data$response7 === void 0 ? void 0 : (_data$response7$succe = _data$response7.success) === null || _data$response7$succe === void 0 ? void 0 : _data$response7$succe.success) === 1) { + } + async function _getForumId2(gameId) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingForumId', + text: gameId + }); + const forumId = Steam_classPrivateFieldGet(this, Steam_cache).forum[gameId]; + if (forumId) { + logStatus.success(); + return forumId; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/app/${gameId}/discussions/`, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText, _data$responseText$ma10; + const forumId = (_data$responseText = data.responseText) === null || _data$responseText === void 0 ? void 0 : (_data$responseText$ma10 = _data$responseText.match(/General_([\d]+(_[\d]+)?)/)) === null || _data$responseText$ma10 === void 0 ? void 0 : _data$responseText$ma10[1]; + if (forumId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'forum', gameId, forumId); logStatus.success(); - return true; + return forumId; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : (_data$response8 = data.response) === null || _data$response8 === void 0 ? void 0 : _data$response8.success}` || `${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error(`Error:${data.statusText}(${data.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.toggleCurator'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.getForumId'); + return false; } - async getCuratorId(path, name) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingCuratorId', - text: `${path}/${name}` - }); - const curatorId = this.#cache.curator[`${path}/${name}`]; - if (curatorId) { - logStatus.success(); - return curatorId; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/${path}/${name}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } + } + async function _toggleFavoriteWorkshop2(id) { + let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + try { + if (!doTask && this.whiteList.workshops.includes(id)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.unfavoriteWorkshop', + id: id }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma11; - const curatorId = (_data$responseText$ma11 = data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1]; - if (curatorId) { - this.#setCache('curator', `${path}/${name}`, curatorId); - logStatus.success(); - return curatorId; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; + return true; + } + const appid = await Steam_classPrivateMethodGet(this, _getWorkshopAppId, _getWorkshopAppId2).call(this, id); + if (!appid) { + return false; + } + const logStatus = scripts_echoLog({ + type: doTask ? 'favoritingWorkshop' : 'unfavoritingWorkshop', + text: id + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/sharedfiles/${doTask ? '' : 'un'}favorite`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + id: id, + appid: appid, + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID + }) + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && !data.responseText) { + if (doTask) { + this.tasks.workshops = unique([ ...this.tasks.workshops, id ]); } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + logStatus.success(); + return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.getCuratorID'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.toggleFavoriteWorkshop'); + return false; } - async #toggleCuratorLike(link) { - let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - try { - const [ path, name ] = link.split('/'); - if (!(path && name)) { - scripts_echoLog({ - text: i18n('errorLink', link) - }); + } + async function _getWorkshopAppId2(id) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingWorkshopAppId', + text: id + }); + const appId = Steam_classPrivateFieldGet(this, Steam_cache).workshop[id]; + if (appId) { + logStatus.success(); + return appId; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://steamcommunity.com/sharedfiles/filedetails/?id=${id}`, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma11; + const appId = (_data$responseText$ma11 = data.responseText.match(//)) === null || _data$responseText$ma11 === void 0 ? void 0 : _data$responseText$ma11[1]; + if (appId) { + Steam_classPrivateMethodGet(this, Steam_setCache, Steam_setCache2).call(this, 'workshop', id, appId); + logStatus.success(); + return appId; + } + logStatus.error('Error: getWorkshopAppId failed'); return false; } - const curatorId = await this.getCuratorId(path, name); - if (curatorId) { - return await this.#toggleCurator(curatorId, doTask); - } - return false; - } catch (error) { - throwError(error, 'Steam.toggleCuratorLike'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.getWorkshopAppId'); + return false; } - async #getAnnouncementParams(appId, viewId) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingAnnouncementParams', - text: appId, - id: viewId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`, - method: 'GET', - responseType: 'json', - headers: { - Host: 'store.steampowered.com', - Referer: `https://store.steampowered.com/news/app/${appId}/view/${viewId}` - } - }); - if (result === 'Success') { - var _data$response9; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response9 = data.response) === null || _data$response9 === void 0 ? void 0 : _data$response9.success) === 1) { - var _data$response$event; - const { - clanid, - gid - } = ((_data$response$event = data.response.event) === null || _data$response$event === void 0 ? void 0 : _data$response$event.announcement_body) || {}; - if (clanid) { - logStatus.success(); - return { - clanId: clanid, - gid: gid - }; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return {}; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return {}; + } + async function _voteUpWorkshop2(id) { + try { + const logStatus = scripts_echoLog({ + type: 'votingUpWorkshop', + text: id + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://steamcommunity.com/sharedfiles/voteup', + method: 'POST', + responseType: 'json', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + id: id, + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).communitySessionID + }) + }); + if (result === 'Success') { + var _data$response6; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response6 = data.response) === null || _data$response6 === void 0 ? void 0 : _data$response6.success) === 1) { + logStatus.success(); + return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return {}; - } catch (error) { - throwError(error, 'Steam.likeAnnouncement'); - return {}; + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return true; } + logStatus.error(`${result}:${statusText}(${status})`); + return true; + } catch (error) { + throwError(error, 'Steam.voteupWorkshop'); + return true; } - async #likeAnnouncement(id) { - try { - const [ appId, viewId ] = id.split('/'); - if (!(appId && viewId)) { - scripts_echoLog({}).error(`${i18n('missParams')}(id)`); - return false; - } - const { - clanId, - gid - } = await this.#getAnnouncementParams(appId, viewId); - if (!clanId) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'likingAnnouncement', - text: appId, - id: viewId - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/updated/ajaxrateupdate/${gid || viewId}`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', - Host: 'store.steampowered.com', - Origin: 'https://store.steampowered.com', - Referer: `https://store.steampowered.com/news/app/${appId}/view/${viewId}` - }, - data: $.param({ - sessionid: this.#auth.storeSessionID, - voteup: 1, - clanid: clanId, - ajax: 1 - }), - dataType: 'json' + } + async function _toggleCurator2(curatorId) { + let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + try { + if (!doTask && this.whiteList.curators.includes(curatorId)) { + scripts_echoLog({ + type: 'whiteList', + text: 'Steam.unfollowCurator', + id: curatorId }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.response.success === 1) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + return true; + } + const logStatus = scripts_echoLog({ + type: doTask ? 'followingCurator' : 'unfollowingCurator', + text: curatorId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/curators/ajaxfollow', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + data: $.param({ + clanid: curatorId, + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + follow: doTask + }), + dataType: 'json' + }); + if (result === 'Success') { + var _data$response7, _data$response7$succe, _data$response8; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && ((_data$response7 = data.response) === null || _data$response7 === void 0 ? void 0 : (_data$response7$succe = _data$response7.success) === null || _data$response7$succe === void 0 ? void 0 : _data$response7$succe.success) === 1) { + logStatus.success(); + return true; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.likeAnnouncement'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : (_data$response8 = data.response) === null || _data$response8 === void 0 ? void 0 : _data$response8.success}` || `${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.toggleCurator'); + return false; } - async #appid2subid(id) { - try { - const logStatus = scripts_echoLog({ - type: 'gettingSubid', - text: id - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/app/${id}`, - method: 'GET', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' - } + } + async function _toggleCuratorLike2(link) { + let doTask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + try { + const [ path, name ] = link.split('/'); + if (!(path && name)) { + scripts_echoLog({ + text: i18n('errorLink', link) }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$responseText$ma12; - if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) { - logStatus.warning(i18n('changeAreaNotice')); - const result = await this.#changeArea(); - if (!result || result === 'CN' || result === 'skip') { - return false; - } - return await this.#appid2subid(id); - } - const subid = (_data$responseText$ma12 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1]; - if (subid) { - logStatus.success(); - return subid; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.appid2subid'); return false; } + const curatorId = await this.getCuratorId(path, name); + if (curatorId) { + return await Steam_classPrivateMethodGet(this, _toggleCurator, _toggleCurator2).call(this, curatorId, doTask); + } + return false; + } catch (error) { + throwError(error, 'Steam.toggleCuratorLike'); + return false; } - async #getLicenses() { - try { - const logStatus = scripts_echoLog({ - text: i18n('gettingLicenses') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/dynamicstore/userdata/?t=${new Date().getTime()}`, - method: 'GET', - responseType: 'json' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$response10; + } + async function _getAnnouncementParams2(appId, viewId) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingAnnouncementParams', + text: appId, + id: viewId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`, + method: 'GET', + responseType: 'json', + headers: { + Host: 'store.steampowered.com', + Referer: `https://store.steampowered.com/news/app/${appId}/view/${viewId}` + } + }); + if (result === 'Success') { + var _data$response9; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response9 = data.response) === null || _data$response9 === void 0 ? void 0 : _data$response9.success) === 1) { + var _data$response$event; + const { + clanid, + gid + } = ((_data$response$event = data.response.event) === null || _data$response$event === void 0 ? void 0 : _data$response$event.announcement_body) || {}; + if (clanid) { logStatus.success(); - return (_data$response10 = data.response) === null || _data$response10 === void 0 ? void 0 : _data$response10.rgOwnedPackages; + return { + clanId: clanid, + gid: gid + }; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + logStatus.error(`Error:${data.statusText}(${data.status})`); + return {}; } - logStatus.error(`${result}:${statusText}(${status})`); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return {}; + } + logStatus.error(`${result}:${statusText}(${status})`); + return {}; + } catch (error) { + throwError(error, 'Steam.likeAnnouncement'); + return {}; + } + } + async function _likeAnnouncement2(id) { + try { + const [ appId, viewId ] = id.split('/'); + if (!(appId && viewId)) { + scripts_echoLog({}).error(`${i18n('missParams')}(id)`); return false; - } catch (error) { - throwError(error, 'Steam.getLicenses'); + } + const { + clanId, + gid + } = await Steam_classPrivateMethodGet(this, _getAnnouncementParams, _getAnnouncementParams2).call(this, appId, viewId); + if (!clanId) { return false; } - } - async #addLicense(id) { - try { - const [ type, ids ] = id.split('-'); - if (type === 'appid') { - const subid = await this.#appid2subid(ids); - if (!subid) { - return false; - } - const logStatus = scripts_echoLog({ - type: 'addingFreeLicense', - text: ids - }); - if (!await this.#addFreeLicense(subid, logStatus)) { - return false; - } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/app/${ids}`, - method: 'GET' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - if (data.responseText.includes('ds_owned_flag ds_flag') || data.responseText.includes('class="already_in_library"')) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data.statusText}(${data.status})`); - return false; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } else if (type === 'subid') { - if (this.#area === 'CN') { - scripts_echoLog({}).success(i18n('tryChangeAreaNotice')); - await this.#changeArea(); - } - const logStatusArr = {}; - const idsArr = ids.split(','); - for (const subid of idsArr) { - const logStatus = scripts_echoLog({ - type: 'addingFreeLicenseSubid', - text: subid - }); - if (!await this.#addFreeLicense(subid, logStatus)) { - return false; - } - logStatusArr[subid] = logStatus; - } - const licenses = await this.#getLicenses(); - if (!licenses) { - return false; - } - for (const subid of idsArr) { - if (licenses.includes(parseInt(subid, 10))) { - logStatusArr[subid].success(); - } else { - logStatusArr[subid].error(); - } - } + const logStatus = scripts_echoLog({ + type: 'likingAnnouncement', + text: appId, + id: viewId + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/updated/ajaxrateupdate/${gid || viewId}`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + Host: 'store.steampowered.com', + Origin: 'https://store.steampowered.com', + Referer: `https://store.steampowered.com/news/app/${appId}/view/${viewId}` + }, + data: $.param({ + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + voteup: 1, + clanid: clanId, + ajax: 1 + }), + dataType: 'json' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && data.response.success === 1) { + logStatus.success(); return true; } - return false; - } catch (error) { - throwError(error, 'Steam.addLicense'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.likeAnnouncement'); + return false; } - async #addFreeLicense(id, logStatusPre) { - try { - const logStatus = logStatusPre || scripts_echoLog({ - type: 'addingFreeLicenseSubid', - text: id - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://store.steampowered.com/checkout/addfreelicense', - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', - Host: 'store.steampowered.com', - Origin: 'https://store.steampowered.com', - Referer: 'https://store.steampowered.com/account/licenses/' - }, - data: $.param({ - action: 'add_to_cart', - sessionid: this.#auth.storeSessionID, - subid: id - }), - dataType: 'json' - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - if (this.#area === 'CN' && data.responseText.includes('id="error_box"')) { - logStatus.warning(i18n('changeAreaNotice')); - const result = await this.#changeArea(); - if (!result || result === 'CN') { - return false; - } - return await this.#addFreeLicense(id); + } + async function _appid2subid2(id) { + try { + const logStatus = scripts_echoLog({ + type: 'gettingSubid', + text: id + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/app/${id}`, + method: 'GET', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$responseText$ma12; + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && data.responseText.includes('id="error_box"')) { + logStatus.warning(i18n('changeAreaNotice')); + const result = await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this); + if (!result || result === 'CN' || result === 'skip') { + return false; } + return await Steam_classPrivateMethodGet(this, _appid2subid, _appid2subid2).call(this, id); + } + const subid = (_data$responseText$ma12 = data.responseText.match(/name="subid" value="([\d]+?)"/)) === null || _data$responseText$ma12 === void 0 ? void 0 : _data$responseText$ma12[1]; + if (subid) { logStatus.success(); - return true; + return subid; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error(`Error:${data.statusText}(${data.status})`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.addFreeLicense'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.appid2subid'); + return false; } - async #requestPlayTestAccess(id) { - try { - const logStatus = scripts_echoLog({ - type: 'requestingPlayTestAccess', - text: id - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://store.steampowered.com/ajaxrequestplaytestaccess/${id}`, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', - Host: 'store.steampowered.com', - Origin: 'https://store.steampowered.com', - Referer: `https://store.steampowered.com/app/${id}` - }, - data: $.param({ - sessionid: this.#auth.storeSessionID - }), - dataType: 'json' - }); - if (result === 'Success') { - var _data$response11; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response11 = data.response) === null || _data$response11 === void 0 ? void 0 : _data$response11.success) === 1) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + } + async function _getLicenses2() { + try { + const logStatus = scripts_echoLog({ + text: i18n('gettingLicenses') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/dynamicstore/userdata/?t=${new Date().getTime()}`, + method: 'GET', + responseType: 'json' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$response10; + logStatus.success(); + return (_data$response10 = data.response) === null || _data$response10 === void 0 ? void 0 : _data$response10.rgOwnedPackages; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Steam.requestPlayTestAccess'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.getLicenses'); + return false; } - async toggle(_ref) { - let { - doTask = true, - groupLinks = [], - officialGroupLinks = [], - wishlistLinks = [], - followLinks = [], - forumLinks = [], - workshopLinks = [], - workshopVoteLinks = [], - curatorLinks = [], - curatorLikeLinks = [], - announcementLinks = [], - licenseLinks = [], - playtestLinks = [] - } = _ref; - try { - if ([ ...groupLinks, ...officialGroupLinks, ...forumLinks, ...workshopLinks, ...workshopVoteLinks ].length > 0 && !this.#communityInitialized) { - scripts_echoLog({ - text: i18n('needInit') - }); - return false; - } - if ([ ...wishlistLinks, ...followLinks, ...curatorLinks, ...curatorLikeLinks, ...announcementLinks, ...licenseLinks, ...playtestLinks ].length > 0 && !this.#storeInitialized) { - scripts_echoLog({ - text: i18n('needInit') - }); + } + async function _addLicense2(id) { + try { + const [ type, ids ] = id.split('-'); + if (type === 'appid') { + const subid = await Steam_classPrivateMethodGet(this, _appid2subid, _appid2subid2).call(this, ids); + if (!subid) { return false; } - const prom = []; - if (doTask && !globalOptions.doTask.steam.groups || !doTask && !globalOptions.undoTask.steam.groups) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.groups' - }); - } else { - const realGroups = this.getRealParams('groups', groupLinks, doTask, link => { - var _link$match; - return (_link$match = link.match(/groups\/(.+)\/?/)) === null || _link$match === void 0 ? void 0 : _link$match[1]; - }); - if (realGroups.length > 0) { - for (const group of realGroups) { - if (doTask) { - prom.push(this.#joinGroup(group)); - } else { - prom.push(this.#leaveGroup(group)); - } - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.officialGroups || !doTask && !globalOptions.undoTask.steam.officialGroups) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.officialGroups' - }); - } else { - const realOfficialGroups = this.getRealParams('officialGroups', officialGroupLinks, doTask, link => { - var _link$match2; - return (_link$match2 = link.match(/games\/(.+)\/?/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1]; - }); - if (realOfficialGroups.length > 0) { - for (const officialGroup of realOfficialGroups) { - if (doTask) { - prom.push(this.#joinOfficialGroup(officialGroup)); - } else { - prom.push(this.#leaveOfficialGroup(officialGroup)); - } - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.wishlists || !doTask && !globalOptions.undoTask.steam.wishlists) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.wishlists' - }); - } else { - const realWishlists = this.getRealParams('wishlists', wishlistLinks, doTask, link => { - var _link$match3; - return (_link$match3 = link.match(/app\/([\d]+)/)) === null || _link$match3 === void 0 ? void 0 : _link$match3[1]; - }); - if (realWishlists.length > 0) { - for (const game of realWishlists) { - if (doTask) { - prom.push(this.#addToWishlist(game)); - } else { - prom.push(this.#removeFromWishlist(game)); - } - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.follows || !doTask && !globalOptions.undoTask.steam.follows) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.follows' - }); - } else { - const realFollows = this.getRealParams('follows', followLinks, doTask, link => { - var _link$match4; - return (_link$match4 = link.match(/app\/([\d]+)/)) === null || _link$match4 === void 0 ? void 0 : _link$match4[1]; - }); - if (realFollows.length > 0) { - for (const game of realFollows) { - prom.push(this.#toggleFollowGame(game, doTask)); - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.forums || !doTask && !globalOptions.undoTask.steam.forums) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.forums' - }); - } else { - const realForums = this.getRealParams('forums', forumLinks, doTask, link => { - var _link$match5; - return (_link$match5 = link.match(/app\/([\d]+)/)) === null || _link$match5 === void 0 ? void 0 : _link$match5[1]; - }); - if (realForums.length > 0) { - for (const forum of realForums) { - prom.push(this.#toggleForum(forum, doTask)); - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.workshops || !doTask && !globalOptions.undoTask.steam.workshops) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.workshops' - }); - } else { - const realWorkshops = this.getRealParams('workshops', workshopLinks, doTask, link => { - var _link$match6; - return (_link$match6 = link.match(/\?id=([\d]+)/)) === null || _link$match6 === void 0 ? void 0 : _link$match6[1]; - }); - if (realWorkshops.length > 0) { - for (const workshop of realWorkshops) { - prom.push(this.#toggleFavoriteWorkshop(workshop, doTask)); - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.workshopVotes) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.workshopVotes' - }); - } else { - const realworkshopVotes = this.getRealParams('workshopVotes', workshopVoteLinks, doTask, link => { - var _link$match7; - return (_link$match7 = link.match(/\?id=([\d]+)/)) === null || _link$match7 === void 0 ? void 0 : _link$match7[1]; - }); - if (doTask && realworkshopVotes.length > 0) { - for (const workshop of realworkshopVotes) { - prom.push(this.#voteUpWorkshop(workshop)); - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.curators || !doTask && !globalOptions.undoTask.steam.curators) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.curators' - }); - } else { - const realCurators = this.getRealParams('curators', curatorLinks, doTask, link => { - var _link$match8; - return (_link$match8 = link.match(/curator\/([\d]+)/)) === null || _link$match8 === void 0 ? void 0 : _link$match8[1]; - }); - const realCuratorLikes = this.getRealParams('curatorLikes', curatorLikeLinks, doTask, link => { - var _link$match9; - return (_link$match9 = link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)) === null || _link$match9 === void 0 ? void 0 : _link$match9.slice(1, 3).join('/'); - }); - if (realCurators.length > 0) { - for (const curator of realCurators) { - prom.push(this.#toggleCurator(curator, doTask)); - await delay(1e3); - } - } - if (realCuratorLikes.length > 0) { - for (const curatorLike of realCuratorLikes) { - prom.push(this.#toggleCuratorLike(curatorLike, doTask)); - await delay(1e3); - } - } - } - if (doTask && !globalOptions.doTask.steam.announcements) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.announcements' - }); - } else { - const realAnnouncements = this.getRealParams('announcements', announcementLinks, doTask, link => { - var _link$match11; - if (link.includes('store.steampowered.com')) { - var _link$match10; - return (_link$match10 = link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/)) === null || _link$match10 === void 0 ? void 0 : _link$match10.slice(1, 3).join('/'); - } - return (_link$match11 = link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/)) === null || _link$match11 === void 0 ? void 0 : _link$match11.slice(1, 3).join('/'); - }); - if (doTask && realAnnouncements.length > 0) { - for (const id of realAnnouncements) { - prom.push(this.#likeAnnouncement(id)); - await delay(1e3); + const logStatus = scripts_echoLog({ + type: 'addingFreeLicense', + text: ids + }); + if (!await Steam_classPrivateMethodGet(this, _addFreeLicense, _addFreeLicense2).call(this, subid, logStatus)) { + return false; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/app/${ids}`, + method: 'GET' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + if (data.responseText.includes('ds_owned_flag ds_flag') || data.responseText.includes('class="already_in_library"')) { + logStatus.success(); + return true; } + logStatus.error(`Error:${data.statusText}(${data.status})`); + return false; } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; } - if (doTask && !globalOptions.doTask.steam.licenses) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.licenses' + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } else if (type === 'subid') { + if (Steam_classPrivateFieldGet(this, _area) === 'CN') { + scripts_echoLog({}).success(i18n('tryChangeAreaNotice')); + await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this); + } + const logStatusArr = {}; + const idsArr = ids.split(','); + for (const subid of idsArr) { + const logStatus = scripts_echoLog({ + type: 'addingFreeLicenseSubid', + text: subid }); - } else if (doTask && globalOptions.doTask.steam.licenses && licenseLinks.length > 0) { - for (const id of licenseLinks) { - prom.push(this.#addLicense(id)); - await delay(1e3); + if (!await Steam_classPrivateMethodGet(this, _addFreeLicense, _addFreeLicense2).call(this, subid, logStatus)) { + return false; } + logStatusArr[subid] = logStatus; } - if (doTask && !globalOptions.doTask.steam.playtests) { - scripts_echoLog({ - type: 'globalOptionsSkip', - text: 'steam.playtests' - }); - } else { - const realPlaytests = this.getRealParams('playtests', playtestLinks, doTask, link => { - var _link$match12; - return (_link$match12 = link.match(/app\/([\d]+)/)) === null || _link$match12 === void 0 ? void 0 : _link$match12[1]; - }); - if (doTask && globalOptions.doTask.steam.playtests && realPlaytests.length > 0) { - for (const id of realPlaytests) { - prom.push(this.#requestPlayTestAccess(id)); - await delay(1e3); - } + const licenses = await Steam_classPrivateMethodGet(this, _getLicenses, _getLicenses2).call(this); + if (!licenses) { + return false; + } + for (const subid of idsArr) { + if (licenses.includes(parseInt(subid, 10))) { + logStatusArr[subid].success(); + } else { + logStatusArr[subid].error(); } } - return Promise.all(prom).then(async () => { - if (this.#area !== 'CN') { - scripts_echoLog({}).warning(i18n('steamFinishNotice')); - await this.#changeArea('CN'); + return true; + } + return false; + } catch (error) { + throwError(error, 'Steam.addLicense'); + return false; + } + } + async function _addFreeLicense2(id, logStatusPre) { + try { + const logStatus = logStatusPre || scripts_echoLog({ + type: 'addingFreeLicenseSubid', + text: id + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://store.steampowered.com/checkout/addfreelicense', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + Host: 'store.steampowered.com', + Origin: 'https://store.steampowered.com', + Referer: 'https://store.steampowered.com/account/licenses/' + }, + data: $.param({ + action: 'add_to_cart', + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID, + subid: id + }), + dataType: 'json' + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + if (Steam_classPrivateFieldGet(this, _area) === 'CN' && data.responseText.includes('id="error_box"')) { + logStatus.warning(i18n('changeAreaNotice')); + const result = await Steam_classPrivateMethodGet(this, _changeArea, _changeArea2).call(this); + if (!result || result === 'CN') { + return false; + } + return await Steam_classPrivateMethodGet(this, _addFreeLicense, _addFreeLicense2).call(this, id); } + logStatus.success(); return true; - }); - } catch (error) { - throwError(error, 'Steam.toggle'); + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.addFreeLicense'); + return false; } - #setCache(type, name, id) { - try { - this.#cache[type][name] = id; - GM_setValue('steamCache', this.#cache); - } catch (error) { - throwError(error, 'Steam.setCache'); + } + async function _requestPlayTestAccess2(id) { + try { + const logStatus = scripts_echoLog({ + type: 'requestingPlayTestAccess', + text: id + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://store.steampowered.com/ajaxrequestplaytestaccess/${id}`, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + Host: 'store.steampowered.com', + Origin: 'https://store.steampowered.com', + Referer: `https://store.steampowered.com/app/${id}` + }, + data: $.param({ + sessionid: Steam_classPrivateFieldGet(this, Steam_auth).storeSessionID + }), + dataType: 'json' + }); + if (result === 'Success') { + var _data$response11; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response11 = data.response) === null || _data$response11 === void 0 ? void 0 : _data$response11.success) === 1) { + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Steam.requestPlayTestAccess'); + return false; + } + } + function Steam_setCache2(type, name, id) { + try { + Steam_classPrivateFieldGet(this, Steam_cache)[type][name] = id; + GM_setValue('steamCache', Steam_classPrivateFieldGet(this, Steam_cache)); + } catch (error) { + throwError(error, 'Steam.setCache'); } } const social_Steam = Steam; + function Website_classPrivateMethodInitSpec(obj, privateSet) { + Website_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Website_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Website_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Website_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + var _bind = new WeakSet(); class Website { - undoneTasks; - socialTasks; - giveawayId; - socialInitialized = { - discord: false, - instagram: false, - reddit: false, - twitch: false, - twitter: false, - vk: false, - youtube: false, - steamStore: false, - steamCommunity: false - }; - initialized = false; - social = {}; - async #bind(name, init) { - try { - return { - name: name, - result: await init - }; - } catch (error) { - throwError(error, 'Website.bind'); - return { - name: name, - result: false - }; - } + constructor() { + Website_classPrivateMethodInitSpec(this, _bind); + Website_defineProperty(this, 'undoneTasks', void 0); + Website_defineProperty(this, 'socialTasks', void 0); + Website_defineProperty(this, 'giveawayId', void 0); + Website_defineProperty(this, 'socialInitialized', { + discord: false, + instagram: false, + reddit: false, + twitch: false, + twitter: false, + vk: false, + youtube: false, + steamStore: false, + steamCommunity: false + }); + Website_defineProperty(this, 'initialized', false); + Website_defineProperty(this, 'social', {}); } async initSocial(action) { try { @@ -6050,49 +6857,49 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const hasDiscord = Object.values(tasks.discord).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasDiscord && (!this.socialInitialized.discord || !this.social.discord)) { this.social.discord = new social_Discord(); - pro.push(this.#bind('discord', this.social.discord.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'discord', this.social.discord.init())); } } if (tasks.instagram) { const hasInstagram = Object.values(tasks.instagram).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasInstagram && (!this.socialInitialized.instagram || !this.social.instagram)) { this.social.instagram = new social_Instagram(); - pro.push(this.#bind('instagram', this.social.instagram.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'instagram', this.social.instagram.init())); } } if (tasks.reddit) { const hasReddit = Object.values(tasks.reddit).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasReddit && (!this.socialInitialized.reddit || !this.social.reddit)) { this.social.reddit = new social_Reddit(); - pro.push(this.#bind('reddit', this.social.reddit.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'reddit', this.social.reddit.init())); } } if (tasks.twitch) { const hasTwitch = Object.values(tasks.twitch).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasTwitch && (!this.socialInitialized.twitch || !this.social.twitch)) { this.social.twitch = new social_Twitch(); - pro.push(this.#bind('twitch', this.social.twitch.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'twitch', this.social.twitch.init())); } } if (tasks.twitter) { const hasTwitter = Object.values(tasks.twitter).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasTwitter && (!this.socialInitialized.twitter || !this.social.twitter)) { this.social.twitter = new social_Twitter(); - pro.push(this.#bind('twitter', this.social.twitter.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'twitter', this.social.twitter.init())); } } if (tasks.vk) { const hasVk = Object.values(tasks.vk).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasVk && (!this.socialInitialized.vk || !this.social.vk)) { this.social.vk = new social_Vk(); - pro.push(this.#bind('vk', this.social.vk.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'vk', this.social.vk.init())); } } if (tasks.youtube) { const hasYoutube = Object.values(tasks.youtube).reduce((total, arr) => [ ...total, ...arr ]).length > 0; if (hasYoutube && (!this.socialInitialized.youtube || !this.social.youtube)) { this.social.youtube = new Youtube(); - pro.push(this.#bind('youtube', this.social.youtube.init())); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'youtube', this.social.youtube.init())); } } if (tasks.steam) { @@ -6106,10 +6913,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return [ 'groupLinks', 'officialGroupLinks', 'forumLinks', 'workshopLinks', 'workshopVoteLinks' ].includes(type) ? ((_tasks$steam = tasks.steam) === null || _tasks$steam === void 0 ? void 0 : (_tasks$steam$type = _tasks$steam[type]) === null || _tasks$steam$type === void 0 ? void 0 : _tasks$steam$type.length) || 0 : 0; }).reduce((total, number) => total + number, 0); if (steamLength - steamCommunityLength > 0 && !this.socialInitialized.steamStore) { - pro.push(this.#bind('steamStore', this.social.steam.init('store'))); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'steamStore', this.social.steam.init('store'))); } if (steamCommunityLength > 0 && !this.socialInitialized.steamCommunity) { - pro.push(this.#bind('steamCommunity', this.social.steam.init('community'))); + pro.push(Website_classPrivateMethodGet(this, _bind, _bind2).call(this, 'steamCommunity', this.social.steam.init('community'))); } } } @@ -6240,7 +7047,49 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } } } + async function _bind2(name, init) { + try { + return { + name: name, + result: await init + }; + } catch (error) { + throwError(error, 'Website.bind'); + return { + name: name, + result: false + }; + } + } const website_Website = Website; + function FreeAnyWhere_classPrivateMethodInitSpec(obj, privateSet) { + FreeAnyWhere_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function FreeAnyWhere_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function FreeAnyWhere_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function FreeAnyWhere_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const FreeAnyWhere_defaultTasksTemplate = { steam: { groupLinks: [], @@ -6253,12 +7102,21 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }; const FreeAnyWhere_defaultTasks = JSON.stringify(FreeAnyWhere_defaultTasksTemplate); + var _getGiveawayId = new WeakSet(); + var _verify = new WeakSet(); + var _checkLeftKey = new WeakSet(); class FreeAnyWhere extends website_Website { - name = 'FreeAnyWhere'; - tasks = []; - socialTasks = JSON.parse(FreeAnyWhere_defaultTasks); - undoneTasks = JSON.parse(FreeAnyWhere_defaultTasks); - buttons = [ 'doTask', 'undoTask', 'verifyTask', 'getKey' ]; + constructor() { + super(...arguments); + FreeAnyWhere_classPrivateMethodInitSpec(this, _checkLeftKey); + FreeAnyWhere_classPrivateMethodInitSpec(this, _verify); + FreeAnyWhere_classPrivateMethodInitSpec(this, _getGiveawayId); + FreeAnyWhere_defineProperty(this, 'name', 'FreeAnyWhere'); + FreeAnyWhere_defineProperty(this, 'tasks', []); + FreeAnyWhere_defineProperty(this, 'socialTasks', JSON.parse(FreeAnyWhere_defaultTasks)); + FreeAnyWhere_defineProperty(this, 'undoneTasks', JSON.parse(FreeAnyWhere_defaultTasks)); + FreeAnyWhere_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'verifyTask', 'getKey' ]); + } static test() { return window.location.host === 'freeanywhere.net'; } @@ -6285,10 +7143,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } window.location.href = `https://freeanywhere.net/#/giveaway/${id}`; } - if (!this.#getGiveawayId()) { + if (!FreeAnyWhere_classPrivateMethodGet(this, _getGiveawayId, _getGiveawayId2).call(this)) { return false; } - if (!await this.#checkLeftKey()) { + if (!await FreeAnyWhere_classPrivateMethodGet(this, _checkLeftKey, _checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } this.initialized = true; @@ -6431,7 +7289,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } const pro = []; for (const task of this.tasks) { - pro.push(this.#verify(task)); + pro.push(FreeAnyWhere_classPrivateMethodGet(this, _verify, _verify2).call(this, task)); await delay(1e3); } await Promise.all(pro); @@ -6480,97 +7338,125 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #getGiveawayId() { - try { - var _window$location$href2; - const giveawayId = (_window$location$href2 = window.location.href.match(/\/giveaway\/([\d]+)/)) === null || _window$location$href2 === void 0 ? void 0 : _window$location$href2[1]; - if (giveawayId) { - this.giveawayId = giveawayId; - return true; - } - scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); - return false; - } catch (error) { - throwError(error, 'FreeAnyWhere.getGiveawayId'); + } + function _getGiveawayId2() { + try { + var _window$location$href2; + const giveawayId = (_window$location$href2 = window.location.href.match(/\/giveaway\/([\d]+)/)) === null || _window$location$href2 === void 0 ? void 0 : _window$location$href2[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; } + scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); + return false; + } catch (error) { + throwError(error, 'FreeAnyWhere.getGiveawayId'); } - async #verify(task) { - try { - const logStatus = scripts_echoLog({ - html: `
  • ${i18n('verifyingTask')}${task.title.trim()}...
  • ` - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: `https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/challenge-status/${task.id}/?format=json`, - method: 'GET', - dataType: 'json', - headers: { - authorization: `Token ${window.localStorage.getItem('token')}`, - 'x-csrftoken': external_Cookies_namespaceObject.get('csrftoken') - } - }); - if (result === 'Success') { - var _data$response3; - if (data !== null && data !== void 0 && (_data$response3 = data.response) !== null && _data$response3 !== void 0 && _data$response3.status) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; + } + async function _verify2(task) { + try { + const logStatus = scripts_echoLog({ + html: `
  • ${i18n('verifyingTask')}${task.title.trim()}...
  • ` + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/challenge-status/${task.id}/?format=json`, + method: 'GET', + dataType: 'json', + headers: { + authorization: `Token ${window.localStorage.getItem('token')}`, + 'x-csrftoken': external_Cookies_namespaceObject.get('csrftoken') } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Freeanywhere.verify'); + }); + if (result === 'Success') { + var _data$response3; + if (data !== null && data !== void 0 && (_data$response3 = data.response) !== null && _data$response3 !== void 0 && _data$response3.status) { + logStatus.success(); + return true; + } + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Freeanywhere.verify'); + return false; } - async #checkLeftKey() { - try { - var _data$response4; - if (!globalOptions.other.checkLeftKey) { - return true; - } - const { - data - } = await tools_httpRequest({ - url: 'https://freeanywhere.net/api/v1/widget/?format=json', - method: 'GET', - dataType: 'json', - headers: { - authorization: `Token ${window.localStorage.getItem('token')}` - } - }); - if (data !== null && data !== void 0 && (_data$response4 = data.response) !== null && _data$response4 !== void 0 && _data$response4.giveaways.find(giveaway => `${giveaway === null || giveaway === void 0 ? void 0 : giveaway.id}` === this.giveawayId)) { - return true; + } + async function _checkLeftKey2() { + try { + var _data$response4; + if (!globalOptions.other.checkLeftKey) { + return true; + } + const { + data + } = await tools_httpRequest({ + url: 'https://freeanywhere.net/api/v1/widget/?format=json', + method: 'GET', + dataType: 'json', + headers: { + authorization: `Token ${window.localStorage.getItem('token')}` } - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('noKeysLeft'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref => { - let { - value - } = _ref; - if (value) { - window.close(); - } - }); + }); + if (data !== null && data !== void 0 && (_data$response4 = data.response) !== null && _data$response4 !== void 0 && _data$response4.giveaways.find(giveaway => `${giveaway === null || giveaway === void 0 ? void 0 : giveaway.id}` === this.giveawayId)) { return true; - } catch (error) { - throwError(error, 'Giveawaysu.checkLeftKey'); - return false; } + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('noKeysLeft'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref => { + let { + value + } = _ref; + if (value) { + window.close(); + } + }); + return true; + } catch (error) { + throwError(error, 'Giveawaysu.checkLeftKey'); + return false; } } const website_FreeAnyWhere = FreeAnyWhere; + function GiveawaySu_classPrivateMethodInitSpec(obj, privateSet) { + GiveawaySu_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function GiveawaySu_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function GiveawaySu_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function GiveawaySu_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const GiveawaySu_defaultTasks = { steam: { groupLinks: [], @@ -6607,20 +7493,29 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); retweetLinks: [] } }; + var _checkLogin = new WeakSet(); + var GiveawaySu_checkLeftKey = new WeakSet(); + var GiveawaySu_getGiveawayId = new WeakSet(); class GiveawaySu extends website_Website { - name = 'GiveawaySu'; - socialTasks = GiveawaySu_defaultTasks; - undoneTasks = GiveawaySu_defaultTasks; - buttons = [ 'doTask', 'undoTask' ]; + constructor() { + super(...arguments); + GiveawaySu_classPrivateMethodInitSpec(this, GiveawaySu_getGiveawayId); + GiveawaySu_classPrivateMethodInitSpec(this, GiveawaySu_checkLeftKey); + GiveawaySu_classPrivateMethodInitSpec(this, _checkLogin); + GiveawaySu_defineProperty(this, 'name', 'GiveawaySu'); + GiveawaySu_defineProperty(this, 'socialTasks', GiveawaySu_defaultTasks); + GiveawaySu_defineProperty(this, 'undoneTasks', GiveawaySu_defaultTasks); + GiveawaySu_defineProperty(this, 'buttons', [ 'doTask', 'undoTask' ]); + } static test() { return /^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href); } async after() { try { - if (!this.#checkLogin()) { + if (!GiveawaySu_classPrivateMethodGet(this, _checkLogin, _checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } - if (!await this.#checkLeftKey()) { + if (!await GiveawaySu_classPrivateMethodGet(this, GiveawaySu_checkLeftKey, GiveawaySu_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } scripts_echoLog({}).warning(i18n('gsNotice')); @@ -6638,7 +7533,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!GiveawaySu_classPrivateMethodGet(this, GiveawaySu_getGiveawayId, GiveawaySu_getGiveawayId2).call(this)) { return false; } this.initialized = true; @@ -6746,73 +7641,111 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { - return true; - } - if ($('a.steam-login').length > 0) { - window.open('/steam/redirect', '_self'); - } + } + function _checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { return true; - } catch (error) { - throwError(error, 'Giveawaysu.checkLogin'); - return false; } - } - async #checkLeftKey() { - try { - if (!globalOptions.other.checkLeftKey) { - return true; - } - if ($('.giveaway-ended').length > 0 && $('.giveaway-key').length === 0) { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('noKeysLeft'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref => { - let { - value - } = _ref; - if (value) { - window.close(); - } - }); - } - return true; - } catch (error) { - throwError(error, 'Giveawaysu.checkLeftKey'); - return false; + if ($('a.steam-login').length > 0) { + window.open('/steam/redirect', '_self'); } + return true; + } catch (error) { + throwError(error, 'Giveawaysu.checkLogin'); + return false; } - #getGiveawayId() { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/\/view\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; + } + async function GiveawaySu_checkLeftKey2() { + try { + if (!globalOptions.other.checkLeftKey) { return true; } - scripts_echoLog({ - text: i18n('getFailed', 'GiveawayId') - }); + if ($('.giveaway-ended').length > 0 && $('.giveaway-key').length === 0) { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('noKeysLeft'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref => { + let { + value + } = _ref; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Giveawaysu.checkLeftKey'); return false; } } + function GiveawaySu_getGiveawayId2() { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/\/view\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; + } + scripts_echoLog({ + text: i18n('getFailed', 'GiveawayId') + }); + return false; + } + function Indiedb_classPrivateMethodInitSpec(obj, privateSet) { + Indiedb_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Indiedb_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Indiedb_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Indiedb_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + var _join = new WeakSet(); + var _do = new WeakSet(); + var Indiedb_checkLogin = new WeakSet(); + var Indiedb_checkLeftKey = new WeakSet(); class Indiedb { - name = 'Indiedb'; - buttons = [ 'doTask' ]; + constructor() { + Indiedb_classPrivateMethodInitSpec(this, Indiedb_checkLeftKey); + Indiedb_classPrivateMethodInitSpec(this, Indiedb_checkLogin); + Indiedb_classPrivateMethodInitSpec(this, _do); + Indiedb_classPrivateMethodInitSpec(this, _join); + Indiedb_defineProperty(this, 'name', 'Indiedb'); + Indiedb_defineProperty(this, 'buttons', [ 'doTask' ]); + } static test() { return window.location.host === 'www.indiedb.com'; } async after() { try { - if (!this.#checkLogin()) { + if (!Indiedb_classPrivateMethodGet(this, Indiedb_checkLogin, Indiedb_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } - if (!await this.#checkLeftKey()) { + if (!await Indiedb_classPrivateMethodGet(this, Indiedb_checkLeftKey, Indiedb_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } } catch (error) { @@ -6821,291 +7754,319 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } async doTask() { try { - if (!await this.#join()) { + if (!await Indiedb_classPrivateMethodGet(this, _join, _join2).call(this)) { return false; } - return await this.#do(); + return await Indiedb_classPrivateMethodGet(this, _do, _do2).call(this); } catch (error) { throwError(error, 'Indiedb.doTask'); return false; } } - async #join() { - try { - if ($('a.buttonenter:contains(Register to join)').length > 0) { - scripts_echoLog({}).error(i18n('needLogin')); - return false; - } - const currentoption = $('a.buttonenter.buttongiveaway'); - if (/join giveaway/gim.test(currentoption.text())) { - const logStatus = scripts_echoLog({ - text: `${i18n('joiningGiveaway')}...` - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: currentoption.attr('href'), - method: 'POST', - data: 'ajax=t', - dataType: 'json', - headers: { - 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', - accept: 'application/json, text/javascript, */*; q=0.01', - origin: window.location.origin - } - }); - if (result === 'Success') { - if ((data === null || data === void 0 ? void 0 : data.status) === 200) { - var _data$response, _data$response4, _data$response5; - if ((_data$response = data.response) !== null && _data$response !== void 0 && _data$response.success) { - var _data$response2, _data$response3; - currentoption.addClass('buttonentered').text('Success - Giveaway joined'); - $('#giveawaysjoined').slideDown(); - $('#giveawaysrecommend').slideDown(); - logStatus.success(`Success${(_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.text ? `:${(_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.text}` : ''}`); - return true; - } - logStatus.error(`Error${(_data$response4 = data.response) !== null && _data$response4 !== void 0 && _data$response4.text ? `:${(_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : _data$response5.text}` : ''}`); - return false; + } + async function _join2() { + try { + if ($('a.buttonenter:contains(Register to join)').length > 0) { + scripts_echoLog({}).error(i18n('needLogin')); + return false; + } + const currentoption = $('a.buttonenter.buttongiveaway'); + if (/join giveaway/gim.test(currentoption.text())) { + const logStatus = scripts_echoLog({ + text: `${i18n('joiningGiveaway')}...` + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: currentoption.attr('href'), + method: 'POST', + data: 'ajax=t', + dataType: 'json', + headers: { + 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', + accept: 'application/json, text/javascript, */*; q=0.01', + origin: window.location.origin + } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + var _data$response, _data$response4, _data$response5; + if ((_data$response = data.response) !== null && _data$response !== void 0 && _data$response.success) { + var _data$response2, _data$response3; + currentoption.addClass('buttonentered').text('Success - Giveaway joined'); + $('#giveawaysjoined').slideDown(); + $('#giveawaysrecommend').slideDown(); + logStatus.success(`Success${(_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.text ? `:${(_data$response3 = data.response) === null || _data$response3 === void 0 ? void 0 : _data$response3.text}` : ''}`); + return true; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error(`Error${(_data$response4 = data.response) !== null && _data$response4 !== void 0 && _data$response4.text ? `:${(_data$response5 = data.response) === null || _data$response5 === void 0 ? void 0 : _data$response5.text}` : ''}`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; - } else if (/success/gim.test($('a.buttonenter.buttongiveaway').text())) { - return true; } - scripts_echoLog({}).warning(i18n('needJoinGiveaway')); - return false; - } catch (error) { - throwError(error, 'Indiedb.init'); + logStatus.error(`${result}:${statusText}(${status})`); return false; + } else if (/success/gim.test($('a.buttonenter.buttongiveaway').text())) { + return true; } + scripts_echoLog({}).warning(i18n('needJoinGiveaway')); + return false; + } catch (error) { + throwError(error, 'Indiedb.init'); + return false; } - async #do() { - try { - const id = $('script').map((index, script) => { - if (/\$\(document\)/gim.test(script.innerHTML)) { - var _script$innerHTML$mat, _script$innerHTML$mat2, _script$innerHTML$mat3, _script$innerHTML$mat4, _script$innerHTML$mat5, _script$innerHTML$mat6; - return [ (_script$innerHTML$mat = script.innerHTML.match(/"\/[\d]+"/gim)) === null || _script$innerHTML$mat === void 0 ? void 0 : (_script$innerHTML$mat2 = _script$innerHTML$mat[0]) === null || _script$innerHTML$mat2 === void 0 ? void 0 : (_script$innerHTML$mat3 = _script$innerHTML$mat2.match(/[\d]+/)) === null || _script$innerHTML$mat3 === void 0 ? void 0 : _script$innerHTML$mat3[0], (_script$innerHTML$mat4 = script.innerHTML.match(/"\/newsletter\/ajax\/subscribeprofile\/optin\/[\d]+"/gim)) === null || _script$innerHTML$mat4 === void 0 ? void 0 : (_script$innerHTML$mat5 = _script$innerHTML$mat4[0]) === null || _script$innerHTML$mat5 === void 0 ? void 0 : (_script$innerHTML$mat6 = _script$innerHTML$mat5.match(/[\d]+/)) === null || _script$innerHTML$mat6 === void 0 ? void 0 : _script$innerHTML$mat6[0] ]; - } - return null; - }); - if (id.length === 2) { - const pro = []; - const tasks = $('#giveawaysjoined a[class*=promo]'); - for (const task of tasks) { - const promo = $(task); - if (!promo.hasClass('buttonentered')) { - const status = scripts_echoLog({ - text: `${i18n('doing')}:${promo.parents('p').text()}...` - }); - if (/facebookpromo|twitterpromo|visitpromo/gim.test(task.className)) { - let text = ''; - if (promo.hasClass('facebookpromo')) { - text = 'facebookpromo'; - } else if (promo.hasClass('twitterpromo')) { - text = 'twitterpromo'; - } else { - text = 'visitpromo'; - } - pro.push(new Promise(resolve => { - $.ajax({ - type: 'POST', - url: urlPath(`/giveaways/ajax/${text}/${id[0]}`), - timeout: 6e4, - dataType: 'json', - data: { - ajax: 't' - }, - error(response, error, exception) { - if (window.DEBUG) { - console.log('%cAuto-Task[Debug]:', 'color:red', { - response: response, - error: error, - exception: exception - }); - } - status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + } + async function _do2() { + try { + const id = $('script').map((index, script) => { + if (/\$\(document\)/gim.test(script.innerHTML)) { + var _script$innerHTML$mat, _script$innerHTML$mat2, _script$innerHTML$mat3, _script$innerHTML$mat4, _script$innerHTML$mat5, _script$innerHTML$mat6; + return [ (_script$innerHTML$mat = script.innerHTML.match(/"\/[\d]+"/gim)) === null || _script$innerHTML$mat === void 0 ? void 0 : (_script$innerHTML$mat2 = _script$innerHTML$mat[0]) === null || _script$innerHTML$mat2 === void 0 ? void 0 : (_script$innerHTML$mat3 = _script$innerHTML$mat2.match(/[\d]+/)) === null || _script$innerHTML$mat3 === void 0 ? void 0 : _script$innerHTML$mat3[0], (_script$innerHTML$mat4 = script.innerHTML.match(/"\/newsletter\/ajax\/subscribeprofile\/optin\/[\d]+"/gim)) === null || _script$innerHTML$mat4 === void 0 ? void 0 : (_script$innerHTML$mat5 = _script$innerHTML$mat4[0]) === null || _script$innerHTML$mat5 === void 0 ? void 0 : (_script$innerHTML$mat6 = _script$innerHTML$mat5.match(/[\d]+/)) === null || _script$innerHTML$mat6 === void 0 ? void 0 : _script$innerHTML$mat6[0] ]; + } + return null; + }); + if (id.length === 2) { + const pro = []; + const tasks = $('#giveawaysjoined a[class*=promo]'); + for (const task of tasks) { + const promo = $(task); + if (!promo.hasClass('buttonentered')) { + const status = scripts_echoLog({ + text: `${i18n('doing')}:${promo.parents('p').text()}...` + }); + if (/facebookpromo|twitterpromo|visitpromo/gim.test(task.className)) { + let text = ''; + if (promo.hasClass('facebookpromo')) { + text = 'facebookpromo'; + } else if (promo.hasClass('twitterpromo')) { + text = 'twitterpromo'; + } else { + text = 'visitpromo'; + } + pro.push(new Promise(resolve => { + $.ajax({ + type: 'POST', + url: urlPath(`/giveaways/ajax/${text}/${id[0]}`), + timeout: 6e4, + dataType: 'json', + data: { + ajax: 't' + }, + error(response, error, exception) { + if (window.DEBUG) { + console.log('%cAuto-Task[Debug]:', 'color:red', { + response: response, + error: error, + exception: exception + }); + } + status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + resolve(true); + }, + success(response) { + if (response.success) { + status.success(`Success:${response.text}`); + promo.addClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); resolve(true); - }, - success(response) { - if (response.success) { - status.success(`Success:${response.text}`); - promo.addClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); - resolve(true); - } else { - status.error(`Error:${response.text}`); - resolve(true); - } + } else { + status.error(`Error:${response.text}`); + resolve(true); + } + } + }); + })); + } else if (promo.hasClass('emailoptinpromo')) { + pro.push(new Promise(resolve => { + $.ajax({ + type: 'POST', + url: urlPath(`/newsletter/ajax/subscribeprofile/optin/${id[1]}`), + timeout: 6e4, + dataType: 'json', + data: { + ajax: 't', + emailsystoggle: 4 + }, + error(response, error, exception) { + if (window.DEBUG) { + console.log('%cAuto-Task[Debug]:', 'color:red', { + response: response, + error: error, + exception: exception + }); } - }); - })); - } else if (promo.hasClass('emailoptinpromo')) { - pro.push(new Promise(resolve => { - $.ajax({ - type: 'POST', - url: urlPath(`/newsletter/ajax/subscribeprofile/optin/${id[1]}`), - timeout: 6e4, - dataType: 'json', - data: { - ajax: 't', - emailsystoggle: 4 - }, - error(response, error, exception) { - if (window.DEBUG) { - console.log('%cAuto-Task[Debug]:', 'color:red', { - response: response, - error: error, - exception: exception - }); - } - status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + resolve(true); + }, + success(response) { + if (response.success) { + status.success(`Success:${response.text}`); + promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); resolve(true); - }, - success(response) { - if (response.success) { - status.success(`Success:${response.text}`); - promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); - resolve(true); - } else { - status.error(`Error:${response.text}`); - resolve(true); - } + } else { + status.error(`Error:${response.text}`); + resolve(true); + } + } + }); + })); + } else if (promo.hasClass('watchingpromo')) { + pro.push(new Promise(resolve => { + var _promo$attr; + const data = getUrlQuery(promo.attr('href')); + data.ajax = 't'; + $.ajax({ + type: 'POST', + url: urlPath((_promo$attr = promo.attr('href')) === null || _promo$attr === void 0 ? void 0 : _promo$attr.split(/[?#]/)[0]), + timeout: 6e4, + dataType: 'json', + data: data, + error(response, error, exception) { + if (window.DEBUG) { + console.log('%cAuto-Task[Debug]:', 'color:red', { + response: response, + error: error, + exception: exception + }); } - }); - })); - } else if (promo.hasClass('watchingpromo')) { - pro.push(new Promise(resolve => { - var _promo$attr; - const data = getUrlQuery(promo.attr('href')); - data.ajax = 't'; - $.ajax({ - type: 'POST', - url: urlPath((_promo$attr = promo.attr('href')) === null || _promo$attr === void 0 ? void 0 : _promo$attr.split(/[?#]/)[0]), - timeout: 6e4, - dataType: 'json', - data: data, - error(response, error, exception) { - if (window.DEBUG) { - console.log('%cAuto-Task[Debug]:', 'color:red', { - response: response, - error: error, - exception: exception - }); - } - status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + resolve(true); + }, + success(response) { + if (response.success) { + status.success(`Success:${response.text}`); + promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); resolve(true); - }, - success(response) { - if (response.success) { - status.success(`Success:${response.text}`); - promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); - resolve(true); - } else { - status.error(`Error:${response.text}`); - resolve(true); - } + } else { + status.error(`Error:${response.text}`); + resolve(true); + } + } + }); + })); + } else if (!/the-challenge-of-adblock/gim.test(promo.attr('href'))) { + pro.push(new Promise(resolve => { + $.ajax({ + type: 'POST', + url: urlPath(promo.attr('href')), + timeout: 6e4, + dataType: 'json', + data: { + ajax: 't' + }, + error(response, error, exception) { + if (window.DEBUG) { + console.log('%cAuto-Task[Debug]:', 'color:red', { + response: response, + error: error, + exception: exception + }); } - }); - })); - } else if (!/the-challenge-of-adblock/gim.test(promo.attr('href'))) { - pro.push(new Promise(resolve => { - $.ajax({ - type: 'POST', - url: urlPath(promo.attr('href')), - timeout: 6e4, - dataType: 'json', - data: { - ajax: 't' - }, - error(response, error, exception) { - if (window.DEBUG) { - console.log('%cAuto-Task[Debug]:', 'color:red', { - response: response, - error: error, - exception: exception - }); - } - status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + status.error('Error:An error has occurred performing the action requested. Please try again shortly.'); + resolve(true); + }, + success(response) { + if (response.success) { + status.success(`Success:${response.text}`); + promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); + resolve(true); + } else { + status.error(`Error:${response.text}`); resolve(true); - }, - success(response) { - if (response.success) { - status.success(`Success:${response.text}`); - promo.toggleClass('buttonentered').closest('p').html(promo.closest('p').find('span').html()); - resolve(true); - } else { - status.error(`Error:${response.text}`); - resolve(true); - } } - }); - })); - } else { - status.error(`Error:${i18n('unKnownTaskType')}`); - } + } + }); + })); + } else { + status.error(`Error:${i18n('unKnownTaskType')}`); } } - await Promise.all(pro); - scripts_echoLog({}).success(i18n('allTasksComplete')); - return true; } - scripts_echoLog({}).error(i18n('getFailed', 'TaskId')); - return false; - } catch (error) { - throwError(error, 'Indiedb.classifyTask'); - return false; + await Promise.all(pro); + scripts_echoLog({}).success(i18n('allTasksComplete')); + return true; } + scripts_echoLog({}).error(i18n('getFailed', 'TaskId')); + return false; + } catch (error) { + throwError(error, 'Indiedb.classifyTask'); + return false; } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { - return true; - } - if ($('a.buttonenter:contains(Register to join)').length > 0) { - window.open('/members/login', '_self'); - } + } + function Indiedb_checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { return true; - } catch (error) { - throwError(error, 'Indiedb.checkLogin'); - return false; } + if ($('a.buttonenter:contains(Register to join)').length > 0) { + window.open('/members/login', '_self'); + } + return true; + } catch (error) { + throwError(error, 'Indiedb.checkLogin'); + return false; } - async #checkLeftKey() { - try { - if (!globalOptions.other.checkLeftKey) { - return true; - } - if ($('a.buttonenter:contains("next time"),a.buttonenter:contains("Giveaway is closed")').length > 0) { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('giveawayEnded'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref => { - let { - value - } = _ref; - if (value) { - window.close(); - } - }); - } + } + async function Indiedb_checkLeftKey2() { + try { + if (!globalOptions.other.checkLeftKey) { return true; - } catch (error) { - throwError(error, 'Indiedb.checkLeftKey'); - return false; } + if ($('a.buttonenter:contains("next time"),a.buttonenter:contains("Giveaway is closed")').length > 0) { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('giveawayEnded'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref => { + let { + value + } = _ref; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Indiedb.checkLeftKey'); + return false; } } const website_Indiedb = Indiedb; + function Keyhub_classPrivateMethodInitSpec(obj, privateSet) { + Keyhub_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Keyhub_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Keyhub_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Keyhub_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const Keyhub_defaultTasksTemplate = { steam: { groupLinks: [], @@ -7122,20 +8083,31 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); links: [] }; const Keyhub_defaultTasks = JSON.stringify(Keyhub_defaultTasksTemplate); + var _doScriptTask = new WeakSet(); + var Keyhub_getGiveawayId = new WeakSet(); + var Keyhub_checkLeftKey = new WeakSet(); + var Keyhub_checkLogin = new WeakSet(); class Keyhub extends website_Website { - name = 'Keyhub'; - socialTasks = JSON.parse(Keyhub_defaultTasks); - undoneTasks = JSON.parse(Keyhub_defaultTasks); - buttons = [ 'doTask', 'undoTask' ]; + constructor() { + super(...arguments); + Keyhub_classPrivateMethodInitSpec(this, Keyhub_checkLogin); + Keyhub_classPrivateMethodInitSpec(this, Keyhub_checkLeftKey); + Keyhub_classPrivateMethodInitSpec(this, Keyhub_getGiveawayId); + Keyhub_classPrivateMethodInitSpec(this, _doScriptTask); + Keyhub_defineProperty(this, 'name', 'Keyhub'); + Keyhub_defineProperty(this, 'socialTasks', JSON.parse(Keyhub_defaultTasks)); + Keyhub_defineProperty(this, 'undoneTasks', JSON.parse(Keyhub_defaultTasks)); + Keyhub_defineProperty(this, 'buttons', [ 'doTask', 'undoTask' ]); + } static test() { return window.location.host === 'key-hub.eu'; } async after() { try { - if (!this.#checkLogin()) { + if (!Keyhub_classPrivateMethodGet(this, Keyhub_checkLogin, Keyhub_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } - if (!await this.#checkLeftKey()) { + if (!await Keyhub_classPrivateMethodGet(this, Keyhub_checkLeftKey, Keyhub_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } $('.NSFW').hide(); @@ -7153,7 +8125,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!Keyhub_classPrivateMethodGet(this, Keyhub_getGiveawayId, Keyhub_getGiveawayId2).call(this)) { return false; } $('#VPNoverlay').hide(); @@ -7235,51 +8207,18 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } } logStatus.success(); - this.undoneTasks = this.uniqueTasks(this.undoneTasks); - this.socialTasks = this.uniqueTasks(this.socialTasks); - if (window.DEBUG) { - console.log('%cAuto-Task[Debug]:', 'color:blue', JSON.stringify(this)); - } - GM_setValue(`khTasks-${this.giveawayId}`, { - tasks: this.socialTasks, - time: new Date().getTime() - }); - return true; - } catch (error) { - throwError(error, 'Keyhub.classifyTask'); - return false; - } - } - async #doScriptTask(data) { - try { - const logStatus = scripts_echoLog({ - text: i18n('doingKeyhubTask') - }); - const { - result, - statusText, - status, - data: response - } = await tools_httpRequest({ - url: `/away?data=${data}`, - method: 'GET', - headers: { - origin: 'https://key-hub.eu', - referer: 'https://key-hub.eu/' - } - }); - if (result === 'Success') { - if ((response === null || response === void 0 ? void 0 : response.status) === 200) { - logStatus.success(); - return true; - } - logStatus.error(`Error:${response === null || response === void 0 ? void 0 : response.statusText}(${response === null || response === void 0 ? void 0 : response.status})`); - return false; + this.undoneTasks = this.uniqueTasks(this.undoneTasks); + this.socialTasks = this.uniqueTasks(this.socialTasks); + if (window.DEBUG) { + console.log('%cAuto-Task[Debug]:', 'color:blue', JSON.stringify(this)); } - logStatus.error(`${result}:${statusText}(${status})`); - return false; + GM_setValue(`khTasks-${this.giveawayId}`, { + tasks: this.socialTasks, + time: new Date().getTime() + }); + return true; } catch (error) { - throwError(error, 'Keyhub.doScriptTask'); + throwError(error, 'Keyhub.classifyTask'); return false; } } @@ -7290,7 +8229,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); try { const pro = []; for (const data of videoTasks) { - pro.push(this.#doScriptTask(data)); + pro.push(Keyhub_classPrivateMethodGet(this, _doScriptTask, _doScriptTask2).call(this, data)); } return Promise.all(pro).then(() => true); } catch (error) { @@ -7298,66 +8237,127 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #getGiveawayId() { - try { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/giveaway\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; + } + async function _doScriptTask2(data) { + try { + const logStatus = scripts_echoLog({ + text: i18n('doingKeyhubTask') + }); + const { + result, + statusText, + status, + data: response + } = await tools_httpRequest({ + url: `/away?data=${data}`, + method: 'GET', + headers: { + origin: 'https://key-hub.eu', + referer: 'https://key-hub.eu/' + } + }); + if (result === 'Success') { + if ((response === null || response === void 0 ? void 0 : response.status) === 200) { + logStatus.success(); return true; } - scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); - return false; - } catch (error) { - throwError(error, 'Keyhub.getGiveawayId'); + logStatus.error(`Error:${response === null || response === void 0 ? void 0 : response.statusText}(${response === null || response === void 0 ? void 0 : response.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Keyhub.doScriptTask'); + return false; } - async #checkLeftKey() { - try { - if (!globalOptions.other.checkLeftKey) { - return true; - } - const leftKey = $('#keysleft').text().trim(); - if (leftKey === '0') { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('noKeysLeft'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref2 => { - let { - value - } = _ref2; - if (value) { - window.close(); - } - }); - } + } + function Keyhub_getGiveawayId2() { + try { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/giveaway\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; return true; - } catch (error) { - throwError(error, 'Keyhub.checkLeftKey'); - return false; } + scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); + return false; + } catch (error) { + throwError(error, 'Keyhub.getGiveawayId'); + return false; } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { - return true; - } - if ($('a[href*="/connect/steam"]').length > 0) { - window.open('/connect/steam', '_self'); - } + } + async function Keyhub_checkLeftKey2() { + try { + if (!globalOptions.other.checkLeftKey) { + return true; + } + const leftKey = $('#keysleft').text().trim(); + if (leftKey === '0') { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('noKeysLeft'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref2 => { + let { + value + } = _ref2; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Keyhub.checkLeftKey'); + return false; + } + } + function Keyhub_checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { return true; - } catch (error) { - throwError(error, 'Keyhub.checkLogin'); - return false; } + if ($('a[href*="/connect/steam"]').length > 0) { + window.open('/connect/steam', '_self'); + } + return true; + } catch (error) { + throwError(error, 'Keyhub.checkLogin'); + return false; } } const website_Keyhub = Keyhub; + function Givekey_classPrivateMethodInitSpec(obj, privateSet) { + Givekey_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Givekey_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Givekey_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Givekey_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const Givekey_defaultTasksTemplate = { steam: { groupLinks: [], @@ -7376,13 +8376,22 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }; const Givekey_defaultTasks = JSON.stringify(Givekey_defaultTasksTemplate); + var Givekey_verify = new WeakSet(); + var Givekey_getGiveawayId = new WeakSet(); + var Givekey_checkLeftKey = new WeakSet(); class Givekey extends website_Website { - name = 'Givekey'; - tasks = []; - socialTasks = JSON.parse(Givekey_defaultTasks); - undoneTasks = JSON.parse(Givekey_defaultTasks); - userId; - buttons = [ 'doTask', 'undoTask', 'verifyTask' ]; + constructor() { + super(...arguments); + Givekey_classPrivateMethodInitSpec(this, Givekey_checkLeftKey); + Givekey_classPrivateMethodInitSpec(this, Givekey_getGiveawayId); + Givekey_classPrivateMethodInitSpec(this, Givekey_verify); + Givekey_defineProperty(this, 'name', 'Givekey'); + Givekey_defineProperty(this, 'tasks', []); + Givekey_defineProperty(this, 'socialTasks', JSON.parse(Givekey_defaultTasks)); + Givekey_defineProperty(this, 'undoneTasks', JSON.parse(Givekey_defaultTasks)); + Givekey_defineProperty(this, 'userId', void 0); + Givekey_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'verifyTask' ]); + } static test() { return window.location.host === 'givekey.ru'; } @@ -7396,7 +8405,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }); }); - if (!await this.#checkLeftKey()) { + if (!await Givekey_classPrivateMethodGet(this, Givekey_checkLeftKey, Givekey_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } } catch (error) { @@ -7414,7 +8423,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!Givekey_classPrivateMethodGet(this, Givekey_getGiveawayId, Givekey_getGiveawayId2).call(this)) { return false; } const userId = $('meta[name="user-id"]').attr('content'); @@ -7536,7 +8545,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); scripts_echoLog({}).warning(i18n('giveKeyNoticeBefore')); const taskLength = this.tasks.length; for (let i = 0; i < taskLength; i++) { - await this.#verify(this.tasks[i]); + await Givekey_classPrivateMethodGet(this, Givekey_verify, Givekey_verify2).call(this, this.tasks[i]); if (i < taskLength - 1) { await delay(15e3); } @@ -7551,107 +8560,144 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - async #verify(task) { - try { - const logStatus = scripts_echoLog({ - html: `
  • ${i18n('verifyingTask')}${task}...
  • ` - }); - return await new Promise(resolve => { - $.ajax({ - url: 'https://givekey.ru/giveaway/task', - method: 'POST', - data: `id=${task}&user_id=${this.userId}`, - dataType: 'json', - headers: { - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') - }, - success: data => { - if (data.btn) { - $(`button[data-id=${this.userId}]`).html(data.btn); - } - if (data.status === 'ok') { - $(`.task_check_${data.id}`).html(``); - logStatus.success(); - resolve(true); - } else if (data.status === 'end') { - logStatus.success(); - scripts_echoLog({}).success(data.key); - resolve(true); - } else { - logStatus.error(`Error:${data.msg}`); - resolve(false); - } - }, - error: xhr => { - logStatus.error(`Error:${xhr.statusText}(${xhr.status})`); + } + async function Givekey_verify2(task) { + try { + const logStatus = scripts_echoLog({ + html: `
  • ${i18n('verifyingTask')}${task}...
  • ` + }); + return await new Promise(resolve => { + $.ajax({ + url: 'https://givekey.ru/giveaway/task', + method: 'POST', + data: `id=${task}&user_id=${this.userId}`, + dataType: 'json', + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + }, + success: data => { + if (data.btn) { + $(`button[data-id=${this.userId}]`).html(data.btn); + } + if (data.status === 'ok') { + $(`.task_check_${data.id}`).html(``); + logStatus.success(); + resolve(true); + } else if (data.status === 'end') { + logStatus.success(); + scripts_echoLog({}).success(data.key); + resolve(true); + } else { + logStatus.error(`Error:${data.msg}`); resolve(false); } - }); + }, + error: xhr => { + logStatus.error(`Error:${xhr.statusText}(${xhr.status})`); + resolve(false); + } }); - } catch (error) { - throwError(error, 'Givekey.verify'); - return false; - } + }); + } catch (error) { + throwError(error, 'Givekey.verify'); + return false; } - #getGiveawayId() { - try { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/giveaway\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; - return true; - } - scripts_echoLog({ - text: i18n('getFailed', 'GiveawayId') - }); - return false; - } catch (error) { - throwError(error, 'Givekey.getGiveawayId'); - return false; + } + function Givekey_getGiveawayId2() { + try { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/giveaway\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; } + scripts_echoLog({ + text: i18n('getFailed', 'GiveawayId') + }); + return false; + } catch (error) { + throwError(error, 'Givekey.getGiveawayId'); + return false; } - async #checkLeftKey() { - try { - if (!globalOptions.other.checkLeftKey) { - return true; - } - if (!$('#keys_count').text()) { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('noKeysLeft'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref => { - let { - value - } = _ref; - if (value) { - window.close(); - } - }); - } + } + async function Givekey_checkLeftKey2() { + try { + if (!globalOptions.other.checkLeftKey) { return true; - } catch (error) { - throwError(error, 'Givekey.checkLeftKey'); - return false; } + if (!$('#keys_count').text()) { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('noKeysLeft'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref => { + let { + value + } = _ref; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Givekey.checkLeftKey'); + return false; } } const website_Givekey = Givekey; + function GiveeClub_classPrivateMethodInitSpec(obj, privateSet) { + GiveeClub_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function GiveeClub_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function GiveeClub_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function GiveeClub_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + var GiveeClub_checkLogin = new WeakSet(); + var GiveeClub_getGiveawayId = new WeakSet(); + var GiveeClub_checkLeftKey = new WeakSet(); class GiveeClub extends GiveawaySu { - name = 'GiveeClub'; - buttons = [ 'doTask', 'undoTask', 'verifyTask' ]; + constructor() { + super(...arguments); + GiveeClub_classPrivateMethodInitSpec(this, GiveeClub_checkLeftKey); + GiveeClub_classPrivateMethodInitSpec(this, GiveeClub_getGiveawayId); + GiveeClub_classPrivateMethodInitSpec(this, GiveeClub_checkLogin); + GiveeClub_defineProperty(this, 'name', 'GiveeClub'); + GiveeClub_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'verifyTask' ]); + } static test() { return /^https?:\/\/givee\.club\/.*?\/event\/[\d]+/.test(window.location.href); } async after() { try { - if (!this.#checkLogin()) { + if (!GiveeClub_classPrivateMethodGet(this, GiveeClub_checkLogin, GiveeClub_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } - if (!await this.#checkLeftKey()) { + if (!await GiveeClub_classPrivateMethodGet(this, GiveeClub_checkLeftKey, GiveeClub_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } } catch (error) { @@ -7663,11 +8709,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const logStatus = scripts_echoLog({ text: i18n('initing') }); - if (!this.#checkLogin()) { + if (!GiveeClub_classPrivateMethodGet(this, GiveeClub_checkLogin, GiveeClub_checkLogin2).call(this)) { logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!GiveeClub_classPrivateMethodGet(this, GiveeClub_getGiveawayId, GiveeClub_getGiveawayId2).call(this)) { return false; } this.initialized = true; @@ -7793,80 +8839,114 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { - return true; - } - if ($('a[href*="/account/auth"]').length > 0) { - window.open($('a[href*="/account/auth"]').attr('href'), '_self'); - } + } + function GiveeClub_checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { return true; - } catch (error) { - throwError(error, 'GiveeClub.checkLogin'); - return false; } - } - #getGiveawayId() { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/\/event\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; - return true; + if ($('a[href*="/account/auth"]').length > 0) { + window.open($('a[href*="/account/auth"]').attr('href'), '_self'); } - scripts_echoLog({ - text: i18n('getFailed', 'GiveawayId') - }); + return true; + } catch (error) { + throwError(error, 'GiveeClub.checkLogin'); return false; } - async #checkLeftKey() { - try { - if (!globalOptions.other.checkLeftKey) { - return true; - } - if ($('.event-ended').length > 0 && $('.event-winner').length === 0) { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('giveawayEnded'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref => { - let { - value - } = _ref; - if (value) { - window.close(); - } - }); - } + } + function GiveeClub_getGiveawayId2() { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/\/event\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; + } + scripts_echoLog({ + text: i18n('getFailed', 'GiveawayId') + }); + return false; + } + async function GiveeClub_checkLeftKey2() { + try { + if (!globalOptions.other.checkLeftKey) { return true; - } catch (error) { - throwError(error, 'Giveawaysu.checkLeftKey'); - return false; } + if ($('.event-ended').length > 0 && $('.event-winner').length === 0) { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('giveawayEnded'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref => { + let { + value + } = _ref; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Giveawaysu.checkLeftKey'); + return false; + } + } + const website_GiveeClub = GiveeClub; + function OpiumPulses_classPrivateMethodInitSpec(obj, privateSet) { + OpiumPulses_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function OpiumPulses_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function OpiumPulses_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; } + return obj; + } + function OpiumPulses_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; } - const website_GiveeClub = GiveeClub; const defaultOptions = { maxPoint: '99999999' }; + var _toggleTask = new WeakSet(); + var OpiumPulses_checkLogin = new WeakSet(); class OpiumPulses { - name = 'OpiumPulses'; - options = { - ...defaultOptions, - ...GM_getValue('OpiumPulsesOptions') - }; - maxPoints = 99999999; - myPoints = 0; - buttons = [ 'doFreeTask', 'doPointTask' ]; + constructor() { + OpiumPulses_classPrivateMethodInitSpec(this, OpiumPulses_checkLogin); + OpiumPulses_classPrivateMethodInitSpec(this, _toggleTask); + OpiumPulses_defineProperty(this, 'name', 'OpiumPulses'); + OpiumPulses_defineProperty(this, 'options', { + ...defaultOptions, + ...GM_getValue('OpiumPulsesOptions') + }); + OpiumPulses_defineProperty(this, 'maxPoints', 99999999); + OpiumPulses_defineProperty(this, 'myPoints', 0); + OpiumPulses_defineProperty(this, 'buttons', [ 'doFreeTask', 'doPointTask' ]); + } static test() { return window.location.host === 'www.opiumpulses.com'; } async after() { try { - if (!this.#checkLogin()) { + if (!OpiumPulses_classPrivateMethodGet(this, OpiumPulses_checkLogin, OpiumPulses_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } this.maxPoints = parseInt(this.options.maxPoint, 10); @@ -7876,7 +8956,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } async doFreeTask() { try { - this.#toggleTask('FREE'); + OpiumPulses_classPrivateMethodGet(this, _toggleTask, _toggleTask2).call(this, 'FREE'); } catch (error) { throwError(error, 'OpiumPulses.doFreeTask'); } @@ -7885,90 +8965,90 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); try { var _$$text$match; this.myPoints = parseInt(((_$$text$match = $('.page-header__nav-func-user-nav-items.points-items').text().match(/[\d]+/gim)) === null || _$$text$match === void 0 ? void 0 : _$$text$match[0]) || '0', 10); - this.#toggleTask('points'); + OpiumPulses_classPrivateMethodGet(this, _toggleTask, _toggleTask2).call(this, 'points'); } catch (error) { throwError(error, 'OpiumPulses.doPointTask'); } } - async #toggleTask(type) { - try { - const items = $(`.giveaways-page-item:contains('${type}'):not(:contains('ENTERED'))`); - for (const item of items) { - var _$$find$text$match; - const needPoints = parseInt(((_$$find$text$match = $(item).find('.giveaways-page-item-header-points').text().match(/[\d]+/gim)) === null || _$$find$text$match === void 0 ? void 0 : _$$find$text$match[0]) || '999999', 10); - const name = $(item).find('.giveaways-page-item-footer-name').text().trim(); - if (type === 'points' && needPoints > this.myPoints) { - scripts_echoLog({}).warning(`${i18n('noPoints')}: ${name}`); - } else if (type === 'points' && !needPoints) { - scripts_echoLog({}).warning(`${i18n('getNeedPointsFailed')}: ${name}`); - } else if (!(type === 'points' && needPoints > this.maxPoints)) { - var _aElement$attr; - const logStatus = scripts_echoLog({ - text: `${i18n('joiningLottery')}${name}...` - }); - const aElement = $(item).find('a.giveaways-page-item-img-btn-enter:contains(\'enter\')'); - if (aElement !== null && aElement !== void 0 && (_aElement$attr = aElement.attr('onclick')) !== null && _aElement$attr !== void 0 && _aElement$attr.includes('checkUser')) { - var _aElement$attr2, _aElement$attr2$match; - const giveawayId = (_aElement$attr2 = aElement.attr('onclick')) === null || _aElement$attr2 === void 0 ? void 0 : (_aElement$attr2$match = _aElement$attr2.match(/[\d]+/)) === null || _aElement$attr2$match === void 0 ? void 0 : _aElement$attr2$match[0]; - if (giveawayId) { - checkUser(giveawayId); - } - } - if (!aElement.attr('href')) { - logStatus.error('Error: No "href".'); - continue; + init() { + return true; + } + classifyTask() { + return true; + } + } + async function _toggleTask2(type) { + try { + const items = $(`.giveaways-page-item:contains('${type}'):not(:contains('ENTERED'))`); + for (const item of items) { + var _$$find$text$match; + const needPoints = parseInt(((_$$find$text$match = $(item).find('.giveaways-page-item-header-points').text().match(/[\d]+/gim)) === null || _$$find$text$match === void 0 ? void 0 : _$$find$text$match[0]) || '999999', 10); + const name = $(item).find('.giveaways-page-item-footer-name').text().trim(); + if (type === 'points' && needPoints > this.myPoints) { + scripts_echoLog({}).warning(`${i18n('noPoints')}: ${name}`); + } else if (type === 'points' && !needPoints) { + scripts_echoLog({}).warning(`${i18n('getNeedPointsFailed')}: ${name}`); + } else if (!(type === 'points' && needPoints > this.maxPoints)) { + var _aElement$attr; + const logStatus = scripts_echoLog({ + text: `${i18n('joiningLottery')}${name}...` + }); + const aElement = $(item).find('a.giveaways-page-item-img-btn-enter:contains(\'enter\')'); + if (aElement !== null && aElement !== void 0 && (_aElement$attr = aElement.attr('onclick')) !== null && _aElement$attr !== void 0 && _aElement$attr.includes('checkUser')) { + var _aElement$attr2, _aElement$attr2$match; + const giveawayId = (_aElement$attr2 = aElement.attr('onclick')) === null || _aElement$attr2 === void 0 ? void 0 : (_aElement$attr2$match = _aElement$attr2.match(/[\d]+/)) === null || _aElement$attr2$match === void 0 ? void 0 : _aElement$attr2$match[0]; + if (giveawayId) { + checkUser(giveawayId); } - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: aElement.attr('href'), - method: 'GET' - }); - if (result === 'Success') { - if (data !== null && data !== void 0 && data.responseText && /You've entered this giveaway/gim.test(data.responseText)) { - var _data$responseText$ma; - logStatus.success(); - const points = (_data$responseText$ma = data.responseText.match(/Points:[\s]*?([\d]+)/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; - if (type === 'points' && points) { - this.myPoints = parseInt(points, 10); - } - } else { - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + } + if (!aElement.attr('href')) { + logStatus.error('Error: No "href".'); + continue; + } + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: aElement.attr('href'), + method: 'GET' + }); + if (result === 'Success') { + if (data !== null && data !== void 0 && data.responseText && /You've entered this giveaway/gim.test(data.responseText)) { + var _data$responseText$ma; + logStatus.success(); + const points = (_data$responseText$ma = data.responseText.match(/Points:[\s]*?([\d]+)/)) === null || _data$responseText$ma === void 0 ? void 0 : _data$responseText$ma[1]; + if (type === 'points' && points) { + this.myPoints = parseInt(points, 10); } } else { - logStatus.error(`${result}:${statusText}(${status})`); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); } + } else { + logStatus.error(`${result}:${statusText}(${status})`); } } - scripts_echoLog({ - text: '-----END-----' - }); - } catch (error) { - throwError(error, 'OpiumPulses.toggleTask'); } + scripts_echoLog({ + text: '-----END-----' + }); + } catch (error) { + throwError(error, 'OpiumPulses.toggleTask'); } - init() { - return true; - } - classifyTask() { - return true; - } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { - return true; - } - if ($('a[href*="/site/login"]').length > 1) { - window.open('/site/login', '_self'); - } + } + function OpiumPulses_checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { return true; - } catch (error) { - throwError(error, 'OpiumPulses.checkLogin'); - return false; } + if ($('a[href*="/site/login"]').length > 1) { + window.open('/site/login', '_self'); + } + return true; + } catch (error) { + throwError(error, 'OpiumPulses.checkLogin'); + return false; } } const website_OpiumPulses = OpiumPulses; @@ -8203,6 +9283,34 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }; const website_leftKeyChecker = leftKeyChecker; + function Keylol_classPrivateMethodInitSpec(obj, privateSet) { + Keylol_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Keylol_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Keylol_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Keylol_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const Keylol_defaultTasksTemplate = { steam: { groupLinks: [], @@ -8240,11 +9348,16 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }; const Keylol_defaultTasks = JSON.stringify(Keylol_defaultTasksTemplate); + var _addBtn = new WeakSet(); class Keylol extends website_Website { - name = 'Keylol'; - socialTasks = JSON.parse(Keylol_defaultTasks); - undoneTasks = JSON.parse(Keylol_defaultTasks); - buttons = [ 'doTask', 'undoTask', 'selectAll', 'selectNone', 'invertSelect' ]; + constructor() { + super(...arguments); + Keylol_classPrivateMethodInitSpec(this, _addBtn); + Keylol_defineProperty(this, 'name', 'Keylol'); + Keylol_defineProperty(this, 'socialTasks', JSON.parse(Keylol_defaultTasks)); + Keylol_defineProperty(this, 'undoneTasks', JSON.parse(Keylol_defaultTasks)); + Keylol_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'selectAll', 'selectNone', 'invertSelect' ]); + } static test() { var _$$eq$attr, _$$eq$attr2; return window.location.host === 'keylol.com' && (!!((_$$eq$attr = $('.subforum_left_title_left_up a').eq(3).attr('href')) !== null && _$$eq$attr !== void 0 && _$$eq$attr.includes('319')) || !!((_$$eq$attr2 = $('.subforum_left_title_left_up a').eq(3).attr('href')) !== null && _$$eq$attr2 !== void 0 && _$$eq$attr2.includes('234'))); @@ -8271,7 +9384,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!(link && /^https?:\/\/discord\.com\/invite\/.+/.test(link))) { continue; } - this.#addBtn(discordLink, 'discord', 'serverLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, discordLink, 'discord', 'serverLinks', link); } } if (redditLinks.length > 0) { @@ -8280,7 +9393,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!(link && /^https?:\/\/www\.reddit\.com\/(r|user)\/.+/.test(link))) { continue; } - this.#addBtn(redditLink, 'reddit', 'redditLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, redditLink, 'reddit', 'redditLinks', link); } } if (insLinks.length > 0) { @@ -8289,7 +9402,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!(link && /^https:\/\/www\.instagram\.com\/.+/.test(link))) { continue; } - this.#addBtn(insLink, 'instagram', 'userLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, insLink, 'instagram', 'userLinks', link); } } if (twitterLinks.length > 0) { @@ -8299,9 +9412,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); continue; } if (/https:\/\/twitter\.com\/.*?\/status\/[\d]+/.test(link)) { - this.#addBtn(twitterLink, 'twitter', 'retweetLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, twitterLink, 'twitter', 'retweetLinks', link); } else { - this.#addBtn(twitterLink, 'twitter', 'userLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, twitterLink, 'twitter', 'userLinks', link); } } } @@ -8311,7 +9424,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!(link && /^https:\/\/(www\.)?twitch\.tv\/.+/.test(link))) { continue; } - this.#addBtn(twitchLink, 'twitch', 'channelLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, twitchLink, 'twitch', 'channelLinks', link); } } if (vkLinks.length > 0) { @@ -8320,7 +9433,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!(link && /^https:\/\/vk\.com\/.+/.test(link))) { continue; } - this.#addBtn(vkLink, 'vk', 'nameLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, vkLink, 'vk', 'nameLinks', link); } } if (steamStoreLinks.length > 0) { @@ -8330,14 +9443,14 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); continue; } if (/curator\/[\d]+/.test(link)) { - this.#addBtn(steamStoreLink, 'steam', 'curatorLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamStoreLink, 'steam', 'curatorLinks', link); } else if (/(publisher|developer|franchise)\/.+/.test(link)) { - this.#addBtn(steamStoreLink, 'steam', 'curatorLikeLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamStoreLink, 'steam', 'curatorLikeLinks', link); } else if (/news(hub)?\/app\/[\d]+\/view\/[\d]+/.test(link)) { - this.#addBtn(steamStoreLink, 'steam', 'announcementLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamStoreLink, 'steam', 'announcementLinks', link); } else if (/app\/[\d]+/.test(link)) { - this.#addBtn(steamStoreLink, 'steam', 'followLinks', link); - this.#addBtn(steamStoreLink, 'steam', 'wishlistLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamStoreLink, 'steam', 'followLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamStoreLink, 'steam', 'wishlistLinks', link); } } } @@ -8348,9 +9461,9 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); continue; } if (/groups\/.+/.test(link)) { - this.#addBtn(steamCommunityLink, 'steam', 'groupLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamCommunityLink, 'steam', 'groupLinks', link); } else if (/announcements\/detail\/[\d]+/.test(link)) { - this.#addBtn(steamCommunityLink, 'steam', 'announcementLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, steamCommunityLink, 'steam', 'announcementLinks', link); } } } @@ -8360,8 +9473,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!link) { continue; } - this.#addBtn(ytbLink, 'youtube', 'channelLinks', link); - this.#addBtn(ytbLink, 'youtube', 'likeLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, ytbLink, 'youtube', 'channelLinks', link); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, ytbLink, 'youtube', 'likeLinks', link); } } const giveawayLinks = mainPost.find('a[href*="giveaway.su/giveaway/view/"]:visible,a[href*="givee.club/"]:visible,a[href*="gleam.io/"]:visible,a[href*="www.indiedb.com/giveaways/"]:visible,a[href*="key-hub.eu/giveaway/"]:visible,a[href*="opquests.com/quests/"]:visible,a[href*="itch.io/s/"]:visible'); @@ -8393,7 +9506,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!link) { continue; } - this.#addBtn($(`a[href="${link}"]`).after(' | ').next()[0], 'steam', 'licenseLinks', `appid-${link.replace('#asf', '')}`); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, $(`a[href="${link}"]`).after(' | ').next()[0], 'steam', 'licenseLinks', `appid-${link.replace('#asf', '')}`); } } const subLinks = mainPost.find('a[href*="steamdb.info/sub/"]:visible'); @@ -8408,7 +9521,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!subid) { continue; } - this.#addBtn(subLink, 'steam', 'licenseLinks', `subid-${subid}`); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, subLink, 'steam', 'licenseLinks', `subid-${subid}`); } } const asfLinks2 = mainPost.find('.blockcode:contains("addlicense"):visible'); @@ -8418,7 +9531,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (!subid || subid.length === 0) { continue; } - this.#addBtn($(asfLink).children('em')[0], 'steam', 'licenseLinks', `subid-${subid.join(',')}`); + Keylol_classPrivateMethodGet(this, _addBtn, _addBtn2).call(this, $(asfLink).children('em')[0], 'steam', 'licenseLinks', `subid-${subid.join(',')}`); } } } @@ -8480,15 +9593,43 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); throwError(error, 'Keylol.invertSelect'); } } - #addBtn(before, social, linkType, link) { - try { - $(before).after('${linkType.replace('Links', '')}`); - } catch (error) { - throwError(error, 'keylol.addBtn'); - } + } + function _addBtn2(before, social, linkType, link) { + try { + $(before).after('${linkType.replace('Links', '')}`); + } catch (error) { + throwError(error, 'keylol.addBtn'); } } const website_Keylol = Keylol; + function Opquests_classPrivateMethodInitSpec(obj, privateSet) { + Opquests_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Opquests_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Opquests_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Opquests_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const Opquests_defaultTasks = { steam: { groupLinks: [], @@ -8497,18 +9638,29 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); curatorLikeLinks: [] } }; + var _confirm = new WeakSet(); + var Opquests_verify = new WeakSet(); + var Opquests_getGiveawayId = new WeakSet(); + var Opquests_checkLogin = new WeakSet(); class Opquests extends website_Website { - name = 'Opquests'; - undoneTasks = { - ...Opquests_defaultTasks - }; - buttons = [ 'doTask', 'verifyTask', 'getKey' ]; + constructor() { + super(...arguments); + Opquests_classPrivateMethodInitSpec(this, Opquests_checkLogin); + Opquests_classPrivateMethodInitSpec(this, Opquests_getGiveawayId); + Opquests_classPrivateMethodInitSpec(this, Opquests_verify); + Opquests_classPrivateMethodInitSpec(this, _confirm); + Opquests_defineProperty(this, 'name', 'Opquests'); + Opquests_defineProperty(this, 'undoneTasks', { + ...Opquests_defaultTasks + }); + Opquests_defineProperty(this, 'buttons', [ 'doTask', 'verifyTask', 'getKey' ]); + } static test() { return window.location.host === 'opquests.com'; } async after() { try { - if (!this.#checkLogin()) { + if (!Opquests_classPrivateMethodGet(this, Opquests_checkLogin, Opquests_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } } catch (error) { @@ -8525,7 +9677,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!Opquests_classPrivateMethodGet(this, Opquests_getGiveawayId, Opquests_getGiveawayId2).call(this)) { return false; } this.initialized = true; @@ -8586,9 +9738,10 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); taskId: $(ele).find('input[name="task_id"]').val(), title: $(ele).find('span.text-sm').text().trim() })); + await Opquests_classPrivateMethodGet(this, _confirm, _confirm2).call(this); const pro = []; for (const task of tasks) { - pro.push(this.#verify(task)); + pro.push(Opquests_classPrivateMethodGet(this, Opquests_verify, Opquests_verify2).call(this, task)); await delay(1e3); } await Promise.all(pro); @@ -8603,51 +9756,6 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - async #verify(task) { - try { - const logStatus = scripts_echoLog({ - html: `
  • ${i18n('verifyingTask')}${task.title.trim()}...
  • ` - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://opquests.com/entries', - method: 'POST', - dataType: 'json', - nochche: true, - headers: { - origin: 'https://opquests.com', - pragma: 'no-cache', - referer: window.location.href, - 'content-type': 'application/x-www-form-urlencoded' - }, - data: `_token=${task.token}&task_id=${task.taskId}` - }); - if (result === 'Success') { - var _data$responseText, _data$responseText2, _$$find$attr; - if (data !== null && data !== void 0 && (_data$responseText = data.responseText) !== null && _data$responseText !== void 0 && _data$responseText.includes('Successfully completed task') || data !== null && data !== void 0 && (_data$responseText2 = data.responseText) !== null && _data$responseText2 !== void 0 && _data$responseText2.includes('unlocked the key')) { - logStatus.success(); - return true; - } - const key = (_$$find$attr = $((data === null || data === void 0 ? void 0 : data.responseText) || '').find('button[data-clipboard-text]:contains("Copy")').attr('data-clipboard-text')) === null || _$$find$attr === void 0 ? void 0 : _$$find$attr.trim(); - if (key) { - logStatus.success(); - scripts_echoLog({}).success(key); - return true; - } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); - return false; - } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Opquests.verify'); - return false; - } - } async getKey(isButton) { try { const logStatus = scripts_echoLog({ @@ -8686,37 +9794,144 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #getGiveawayId() { - try { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/quests\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; + } + async function _confirm2() { + try { + const logStatus = scripts_echoLog({ + html: `
  • ${i18n('confirmingTask')}...
  • ` + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: `https://opquests.com/quests/${this.giveawayId}?confirm=1`, + method: 'POST', + nochche: true, + headers: { + origin: 'https://opquests.com', + referer: `https://opquests.com/warning?id=${this.giveawayId}` + } + }); + if (result === 'Success') { + if ((data === null || data === void 0 ? void 0 : data.status) === 200) { + logStatus.success(); return true; } - scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); - return false; - } catch (error) { - throwError(error, 'Opquests.getGiveawayId'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Opquests.confirm'); + return false; } - #checkLogin() { - try { - if (!globalOptions.other.checkLogin) { + } + async function Opquests_verify2(task) { + try { + const logStatus = scripts_echoLog({ + html: `
  • ${i18n('verifyingTask')}${task.title.trim()}...
  • ` + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://opquests.com/entries', + method: 'POST', + dataType: 'json', + nochche: true, + headers: { + origin: 'https://opquests.com', + pragma: 'no-cache', + referer: window.location.href, + 'content-type': 'application/x-www-form-urlencoded' + }, + data: `_token=${task.token}&task_id=${task.taskId}` + }); + if (result === 'Success') { + var _data$responseText, _data$responseText2, _$$find$attr; + if (data !== null && data !== void 0 && (_data$responseText = data.responseText) !== null && _data$responseText !== void 0 && _data$responseText.includes('Successfully completed task') || data !== null && data !== void 0 && (_data$responseText2 = data.responseText) !== null && _data$responseText2 !== void 0 && _data$responseText2.includes('unlocked the key')) { + logStatus.success(); return true; } - if ($('a[href*="/auth/redirect"]').length > 0) { - window.open('/auth/redirect', '_self'); + const key = (_$$find$attr = $((data === null || data === void 0 ? void 0 : data.responseText) || '').find('button[data-clipboard-text]:contains("Copy")').attr('data-clipboard-text')) === null || _$$find$attr === void 0 ? void 0 : _$$find$attr.trim(); + if (key) { + logStatus.success(); + scripts_echoLog({}).success(key); + return true; } - return true; - } catch (error) { - throwError(error, 'Opquests.checkLogin'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Opquests.verify'); + return false; + } + } + function Opquests_getGiveawayId2() { + try { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/quests\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; + } + scripts_echoLog({}).error(i18n('getFailed', 'GiveawayId')); + return false; + } catch (error) { + throwError(error, 'Opquests.getGiveawayId'); + return false; + } + } + function Opquests_checkLogin2() { + try { + if (!globalOptions.other.checkLogin) { + return true; + } + if ($('a[href*="/auth/redirect"]').length > 0) { + window.open('/auth/redirect', '_self'); + } + return true; + } catch (error) { + throwError(error, 'Opquests.checkLogin'); + return false; } } const website_Opquests = Opquests; + function Gleam_classPrivateMethodInitSpec(obj, privateSet) { + Gleam_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Gleam_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Gleam_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Gleam_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const Gleam_defaultTasksTemplate = { steam: { groupLinks: [], @@ -8747,15 +9962,28 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); vlootUsername: '', gameroundUsername: '' }; + var _checkSync = new WeakSet(); + var _doGleamTask = new WeakSet(); + var Gleam_getGiveawayId = new WeakSet(); + var _getGleamLink = new WeakSet(); + var Gleam_checkLeftKey = new WeakSet(); class Gleam extends website_Website { - name = 'Gleam'; - undoneTasks = JSON.parse(Gleam_defaultTasks); - socialTasks = JSON.parse(Gleam_defaultTasks); - options = { - ...Gleam_defaultOptions, - ...GM_getValue('GleamOptions') - }; - buttons = [ 'doTask', 'undoTask', 'verifyTask' ]; + constructor() { + super(...arguments); + Gleam_classPrivateMethodInitSpec(this, Gleam_checkLeftKey); + Gleam_classPrivateMethodInitSpec(this, _getGleamLink); + Gleam_classPrivateMethodInitSpec(this, Gleam_getGiveawayId); + Gleam_classPrivateMethodInitSpec(this, _doGleamTask); + Gleam_classPrivateMethodInitSpec(this, _checkSync); + Gleam_defineProperty(this, 'name', 'Gleam'); + Gleam_defineProperty(this, 'undoneTasks', JSON.parse(Gleam_defaultTasks)); + Gleam_defineProperty(this, 'socialTasks', JSON.parse(Gleam_defaultTasks)); + Gleam_defineProperty(this, 'options', { + ...Gleam_defaultOptions, + ...GM_getValue('GleamOptions') + }); + Gleam_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'verifyTask' ]); + } static test() { return window.location.host === 'gleam.io'; } @@ -8785,7 +10013,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); await delay(1e3); } scripts_echoLog({}).warning(i18n('gleamTaskNotice')); - } else if (!await this.#checkLeftKey()) { + } else if (!await Gleam_classPrivateMethodGet(this, Gleam_checkLeftKey, Gleam_checkLeftKey2).call(this)) { scripts_echoLog({}).warning(i18n('checkLeftKeyFailed')); } } catch (error) { @@ -8798,7 +10026,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const logStatus = scripts_echoLog({ text: i18n('initing') }); - if (!this.#getGiveawayId()) { + if (!Gleam_classPrivateMethodGet(this, Gleam_getGiveawayId, Gleam_getGiveawayId2).call(this)) { return false; } this.initialized = true; @@ -8946,7 +10174,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if (action !== 'do') { continue; } - const gleamLink = await this.#getGleamLink(taskText); + const gleamLink = await Gleam_classPrivateMethodGet(this, _getGleamLink, _getGleamLink2).call(this, taskText); if (!gleamLink) { continue; } @@ -8978,7 +10206,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); try { const pro = []; for (const link of gleam) { - pro.push(this.#doGleamTask(link)); + pro.push(Gleam_classPrivateMethodGet(this, _doGleamTask, _doGleamTask2).call(this, link)); } return Promise.all(pro).then(() => true); } catch (error) { @@ -9000,12 +10228,12 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const taskInfo = $task.find('.user-links'); taskInfo[0].click(); await delay(500); - await this.#checkSync(); + await Gleam_classPrivateMethodGet(this, _checkSync, _checkSync2).call(this); const continueBtn = $task.find('.expandable').find('span:contains(Continue),button:contains(Continue)'); for (const button of continueBtn) { button.click(); await delay(500); - await this.#checkSync(); + await Gleam_classPrivateMethodGet(this, _checkSync, _checkSync2).call(this); } } scripts_echoLog({ @@ -9016,159 +10244,198 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - async #checkSync() { - try { - return await new Promise(resolve => { - const checker = setInterval(() => { - if ($('.entry-content .entry-method i.fa-sync').length === 0) { - clearInterval(checker); - resolve(true); - } - }, 500); - }); - } catch (error) { - throwError(error, 'Gleam.checkSync'); - return false; - } - } - async #doGleamTask(link) { - try { - const logStatus = scripts_echoLog({ - text: i18n('doingGleamTask') - }); - return await new Promise(resolve => { - GM_openInTab(`${link}?8b07d23f4bfa65f9`, { - active: true, - insert: true, - setParent: true - }).onclose = () => { - logStatus.success(); + } + async function _checkSync2() { + try { + return await new Promise(resolve => { + const checker = setInterval(() => { + if ($('.entry-content .entry-method i.fa-sync').length === 0) { + clearInterval(checker); resolve(true); - }; - }); - } catch (error) { - throwError(error, 'Gleam.doGleamTask'); - return false; - } + } + }, 500); + }); + } catch (error) { + throwError(error, 'Gleam.checkSync'); + return false; } - #getGiveawayId() { - try { - const giveawayId = window.location.pathname; - if (giveawayId) { - this.giveawayId = giveawayId; - return true; - } - scripts_echoLog({ - text: i18n('getFailed', 'GiveawayId') - }); - return false; - } catch (error) { - throwError(error, 'Gleam.getGiveawayId'); - return false; + } + async function _doGleamTask2(link) { + try { + const logStatus = scripts_echoLog({ + text: i18n('doingGleamTask') + }); + return await new Promise(resolve => { + GM_openInTab(`${link}?8b07d23f4bfa65f9`, { + active: true, + insert: true, + setParent: true + }).onclose = () => { + logStatus.success(); + resolve(true); + }; + }); + } catch (error) { + throwError(error, 'Gleam.doGleamTask'); + return false; + } + } + function Gleam_getGiveawayId2() { + try { + const giveawayId = window.location.pathname; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; } + scripts_echoLog({ + text: i18n('getFailed', 'GiveawayId') + }); + return false; + } catch (error) { + throwError(error, 'Gleam.getGiveawayId'); + return false; } - async #getGleamLink(title) { - try { - const logStatus = scripts_echoLog({ - text: i18n('gettingGleamLink') - }); - const { - result, - statusText, - status, - data - } = await tools_httpRequest({ - url: 'https://www.vloot.io/api/v1/giveaways', - method: 'GET', - responseType: 'json' - }); - if (result === 'Success') { - var _data$response, _data$response2; - if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.Success) === true && data !== null && data !== void 0 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.Data) { - const { - link - } = data.response.Data.find(giveaway => title.replace(/[\s]/g, '').toLowerCase().includes(giveaway.title.replace(/[\s]/g, '').toLowerCase())) || {}; - if (link) { - logStatus.success(); - return link; - } - logStatus.error(`Error:${i18n('getLinkFailed')}`); - return false; + } + async function _getGleamLink2(title) { + try { + const logStatus = scripts_echoLog({ + text: i18n('gettingGleamLink') + }); + const { + result, + statusText, + status, + data + } = await tools_httpRequest({ + url: 'https://www.vloot.io/api/v1/giveaways', + method: 'GET', + responseType: 'json' + }); + if (result === 'Success') { + var _data$response, _data$response2; + if ((data === null || data === void 0 ? void 0 : data.status) === 200 && (data === null || data === void 0 ? void 0 : (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.Success) === true && data !== null && data !== void 0 && (_data$response2 = data.response) !== null && _data$response2 !== void 0 && _data$response2.Data) { + const { + link + } = data.response.Data.find(giveaway => title.replace(/[\s]/g, '').toLowerCase().includes(giveaway.title.replace(/[\s]/g, '').toLowerCase())) || {}; + if (link) { + logStatus.success(); + return link; } - logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); + logStatus.error(`Error:${i18n('getLinkFailed')}`); return false; } - logStatus.error(`${result}:${statusText}(${status})`); - return false; - } catch (error) { - throwError(error, 'Gleam.getGleamLink'); + logStatus.error(`Error:${data === null || data === void 0 ? void 0 : data.statusText}(${data === null || data === void 0 ? void 0 : data.status})`); return false; } + logStatus.error(`${result}:${statusText}(${status})`); + return false; + } catch (error) { + throwError(error, 'Gleam.getGleamLink'); + return false; } - async #checkLeftKey() { - try { - var _$$attr, _$$attr$match, _$$attr2, _$$attr2$match; - if (!globalOptions.other.checkLeftKey) { - return true; - } - const campaignString = (_$$attr = $('div.popup-blocks-container').attr('ng-init')) === null || _$$attr === void 0 ? void 0 : (_$$attr$match = _$$attr.match(/initCampaign\(([\w\W]+?)\)$/)) === null || _$$attr$match === void 0 ? void 0 : _$$attr$match[1]; - if (!campaignString) { - return false; - } - const { - campaign, - incentive - } = JSON.parse(campaignString); - const controllerString = (_$$attr2 = $('div.campaign.reward').attr('ng-init')) === null || _$$attr2 === void 0 ? void 0 : (_$$attr2$match = _$$attr2.match(/initContestant\(([\w\W]+?)\);/)) === null || _$$attr2$match === void 0 ? void 0 : _$$attr2$match[1]; - let ownedKey = false; - if (controllerString) { - var _JSON$parse$contestan, _JSON$parse$contestan2, _JSON$parse$contestan3, _JSON$parse$contestan4; - if ((_JSON$parse$contestan = JSON.parse(controllerString).contestant) !== null && _JSON$parse$contestan !== void 0 && (_JSON$parse$contestan2 = _JSON$parse$contestan.claims) !== null && _JSON$parse$contestan2 !== void 0 && (_JSON$parse$contestan3 = _JSON$parse$contestan2.incentives) !== null && _JSON$parse$contestan3 !== void 0 && (_JSON$parse$contestan4 = _JSON$parse$contestan3[incentive.id]) !== null && _JSON$parse$contestan4 !== void 0 && _JSON$parse$contestan4.length) { - ownedKey = true; - } - } - if (campaign.banned || campaign.finished && !ownedKey || campaign.paused || new Date().getTime() < campaign.starts_at * 1e3) { - await external_Swal_default().fire({ - icon: 'warning', - title: i18n('notice'), - text: i18n('giveawayNotWork'), - confirmButtonText: i18n('confirm'), - cancelButtonText: i18n('cancel'), - showCancelButton: true - }).then(_ref2 => { - let { - value - } = _ref2; - if (value) { - window.close(); - } - }); - } + } + async function Gleam_checkLeftKey2() { + try { + var _$$attr, _$$attr$match, _$$attr2, _$$attr2$match; + if (!globalOptions.other.checkLeftKey) { return true; - } catch (error) { - throwError(error, 'Gleam.checkLeftKey'); + } + const campaignString = (_$$attr = $('div.popup-blocks-container').attr('ng-init')) === null || _$$attr === void 0 ? void 0 : (_$$attr$match = _$$attr.match(/initCampaign\(([\w\W]+?)\)$/)) === null || _$$attr$match === void 0 ? void 0 : _$$attr$match[1]; + if (!campaignString) { return false; } + const { + campaign, + incentive + } = JSON.parse(campaignString); + const controllerString = (_$$attr2 = $('div.campaign.reward').attr('ng-init')) === null || _$$attr2 === void 0 ? void 0 : (_$$attr2$match = _$$attr2.match(/initContestant\(([\w\W]+?)\);/)) === null || _$$attr2$match === void 0 ? void 0 : _$$attr2$match[1]; + let ownedKey = false; + if (controllerString) { + var _JSON$parse$contestan, _JSON$parse$contestan2, _JSON$parse$contestan3, _JSON$parse$contestan4; + if ((_JSON$parse$contestan = JSON.parse(controllerString).contestant) !== null && _JSON$parse$contestan !== void 0 && (_JSON$parse$contestan2 = _JSON$parse$contestan.claims) !== null && _JSON$parse$contestan2 !== void 0 && (_JSON$parse$contestan3 = _JSON$parse$contestan2.incentives) !== null && _JSON$parse$contestan3 !== void 0 && (_JSON$parse$contestan4 = _JSON$parse$contestan3[incentive.id]) !== null && _JSON$parse$contestan4 !== void 0 && _JSON$parse$contestan4.length) { + ownedKey = true; + } + } + if (campaign.banned || campaign.finished && !ownedKey || campaign.paused || new Date().getTime() < campaign.starts_at * 1e3) { + await external_Swal_default().fire({ + icon: 'warning', + title: i18n('notice'), + text: i18n('giveawayNotWork'), + confirmButtonText: i18n('confirm'), + cancelButtonText: i18n('cancel'), + showCancelButton: true + }).then(_ref2 => { + let { + value + } = _ref2; + if (value) { + window.close(); + } + }); + } + return true; + } catch (error) { + throwError(error, 'Gleam.checkLeftKey'); + return false; } } const website_Gleam = Gleam; + function SweepWidget_classPrivateMethodInitSpec(obj, privateSet) { + SweepWidget_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function SweepWidget_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function SweepWidget_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function SweepWidget_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } const SweepWidget_defaultOptions = { username: '', email: '' }; + var SweepWidget_checkLogin = new WeakSet(); + var SweepWidget_getGiveawayId = new WeakSet(); + var _checkEnter = new WeakSet(); + var _checkFinish = new WeakSet(); class SweepWidget extends website_Website { - name = 'SweepWidget'; - options = { - ...SweepWidget_defaultOptions, - ...GM_getValue('SweepWidgetOptions') - }; - buttons = [ 'doTask' ]; + constructor() { + super(...arguments); + SweepWidget_classPrivateMethodInitSpec(this, _checkFinish); + SweepWidget_classPrivateMethodInitSpec(this, _checkEnter); + SweepWidget_classPrivateMethodInitSpec(this, SweepWidget_getGiveawayId); + SweepWidget_classPrivateMethodInitSpec(this, SweepWidget_checkLogin); + SweepWidget_defineProperty(this, 'name', 'SweepWidget'); + SweepWidget_defineProperty(this, 'options', { + ...SweepWidget_defaultOptions, + ...GM_getValue('SweepWidgetOptions') + }); + SweepWidget_defineProperty(this, 'buttons', [ 'doTask' ]); + } static test() { return /^https?:\/\/sweepwidget\.com\/view\/[\d]+/.test(window.location.href); } async after() { try { - if (!this.#checkLogin()) { + if (!SweepWidget_classPrivateMethodGet(this, SweepWidget_checkLogin, SweepWidget_checkLogin2).call(this)) { scripts_echoLog({}).warning(i18n('checkLoginFailed')); } } catch (error) { @@ -9180,11 +10447,11 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const logStatus = scripts_echoLog({ text: i18n('initing') }); - if (!this.#checkLogin()) { + if (!SweepWidget_classPrivateMethodGet(this, SweepWidget_checkLogin, SweepWidget_checkLogin2).call(this)) { logStatus.warning(i18n('needLogin')); return false; } - if (!this.#getGiveawayId()) { + if (!SweepWidget_classPrivateMethodGet(this, SweepWidget_getGiveawayId, SweepWidget_getGiveawayId2).call(this)) { return false; } this.initialized = true; @@ -9210,7 +10477,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); if ($('#sw_login_button:visible').length > 0) { $('#sw_login_button')[0].click(); } - if (!await this.#checkEnter()) { + if (!await SweepWidget_classPrivateMethodGet(this, _checkEnter, _checkEnter2).call(this)) { return false; } } @@ -9241,7 +10508,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); await delay(300); } (_$task$find$removeAtt = $task.find('input.sw_verify').removeAttr('disabled')[0]) === null || _$task$find$removeAtt === void 0 ? void 0 : _$task$find$removeAtt.click(); - await this.#checkFinish($task); + await SweepWidget_classPrivateMethodGet(this, _checkFinish, _checkFinish2).call(this, $task); await delay(parseInt(`${Math.random() * (3e3 - 1e3 + 1) + 1e3}`, 10)); } logStatus.success(); @@ -9251,63 +10518,63 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); return false; } } - #checkLogin() { - try { - if ($('#twitter_login_button').length > 0) { - $('#twitter_login_button')[0].click(); - } - return true; - } catch (error) { - throwError(error, 'SweepWidget.checkLogin'); - return false; + } + function SweepWidget_checkLogin2() { + try { + if ($('#twitter_login_button').length > 0) { + $('#twitter_login_button')[0].click(); } + return true; + } catch (error) { + throwError(error, 'SweepWidget.checkLogin'); + return false; } - #getGiveawayId() { - try { - var _window$location$href; - const giveawayId = (_window$location$href = window.location.href.match(/\/view\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; - if (giveawayId) { - this.giveawayId = giveawayId; - return true; - } - scripts_echoLog({ - text: i18n('getFailed', 'GiveawayId') - }); - return false; - } catch (error) { - throwError(error, 'SweepWidget.getGiveawayId'); - return false; + } + function SweepWidget_getGiveawayId2() { + try { + var _window$location$href; + const giveawayId = (_window$location$href = window.location.href.match(/\/view\/([\d]+)/)) === null || _window$location$href === void 0 ? void 0 : _window$location$href[1]; + if (giveawayId) { + this.giveawayId = giveawayId; + return true; } + scripts_echoLog({ + text: i18n('getFailed', 'GiveawayId') + }); + return false; + } catch (error) { + throwError(error, 'SweepWidget.getGiveawayId'); + return false; } - async #checkEnter() { - try { - return new Promise(resolve => { - const checker = setInterval(() => { - if ($('#unlock_rewards_main_wrapper').length > 0) { - clearInterval(checker); - resolve(true); - } - }); + } + async function _checkEnter2() { + try { + return new Promise(resolve => { + const checker = setInterval(() => { + if ($('#unlock_rewards_main_wrapper').length > 0) { + clearInterval(checker); + resolve(true); + } }); - } catch (error) { - throwError(error, 'SweepWidget.checkEnter'); - return false; - } + }); + } catch (error) { + throwError(error, 'SweepWidget.checkEnter'); + return false; } - async #checkFinish($task) { - try { - return new Promise(resolve => { - const checker = setInterval(() => { - if ($task.find('i.fa-check:visible').length > 0 || $task.find('.sw_entry_input:visible').length === 0) { - clearInterval(checker); - resolve(true); - } - }); + } + async function _checkFinish2($task) { + try { + return new Promise(resolve => { + const checker = setInterval(() => { + if ($task.find('i.fa-check:visible').length > 0 || $task.find('.sw_entry_input:visible').length === 0) { + clearInterval(checker); + resolve(true); + } }); - } catch (error) { - throwError(error, 'SweepWidget.checkFinish'); - return false; - } + }); + } catch (error) { + throwError(error, 'SweepWidget.checkFinish'); + return false; } } const website_SweepWidget = SweepWidget; @@ -9766,10 +11033,44 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } }; const dataSync = syncOptions; + function Setting_classPrivateMethodInitSpec(obj, privateSet) { + Setting_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function Setting_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function Setting_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function Setting_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + var Setting_getId = new WeakSet(); + var _environment = new WeakSet(); class Setting { - name = 'Setting'; - buttons = [ 'saveGlobalOptions', 'syncData', 'tasksHistory' ]; - syncData = dataSync; + constructor() { + Setting_classPrivateMethodInitSpec(this, _environment); + Setting_classPrivateMethodInitSpec(this, Setting_getId); + Setting_defineProperty(this, 'name', 'Setting'); + Setting_defineProperty(this, 'buttons', [ 'saveGlobalOptions', 'syncData', 'tasksHistory' ]); + Setting_defineProperty(this, 'syncData', dataSync); + } tasksHistory() { window.open('https://auto-task-v4.hclonely.com/history.html', '_blank'); } @@ -9781,16 +11082,16 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } after() { try { - this.#environment(); + Setting_classPrivateMethodGet(this, _environment, _environment2).call(this); changeGlobalOptions('page'); whiteList('page'); $('input[name="other.twitterVerifyId"]').after(``); $('#getTwitterUserId').on('click', () => { - this.#getId('twitterUser'); + Setting_classPrivateMethodGet(this, Setting_getId, Setting_getId2).call(this, 'twitterUser'); }); $('input[name="other.youtubeVerifyChannel"]').after(``); $('#getYoutubeChannelId').on('click', () => { - this.#getId('youtubeChannel'); + Setting_classPrivateMethodGet(this, Setting_getId, Setting_getId2).call(this, 'youtubeChannel'); }); $('input[name^="position"]').on('input', function() { const type = $(this).attr('name').replace('position.', ''); @@ -9882,56 +11183,89 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); saveGlobalOptions() { saveData(); } - #getId(social) { - try { - external_Swal_default().fire({ - title: i18n('getId', i18n(social)), - html: ` + } + function Setting_getId2(social) { + try { + external_Swal_default().fire({ + title: i18n('getId', i18n(social)), + html: ` `, - showCancelButton: true, - cancelButtonText: i18n('close'), - showConfirmButton: false - }); - $('#link2id').on('click', async function() { - const link = $('#socialLink').val(); - if (!link) { - return; - } - const type = $(this).attr('data-type'); - if (type === 'twitterUser') { - var _link$match; - const name = ((_link$match = link.match(/https:\/\/twitter\.com\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]) || link; - $('#socialLink').val(await new social_Twitter().userName2id(name) || ''); - } else if (type === 'youtubeChannel') { - var _link$match2, _await$getInfo, _await$getInfo$params; - const name = /^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www.youtube.com\/.*/.test(link) ? (_link$match2 = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1] : link; - $('#socialLink').val(((_await$getInfo = await getInfo(name, 'channel')) === null || _await$getInfo === void 0 ? void 0 : (_await$getInfo$params = _await$getInfo.params) === null || _await$getInfo$params === void 0 ? void 0 : _await$getInfo$params.channelId) || ''); - } - }); - } catch (error) { - throwError(error, 'Setting.getId'); - } + showCancelButton: true, + cancelButtonText: i18n('close'), + showConfirmButton: false + }); + $('#link2id').on('click', async function() { + const link = $('#socialLink').val(); + if (!link) { + return; + } + const type = $(this).attr('data-type'); + if (type === 'twitterUser') { + var _link$match; + const name = ((_link$match = link.match(/https:\/\/twitter\.com\/(.+)/)) === null || _link$match === void 0 ? void 0 : _link$match[1]) || link; + $('#socialLink').val(await new social_Twitter().userName2id(name) || ''); + } else if (type === 'youtubeChannel') { + var _link$match2, _await$getInfo, _await$getInfo$params; + const name = /^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www.youtube.com\/.*/.test(link) ? (_link$match2 = link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)) === null || _link$match2 === void 0 ? void 0 : _link$match2[1] : link; + $('#socialLink').val(((_await$getInfo = await getInfo(name, 'channel')) === null || _await$getInfo === void 0 ? void 0 : (_await$getInfo$params = _await$getInfo.params) === null || _await$getInfo$params === void 0 ? void 0 : _await$getInfo$params.channelId) || ''); + } + }); + } catch (error) { + throwError(error, 'Setting.getId'); } - #environment() { - try { - const userAgent = (0, javascript_utils_umd_min.ua)(); - const environmentForm = `
    + } + function _environment2() { + try { + const userAgent = (0, javascript_utils_umd_min.ua)(); + const environmentForm = `
    ${i18n('type')}${i18n('name')}${i18n('version')}
    ${i18n('os')}${userAgent.os}${userAgent.osVersion}
    ${i18n('browser')}${userAgent.browserZH}${userAgent.browserVersion}
    ${i18n('scriptManager')}${GM_info.scriptHandler}${GM_info.version}
    ${i18n('script')}${GM_info.script.name}${GM_info.script.version}
    `; - $('body').append(`

    ${i18n('environment')}

    ${environmentForm}`); - } catch (error) { - throwError(error, 'Setting.environment'); - } + $('body').append(`

    ${i18n('environment')}

    ${environmentForm}`); + } catch (error) { + throwError(error, 'Setting.environment'); } } const website_Setting = Setting; + function History_classPrivateMethodInitSpec(obj, privateSet) { + History_checkPrivateRedeclaration(obj, privateSet); + privateSet.add(obj); + } + function History_checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError('Cannot initialize the same private elements twice on an object'); + } + } + function History_defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function History_classPrivateMethodGet(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) { + throw new TypeError('attempted to get private field on non-instance'); + } + return fn; + } + var _addItem = new WeakSet(); class History extends website_Keylol { - name = 'History'; - buttons = [ 'doTask', 'undoTask', 'selectAll', 'selectNone', 'invertSelect', 'clearHistory' ]; + constructor() { + super(...arguments); + History_classPrivateMethodInitSpec(this, _addItem); + History_defineProperty(this, 'name', 'History'); + History_defineProperty(this, 'buttons', [ 'doTask', 'undoTask', 'selectAll', 'selectNone', 'invertSelect', 'clearHistory' ]); + } static test() { return window.location.host === 'auto-task-v4.hclonely.com' && window.location.pathname === '/history.html'; } @@ -9941,7 +11275,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); const data = GM_listValues() || []; const tasksHistory = data.map(value => /^[\w]+?Tasks-/.test(value) ? value : null).filter(value => value); for (const item of tasksHistory) { - this.#addItem(item); + History_classPrivateMethodGet(this, _addItem, _addItem2).call(this, item); } } catch (error) { throwError(error, 'History.before'); @@ -9962,83 +11296,83 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); throwError(error, 'History.after'); } } - #addItem(item) { - try { - const tasksData = GM_getValue(item); - if (!(tasksData !== null && tasksData !== void 0 && tasksData.tasks)) { - return; - } - let html = ''; - let title = ''; - let link = ''; - const [ website, id ] = item.split('-'); - switch (website) { - case 'fawTasks': - title = `Freeanywhere[${id}]`; - link = `https://freeanywhere.net/#/giveaway/${id}`; - break; + } + function _addItem2(item) { + try { + const tasksData = GM_getValue(item); + if (!(tasksData !== null && tasksData !== void 0 && tasksData.tasks)) { + return; + } + let html = ''; + let title = ''; + let link = ''; + const [ website, id ] = item.split('-'); + switch (website) { + case 'fawTasks': + title = `Freeanywhere[${id}]`; + link = `https://freeanywhere.net/#/giveaway/${id}`; + break; - case 'gasTasks': - title = `Giveawaysu[${id}]`; - link = `https://giveaway.su/giveaway/view/${id}`; - break; + case 'gasTasks': + title = `Giveawaysu[${id}]`; + link = `https://giveaway.su/giveaway/view/${id}`; + break; - case 'gcTasks': - title = `GiveeClub[${id}]`; - link = `https://givee.club/event/${id}`; - break; + case 'gcTasks': + title = `GiveeClub[${id}]`; + link = `https://givee.club/event/${id}`; + break; - case 'gkTasks': - title = `Givekey[${id}]`; - link = `https://givekey.ru/giveaway/${id}`; - break; + case 'gkTasks': + title = `Givekey[${id}]`; + link = `https://givekey.ru/giveaway/${id}`; + break; - case 'gleamTasks': - title = `Gleam[${id}]`; - link = `https://gleam.io${id}`; - break; + case 'gleamTasks': + title = `Gleam[${id}]`; + link = `https://gleam.io${id}`; + break; - case 'khTasks': - title = `keyhub[${id}]`; - link = `https://key-hub.eu/giveaway/${id}`; - break; + case 'khTasks': + title = `keyhub[${id}]`; + link = `https://key-hub.eu/giveaway/${id}`; + break; - case 'prysTasks': - title = `Prys[${id}]`; - link = `https://prys.revadike.com/giveaway/?id=${id}`; - break; + case 'prysTasks': + title = `Prys[${id}]`; + link = `https://prys.revadike.com/giveaway/?id=${id}`; + break; - default: - return; - } - for (const [ social, types ] of Object.entries(tasksData.tasks)) { - for (const [ type, tasks ] of Object.entries(types)) { - for (const task of tasks) { - html += `
  • ${social}.${i18n(type.replace('Link', ''))}: ${task.length > 55 ? `${task.slice(0, 55)}...` : task}
  • `; - } + default: + return; + } + for (const [ social, types ] of Object.entries(tasksData.tasks)) { + for (const [ type, tasks ] of Object.entries(types)) { + for (const task of tasks) { + html += `
  • ${social}.${i18n(type.replace('Link', ''))}: ${task.length > 55 ? `${task.slice(0, 55)}...` : task}
  • `; } } - $('.container').append(`
      ${html}
    ${i18n('lastChangeTime')}: ${external_dayjs_namespaceObject(tasksData.time).format('YYYY-MM-DD HH:mm:ss')}
    `); - $('span.delete-task').on('click', function() { - const itemName = $(this).attr('data-name'); - if (itemName) { - GM_deleteValue(itemName); - $(`div.card[data-name="${itemName}"]`).remove(); - external_Swal_default().fire({ - title: i18n('clearTaskFinished'), - text: itemName, - icon: 'success' - }); - } else { - external_Swal_default().fire({ - title: i18n('clearTaskFailed'), - icon: 'error' - }); - } - }); - } catch (error) { - throwError(error, 'History.addItem'); } + $('.container').append(`
      ${html}
    ${i18n('lastChangeTime')}: ${external_dayjs_namespaceObject(tasksData.time).format('YYYY-MM-DD HH:mm:ss')}
    `); + $('span.delete-task').on('click', function() { + const itemName = $(this).attr('data-name'); + if (itemName) { + GM_deleteValue(itemName); + $(`div.card[data-name="${itemName}"]`).remove(); + external_Swal_default().fire({ + title: i18n('clearTaskFinished'), + text: itemName, + icon: 'success' + }); + } else { + external_Swal_default().fire({ + title: i18n('clearTaskFailed'), + icon: 'error' + }); + } + }); + } catch (error) { + throwError(error, 'History.addItem'); } } const website_History = History; diff --git a/dist/auto-task-v4.compatibility.all.user.js b/dist/auto-task-v4.compatibility.all.user.js index f214d25..6068d5b 100644 --- a/dist/auto-task-v4.compatibility.all.user.js +++ b/dist/auto-task-v4.compatibility.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4.compatibility // @namespace auto-task-v4.compatibility -// @version 4.2.31 +// @version 4.2.32 // @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。 // @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites. // @author HCLonely @@ -116,10 +116,10 @@ var runtime=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); -!function(){var __webpack_modules__={588:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date(){options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}}const tools_httpRequest=httpRequest;function delay(){let time=0{setTimeout(()=>{resolve(!0)},time)})}const scripts_echoLog=_ref=>{let{type,text,html,id}=_ref;const emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{var _ele$;let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ +!function(){var __webpack_modules__={588:function(__unused_webpack_module,exports){!function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,o=1,t=arguments.length;o[a-z\d]+)(\/|\s)(?(\d+\.)+\d+)/i))||void 0===n?void 0:n.groups)&&void 0!==o?o:{},s=i.name,a=i.version,c={},f=0,u=Object.entries(this.browserNameMap);f(.*)=.+)/.exec(decodeURIComponent(e)))||void 0===e?void 0:e.groups;if(!e)return{};for(var n=e.params.split("&"),t={},o=0;o=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date(){options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}}const tools_httpRequest=httpRequest;function delay(){let time=0{setTimeout(()=>{resolve(!0)},time)})}const scripts_echoLog=_ref=>{let{type,text,html,id}=_ref;const emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{var _ele$;let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ ${text}]...
  • `);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ - ${null===text||void 0===text?void 0:text.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError(error,"unique"),[]}},getRedirectLink=async link=>{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError(error,"getRedirectLink"),null}},visitLink=async(link,options)=>{try{const logStatus=scripts_echoLog({type:"visitLink",text:link});return await tools_httpRequest({url:link,method:"GET",...options}).then(status=>{var{result,statusText,status}=status;return"Success"===result?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)})}catch(error){return throwError(error,"visitLink"),!1}};const stringToColour=str=>{try{let hash=0;for(let i=0;i>8*i&255;colour+=("00"+value.toString(16)).slice(-2)}return colour}catch(error){return throwError(error,"stringToColour"),"#fff"}},defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};var website_FreeAnyWhere=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,website_FreeAnyWhere),saveData=()=>{try{const data={};$("#globalOptionsForm").serializeArray().map(value=>(data[value.name]=value.value,value)),$.makeArray($("#globalOptionsForm input")).map(element=>{const name=$(element).attr("name");var keys=name.split(".");return 3===keys.length?globalOptions[keys[0]][keys[1]][keys[2]]=!!data[name]&&("on"===data[name]||data[name]):2===keys.length&&(globalOptions[keys[0]][keys[1]]=!!data[name]&&("on"===data[name]||data[name])),element}),GM_setValue("globalOptions",globalOptions),external_Swal_default().fire({title:i18n("changeGlobalOptionsSuccess"),icon:"success"})}catch(error){throwError(error,"saveData")}},changeGlobalOptions=showType=>{try{let globalOptionsForm=`
    + ${null===text||void 0===text?void 0:text.replace("u_","")}]...`);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),null!==(_ele$=ele[0])&&void 0!==_ele$&&_ele$.scrollIntoView(),{font:ele.find("font"),success(){var _this$font,_this$font3,text=0{try{return[...new Set(array)]}catch(error){return throwError(error,"unique"),[]}},getRedirectLink=async link=>{try{if(!link)return null;const redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link]&&redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(data=>{data=data.data;return null!=data&&data.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null})}catch(error){return throwError(error,"getRedirectLink"),null}},visitLink=async(link,options)=>{try{const logStatus=scripts_echoLog({type:"visitLink",text:link});return await tools_httpRequest({url:link,method:"GET",...options}).then(status=>{var{result,statusText,status}=status;return"Success"===result?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)})}catch(error){return throwError(error,"visitLink"),!1}};const stringToColour=str=>{try{let hash=0;for(let i=0;i>8*i&255;colour+=("00"+value.toString(16)).slice(-2)}return colour}catch(error){return throwError(error,"stringToColour"),"#fff"}},defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}};var external_keyboardJS_namespaceObject=GM_getValue("globalOptions")||{};const assignObject=(obj1,obj2)=>{try{const newObj={};for(var[key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError(error,"assignObject"),defaultGlobalOptions}},globalOptions=assignObject(defaultGlobalOptions,external_keyboardJS_namespaceObject),saveData=()=>{try{const data={};$("#globalOptionsForm").serializeArray().map(value=>(data[value.name]=value.value,value)),$.makeArray($("#globalOptionsForm input")).map(element=>{const name=$(element).attr("name");var keys=name.split(".");return 3===keys.length?globalOptions[keys[0]][keys[1]][keys[2]]=!!data[name]&&("on"===data[name]||data[name]):2===keys.length&&(globalOptions[keys[0]][keys[1]]=!!data[name]&&("on"===data[name]||data[name])),element}),GM_setValue("globalOptions",globalOptions),external_Swal_default().fire({title:i18n("changeGlobalOptionsSuccess"),icon:"success"})}catch(error){throwError(error,"saveData")}},changeGlobalOptions=showType=>{try{let globalOptionsForm=` `;for(const[type,data1]of Object.entries(globalOptions))for(var[option,data2]of Object.entries(data1))if(["other","position","hotKey"].includes(type))"boolean"==typeof data2?globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`:globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;else for(var[socialType,data3]of Object.entries(data2))globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;globalOptionsForm+="
    ${i18n("type")}${i18n("option")}${i18n("value")}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${option}.${i18n(socialType)}
    ","swal"===showType?external_Swal_default().fire({title:i18n("globalOptions"),html:globalOptionsForm,showConfirmButton:!0,confirmButtonText:i18n("save"),showCancelButton:!0,cancelButtonText:i18n("close")}).then(isConfirmed=>{isConfirmed=isConfirmed.isConfirmed;isConfirmed&&saveData()}):$("body").append(`

    ${i18n("globalOptions")}

    `+globalOptionsForm)}catch(error){throwError(error,"changeGlobalOptions")}};const languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en";const i18n=function(key){for(var _languages$language,_len=arguments.length,argvs=new Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)argvs[_key-1]=arguments[_key];return null!==(_languages$language=languages[language])&&void 0!==_languages$language&&_languages$language[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key};function throwError(error,name){window.TRACE&&console.trace("%cAuto-Task[Debug]:","color:blue"),external_Swal_default().fire({title:i18n("errorReport"),icon:"error",showCancelButton:!0,confirmButtonText:i18n("toGithub"),showDenyButton:!0,denyButtonText:i18n("toKeylol"),cancelButtonText:i18n("close")}).then(isConfirmed=>{var{isDenied:text,isConfirmed}=isConfirmed;isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):text&&(text=`错误链接: [url=${window.location.href}]${window.location.href}[/url] 环境: @@ -134,19 +134,19 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); 执行日志: [code]${$.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")}[/code]`,GM_setClipboard(text),external_Swal_default().fire({title:i18n("copySuccess"),icon:"success",confirmButtonText:i18n("ok")}).then(()=>{window.open("https://keylol.com/forum.php?mod=post&action=reply&fid=319&tid=777450","_blank")}))}),console.log("%c%s","color:white;background:red",`Auto-Task[Error]: ${name} -`+error.stack)}var external_keyboardJS_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0{var{isConfirmed,isDenied}=isDenied;return!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)}))return this.#initialized=!1,"skip";return globalOptions.doTask.discord.servers||globalOptions.undoTask.discord.servers?!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)):(this.#initialized=!1,"skip")}catch(error){return throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=null===(auth=GM_getValue("discordAuth"))||void 0===auth?void 0:auth.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{const logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId});var _data$response,_data$response$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;logStatus.success();var guild=String(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$guild=_data$response.guild)||void 0===_data$response$guild?void 0:_data$response$guild.id);return guild&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0}catch(error){return throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(!guild)return!1;const logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild});var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});return"Success"===result&&204===(null==data?void 0:data.status)?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{const logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId});var guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var _data$response2,_data$response2$guild,{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==(null==data?void 0:data.status))return logStatus.error(result+`:${statusText}(${status})`),!1;{const guild=null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$guild=_data$response2.guild)||void 0===_data$response2$guild?void 0:_data$response2$guild.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError(error,"Discord.getGuild"),!1}}async toggle(serverLinks){var{doTask=!0,serverLinks=[]}=serverLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/invite\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError(error,"Discord.setCache")}}};var website_Givekey=JSON.stringify({users:[]});const social_Instagram=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_Givekey);whiteList={...JSON.parse(website_Givekey),...null===(website_GiveeClub=GM_getValue("whiteList"))||void 0===website_GiveeClub?void 0:website_GiveeClub.instagram};#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError(error,"Instagram.init"),!1}}async#getUserInfo(){var name=0{return null===(_link$match=_link$match.match(/https:\/\/www\.instagram\.com\/(.+)?\//))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError(error,"Instagram.setCache")}}};var website_OpiumPulses=JSON.stringify({reddits:[]});const social_Reddit=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_OpiumPulses);whiteList={...JSON.parse(website_OpiumPulses),...null===(website_Opquests=GM_getValue("whiteList"))||void 0===website_Opquests?void 0:website_Opquests.reddit};#auth;#initialized=!1;async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError(error,"Reddit.init"),!1}}async#useBeta(){try{const logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{const newTab=GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(){var _data$responseText$ma,beta=0{var name=null===(name=userName.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/))||void 0===name?void 0:name[1],userName=null===(userName=userName.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/))||void 0===userName?void 0:userName[1];return userName?name||userName:name});if(0!0)}catch(error){return throwError(error,"Reddit.toggle"),!1}}};var dataSync=JSON.stringify({channels:[]});const social_Twitch=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(dataSync);whiteList={...JSON.parse(dataSync),...null===(website_Website=GM_getValue("whiteList"))||void 0===website_Website?void 0:website_Website.twitch};#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(GM_setValue("twitchAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{const logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")});var _data$response,_data$response$,_data$response$$data,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response=data.response)&&void 0!==_data$response&&null!==(_data$response$=_data$response[0])&&void 0!==_data$response$&&null!==(_data$response$$data=_data$response$.data)&&void 0!==_data$response$$data&&_data$response$$data.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(){var isFirst=!(0{const newTab=GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel(doTask){var{name,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(!channelId)return!1;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name});var _data$response3,_data$response4,_data$response4$0$err,_data$response4$0$err2,followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});return"Success"===result?200===(null==data?void 0:data.status)&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+((null==data||null===(_data$response4=data.response)||void 0===_data$response4||null===(_data$response4$0$err=_data$response4[0].errors)||void 0===_data$response4$0$err||null===(_data$response4$0$err2=_data$response4$0$err[0])||void 0===_data$response4$0$err2?void 0:_data$response4$0$err2.message)||`${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`)),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{const logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name});var channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var _data$response5,_data$response5$,_data$response5$$data,_data$response5$$data2,{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const channelId=null===(_data$response5=data.response)||void 0===_data$response5||null===(_data$response5$=_data$response5[0])||void 0===_data$response5$||null===(_data$response5$$data=_data$response5$.data)||void 0===_data$response5$$data||null===(_data$response5$$data2=_data$response5$$data.user)||void 0===_data$response5$$data2?void 0:_data$response5$$data2.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Twitch.getChannelId"),!1}}async toggle(channelLinks){var{doTask=!0,channelLinks=[]}=channelLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/))||void 0===_link$match?void 0:_link$match[2]});if(0!0)}catch(error){return throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError(error,"Twitch.setCache")}}};website_FreeAnyWhere=JSON.stringify({users:[],retweets:[],likes:[]});const social_Twitter=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_FreeAnyWhere);whiteList={...JSON.parse(website_FreeAnyWhere),...null===(website_Indiedb=GM_getValue("whiteList"))||void 0===website_Indiedb?void 0:website_Indiedb.twitter};#verifyId=globalOptions.other.twitterVerifyId;#auth=GM_getValue("twitterAuth")||{};#cache=GM_getValue("twitterCache")||{};#initialized=!1;async init(){try{return this.#initialized?!0:this.#auth.ct0?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Twitter")),this.#initialized=!0):(GM_setValue("twitterAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Twitter")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitter")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Twitter.init"),!1}}async#verifyAuth(){try{return await this.#toggleUser({name:"verify",doTask:!0,verify:!0})}catch(error){return throwError(error,"Twitter.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitter")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://twitter.com/settings/account?k#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("twitterAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update twitter auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Twitter.updateToken"),!1}}async#toggleUser(verify){var{name,doTask=!0,verify=!1}=verify;try{if(!doTask&&!verify&&this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitter.unfollowUser",id:name}),!0;var userId=verify?this.#verifyId:await this.userName2id(name);if(!userId)return!1;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Twitter")}):scripts_echoLog({type:`${doTask?"":"un"}followingTwitterUser`,text:name});var _data$response,_data$response$errors,_data$response$errors2,{result,statusText,status,data}=await tools_httpRequest({url:`https://api.twitter.com/1.1/friendships/${doTask?"create":"destroy"}.json`,method:"POST",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","Content-Type":"application/x-www-form-urlencoded","x-csrf-token":this.#auth.ct0},responseType:"json",data:$.param({include_profile_interstitial_type:1,include_blocking:1,include_blocked_by:1,include_followed_by:1,include_want_retweets:1,include_mute_edge:1,include_can_dm:1,include_can_media_tag:1,skip_status:1,id:userId})});return"Success"===result?200===(null==data?void 0:data.status)?(logStatus.success(),doTask&&!verify&&(this.tasks.users=unique([...this.tasks.users,name])),!0):verify&&403===(null==data?void 0:data.status)&&158===(null===(_data$response=data.response)||void 0===_data$response||null===(_data$response$errors=_data$response.errors)||void 0===_data$response$errors||null===(_data$response$errors2=_data$response$errors[0])||void 0===_data$response$errors2?void 0:_data$response$errors2.code)?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Twitter.toggleUser"),!1}}async userName2id(name){try{const logStatus=scripts_echoLog({type:"gettingTwitterUserId",text:name});var userId=this.#cache[name];if(userId)return logStatus.success(),userId;var _response,_response$data,_response$data$user,_response$data$user$r,{result,statusText,status,data}=await tools_httpRequest({url:"https://api.twitter.com/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName"+`?variables=%7B%22screen_name%22%3A%22${name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`,method:"GET",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","content-type":"application/json",referer:"https://twitter.com/"+name,"x-csrf-token":this.#auth.ct0},responseType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{let response=data.response||("object"==typeof data.responseText?data.responseText:null);if(!response)try{response=JSON.parse(data.responseText)}catch(error){response=null}const userId=String(null===(_response=response)||void 0===_response||null===(_response$data=_response.data)||void 0===_response$data||null===(_response$data$user=_response$data.user)||void 0===_response$data$user||null===(_response$data$user$r=_response$data$user.result)||void 0===_response$data$user$r?void 0:_response$data$user$r.rest_id);return userId?(this.#setCache(name,userId),logStatus.success(),userId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Twitter.getUserId"),!1}}async#toggleRetweet(doTask){var{retweetId,doTask=!0}=doTask;try{if(!doTask&&this.whiteList.retweets.includes(retweetId))return scripts_echoLog({type:"whiteList",text:"Twitter.unretweet",id:retweetId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}retweetting`,text:retweetId});var _data$response2,_data$response2$error,_data$response2$error2,{result,statusText,status,data}=await tools_httpRequest({url:`https://api.twitter.com/1.1/statuses/${doTask?"":"un"}retweet.json`,method:"POST",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","Content-Type":"application/x-www-form-urlencoded","x-csrf-token":this.#auth.ct0},data:$.param({tweet_mode:"extended",id:retweetId}),responseType:"json"});return"Success"===result?200===(null==data?void 0:data.status)||403===(null==data?void 0:data.status)&&327===(null===(_data$response2=data.response)||void 0===_data$response2||null===(_data$response2$error=_data$response2.errors)||void 0===_data$response2$error||null===(_data$response2$error2=_data$response2$error[0])||void 0===_data$response2$error2?void 0:_data$response2$error2.code)?(logStatus.success(),doTask&&(this.tasks.retweets=unique([...this.tasks.retweets,retweetId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Twitter.toggleRetweet"),!1}}async toggle(retweetLinks){var{doTask=!0,userLinks=[],retweetLinks=[]}=retweetLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.twitter.users||!doTask&&!globalOptions.undoTask.twitter.users)scripts_echoLog({type:"globalOptionsSkip",text:"twitter.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,_link$match=>{return null===(_link$match=_link$match.match(/https:\/\/twitter\.com\/(.+)/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/https:\/\/twitter\.com\/.*?\/status\/([\d]+)/))||void 0===_link$match2?void 0:_link$match2[1]});if(0!0)}catch(error){return throwError(error,"Twitter.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitterCache",this.#cache)}catch(error){throwError(error,"Twitter.setCache")}}};var website_Keyhub=JSON.stringify({names:[]});const social_Vk=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_Keyhub);whiteList={...JSON.parse(website_Keyhub),...null===(website_Givekey=GM_getValue("whiteList"))||void 0===website_Givekey?void 0:website_Givekey.vk};#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{const logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});var _data$responseText$ma;return"Success"===result?null!==data&&void 0!==data&&data.finalUrl.includes("vk.com/login")?(logStatus.error("Error:"+i18n("loginVk"),!0),!1):200===(null===data||void 0===data?void 0:data.status)?(this.#username=(null===(_data$responseText$ma=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1])||"",logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam){var doTask=!(2{return null===(_link$match=_link$match.match(/https:\/\/vk\.com\/([^/]+)/))||void 0===_link$match?void 0:_link$match[1]});if(0!0)}catch(error){return throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError(error,"Vk.setCache")}}};var website_GiveeClub=JSON.stringify({channels:[],likes:[]});const getInfo=async function(link,type){try{const logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),{};if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),{};{var _data$responseText$ma,_ref;if(data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube"))return logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0};var apiKey=null===(_data$responseText$ma=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],context=(null===(_ref=data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))||void 0===_ref?void 0:_ref[1])||"{}";const{client,request}=JSON.parse(context);if(apiKey&&client&&request){if(client.hl="en","channel"===type){var _data$responseText$ma2,channelId=null===(_data$responseText$ma2=data.responseText.match(//))||void 0===_data$responseText$ma2?void 0:_data$responseText$ma2[1];return channelId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{})}if("likeVideo"!==type)return logStatus.error("Error: Unknown type"),{};var _data$responseText$ma3,_data$responseText$ma4,videoId=null===(_data$responseText$ma3=data.responseText.match(//))||void 0===_data$responseText$ma3?void 0:_data$responseText$ma3[1],likeParams=null===(_data$responseText$ma4=data.responseText.match(/"likeParams":"(.*?)"/))||void 0===_data$responseText$ma4?void 0:_data$responseText$ma4[1];return videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})}return logStatus.error('Error: Parameter "apiKey" not found!'),{}}}catch(error){return throwError(error,"Youtube.getInfo"),{}}};class Youtube extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_GiveeClub);whiteList={...JSON.parse(website_GiveeClub),...null===(website_OpiumPulses=GM_getValue("whiteList"))||void 0===website_OpiumPulses?void 0:website_OpiumPulses.youtube};#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(GM_setValue("youtubeAuth",null),await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1)):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{const logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{const newTab=GM_openInTab("https://www.youtube.com/#auth",{active:!0,insert:!0,setParent:!0});newTab.onclose=async()=>{var auth=GM_getValue("youtubeAuth");auth?(this.#auth=auth,logStatus.success(),this.#verifyAuth().then(result=>{resolve(result)})):(logStatus.error("Error: Update youtube auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Discord.updateAuth"),!1}}#getInfo(link,type){return getInfo(link,type)}async#toggleChannel(verify){var{link,doTask=!0,verify=!1}=verify;try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)return scripts_echoLog({html:i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&channelId))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;const logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":null==client?void 0:client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:null==request?void 0:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&(/"subscribed": true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed": false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo(doTask){var{link,doTask=!0}=doTask;try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)return scripts_echoLog({html:""+i18n("loginYtb")}),!1;if(!(apiKey&&client&&request&&videoId&&likeParams))return scripts_echoLog({text:'"getYtbToken" failed'}),!1;if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;const logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId});var nowTime=parseInt(String((new Date).getTime()/1e3),10);const likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}const{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle(videoLinks){var{doTask=!0,channelLinks=[],videoLinks=[]}=videoLinks;try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;const prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>{var _link$match;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match?void 0:_link$match[1]:link});if(0{var _link$match2;return/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?null===(_link$match2=link.match(/url=(https:\/\/www\.youtube\.com\/.*)/))||void 0===_link$match2?void 0:_link$match2[1]:link});if(0!0)}catch(error){return throwError(error,"Youtube.toggle"),!1}}}var website_Opquests=JSON.stringify({groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]});const social_Steam=class extends external_keyboardJS_namespaceObject{tasks=JSON.parse(website_Opquests);whiteList={...JSON.parse(website_Opquests),...null===(dataSync=GM_getValue("whiteList"))||void 0===dataSync?void 0:dataSync.steam};#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";async init(){var type=0/g)].map(search=>search[1]);return currentArea&&0{const checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){const{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}const logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)});var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/account/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==(null==data?void 0:data.status)||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),"CN";var currentArea=(await this.#getAreaInfo())["currentArea"];return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}catch(error){return this.#areaStatus="error",throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{const logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})});return"Success"===result?200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;var groupId=await this.#getGroupId(groupName);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{const logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName});var _data$responseText$ma6,groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma6=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/))||void 0===_data$responseText$ma6?void 0:_data$responseText$ma6[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{const logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status)||data.responseText.includes('id="publicGroupJoin"'))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;var _data$responseText$ma7;logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]);var groupId=null===(_data$responseText$ma7=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma7?void 0:_data$responseText$ma7[1];return groupId&&this.#setCache("officialGroup",gameId,groupId),!0}catch(error){return throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;var groupId=await this.#getOfficialGroupId(gameId);if(!groupId)return!1;const logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId});var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null==data?void 0:data.status))return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1;{const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}}catch(error){return throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{const logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId});var _data$responseText$ma8,groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;const{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==(null===data||void 0===data?void 0:data.status))return logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`),!1;{const groupId=null===(_data$responseText$ma8=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/))||void 0===_data$responseText$ma8?void 0:_data$responseText$ma8[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{var _data$response2;const logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response2=data.response)||void 0===_data$response2?void 0:_data$response2.success))return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===resultR?200===(null===dataR||void 0===dataR?void 0:dataR.status)?"CN"===this.#area&&dataR.responseText.includes('id="error_box"')?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId)):(!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"'))?(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1):(logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0):(logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)}catch(error){return throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{var _data$response3;if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;const logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===(null==data?void 0:data.status)&&!0===(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.success))return logStatus.success(),!0;const{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==(null===dataR||void 0===dataR?void 0:dataR.status))return logStatus.error(`Error:${null===dataR||void 0===dataR?void 0:dataR.statusText}(${null===dataR||void 0===dataR?void 0:dataR.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));const result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{if(!doTask&&this.whiteList.follows.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0;const logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId};doTask||(requestData.unfollow="1");var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)});if("Success"===result&&200===(null==data?void 0:data.status)&&"true"===data.responseText)return logStatus.success(),!0;var followed=await this.#isFollowedGame(gameId);return"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1)}catch(error){return throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{const{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===(null===data||void 0===data?void 0:data.status)&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId){var doTask=!(1/))||void 0===_data$responseText$ma10?void 0:_data$responseText$ma10[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{const logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id});var _data$response6,{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?(200===(null==data?void 0:data.status)&&1===(null===(_data$response6=data.response)||void 0===_data$response6?void 0:_data$response6.success)?logStatus.success():logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!0):(logStatus.error(result+`:${statusText}(${status})`),!0)}catch(error){return throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId){var doTask=!(1{return null===(_link$match=_link$match.match(/groups\/(.+)\/?/))||void 0===_link$match?void 0:_link$match[1]});if(0{return null===(_link$match2=_link$match2.match(/games\/(.+)\/?/))||void 0===_link$match2?void 0:_link$match2[1]});if(0{return null===(_link$match3=_link$match3.match(/app\/([\d]+)/))||void 0===_link$match3?void 0:_link$match3[1]});if(0{return null===(_link$match4=_link$match4.match(/app\/([\d]+)/))||void 0===_link$match4?void 0:_link$match4[1]});if(0{return null===(_link$match5=_link$match5.match(/app\/([\d]+)/))||void 0===_link$match5?void 0:_link$match5[1]});if(0{return null===(_link$match6=_link$match6.match(/\?id=([\d]+)/))||void 0===_link$match6?void 0:_link$match6[1]});if(0{return null===(_link$match7=_link$match7.match(/\?id=([\d]+)/))||void 0===_link$match7?void 0:_link$match7[1]});if(doTask&&0{return null===(_link$match8=_link$match8.match(/curator\/([\d]+)/))||void 0===_link$match8?void 0:_link$match8[1]}),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,_link$match9=>{return null===(_link$match9=_link$match9.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/))||void 0===_link$match9?void 0:_link$match9.slice(1,3).join("/")});if(0{var _link$match10;return _link$match11.includes("store.steampowered.com")?null===(_link$match10=_link$match11.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/))||void 0===_link$match10?void 0:_link$match10.slice(1,3).join("/"):null===(_link$match11=_link$match11.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))||void 0===_link$match11?void 0:_link$match11.slice(1,3).join("/")});if(doTask&&0{return null===(_link$match12=_link$match12.match(/app\/([\d]+)/))||void 0===_link$match12?void 0:_link$match12[1]});if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError(error,"Steam.setCache")}}};website_Website=class{undoneTasks;socialTasks;giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,twitter:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1};initialized=!1;social={};async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError(error,"Website.bind"),{name:name,result:!1}}}async initSocial(action){try{const pro=[],tasks="do"===action?this.undoneTasks:this.socialTasks;var steamLength,steamCommunityLength;return tasks.discord&&(!(0[...total,...arr]).length)||this.socialInitialized.discord&&this.social.discord||(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init())))),tasks.instagram&&(!(0[...total,...arr]).length)||this.socialInitialized.instagram&&this.social.instagram||(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init())))),tasks.reddit&&(!(0[...total,...arr]).length)||this.socialInitialized.reddit&&this.social.reddit||(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init())))),tasks.twitch&&(!(0[...total,...arr]).length)||this.socialInitialized.twitch&&this.social.twitch||(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init())))),tasks.twitter&&(!(0[...total,...arr]).length)||this.socialInitialized.twitter&&this.social.twitter||(this.social.twitter=new social_Twitter,pro.push(this.#bind("twitter",this.social.twitter.init())))),tasks.vk&&(!(0[...total,...arr]).length)||this.socialInitialized.vk&&this.social.vk||(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init())))),tasks.youtube&&(!(0[...total,...arr]).length)||this.socialInitialized.youtube&&this.social.youtube||(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init())))),!tasks.steam||0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0{var _tasks$steam,_tasks$steam$type;return["groupLinks","officialGroupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&(null===(_tasks$steam=tasks.steam)||void 0===_tasks$steam||null===(_tasks$steam$type=_tasks$steam[type])||void 0===_tasks$steam$type?void 0:_tasks$steam$type.length)||0}).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(const data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError(error,"Website.initSocial"),!1}}uniqueTasks(allTasks){const result={};for(var[social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async toggleTask(action){try{if(!this.initialized&&!this.init())return!1;if(!await this.classifyTask(action))return!1;if(!await this.initSocial(action))return!1;const pro=[];var doTask="do"===action,tasks=doTask?this.undoneTasks:this.socialTasks;if("skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:doTask,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:doTask,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:doTask,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:doTask,...tasks.twitch})),this.social.twitter&&pro.push(this.social.twitter.toggle({doTask:doTask,...tasks.twitter})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:doTask,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:doTask,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:doTask,...tasks.steam})),this.social.visitLink&&tasks.links&&doTask)for(const link of tasks.links)pro.push(this.social.visitLink(link));return doTask&&tasks.extra&&this.extraDoTask&&0[...total,...arr]).length&&pro.push(this.extraDoTask(tasks.extra)),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError(error,"Website.toggleTask"),!1}}async doTask(){try{return await this.toggleTask("do")}catch(error){return throwError(error,"Website.doTask"),!1}}async undoTask(){try{return await this.toggleTask("undo")}catch(error){return throwError(error,"Website.undoTask"),!1}}};const FreeAnyWhere_defaultTasks=JSON.stringify({steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],followLinks:[]},vk:{nameLinks:[]}});website_FreeAnyWhere=class extends website_Website{name="FreeAnyWhere";tasks=[];socialTasks=JSON.parse(FreeAnyWhere_defaultTasks);undoneTasks=JSON.parse(FreeAnyWhere_defaultTasks);buttons=["doTask","undoTask","verifyTask","getKey"];static test(){return"freeanywhere.net"===window.location.host}async init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});if(0<$('a[href="#/login"]').length)return window.open("/#/login","_self"),logStatus.warning(i18n("needLogin")),!1;if(window.location.href.includes("/login"))return logStatus.warning(i18n("needLogin")),!1;if(!/^https?:\/\/freeanywhere\.net\/#\/giveaway\/[\d]+/.test(window.location.href)){var _window$location$href,id=null===(_window$location$href=window.location.href.match(/https?:\/\/freeanywhere\.net\/.*?#\/giveaway\/([\d]+)/))||void 0===_window$location$href?void 0:_window$location$href[1];if(!id)return logStatus.error(i18n("getFailed","Id")),!1;window.location.href="https://freeanywhere.net/#/giveaway/"+id}return this.#getGiveawayId()?(await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),this.initialized=!0,logStatus.success(),!0):!1}catch(error){return throwError(error,"Freeanywhere.init"),!1}}async classifyTask(action){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")});var _GM_getValue;"undo"===action&&(this.socialTasks=(null===(_GM_getValue=GM_getValue("fawTasks-"+this.giveawayId))||void 0===_GM_getValue?void 0:_GM_getValue.tasks)||JSON.parse(FreeAnyWhere_defaultTasks));var{result,statusText,status,data}=await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/?format=json`,method:"GET",headers:{authorization:"Token "+window.localStorage.getItem("token"),"x-csrftoken":external_Cookies_namespaceObject.get("csrftoken")},responseType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;var _data$response,tasks=null==data||null===(_data$response=data.response)||void 0===_data$response?void 0:_data$response.challenges;if(tasks){"verify"===action&&(this.tasks=[]);for(const task of tasks){var type=task.challenge,social=task.challenge_provider;const taskInfo={id:task.id,title:task.title};if("verify"!==action||task.is_success)switch(social){case"steam":switch(taskInfo.social="steam",type){case"WL":"undo"===action&&this.socialTasks.steam.wishlistLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.wishlistLinks.push(task.link);break;case"JTG":"undo"===action&&this.socialTasks.steam.groupLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.groupLinks.push(task.link);break;case"STC":"undo"===action&&this.socialTasks.steam.curatorLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.curatorLinks.push(task.link);break;case"GF":"undo"===action&&this.socialTasks.steam.followLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.followLinks.push(task.link)}break;case"vk-oauth2":"undo"===action&&this.socialTasks.vk.nameLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.vk.nameLinks.push(task.link);break;case"website":break;default:scripts_echoLog({}).warning(i18n("unKnownTaskType")+": "+social)}else this.tasks.push(taskInfo)}return logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("fawTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}return logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1}catch(error){return throwError(error,"Freeanywhere.classifyTask"),!1}}async verifyTask(){try{if(!this.initialized&&!this.init())return!1;if(0===this.tasks.length&&!await this.classifyTask("verify"))return!1;const pro=[];for(const task of this.tasks)pro.push(this.#verify(task)),await delay(1e3);return await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!!await this.getKey(!0)}catch(error){return throwError(error,"Freeanywhere.verifyTask"),!1}}async getKey(initialized){try{if(!initialized&&!this.initialized&&!this.init())return!1;const logStatus=scripts_echoLog({text:i18n("gettingKey")});var _data$response2,{result,statusText,status,data}=await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/reward/?format=json`,method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token")}});return"Success"===result?null!=data&&null!==(_data$response2=data.response)&&void 0!==_data$response2&&_data$response2.reward?(logStatus.success(),scripts_echoLog({}).success(data.response.reward),data.response.reward):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"FreeAnyWhere.getGiveawayId"),!1}}#getGiveawayId(){try{var _window$location$href2,giveawayId=null===(_window$location$href2=window.location.href.match(/\/giveaway\/([\d]+)/))||void 0===_window$location$href2?void 0:_window$location$href2[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({}).error(i18n("getFailed","GiveawayId")),!1)}catch(error){throwError(error,"FreeAnyWhere.getGiveawayId")}}async#verify(task){try{const logStatus=scripts_echoLog({html:`
  • ${i18n("verifyingTask")}${task.title.trim()}...
  • `});var _data$response3,{result,statusText,status,data}=await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/challenge-status/${task.id}/?format=json`,method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token"),"x-csrftoken":external_Cookies_namespaceObject.get("csrftoken")}});return"Success"===result?null!=data&&null!==(_data$response3=data.response)&&void 0!==_data$response3&&_data$response3.status?(logStatus.success(),!0):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Freeanywhere.verify"),!1}}async#checkLeftKey(){try{var _data$response4;if(!globalOptions.other.checkLeftKey)return!0;var data=(await tools_httpRequest({url:"https://freeanywhere.net/api/v1/widget/?format=json",method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token")}}))["data"];return null!=data&&null!==(_data$response4=data.response)&&void 0!==_data$response4&&_data$response4.giveaways.find(giveaway=>""+(null==giveaway?void 0:giveaway.id)===this.giveawayId)?!0:(await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0)}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}};const GiveawaySu_defaultTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};class GiveawaySu extends website_Website{name="GiveawaySu";socialTasks=GiveawaySu_defaultTasks;undoneTasks=GiveawaySu_defaultTasks;buttons=["doTask","undoTask"];static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),scripts_echoLog({}).warning(i18n("gsNotice"))}catch(error){throwError(error,"Giveawaysu.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError(error,"Giveawaysu.init"),!1}}async classifyTask(action){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")});var _GM_getValue;if("undo"===action)return this.socialTasks=(null===(_GM_getValue=GM_getValue("gasTasks-"+this.giveawayId))||void 0===_GM_getValue?void 0:_GM_getValue.tasks)||GiveawaySu_defaultTasks,!0;const pro=[];var tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(const task of tasks)pro.push(new Promise(resolve=>{const td=$(task).find('td:not(".hidden")');var colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])');const taskDes=0taskLink?(taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),void resolve(!0)):resolve(!1)).catch(error=>(throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.undoneTasks,window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gasTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0):!0}catch(error){return throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?(0<$(".giveaway-ended").length&&0===$(".giveaway-key").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=null===(giveawayId=window.location.href.match(/\/view\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}}website_Indiedb=class{name="Indiedb";buttons=["doTask"];static test(){return"www.indiedb.com"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError(error,"Indiedb.after")}}async doTask(){try{return await this.#join()?await this.#do():!1}catch(error){return throwError(error,"Indiedb.doTask"),!1}}async#join(){try{if(0<$("a.buttonenter:contains(Register to join)").length)return scripts_echoLog({}).error(i18n("needLogin")),!1;const currentoption=$("a.buttonenter.buttongiveaway");if(/join giveaway/gim.test(currentoption.text())){const logStatus=scripts_echoLog({text:i18n("joiningGiveaway")+"..."});var _data$response,_data$response4,_data$response5,_data$response2,_data$response3,{result,statusText,status,data}=await tools_httpRequest({url:currentoption.attr("href"),method:"POST",data:"ajax=t",dataType:"json",headers:{"content-type":"application/x-www-form-urlencoded; charset=UTF-8",accept:"application/json, text/javascript, */*; q=0.01",origin:window.location.origin}});return"Success"===result?200===(null==data?void 0:data.status)?null!==(_data$response=data.response)&&void 0!==_data$response&&_data$response.success?(currentoption.addClass("buttonentered").text("Success - Giveaway joined"),$("#giveawaysjoined").slideDown(),$("#giveawaysrecommend").slideDown(),logStatus.success("Success"+(null!==(_data$response2=data.response)&&void 0!==_data$response2&&_data$response2.text?":"+(null===(_data$response3=data.response)||void 0===_data$response3?void 0:_data$response3.text):"")),!0):(logStatus.error("Error"+(null!==(_data$response4=data.response)&&void 0!==_data$response4&&_data$response4.text?":"+(null===(_data$response5=data.response)||void 0===_data$response5?void 0:_data$response5.text):"")),!1):(logStatus.error(`Error:${null==data?void 0:data.statusText}(${null==data?void 0:data.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}return/success/gim.test($("a.buttonenter.buttongiveaway").text())?!0:(scripts_echoLog({}).warning(i18n("needJoinGiveaway")),!1)}catch(error){return throwError(error,"Indiedb.init"),!1}}async#do(){try{const id=$("script").map((index,_script$innerHTML$mat4)=>{var _script$innerHTML$mat,_script$innerHTML$mat2,_script$innerHTML$mat3,_script$innerHTML$mat5,_script$innerHTML$mat6;return/\$\(document\)/gim.test(_script$innerHTML$mat4.innerHTML)?[null===(_script$innerHTML$mat=_script$innerHTML$mat4.innerHTML.match(/"\/[\d]+"/gim))||void 0===_script$innerHTML$mat||null===(_script$innerHTML$mat2=_script$innerHTML$mat[0])||void 0===_script$innerHTML$mat2||null===(_script$innerHTML$mat3=_script$innerHTML$mat2.match(/[\d]+/))||void 0===_script$innerHTML$mat3?void 0:_script$innerHTML$mat3[0],null===(_script$innerHTML$mat4=_script$innerHTML$mat4.innerHTML.match(/"\/newsletter\/ajax\/subscribeprofile\/optin\/[\d]+"/gim))||void 0===_script$innerHTML$mat4||null===(_script$innerHTML$mat5=_script$innerHTML$mat4[0])||void 0===_script$innerHTML$mat5||null===(_script$innerHTML$mat6=_script$innerHTML$mat5.match(/[\d]+/))||void 0===_script$innerHTML$mat6?void 0:_script$innerHTML$mat6[0]]:null});if(2!==id.length)return scripts_echoLog({}).error(i18n("getFailed","TaskId")),!1;{const pro=[];for(const task of $("#giveawaysjoined a[class*=promo]")){const promo=$(task);if(!promo.hasClass("buttonentered")){const status=scripts_echoLog({text:`${i18n("doing")}:${promo.parents("p").text()}...`});if(/facebookpromo|twitterpromo|visitpromo/gim.test(task.className)){let text="";text=promo.hasClass("facebookpromo")?"facebookpromo":promo.hasClass("twitterpromo")?"twitterpromo":"visitpromo",pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath(`/giveaways/ajax/${text}/`+id[0]),timeout:6e4,dataType:"json",data:{ajax:"t"},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.addClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})}))}else promo.hasClass("emailoptinpromo")?pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath("/newsletter/ajax/subscribeprofile/optin/"+id[1]),timeout:6e4,dataType:"json",data:{ajax:"t",emailsystoggle:4},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})})):promo.hasClass("watchingpromo")?pro.push(new Promise(resolve=>{var _promo$attr;const data=(url=>{try{const query={};return url?url.includes("?")&&url.split("?")[1].replace(/([^?&=]+)=([^&]+)/g,(str,key,value)=>(query[key]=value,str)):window.location.search.replace(/([^?&=]+)=([^&]+)/g,(str,key,value)=>(query[key]=value,str)),query}catch(error){return throwError(error,"getUrlQuery"),{}}})(promo.attr("href"));data.ajax="t",$.ajax({type:"POST",url:urlPath(null===(_promo$attr=promo.attr("href"))||void 0===_promo$attr?void 0:_promo$attr.split(/[?#]/)[0]),timeout:6e4,dataType:"json",data:data,error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})})):/the-challenge-of-adblock/gim.test(promo.attr("href"))?status.error("Error:"+i18n("unKnownTaskType")):pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath(promo.attr("href")),timeout:6e4,dataType:"json",data:{ajax:"t"},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})}))}}return await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}}catch(error){return throwError(error,"Indiedb.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$("a.buttonenter:contains(Register to join)").length&&window.open("/members/login","_self"),!0):!0}catch(error){return throwError(error,"Indiedb.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?(0<$('a.buttonenter:contains("next time"),a.buttonenter:contains("Giveaway is closed")').length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("giveawayEnded"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError(error,"Indiedb.checkLeftKey"),!1}}};const Keyhub_defaultTasks=JSON.stringify({steam:{groupLinks:[],officialGroupLinks:[],wishlistLinks:[],curatorLinks:[]},discord:{serverLinks:[]},extra:{videoTasks:[]},links:[]});website_Keyhub=class extends website_Website{name="Keyhub";socialTasks=JSON.parse(Keyhub_defaultTasks);undoneTasks=JSON.parse(Keyhub_defaultTasks);buttons=["doTask","undoTask"];static test(){return"key-hub.eu"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),$(".NSFW").hide()}catch(error){throwError(error,"Keyhub.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return 0<$('a[href*="/connect/steam"]').length?(window.open("/connect/steam","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&($("#VPNoverlay").hide(),$("#mainArticleSection").show(),this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError(error,"Keyhub.init"),!1}}async classifyTask(action){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")});var _GM_getValue;"undo"===action&&(this.socialTasks=(null===(_GM_getValue=GM_getValue("khTasks-"+this.giveawayId))||void 0===_GM_getValue?void 0:_GM_getValue.tasks)||JSON.parse(Keyhub_defaultTasks));for(const task of $('.task:not(".googleads")').filter((index,element)=>"do"!==action||0===$(element).find("i.fa-check-circle:visible").length).find("a")){let link=$(task).attr("href");var _link$match,taskData,taskDes=$(task).text().trim();link&&((/\/away\?data=/.test(link)||/steamcommunity\.com\/gid\//.test(link))&&(link=await getRedirectLink(link)||link),/https?:\/\/key-hub\.eu\/connect\/discord/.test(link)?window.open(link,"_blank"):/steamcommunity\.com\/groups\//.test(link)?("undo"===action&&this.socialTasks.steam.groupLinks.push(link),"do"===action&&this.undoneTasks.steam.groupLinks.push(link)):/steamcommunity\.com\/games\/[\d]+/.test(link)?("undo"===action&&this.socialTasks.steam.officialGroupLinks.push(link),"do"===action&&this.undoneTasks.steam.officialGroupLinks.push(link)):/store\.steampowered\.com\/app\//.test(link)&&/wishlist/gim.test(taskDes)?("undo"===action&&this.socialTasks.steam.wishlistLinks.push(link),"do"===action&&this.undoneTasks.steam.wishlistLinks.push(link)):/store\.steampowered\.com\/curator\//.test(link)?("undo"===action&&this.socialTasks.steam.curatorLinks.push(link),"do"===action&&this.undoneTasks.steam.curatorLinks.push(link)):/^https?:\/\/discord\.com\/invite\//.test(link)?("undo"===action&&this.socialTasks.discord.serverLinks.push(link),"do"===action&&this.undoneTasks.discord.serverLinks.push(link)):/^javascript:videoTask.+/.test(link)?"do"!==action||(taskData=null===(_link$match=link.match(/javascript:videoTask\('.+?','(.+?)'/))||void 0===_link$match?void 0:_link$match[1])&&this.undoneTasks.extra.videoTasks.push(taskData):/^https?:\/\/www\.instagram\.com\/.*/.test(link)||/^https?:\/\/twitter\.com\/.*/.test(link)||/^https?:\/\/www\.twitch\.tv\/.*/.test(link)||/^https?:\/\/www\.facebook\.com\/.*/.test(link)||/^https?:\/\/www\.youtube\.com\/.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/developer\//.test(link)||/^https?:\/\/.*?\.itch\.io\/.*/.test(link)||/^https?:\/\/key-hub\.eu.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/app\/.*/.test(link)||/^https?:\/\/qr\.streamelements\.com\/.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/news\/app\/.*/.test(link)||scripts_echoLog({}).warning(`${i18n("unKnownTaskType")}: ${taskDes}(${link})`))}return logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("khTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"Keyhub.classifyTask"),!1}}async#doScriptTask(data){try{const logStatus=scripts_echoLog({text:i18n("doingKeyhubTask")});var{result,statusText,status,data:response}=await tools_httpRequest({url:"/away?data="+data,method:"GET",headers:{origin:"https://key-hub.eu",referer:"https://key-hub.eu/"}});return"Success"===result?200===(null==response?void 0:response.status)?(logStatus.success(),!0):(logStatus.error(`Error:${null==response?void 0:response.statusText}(${null==response?void 0:response.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Keyhub.doScriptTask"),!1}}async extraDoTask(videoTasks){videoTasks=videoTasks.videoTasks;try{const pro=[];for(const data of videoTasks)pro.push(this.#doScriptTask(data));return Promise.all(pro).then(()=>!0)}catch(error){return throwError(error,"Keyhub.extraDoTask"),!1}}#getGiveawayId(){try{var _window$location$href,giveawayId=null===(_window$location$href=window.location.href.match(/giveaway\/([\d]+)/))||void 0===_window$location$href?void 0:_window$location$href[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({}).error(i18n("getFailed","GiveawayId")),!1)}catch(error){return throwError(error,"Keyhub.getGiveawayId"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?("0"===$("#keysleft").text().trim()&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError(error,"Keyhub.checkLeftKey"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$('a[href*="/connect/steam"]').length&&window.open("/connect/steam","_self"),!0):!0}catch(error){return throwError(error,"Keyhub.checkLogin"),!1}}};const Givekey_defaultTasks=JSON.stringify({steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[]},twitter:{userLinks:[]},vk:{nameLinks:[]},discord:{serverLinks:[]}});website_Givekey=class extends website_Website{name="Givekey";tasks=[];socialTasks=JSON.parse(Givekey_defaultTasks);undoneTasks=JSON.parse(Givekey_defaultTasks);userId;buttons=["doTask","undoTask","verifyTask"];static test(){return"givekey.ru"===window.location.host}async after(){try{await new Promise(resolve=>{const checker=setInterval(()=>{0<$("#navbarDropdown").length&&(clearInterval(checker),resolve(!0))})}),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){return throwError(error,"Givekey.after"),!1}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});if(0<$('a[href*="/auth/steam"]').length)return window.open("/auth/steam","_self"),logStatus.warning(i18n("needLogin")),!1;if(!this.#getGiveawayId())return!1;var userId=$('meta[name="user-id"]').attr("content");return userId?(this.userId=userId,this.initialized=!0,logStatus.success(),!0):(logStatus.error(i18n("getFailed",i18n("userId"))),!1)}catch(error){return throwError(error,"Givekey.init"),!1}}async classifyTask(action){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")});var _GM_getValue;"undo"===action&&(this.socialTasks=(null===(_GM_getValue=GM_getValue("gkTasks-"+this.giveawayId))||void 0===_GM_getValue?void 0:_GM_getValue.tasks)||JSON.parse(Givekey_defaultTasks));for(const task of $('.card-body:has("button") .row')){const taskEle=$(task);var isSuccess=/Complete/i.test(taskEle.find("button").text().trim());if(!isSuccess||"undo"===action){const checkButton=taskEle.find("#task_check");var taskId=checkButton.attr("data-id");if(taskId&&this.tasks.push(taskId),"verify"!==action){let href=taskEle.find("a").attr("href")||null;var text=taskEle.find("a").text().trim();const icon=taskEle.find("i");href&&text&&(/^https?:\/\/givekey\.ru\/giveaway\/[\d]+\/execution_task/.test(href)&&(href=await getRedirectLink(href)),href&&(/^https?:\/\/vk\.com\//.test(href)?(this.socialTasks.vk.nameLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.vk.nameLinks.push(href)):/^https?:\/\/steamcommunity\.com\/groups/.test(href)?(this.socialTasks.steam.groupLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.groupLinks.push(href)):/^https?:\/\/store\.steampowered\.com\/app\//.test(href)?(this.socialTasks.steam.wishlistLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.wishlistLinks.push(href)):/Subscribe/gi.test(text)&&icon.hasClass("fa-steam-square")?/^https?:\/\/store\.steampowered\.com\/curator\//.test(href)?(this.socialTasks.steam.curatorLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.curatorLinks.push(href)):(this.socialTasks.steam.curatorLikeLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.curatorLikeLinks.push(href)):/^https?:\/\/twitter\.com\//.test(href)&&/Subscribe/gi.test(text)?(this.socialTasks.twitter.userLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.twitter.userLinks.push(href)):icon.hasClass("fa-discord")||/^https?:\/\/discord\.com\/invite\//.test(href)?(this.socialTasks.discord.serverLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.discord.serverLinks.push(href)):scripts_echoLog({}).warning(`${i18n("unKnownTaskType")}: ${text}(${href})`)))}}}return logStatus.success(),this.tasks=unique(this.tasks),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gkTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"Givekey.classifyTask"),!1}}async verifyTask(){try{if(!this.initialized&&!this.init())return!1;if(0===this.tasks.length&&!await this.classifyTask("verify"))return!1;scripts_echoLog({}).warning(i18n("giveKeyNoticeBefore"));var taskLength=this.tasks.length;for(let i=0;i${i18n("giveKeyNoticeAfter")}`}),!0}catch(error){return throwError(error,"Givekey.verifyTask"),!1}}async#verify(task){try{const logStatus=scripts_echoLog({html:`
  • ${i18n("verifyingTask")}${task}...
  • `});return await new Promise(resolve=>{$.ajax({url:"https://givekey.ru/giveaway/task",method:"POST",data:`id=${task}&user_id=`+this.userId,dataType:"json",headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},success:data=>{data.btn&&$(`button[data-id=${this.userId}]`).html(data.btn),"ok"===data.status?($(".task_check_"+data.id).html(``),logStatus.success(),resolve(!0)):"end"===data.status?(logStatus.success(),scripts_echoLog({}).success(data.key),resolve(!0)):(logStatus.error("Error:"+data.msg),resolve(!1))},error:xhr=>{logStatus.error(`Error:${xhr.statusText}(${xhr.status})`),resolve(!1)}})})}catch(error){return throwError(error,"Givekey.verify"),!1}}#getGiveawayId(){try{var _window$location$href,giveawayId=null===(_window$location$href=window.location.href.match(/giveaway\/([\d]+)/))||void 0===_window$location$href?void 0:_window$location$href[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}catch(error){return throwError(error,"Givekey.getGiveawayId"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?($("#keys_count").text()||await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError(error,"Givekey.checkLeftKey"),!1}}};website_GiveeClub=class extends GiveawaySu{name="GiveeClub";buttons=["doTask","undoTask","verifyTask"];static test(){return/^https?:\/\/givee\.club\/.*?\/event\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError(error,"GiveeClub.after")}}init(){try{const logStatus=scripts_echoLog({text:i18n("initing")});return this.#checkLogin()?!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0):(logStatus.warning(i18n("needLogin")),!1)}catch(error){return throwError(error,"GiveeClub.init"),!1}}async classifyTask(action){try{const logStatus=scripts_echoLog({text:i18n("getTasksInfo")});var _GM_getValue;if("undo"===action)return this.socialTasks=(null===(_GM_getValue=GM_getValue("gcTasks-"+this.giveawayId))||void 0===_GM_getValue?void 0:_GM_getValue.tasks)||GiveawaySu_defaultTasks,!0;const pro=[];for(const task of $(".event-actions tr"))pro.push(new Promise(resolve=>{const taskDes=$(task).find(".event-action-label a"),taskIcon=$(task).find(".event-action-icon i").attr("class")||"",taskName=taskDes.text().trim(),taskType=null===(taskFinished=$(task).find("button[data-type]"))||void 0===taskFinished?void 0:taskFinished.attr("data-type");var taskFinished=null===(taskFinished=$(task).find(".event-action-buttons .btn-success"))||void 0===taskFinished?void 0:taskFinished.length;if(taskIcon.includes("ban")||/AdBlock/i.test(taskName)||taskIcon.includes("envelope")||taskFinished)return resolve(!0);getRedirectLink(taskDes.attr("href")).then(taskLink=>taskLink?("steam.group.join"===taskType&&/^https?:\/\/steamcommunity\.com\/groups/.test(taskLink)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):"steam.game.wishlist"===taskType&&/^https?:\/\/store\.steampowered\.com\/app\//.test(taskLink)?this.undoneTasks.steam.wishlistLinks.push(taskLink):"steam.game.wishlist"===taskType&&taskDes.attr("data-steam-wishlist-appid")?this.undoneTasks.steam.wishlistLinks.push("https://store.steampowered.com/app/"+taskDes.attr("data-steam-wishlist-appid")):"steam.game.follow"===taskType&&/^https?:\/\/store\.steampowered\.com\/app\//.test(taskLink)?this.undoneTasks.steam.followLinks.push(taskLink):/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("discord")?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):taskIcon.includes("twitter")?/https?:\/\/twitter\.com\/[^/]+\/?$/gim.test(taskLink)?this.undoneTasks.twitter.userLinks.push(taskLink):/https?:\/\/twitter\.com\/[^/]+?\/status\/[\d]+/gim.test(taskLink)&&this.undoneTasks.twitter.retweetLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink),void resolve(!0)):resolve(!1)).catch(error=>(throwError(error,"GiveeClub.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.undoneTasks,window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gcTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"GiveeClub.classifyTask"),!1}}async verifyTask(){try{const logStatus=scripts_echoLog({text:i18n("giveeClubVerifyNotice")});for(const button of $(".event-actions tr button").has("i.glyphicon-refresh").not('[data-type="user.adblock"]'))button.click(),"steam.game.wishlist"!==$(button).attr("data-type")&&await delay(1e3);return logStatus.warning(i18n("giveeClubVerifyFinished")),!0}catch(error){return throwError(error,"Givekey.verifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin?(0<$('a[href*="/account/auth"]').length&&window.open($('a[href*="/account/auth"]').attr("href"),"_self"),!0):!0}catch(error){return throwError(error,"GiveeClub.checkLogin"),!1}}#getGiveawayId(){var giveawayId=null===(giveawayId=window.location.href.match(/\/event\/([\d]+)/))||void 0===giveawayId?void 0:giveawayId[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey?(0<$(".event-ended").length&&0===$(".event-winner").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("giveawayEnded"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(value=>{value=value.value;value&&window.close()}),!0):!0}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}};var website_OpiumPulses=class{name="OpiumPulses";options={maxPoint:"99999999",...GM_getValue("OpiumPulsesOptions")};maxPoints=99999999;myPoints=0;buttons=["doFreeTask","doPointTask"];static test(){return"www.opiumpulses.com"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),this.maxPoints=parseInt(this.options.maxPoint,10)}catch(error){throwError(error,"OpiumPulses.after")}}async doFreeTask(){try{this.#toggleTask("FREE")}catch(error){throwError(error,"OpiumPulses.doFreeTask")}}async doPointTask(){try{var _$$text$match;this.myPoints=parseInt((null===(_$$text$match=$(".page-header__nav-func-user-nav-items.points-items").text().match(/[\d]+/gim))||void 0===_$$text$match?void 0:_$$text$match[0])||"0",10),this.#toggleTask("points")}catch(error){throwError(error,"OpiumPulses.doPointTask")}}async#toggleTask(type){try{for(const item of $(`.giveaways-page-item:contains('${type}'):not(:contains('ENTERED'))`)){var _$$find$text$match,_aElement$attr,_aElement$attr2,_aElement$attr2$match,giveawayId,_data$responseText$ma,points,needPoints=parseInt((null===(_$$find$text$match=$(item).find(".giveaways-page-item-header-points").text().match(/[\d]+/gim))||void 0===_$$find$text$match?void 0:_$$find$text$match[0])||"999999",10),name=$(item).find(".giveaways-page-item-footer-name").text().trim();if("points"===type&&needPoints>this.myPoints)scripts_echoLog({}).warning(i18n("noPoints")+": "+name);else if("points"!==type||needPoints){if(!("points"===type&&needPoints>this.maxPoints)){const logStatus=scripts_echoLog({text:`${i18n("joiningLottery")}${name}...`}),aElement=$(item).find("a.giveaways-page-item-img-btn-enter:contains('enter')");if(null===aElement||void 0===aElement||null===(_aElement$attr=aElement.attr("onclick"))||void 0===_aElement$attr||!_aElement$attr.includes("checkUser")||(giveawayId=null===(_aElement$attr2=aElement.attr("onclick"))||void 0===_aElement$attr2||null===(_aElement$attr2$match=_aElement$attr2.match(/[\d]+/))||void 0===_aElement$attr2$match?void 0:_aElement$attr2$match[0])&&checkUser(giveawayId),aElement.attr("href")){const{result,statusText,status,data}=await tools_httpRequest({url:aElement.attr("href"),method:"GET"});"Success"===result?null!==data&&void 0!==data&&data.responseText&&/You've entered this giveaway/gim.test(data.responseText)?(logStatus.success(),points=null===(_data$responseText$ma=data.responseText.match(/Points:[\s]*?([\d]+)/))||void 0===_data$responseText$ma?void 0:_data$responseText$ma[1],"points"===type&&points&&(this.myPoints=parseInt(points,10))):logStatus.error(`Error:${null===data||void 0===data?void 0:data.statusText}(${null===data||void 0===data?void 0:data.status})`):logStatus.error(result+`:${statusText}(${status})`)}else logStatus.error('Error: No "href".')}}else scripts_echoLog({}).warning(i18n("getNeedPointsFailed")+": "+name)}scripts_echoLog({text:"-----END-----"})}catch(error){throwError(error,"OpiumPulses.toggleTask")}}init(){return!0}classifyTask(){return!0}#checkLogin(){try{return globalOptions.other.checkLogin?(1<$('a[href*="/site/login"]').length&&window.open("/site/login","_self"),!0):!0}catch(error){return throwError(error,"OpiumPulses.checkLogin"),!1}}},dayjs_min=__webpack_require__(698),dayjs_min_default=__webpack_require__.n(dayjs_min);const website_leftKeyChecker={async classify(link){try{return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(link)?await this.giveawaySu(link):/^https?:\/\/givee\.club\/[\w]+?\/event\/[\d]+/.test(link)?await this.giveeClub(link):/^https?:\/\/gleam\.io\/.+?\/.+/.test(link)?await this.gleam(link):/^https?:\/\/www\.indiedb\.com\/giveaways\/.+/.test(link)?await this.indieDb(link):/^https?:\/\/key-hub\.eu\/giveaway\/[\d]+/.test(link)?await this.keyhub(link):/^https?:\/\/opquests\.com\/quests\/[\d]+/.test(link)?await this.opquests(link):!!/^https?:\/\/itch\.io\/s\/[\d]+?\/.*/.test(link)&&await this.itch(link)}catch(error){return throwError(error,"leftKeyChecker.classify"),!1}},async giveawaySu(link){try{const{result,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result&&200===(null===data||void 0===data?void 0:data.status)?!data.responseText.includes('class="steam-login"')&&(data.responseText.includes('class="giveaway-ended"')?"Ended":"Active"):!1}catch(error){return throwError(error,"leftKeyChecker.giveawaySu"),!1}},async giveeClub(link){try{const{result,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result&&200===(null===data||void 0===data?void 0:data.status)?data.responseText.includes('class="event-winner"')?"Won":data.responseText.includes('class="event-ended"')?"Ended":"Active":!1}catch(error){return throwError(error,"leftKeyChecker.giveeClub"),!1}},async gleam(link){try{const{result,data}=await tools_httpRequest({url:link,method:"GET"});if("Success"!==result||200!==(null===data||void 0===data?void 0:data.status))return!1;var _data$responseText$ma,_$$attr,_$$attr$match;if(/incentives":{"[\d]+?":\[".+?"\]/.test(data.responseText))return"Won";var campaignDiv=null===(_data$responseText$ma=data.responseText.match(/