{ "version": 3, "sources": ["../../../../server/chat-plugins/sample-teams.ts"], "sourcesContent": ["/**\n * A sample teams plugin\n *\n * @author Kris\n */\n\nimport {FS, Utils} from \"../../lib\";\n\nconst SAMPLE_TEAMS = 'config/chat-plugins/sample-teams.json';\n\ninterface SampleTeamsData {\n\twhitelist: {[formatid: string]: RoomID[]};\n\t/** Teams are stored in the packed format */\n\tteams: {\n\t\t[formatid: string]: {\n\t\t\tuncategorized: {[k: string]: string},\n\t\t\t[category: string]: {[teamName: string]: string},\n\t\t},\n\t};\n}\n\nexport const teamData: SampleTeamsData = (() => {\n\ttry {\n\t\treturn JSON.parse(FS(SAMPLE_TEAMS).readIfExistsSync());\n\t} catch {\n\t\treturn {\n\t\t\twhitelist: {},\n\t\t\tteams: {},\n\t\t};\n\t}\n})();\n\nfunction save() {\n\tFS(SAMPLE_TEAMS).writeUpdate(() => JSON.stringify(teamData));\n}\n\nfor (const formatid in teamData.teams) {\n\tif (!teamData.teams[formatid].uncategorized) teamData.teams[formatid].uncategorized = {};\n}\nsave();\n\nexport const SampleTeams = new class SampleTeams {\n\tprivate isRoomStaff(user: User, roomids: RoomID[]) {\n\t\tlet matched = false;\n\t\tif (!roomids?.length) return false;\n\t\tfor (const roomid of roomids) {\n\t\t\tconst room = Rooms.search(roomid);\n\t\t\t// Malformed entry from botched room rename\n\t\t\tif (!room) continue;\n\t\t\tmatched = room.auth.isStaff(user.id);\n\t\t\tif (matched) break;\n\t\t}\n\t\treturn matched;\n\t}\n\n\tisDevMod(user: User) {\n\t\treturn !!Rooms.get('development')?.auth.atLeast(user, '@');\n\t}\n\n\tcheckPermissions(user: User, roomids: RoomID[]) {\n\t\t// Give Development room mods access to help fix crashes\n\t\treturn this.isRoomStaff(user, roomids) || user.can('bypassall') || this.isDevMod(user);\n\t}\n\n\twhitelistedRooms(formatid: string, names = false) {\n\t\tformatid = this.sanitizeFormat(formatid);\n\t\tif (!teamData.whitelist[formatid]?.length) return null;\n\t\treturn Utils.sortBy(teamData.whitelist[formatid], (x) => {\n\t\t\tif (!names) return x;\n\t\t\tconst room = Rooms.search(x);\n\t\t\tif (!room) return x;\n\t\t\treturn room.title;\n\t\t});\n\t}\n\n\twhitelistRooms(formatids: string[], roomids: string[]) {\n\t\tfor (const unsanitizedFormatid of formatids) {\n\t\t\tconst formatid = this.sanitizeFormat(unsanitizedFormatid);\n\t\t\tif (!teamData.whitelist[formatid]) teamData.whitelist[formatid] = [];\n\t\t\tfor (const roomid of roomids) {\n\t\t\t\tconst targetRoom = Rooms.search(roomid);\n\t\t\t\tif (!targetRoom?.persist) {\n\t\t\t\t\tthrow new Chat.ErrorMessage(`Room ${roomid} not found. Check spelling?`);\n\t\t\t\t}\n\t\t\t\tif (teamData.whitelist[formatid].includes(targetRoom.roomid)) {\n\t\t\t\t\tthrow new Chat.ErrorMessage(`Room ${targetRoom.title} is already added.`);\n\t\t\t\t}\n\t\t\t\tteamData.whitelist[formatid].push(targetRoom.roomid);\n\t\t\t\tsave();\n\t\t\t}\n\t\t}\n\t}\n\n\tunwhitelistRoom(formatid: string, roomid: string) {\n\t\tformatid = this.sanitizeFormat(formatid, false);\n\t\tconst targetRoom = Rooms.search(roomid);\n\t\tif (!targetRoom?.persist) throw new Chat.ErrorMessage(`Room ${roomid} not found. Check spelling?`);\n\t\tif (!teamData.whitelist[formatid]?.length) throw new Chat.ErrorMessage(`No rooms are whitelisted for ${formatid}.`);\n\t\tif (!teamData.whitelist[formatid].includes(targetRoom.roomid)) {\n\t\t\tthrow new Chat.ErrorMessage(`Room ${targetRoom.title} isn't whitelisted.`);\n\t\t}\n\t\tconst index = teamData.whitelist[formatid].indexOf(targetRoom.roomid);\n\t\tteamData.whitelist[formatid].splice(index, 1);\n\t\tif (!teamData.whitelist[formatid].length) delete teamData.whitelist[formatid];\n\t\tsave();\n\t}\n\n\tsanitizeFormat(formatid: string, checkExists = false) {\n\t\tconst format = Dex.formats.get(formatid);\n\t\tif (checkExists && !format.exists) {\n\t\t\tthrow new Chat.ErrorMessage(`Format \"${formatid.trim()}\" not found. Check spelling?`);\n\t\t}\n\t\tif (format.team) {\n\t\t\tthrow new Chat.ErrorMessage(`Formats with computer-generated teams can't have team storage.`);\n\t\t}\n\t\treturn format.id;\n\t}\n\n\tinitializeFormat(formatid: string) {\n\t\tif (!teamData.teams[formatid]) {\n\t\t\tteamData.teams[formatid] = {uncategorized: {}};\n\t\t\tsave();\n\t\t}\n\t}\n\n\taddCategory(user: User, formatid: string, category: string) {\n\t\tformatid = this.sanitizeFormat(formatid);\n\t\tif (!this.checkPermissions(user, teamData.whitelist[formatid])) {\n\t\t\tlet rankNeeded = `a global administrator`;\n\t\t\tif (teamData.whitelist[formatid]) {\n\t\t\t\trankNeeded = `staff in ${Chat.toListString(teamData.whitelist[formatid], \"or\")}`;\n\t\t\t}\n\t\t\tthrow new Chat.ErrorMessage(`Access denied. You need to be ${rankNeeded} to add teams for ${formatid}`);\n\t\t}\n\t\tcategory = category.trim();\n\t\tthis.initializeFormat(formatid);\n\t\tif (this.findCategory(formatid, category)) {\n\t\t\tthrow new Chat.ErrorMessage(`The category named ${category} already exists.`);\n\t\t}\n\t\tteamData.teams[formatid][category] = {};\n\t\tsave();\n\t}\n\n\tremoveCategory(user: User, formatid: string, category: string) {\n\t\tformatid = this.sanitizeFormat(formatid, false);\n\t\tif (!this.checkPermissions(user, teamData.whitelist[formatid])) {\n\t\t\tlet rankNeeded = `a global administrator`;\n\t\t\tif (teamData.whitelist[formatid]) {\n\t\t\t\trankNeeded = `staff in ${Chat.toListString(teamData.whitelist[formatid], \"or\")}`;\n\t\t\t}\n\t\t\tthrow new Chat.ErrorMessage(`Access denied. You need to be ${rankNeeded} to add teams for ${formatid}`);\n\t\t}\n\t\tconst categoryName = this.findCategory(formatid, category);\n\t\tif (!categoryName) {\n\t\t\tthrow new Chat.ErrorMessage(`There's no category named \"${category.trim()}\" for the format ${formatid}.`);\n\t\t}\n\t\tdelete teamData.teams[formatid][categoryName];\n\t\tsave();\n\t}\n\n\t/**\n\t * @param user\n\t * @param formatid\n\t * @param teamName\n\t * @param team - Can be a team in the packed, JSON, or exported format\n\t * @param category - Category the team will go in, defaults to uncategorized\n\t */\n\taddTeam(user: User, formatid: string, teamName: string, team: string, category = \"uncategorized\") {\n\t\tformatid = this.sanitizeFormat(formatid);\n\t\tif (!this.checkPermissions(user, teamData.whitelist[formatid])) {\n\t\t\tlet rankNeeded = `a global administrator`;\n\t\t\tif (teamData.whitelist[formatid]?.length) {\n\t\t\t\trankNeeded = `staff in ${Chat.toListString(teamData.whitelist[formatid], \"or\")}`;\n\t\t\t}\n\t\t\tthrow new Chat.ErrorMessage(`Access denied. You need to be ${rankNeeded} to add teams for ${formatid}`);\n\t\t}\n\t\tteamName = teamName.trim();\n\t\tcategory = category.trim();\n\t\tthis.initializeFormat(formatid);\n\t\tif (this.findTeamName(formatid, category, teamName)) {\n\t\t\tthrow new Chat.ErrorMessage(`There is already a team for ${formatid} with the name ${teamName} in the ${category} category.`);\n\t\t}\n\t\tif (!teamData.teams[formatid][category]) this.addCategory(user, formatid, category);\n\t\tteamData.teams[formatid][category][teamName] = Teams.pack(Teams.import(team.trim()));\n\t\tsave();\n\t\treturn teamData.teams[formatid][category][teamName];\n\t}\n\n\tremoveTeam(user: User, formatid: string, teamid: string, category: string) {\n\t\tformatid = this.sanitizeFormat(formatid, false);\n\t\tcategory = category.trim();\n\t\tif (!this.checkPermissions(user, teamData.whitelist[formatid])) {\n\t\t\tlet required = `an administrator`;\n\t\t\tif (teamData.whitelist[formatid]) {\n\t\t\t\trequired = `staff in ${Chat.toListString(teamData.whitelist[formatid], \"or\")}`;\n\t\t\t}\n\t\t\tthrow new Chat.ErrorMessage(`Access denied. You need to be ${required} to add teams for ${formatid}`);\n\t\t}\n\t\tconst categoryName = this.findCategory(formatid, category);\n\t\tif (!categoryName) {\n\t\t\tthrow new Chat.ErrorMessage(`There are no teams for ${formatid} under the category ${category.trim()}. Check spelling?`);\n\t\t}\n\t\tconst teamName = this.findTeamName(formatid, category, teamid);\n\t\tif (!teamName) {\n\t\t\tthrow new Chat.ErrorMessage(`There is no team for ${formatid} with the name of \"${teamid}\". Check spelling?`);\n\t\t}\n\t\tconst oldTeam = teamData.teams[formatid][categoryName][teamName];\n\t\tdelete teamData.teams[formatid][categoryName][teamName];\n\t\tif (!Object.keys(teamData.teams[formatid][categoryName]).length) delete teamData.teams[formatid][categoryName];\n\t\tif (!Object.keys(teamData.teams[formatid]).filter(x => x !== 'uncategorized').length) delete teamData.teams[formatid];\n\t\tsave();\n\t\treturn oldTeam;\n\t}\n\n\tformatTeam(teamName: string, teamStr: string, broadcasting = false) {\n\t\tconst team = Teams.unpack(teamStr);\n\t\tif (!team) return `Team is not correctly formatted. PM room staff to fix the formatting.`;\n\t\tlet buf = ``;\n\t\tif (!broadcasting) {\n\t\t\tbuf += `
${team.map(x => ``).join('')}`;\n\t\t\tbuf += `
${Utils.escapeHTML(teamName.toUpperCase())}
`;\n\t\t\tbuf += Chat.getReadmoreCodeBlock(Teams.export(team).trim());\n\t\t} else {\n\t\t\tbuf += `
${team.map(x => ``).join('')} – ${Utils.escapeHTML(teamName)}`;\n\t\t\tbuf += `${Teams.export(team).trim().replace(/\\n/g, '
')}
`;\n\t\t}\n\t\treturn buf;\n\t}\n\n\tmodlog(context: Chat.CommandContext, formatid: string, action: string, note: string, log: string) {\n\t\tformatid = this.sanitizeFormat(formatid);\n\t\tconst whitelistedRooms = this.whitelistedRooms(formatid);\n\t\tif (whitelistedRooms?.length) {\n\t\t\tfor (const roomid of whitelistedRooms) {\n\t\t\t\tconst room = Rooms.get(roomid);\n\t\t\t\tif (!room) continue;\n\t\t\t\tcontext.room = room;\n\t\t\t\tcontext.modlog(action, null, `${formatid}: ${note}`);\n\t\t\t\tcontext.privateModAction(log);\n\t\t\t}\n\t\t} else {\n\t\t\tcontext.room = Rooms.get('staff') || null;\n\t\t\tcontext.globalModlog(action, null, `${formatid}: ${note}`);\n\t\t\tcontext.privateGlobalModAction(log);\n\t\t}\n\t}\n\n\t/**\n\t * Returns the category name of the provided category ID if there is one.\n\t */\n\tfindCategory(formatid: string, categoryid: string) {\n\t\tformatid = toID(formatid);\n\t\tcategoryid = toID(categoryid);\n\t\tlet match: string | null = null;\n\t\tfor (const categoryName in teamData.teams[formatid] || {}) {\n\t\t\tif (toID(categoryName) === categoryid) {\n\t\t\t\tmatch = categoryName;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn match;\n\t}\n\n\tfindTeamName(formatid: string, categoryid: string, teamid: string) {\n\t\tconst categoryName = this.findCategory(formatid, categoryid);\n\t\tif (!categoryName) return null;\n\t\tlet match: string | null = null;\n\t\tfor (const teamName in teamData.teams[formatid][categoryName] || {}) {\n\t\t\tif (toID(teamName) === teamid) {\n\t\t\t\tmatch = teamName;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn match;\n\t}\n\n\tgetFormatName(formatid: string) {\n\t\treturn Dex.formats.get(formatid).exists ? Dex.formats.get(formatid).name : formatid;\n\t}\n\n\tdestroy() {\n\t\tfor (const formatid in teamData.whitelist) {\n\t\t\tfor (const [i, roomid] of teamData.whitelist[formatid].entries()) {\n\t\t\t\tconst room = Rooms.search(roomid);\n\t\t\t\tif (room) continue;\n\t\t\t\tteamData.whitelist[formatid].splice(i, 1);\n\t\t\t\tif (!teamData.whitelist[formatid].length) delete teamData.whitelist[formatid];\n\t\t\t\tsave();\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport const destroy = SampleTeams.destroy;\n\nexport const handlers: Chat.Handlers = {\n\tonRenameRoom(oldID, newID) {\n\t\tfor (const formatid in teamData.whitelist) {\n\t\t\tif (!SampleTeams.whitelistedRooms(formatid)?.includes(oldID)) continue;\n\t\t\tSampleTeams.unwhitelistRoom(formatid, oldID);\n\t\t\tSampleTeams.whitelistRooms([formatid], [newID]);\n\t\t}\n\t},\n};\n\nexport const commands: Chat.ChatCommands = {\n\tsampleteams(target, room, user) {\n\t\tthis.sendReply(`Sample Teams are being deprecated. Please do \\`\\`/tier [formatid]\\`\\` to view their resources.`);\n\t\tthis.sendReply(`If you are room staff for a room and would like to access old samples for your room's formats, please contact an admin.`);\n\t},\n\t/* sampleteams: {\n\t\t''(target, room, user) {\n\t\t\tthis.runBroadcast();\n\t\t\tlet [formatid, category] = target.split(',');\n\t\t\tif (!this.broadcasting) {\n\t\t\t\tif (!formatid) return this.parse(`/j view-sampleteams-view`);\n\t\t\t\tformatid = SampleTeams.sanitizeFormat(formatid);\n\t\t\t\tif (!category) return this.parse(`/j view-sampleteams-view-${formatid}`);\n\t\t\t\tconst categoryName = SampleTeams.findCategory(formatid, category);\n\t\t\t\treturn this.parse(`/j view-sampleteams-view-${formatid}${categoryName ? '-' + toID(categoryName) : ''}`);\n\t\t\t}\n\t\t\tif (!formatid) return this.parse(`/help sampleteams`);\n\t\t\tformatid = SampleTeams.sanitizeFormat(formatid);\n\t\t\tif (!teamData.teams[formatid]) {\n\t\t\t\tthrow new Chat.ErrorMessage(`No teams for ${SampleTeams.getFormatName(formatid)} found. Check spelling?`);\n\t\t\t}\n\t\t\tlet buf = ``;\n\t\t\tif (!category) {\n\t\t\t\tfor (const categoryName in teamData.teams[formatid]) {\n\t\t\t\t\tif (!Object.keys(teamData.teams[formatid][categoryName]).length) continue;\n\t\t\t\t\tif (buf) buf += `
`;\n\t\t\t\t\tbuf += `${categoryName.toUpperCase()}`;\n\t\t\t\t\tfor (const [i, teamName] of Object.keys(teamData.teams[formatid][categoryName]).entries()) {\n\t\t\t\t\t\tif (i) buf += `
`;\n\t\t\t\t\t\tbuf += SampleTeams.formatTeam(teamName, teamData.teams[formatid][categoryName][teamName], true);\n\t\t\t\t\t}\n\t\t\t\t\tbuf += ``;\n\t\t\t\t}\n\t\t\t\tif (!buf) {\n\t\t\t\t\tthrow new Chat.ErrorMessage(`No teams for ${SampleTeams.getFormatName(formatid)} found. Check spelling?`);\n\t\t\t\t} else {\n\t\t\t\t\tbuf = `

Sample Teams for ${SampleTeams.getFormatName(formatid)}


${buf}`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst categoryName = SampleTeams.findCategory(formatid, category);\n\t\t\t\tif (!categoryName) {\n\t\t\t\t\tthrow new Chat.ErrorMessage(`No teams for ${SampleTeams.getFormatName(formatid)} in the ${category} category found. Check spelling?`);\n\t\t\t\t}\n\t\t\t\tfor (const teamName in teamData.teams[formatid][categoryName]) {\n\t\t\t\t\tbuf += SampleTeams.formatTeam(teamName, teamData.teams[formatid][categoryName][teamName], true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.sendReplyBox(buf);\n\t\t},\n\t\taddcategory(target, room, user) {\n\t\t\tlet [formatid, categoryName] = target.split(',');\n\t\t\tif (!(formatid && categoryName)) return this.parse(`/help sampleteams`);\n\t\t\tif (!categoryName.trim()) categoryName = \"uncategorized\";\n\t\t\tSampleTeams.addCategory(user, formatid, categoryName.trim());\n\t\t\tSampleTeams.modlog(\n\t\t\t\tthis, formatid, 'ADDTEAMCATEGORY', categoryName.trim(),\n\t\t\t\t`${user.name} added ${categoryName.trim()} as a category for ${formatid}.`\n\t\t\t);\n\t\t\tthis.sendReply(`Added ${categoryName.trim()} as a category for ${formatid}.`);\n\t\t},\n\t\tremovecategory(target, room, user) {\n\t\t\tconst [formatid, categoryName] = target.split(',');\n\t\t\tif (!(formatid && categoryName)) return this.parse(`/help sampleteams`);\n\t\t\tif (toID(categoryName) === 'uncategorized') {\n\t\t\t\tthrow new Chat.ErrorMessage(`The uncategorized category cannot be removed.`);\n\t\t\t}\n\t\t\tSampleTeams.removeCategory(user, formatid, categoryName);\n\t\t\tSampleTeams.modlog(\n\t\t\t\tthis, formatid, 'REMOVETEAMCATEGORY', categoryName.trim(),\n\t\t\t\t`${user.name} removed ${categoryName.trim()} as a category for ${formatid}.`\n\t\t\t);\n\t\t\tthis.sendReply(`Removed ${categoryName.trim()} as a category for ${formatid}.`);\n\t\t},\n\t\tadd(target, room, user) {\n\t\t\tconst [formatid, category, teamName, team] = target.split(',');\n\t\t\tif (!(formatid && category?.trim() && teamName && team)) return this.parse('/j view-sampleteams-add');\n\t\t\tconst packedTeam = SampleTeams.addTeam(user, formatid, teamName, team, category);\n\t\t\tSampleTeams.modlog(\n\t\t\t\tthis, formatid, 'ADDTEAM', `${category}: ${teamName}: ${packedTeam}`,\n\t\t\t\t`${user.name} added a team for ${formatid} in the ${category} category.`\n\t\t\t);\n\t\t\tthis.sendReply(`Added a team for ${formatid} in the ${category} category.`);\n\t\t},\n\t\tremove(target, room, user) {\n\t\t\tconst [formatid, category, teamName] = target.split(',').map(x => x.trim());\n\t\t\tif (!(formatid && category && teamName)) return this.parse(`/help sampleteams`);\n\t\t\tconst team = SampleTeams.removeTeam(user, formatid, toID(teamName), category);\n\t\t\tSampleTeams.modlog(\n\t\t\t\tthis, formatid, 'REMOVETEAM', `${category}: ${teamName}: ${team}`,\n\t\t\t\t`${user.name} removed a team from ${formatid} in the ${category} category.`\n\t\t\t);\n\t\t\tthis.sendReply(`Removed a team from ${formatid} in the ${category} category.`);\n\t\t},\n\t\twhitelist: {\n\t\t\tadd(target, room, user) {\n\t\t\t\t// Allow development roommods to whitelist to help debug\n\t\t\t\tif (!SampleTeams.isDevMod(user)) {\n\t\t\t\t\tthis.checkCan('bypassall');\n\t\t\t\t}\n\t\t\t\tconst [formatids, roomids] = target.split('|').map(x => x.split(','));\n\t\t\t\tif (!(formatids?.length && roomids?.length)) return this.parse(`/help sampleteams`);\n\t\t\t\tSampleTeams.whitelistRooms(formatids, roomids);\n\t\t\t\tthis.privateGlobalModAction(`${user.name} whitelisted ${Chat.toListString(roomids.map(x => Rooms.search(x)!.title))} to handle sample teams for ${Chat.toListString(formatids)}.`);\n\t\t\t\tthis.globalModlog(`SAMPLETEAMS WHITELIST`, null, roomids.join(', '));\n\t\t\t\tthis.sendReply(`Whitelisted ${Chat.toListString(roomids)} to handle sample teams for ${Chat.toListString(formatids)}.`);\n\t\t\t},\n\t\t\tremove(target, room, user) {\n\t\t\t\t// Allow development roommods to whitelist to help debug\n\t\t\t\tif (!SampleTeams.isDevMod(user)) {\n\t\t\t\t\tthis.checkCan('bypassall');\n\t\t\t\t}\n\t\t\t\tconst [formatid, roomid] = target.split(',');\n\t\t\t\tif (!(formatid && roomid)) return this.parse(`/help sampleteams`);\n\t\t\t\tSampleTeams.unwhitelistRoom(formatid, roomid);\n\t\t\t\tthis.refreshPage('sampleteams-whitelist');\n\t\t\t},\n\t\t\t'': 'view',\n\t\t\tview(target, room, user) {\n\t\t\t\t// Allow development roommods to whitelist to help debug\n\t\t\t\tif (!SampleTeams.isDevMod(user)) {\n\t\t\t\t\tthis.checkCan('bypassall');\n\t\t\t\t}\n\t\t\t\tthis.parse(`/j view-sampleteams-whitelist`);\n\t\t\t},\n\t\t},\n\t},\n\tsampleteamshelp: [\n\t\t`/sampleteams [format] - Lists the sample teams for [format], if there are any.`,\n\t\t`/sampleteams addcategory/removecategory [format], [category] - Adds/removes categories for [format].`,\n\t\t`/sampleteams add - Pulls up the interface to add sample teams. Requires: Room staff in dedicated tier room, &`,\n\t\t`/sampleteams remove [format], [category], [team name] - Removes a sample team for [format] in [category].`,\n\t\t`/sampleteams whitelist add [formatid], [formatid] | [roomid], [roomid], ... - Whitelists room staff for the provided roomids to add sample teams. Requires: &`,\n\t\t`/sampleteams whitelist remove [formatid], [roomid] - Unwhitelists room staff for the provided room to add sample teams. Requires: &`,\n\t], */\n};\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAAwB;AAExB,MAAM,eAAe;AAad,MAAM,YAA6B,MAAM;AAC/C,MAAI;AACH,WAAO,KAAK,UAAM,eAAG,YAAY,EAAE,iBAAiB,CAAC;AAAA,EACtD,QAAE;AACD,WAAO;AAAA,MACN,WAAW,CAAC;AAAA,MACZ,OAAO,CAAC;AAAA,IACT;AAAA,EACD;AACD,GAAG;AAEH,SAAS,OAAO;AACf,qBAAG,YAAY,EAAE,Y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