diff --git a/code/__defines/chat.dm b/code/__defines/chat.dm index 37624e1f4d..e1acf03d64 100644 --- a/code/__defines/chat.dm +++ b/code/__defines/chat.dm @@ -3,6 +3,11 @@ * SPDX-License-Identifier: MIT */ +/// How many chat payloads to keep in history +#define CHAT_RELIABILITY_HISTORY_SIZE 5 +/// How many resends to allow before giving up +#define CHAT_RELIABILITY_MAX_RESENDS 3 + #define MESSAGE_TYPE_SYSTEM "system" #define MESSAGE_TYPE_LOCALCHAT "localchat" #define MESSAGE_TYPE_PLOCALCHAT "plocalchat" diff --git a/code/_helpers/icons.dm b/code/_helpers/icons.dm index dce51f35bf..532222b7f6 100644 --- a/code/_helpers/icons.dm +++ b/code/_helpers/icons.dm @@ -517,6 +517,37 @@ GLOBAL_LIST_EMPTY(cached_examine_icons) return list(rsc_ref, hash, "asset.[hash]") +/// Gets a dummy savefile for usage in icon generation. +/// Savefiles generated from this proc will be empty. +/proc/get_dummy_savefile(from_failure = FALSE) + var/static/next_id = 0 + if(next_id++ > 9) + next_id = 0 + var/savefile_path = "tmp/dummy-save-[next_id].sav" + try + if(fexists(savefile_path)) + fdel(savefile_path) + return new /savefile(savefile_path) + catch(var/exception/error) + // if we failed to create a dummy once, try again; maybe someone slept somewhere they shouldnt have + if(from_failure) // this *is* the retry, something fucked up + CRASH("get_dummy_savefile failed to create a dummy savefile: '[error]'") + return get_dummy_savefile(from_failure = TRUE) + +/** + * Converts an icon to base64. Operates by putting the icon in the iconCache savefile, + * exporting it as text, and then parsing the base64 from that. + * (This relies on byond automatically storing icons in savefiles as base64) + */ +/proc/icon2base64(icon/icon) + if (!isicon(icon)) + return FALSE + var/savefile/dummySave = get_dummy_savefile() + WRITE_FILE(dummySave["dummy"], icon) + var/iconData = dummySave.ExportText("dummy") + var/list/partial = splittext(iconData, "{") + return replacetext(copytext_char(partial[2], 3, -5), "\n", "") //if cleanup fails we want to still return the correct base64 + ///given a text string, returns whether it is a valid dmi icons folder path /proc/is_valid_dmi_file(icon_path) if(!istext(icon_path) || !length(icon_path)) @@ -671,6 +702,39 @@ GLOBAL_LIST_EMPTY(cached_examine_icons) return get_asset_url(key) return "" +/proc/icon2base64html(target, var/custom_classes = "") + if (!target) + return + var/static/list/bicon_cache = list() + if (isicon(target)) + var/icon/target_icon = target + var/icon_base64 = icon2base64(target_icon) + + if (target_icon.Height() > world.icon_size || target_icon.Width() > world.icon_size) + var/icon_md5 = md5(icon_base64) + icon_base64 = bicon_cache[icon_md5] + if (!icon_base64) // Doesn't exist yet, make it. + bicon_cache[icon_md5] = icon_base64 = icon2base64(target_icon) + + + return "" + + // Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with. + var/atom/target_atom = target + var/key = "[istype(target_atom.icon, /icon) ? "[REF(target_atom.icon)]" : target_atom.icon]:[target_atom.icon_state]" + + + if (!bicon_cache[key]) // Doesn't exist, make it. + var/icon/target_icon = icon(target_atom.icon, target_atom.icon_state, SOUTH, 1) + if (ishuman(target)) // Shitty workaround for a BYOND issue. + var/icon/temp = target_icon + target_icon = icon() + target_icon.Insert(temp, dir = SOUTH) + + bicon_cache[key] = icon2base64(target_icon) + + return "" + //Costlier version of icon2html() that uses getFlatIcon() to account for overlays, underlays, etc. Use with extreme moderation, ESPECIALLY on mobs. /proc/costly_icon2html(thing, target, sourceonly = FALSE) if (!thing) diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index 5e77b4b09c..1ce469c407 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -347,7 +347,7 @@ if(!text_tag_cache[tagname]) var/icon/tag = icon(text_tag_icons, tagname) text_tag_cache[tagname] = bicon(tag, TRUE, "text_tag") - if(C.chatOutput.broken) + if(!C.tgui_panel.is_ready() || C.tgui_panel.oldchat) return "[tagdesc]" return text_tag_cache[tagname] diff --git a/code/_macros.dm b/code/_macros.dm index 737b317abe..169a897881 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -12,7 +12,7 @@ // #define to_chat(target, message) target << message Not anymore! //#define to_chat to_chat_filename=__FILE__;to_chat_line=__LINE__;to_chat_src=src;__to_chat -#define to_chat __to_chat +//#define to_chat __to_chat #define to_world(message) to_chat(world, message) #define to_world_log(message) world.log << message // TODO - Baystation has this log to crazy places. For now lets just world.log, but maybe look into it later. diff --git a/code/controllers/subsystems/chat.dm b/code/controllers/subsystems/chat.dm index 92a1be2757..b8b2917c8d 100644 --- a/code/controllers/subsystems/chat.dm +++ b/code/controllers/subsystems/chat.dm @@ -1,77 +1,100 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + SUBSYSTEM_DEF(chat) name = "Chat" - flags = SS_TICKER - wait = 1 // SS_TICKER means this runs every tick + flags = SS_TICKER|SS_NO_INIT + wait = 1 priority = FIRE_PRIORITY_CHAT init_order = INIT_ORDER_CHAT - var/list/list/msg_queue = list() //List of lists + /// Assosciates a ckey with a list of messages to send to them. + var/list/list/datum/chat_payload/client_to_payloads = list() -/datum/controller/subsystem/chat/Initialize(timeofday) - init_vchat() - ..() + /// Associates a ckey with an assosciative list of their last CHAT_RELIABILITY_HISTORY_SIZE messages. + var/list/list/datum/chat_payload/client_to_reliability_history = list() + + /// Assosciates a ckey with their next sequence number. + var/list/client_to_sequence_number = list() + +/datum/controller/subsystem/chat/proc/generate_payload(client/target, message_data) + var/sequence = client_to_sequence_number[target.ckey] + client_to_sequence_number[target.ckey] += 1 + + var/datum/chat_payload/payload = new + payload.sequence = sequence + payload.content = message_data + + if(!(target.ckey in client_to_reliability_history)) + client_to_reliability_history[target.ckey] = list() + var/list/client_history = client_to_reliability_history[target.ckey] + client_history["[sequence]"] = payload + + if(length(client_history) > CHAT_RELIABILITY_HISTORY_SIZE) + var/oldest = text2num(client_history[1]) + for(var/index in 2 to length(client_history)) + var/test = text2num(client_history[index]) + if(test < oldest) + oldest = test + client_history -= "[oldest]" + return payload + +/datum/controller/subsystem/chat/proc/send_payload_to_client(client/target, datum/chat_payload/payload) + target.tgui_panel.window.send_message("chat/message", payload.into_message()) + SEND_TEXT(target, payload.get_content_as_html()) /datum/controller/subsystem/chat/fire() - var/list/msg_queue = src.msg_queue // Local variable for sanic speed. - for(var/client/C as anything in msg_queue) - var/list/messages = msg_queue[C] - msg_queue -= C - if (C) - C << output(jsEncode(messages), "htmloutput:putmessage") + for(var/ckey in client_to_payloads) + var/client/target = GLOB.directory[ckey] + if(isnull(target)) // verify client still exists + LAZYREMOVE(client_to_payloads, ckey) + continue + + for(var/datum/chat_payload/payload as anything in client_to_payloads[ckey]) + send_payload_to_client(target, payload) + LAZYREMOVE(client_to_payloads, ckey) if(MC_TICK_CHECK) return -/datum/controller/subsystem/chat/stat_entry() - ..("C:[msg_queue.len]") +/datum/controller/subsystem/chat/proc/queue(queue_target, list/message_data) + var/list/targets = islist(queue_target) ? queue_target : list(queue_target) + for(var/target in targets) + var/client/client = CLIENT_FROM_VAR(target) + if(isnull(client)) + continue + LAZYADDASSOCLIST(client_to_payloads, client.ckey, generate_payload(client, message_data)) -/datum/controller/subsystem/chat/proc/queue(target, time, message, handle_whitespace = TRUE) - if(!target || !message) +/datum/controller/subsystem/chat/proc/send_immediate(send_target, list/message_data) + var/list/targets = islist(send_target) ? send_target : list(send_target) + for(var/target in targets) + var/client/client = CLIENT_FROM_VAR(target) + if(isnull(client)) + continue + send_payload_to_client(client, generate_payload(client, message_data)) + +/datum/controller/subsystem/chat/proc/handle_resend(client/client, sequence) + var/list/client_history = client_to_reliability_history[client.ckey] + sequence = "[sequence]" + if(isnull(client_history) || !(sequence in client_history)) return - if(!istext(message)) - stack_trace("to_chat called with invalid input type") - return + var/datum/chat_payload/payload = client_history[sequence] + if(payload.resends > CHAT_RELIABILITY_MAX_RESENDS) + return // we tried but byond said no - // Currently to_chat(world, ...) gets sent individually to each client. Consider. - if(target == world) - target = GLOB.clients - - //Some macros remain in the string even after parsing and fuck up the eventual output - var/original_message = message - message = replacetext(message, "\n", "
") - message = replacetext(message, "\improper", "") - message = replacetext(message, "\proper", "") - - if(isnull(time)) - time = world.time - - var/list/messageStruct = list("time" = time, "message" = message); - - if(islist(target)) - for(var/I in target) - var/client/C = CLIENT_FROM_VAR(I) //Grab us a client if possible - - if(!C || !C.chatOutput) - continue // No client? No care. - else if(C.chatOutput.broken) - DIRECT_OUTPUT(C, original_message) - continue - else if(!C.chatOutput.loaded) - continue // If not loaded yet, do nothing and history-sending on load will get it. - - LAZYINITLIST(msg_queue[C]) - msg_queue[C][++msg_queue[C].len] = messageStruct - else - var/client/C = CLIENT_FROM_VAR(target) //Grab us a client if possible - - if(!C || !C.chatOutput) - return // No client? No care. - else if(C.chatOutput.broken) - DIRECT_OUTPUT(C, original_message) - return - else if(!C.chatOutput.loaded) - return // If not loaded yet, do nothing and history-sending on load will get it. - - LAZYINITLIST(msg_queue[C]) - msg_queue[C][++msg_queue[C].len] = messageStruct + payload.resends += 1 + send_payload_to_client(client, client_history[sequence]) + /* + SSblackbox.record_feedback( + "nested tally", + "chat_resend_byond_version", + 1, + list( + "[client.byond_version]", + "[client.byond_build]", + ), + ) + */ diff --git a/code/controllers/subsystems/ping.dm b/code/controllers/subsystems/ping.dm new file mode 100644 index 0000000000..00e3effe02 --- /dev/null +++ b/code/controllers/subsystems/ping.dm @@ -0,0 +1,44 @@ +/*! + * Copyright (c) 2022 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +SUBSYSTEM_DEF(ping) + name = "Ping" + priority = FIRE_PRIORITY_PING + // init_stage = INITSTAGE_EARLY + wait = 4 SECONDS + flags = SS_NO_INIT + runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT + var/list/currentrun = list() + +/datum/controller/subsystem/ping/stat_entry() + ..("P:[GLOB.clients.len]") + +/datum/controller/subsystem/ping/fire(resumed = FALSE) + // Prepare the new batch of clients + if (!resumed) + src.currentrun = GLOB.clients.Copy() + + // De-reference the list for sanic speeds + var/list/currentrun = src.currentrun + + while (currentrun.len) + var/client/client = currentrun[currentrun.len] + currentrun.len-- + + if(!client.is_preference_enabled(/datum/client_preference/vchat_enable)) + winset(client, "output", "on-show=&is-disabled=0&is-visible=1") + winset(client, "browseroutput", "is-disabled=1;is-visible=0") + client.tgui_panel.oldchat = TRUE + + if (client?.tgui_panel?.is_ready()) + // Send a soft ping + client.tgui_panel.window.send_message("ping/soft", list( + // Slightly less than the subsystem timer (somewhat arbitrary) + // to prevent incoming pings from resetting the afk state + "afk" = client.is_afk(3.5 SECONDS), + )) + + if (MC_TICK_CHECK) + return diff --git a/code/controllers/subsystems/tgui.dm b/code/controllers/subsystems/tgui.dm index 73494cbf46..6810a23a7f 100644 --- a/code/controllers/subsystems/tgui.dm +++ b/code/controllers/subsystems/tgui.dm @@ -2,6 +2,7 @@ * Copyright (c) 2020 Aleksej Komarov * SPDX-License-Identifier: MIT */ + /** * tgui subsystem * @@ -37,7 +38,7 @@ SUBSYSTEM_DEF(tgui) /datum/controller/subsystem/tgui/stat_entry() ..("P:[all_uis.len]") -/datum/controller/subsystem/tgui/fire(resumed = 0) +/datum/controller/subsystem/tgui/fire(resumed = FALSE) if(!resumed) src.current_run = all_uis.Copy() // Cache for sanic speed (lists are references anyways) @@ -46,8 +47,8 @@ SUBSYSTEM_DEF(tgui) var/datum/tgui/ui = current_run[current_run.len] current_run.len-- // TODO: Move user/src_object check to process() - if(ui && ui.user && ui.src_object) - ui.process() + if(ui?.user && ui.src_object) + ui.process(wait * 0.1) else ui.close(0) if(MC_TICK_CHECK) @@ -86,6 +87,8 @@ SUBSYSTEM_DEF(tgui) window_found = TRUE break if(!window_found) + log_tgui(user, "Error: Pool exhausted", + context = "SStgui/request_pooled_window") return null return window @@ -97,6 +100,7 @@ SUBSYSTEM_DEF(tgui) * required user mob */ /datum/controller/subsystem/tgui/proc/force_close_all_windows(mob/user) + log_tgui(user, context = "SStgui/force_close_all_windows") if(user.client) user.client.tgui_windows = list() for(var/i in 1 to TGUI_WINDOW_HARD_LIMIT) @@ -112,6 +116,7 @@ SUBSYSTEM_DEF(tgui) * required window_id string */ /datum/controller/subsystem/tgui/proc/force_close_window(mob/user, window_id) + log_tgui(user, context = "SStgui/force_close_window") // Close all tgui datums based on window_id. for(var/datum/tgui/ui in user.tgui_open_uis) if(ui.window && ui.window.id == window_id) @@ -121,22 +126,23 @@ SUBSYSTEM_DEF(tgui) // Close window directly just to be sure. user << browse(null, "window=[window_id]") - /** - * public - * - * Get a open UI given a user, src_object, and ui_key and try to update it with data. - * - * required user mob The mob who opened/is using the UI. - * required src_object datum The object/datum which owns the UI. - * required ui_key string The ui_key of the UI. - * - * return datum/tgui The found UI. - **/ +/** + * public + * + * Try to find an instance of a UI, and push an update to it. + * + * required user mob The mob who opened/is using the UI. + * required src_object datum The object/datum which owns the UI. + * optional ui datum/tgui The UI to be updated, if it exists. + * optional force_open bool If the UI should be re-opened instead of updated. + * + * return datum/tgui The found UI. + */ /datum/controller/subsystem/tgui/proc/try_update_ui( mob/user, datum/src_object, datum/tgui/ui) - // Look up a UI if it wasn't passed. + // Look up a UI if it wasn't passed if(isnull(ui)) ui = get_open_ui(user, src_object) // Couldn't find a UI. @@ -152,17 +158,16 @@ SUBSYSTEM_DEF(tgui) ui.send_update() return ui - /** - * private - * - * Get a open UI given a user, src_object, and ui_key. - * - * required user mob The mob who opened/is using the UI. - * required src_object datum The object/datum which owns the UI. - * required ui_key string The ui_key of the UI. - * - * return datum/tgui The found UI. - **/ +/** + * public + * + * Get a open UI given a user and src_object. + * + * required user mob The mob who opened/is using the UI. + * required src_object datum The object/datum which owns the UI. + * + * return datum/tgui The found UI. + */ /datum/controller/subsystem/tgui/proc/get_open_ui(mob/user, datum/src_object) // No UIs opened for this src_object if(!LAZYLEN(src_object?.open_tguis)) @@ -171,56 +176,57 @@ SUBSYSTEM_DEF(tgui) // Make sure we have the right user if(ui.user == user) return ui - return null // Couldn't find a UI! + return null - /** - * private - * - * Update all UIs attached to src_object. - * - * required src_object datum The object/datum which owns the UIs. - * - * return int The number of UIs updated. - **/ +/** + * public + * + * Update all UIs attached to src_object. + * + * required src_object datum The object/datum which owns the UIs. + * + * return int The number of UIs updated. + */ /datum/controller/subsystem/tgui/proc/update_uis(datum/src_object) // No UIs opened for this src_object if(!LAZYLEN(src_object?.open_tguis)) return 0 var/count = 0 for(var/datum/tgui/ui in src_object.open_tguis) - // Check the UI is valid. - if(ui && ui.src_object && ui.user && ui.src_object.tgui_host(ui.user)) + // Check if UI is valid. + if(ui?.src_object && ui.user && ui.src_object.tgui_host(ui.user)) INVOKE_ASYNC(ui, TYPE_PROC_REF(/datum/tgui, process), wait * 0.1, TRUE) - count++ // Count each UI we update. + count++ return count - /** - * private - * - * Close all UIs attached to src_object. - * - * required src_object datum The object/datum which owns the UIs. - * - * return int The number of UIs closed. - **/ +/** + * public + * + * Close all UIs attached to src_object. + * + * required src_object datum The object/datum which owns the UIs. + * + * return int The number of UIs closed. + */ /datum/controller/subsystem/tgui/proc/close_uis(datum/src_object) // No UIs opened for this src_object if(!LAZYLEN(src_object?.open_tguis)) return 0 var/count = 0 for(var/datum/tgui/ui in src_object.open_tguis) - if(ui && ui.src_object && ui.user && ui.src_object.tgui_host(ui.user)) // Check the UI is valid. - ui.close() // Close the UI. - count++ // Count each UI we close. + // Check if UI is valid. + if(ui?.src_object && ui.user && ui.src_object.tgui_host(ui.user)) + ui.close() + count++ return count - /** - * private - * - * Close all UIs regardless of their attachment to src_object. - * - * return int The number of UIs closed. - **/ +/** + * public + * + * Close all UIs regardless of their attachment to src_object. + * + * return int The number of UIs closed. + */ /datum/controller/subsystem/tgui/proc/close_all_uis() var/count = 0 for(var/datum/tgui/ui in all_uis) @@ -230,67 +236,67 @@ SUBSYSTEM_DEF(tgui) count++ return count - /** - * private - * - * Update all UIs belonging to a user. - * - * required user mob The mob who opened/is using the UI. - * optional src_object datum If provided, only update UIs belonging this src_object. - * - * return int The number of UIs updated. - **/ +/** + * public + * + * Update all UIs belonging to a user. + * + * required user mob The mob who opened/is using the UI. + * optional src_object datum If provided, only update UIs belonging this src_object. + * + * return int The number of UIs updated. + */ /datum/controller/subsystem/tgui/proc/update_user_uis(mob/user, datum/src_object) var/count = 0 if(length(user?.tgui_open_uis) == 0) return count for(var/datum/tgui/ui in user.tgui_open_uis) if(isnull(src_object) || ui.src_object == src_object) - ui.process(force = 1) + ui.process(wait * 0.1, force = 1) count++ return count - /** - * private - * - * Close all UIs belonging to a user. - * - * required user mob The mob who opened/is using the UI. - * optional src_object datum If provided, only close UIs belonging this src_object. - * - * return int The number of UIs closed. - **/ -/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object, logout = FALSE) +/** + * public + * + * Close all UIs belonging to a user. + * + * required user mob The mob who opened/is using the UI. + * optional src_object datum If provided, only close UIs belonging this src_object. + * + * return int The number of UIs closed. + */ +/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object) var/count = 0 if(length(user?.tgui_open_uis) == 0) return count for(var/datum/tgui/ui in user.tgui_open_uis) if(isnull(src_object) || ui.src_object == src_object) - ui.close(logout = logout) + ui.close() count++ return count - /** - * private - * - * Add a UI to the list of open UIs. - * - * required ui datum/tgui The UI to be added. - **/ +/** + * private + * + * Add a UI to the list of open UIs. + * + * required ui datum/tgui The UI to be added. + */ /datum/controller/subsystem/tgui/proc/on_open(datum/tgui/ui) ui.user?.tgui_open_uis |= ui LAZYOR(ui.src_object.open_tguis, ui) all_uis |= ui - /** - * private - * - * Remove a UI from the list of open UIs. - * - * required ui datum/tgui The UI to be removed. - * - * return bool If the UI was removed or not. - **/ +/** + * private + * + * Remove a UI from the list of open UIs. + * + * required ui datum/tgui The UI to be removed. + * + * return bool If the UI was removed or not. + */ /datum/controller/subsystem/tgui/proc/on_close(datum/tgui/ui) // Remove it from the list of processing UIs. all_uis -= ui @@ -302,28 +308,28 @@ SUBSYSTEM_DEF(tgui) LAZYREMOVE(ui.src_object.open_tguis, ui) return TRUE - /** - * private - * - * Handle client logout, by closing all their UIs. - * - * required user mob The mob which logged out. - * - * return int The number of UIs closed. - **/ +/** + * private + * + * Handle client logout, by closing all their UIs. + * + * required user mob The mob which logged out. + * + * return int The number of UIs closed. + */ /datum/controller/subsystem/tgui/proc/on_logout(mob/user) - return close_user_uis(user, logout = TRUE) + close_user_uis(user) - /** - * private - * - * Handle clients switching mobs, by transferring their UIs. - * - * required user source The client's original mob. - * required user target The client's new mob. - * - * return bool If the UIs were transferred. - **/ +/** + * private + * + * Handle clients switching mobs, by transferring their UIs. + * + * required user source The client's original mob. + * required user target The client's new mob. + * + * return bool If the UIs were transferred. + */ /datum/controller/subsystem/tgui/proc/on_transfer(mob/source, mob/target) // The old mob had no open UIs. if(length(source?.tgui_open_uis) == 0) diff --git a/code/datums/chat_payload.dm b/code/datums/chat_payload.dm new file mode 100644 index 0000000000..fd35bbc4ee --- /dev/null +++ b/code/datums/chat_payload.dm @@ -0,0 +1,16 @@ +/// Stores information about a chat payload +/datum/chat_payload + /// Sequence number of this payload + var/sequence = 0 + /// Message we are sending + var/list/content + /// Resend count + var/resends = 0 + +/// Converts the chat payload into a JSON string +/datum/chat_payload/proc/into_message() + return "{\"sequence\":[sequence],\"content\":[json_encode(content)]}" + +/// Returns an HTML-encoded message from our contents. +/datum/chat_payload/proc/get_content_as_html() + return message_to_html(content) diff --git a/code/game/world.dm b/code/game/world.dm index 88d6b2412c..70df3ea593 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -60,7 +60,6 @@ GLOB.timezoneOffset = get_timezone_offset() callHook("startup") - init_vchat() //Emergency Fix load_mods() //end-emergency fix diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index b2be689721..ffac68a6f9 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -22,9 +22,9 @@ for(var/client/C in GLOB.admins) if(R_ADMIN|R_EVENT & C.holder.rights) if(C.is_preference_enabled(/datum/client_preference/admin/show_chat_prayers)) - to_chat(C,msg) + to_chat(C, msg, type = MESSAGE_TYPE_PRAYER, confidential = TRUE) C << 'sound/effects/ding.ogg' - to_chat(usr, "Your prayers have been received by the gods.") + to_chat(usr, "Your prayers have been received by the gods.", confidential = TRUE) feedback_add_details("admin_verb","PR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! log_pray(raw_msg, src) diff --git a/code/modules/asset_cache/assets/chat.dm b/code/modules/asset_cache/assets/chat.dm new file mode 100644 index 0000000000..eba0e5418e --- /dev/null +++ b/code/modules/asset_cache/assets/chat.dm @@ -0,0 +1,2 @@ +/datum/asset/spritesheet/chat + name = "chat" diff --git a/code/modules/asset_cache/assets/tgui.dm b/code/modules/asset_cache/assets/tgui.dm index 6874c24eea..6446471a30 100644 --- a/code/modules/asset_cache/assets/tgui.dm +++ b/code/modules/asset_cache/assets/tgui.dm @@ -5,11 +5,9 @@ "tgui.bundle.css" = file("tgui/public/tgui.bundle.css"), ) -/* Comment will be removed in later part /datum/asset/simple/tgui_panel // keep_local_name = TRUE assets = list( "tgui-panel.bundle.js" = file("tgui/public/tgui-panel.bundle.js"), "tgui-panel.bundle.css" = file("tgui/public/tgui-panel.bundle.css"), ) -*/ diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 13b80f1529..fa78e8d29a 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -41,8 +41,10 @@ var/datum/admins/deadmin_holder = null var/buildmode = 0 - var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming. - var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent. + ///Contains the last message sent by this client - used to protect against copy-paste spamming. + var/last_message = "" + ///contins a number of how many times a message identical to last_message was sent. + var/last_message_count = 0 var/ircreplyamount = 0 var/entity_narrate_holder //Holds /datum/entity_narrate when using the relevant admin verbs. @@ -56,9 +58,7 @@ var/area = null var/time_died_as_mouse = null //when the client last died as a mouse var/datum/tooltip/tooltips = null - var/datum/chatOutput/chatOutput var/datum/volume_panel/volume_panel = null // Initialized by /client/verb/volume_panel() - var/chatOutputLoadedAt var/seen_news = 0 var/adminhelped = 0 diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 1a91fb94a0..cdc7577afc 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -135,7 +135,6 @@ if("usr") hsrc = mob if("prefs") return prefs.process_link(usr,href_list) if("vars") return view_var_Topic(href,href_list,hsrc) - if("chat") return chatOutput.Topic(href, href_list) switch(href_list["action"]) if("openLink") @@ -174,11 +173,6 @@ del(src) return - chatOutput = new /datum/chatOutput(src) //veechat - chatOutput.send_resources() - spawn() - chatOutput.start() - //Only show this if they are put into a new_player mob. Otherwise, "what title screen?" if(isnewplayer(src.mob)) to_chat(src, "If the title screen is black, resources are still downloading. Please be patient until the title screen appears.") @@ -186,6 +180,9 @@ GLOB.clients += src GLOB.directory[ckey] = src + // Instantiate tgui panel + tgui_panel = new(src, "browseroutput") + GLOB.tickets.ClientLogin(src) // CHOMPedit - Tickets System //Admin Authorisation @@ -214,6 +211,9 @@ if(prefs) prefs.selecting_slots = FALSE + // Initialize tgui panel + tgui_panel.initialize() + connection_time = world.time connection_realtime = world.realtime connection_timeofday = world.timeofday @@ -492,29 +492,6 @@ return FALSE return ..() -/client/verb/reload_vchat() - set name = "Reload VChat" - set category = "OOC" - - //Timing - if(src.chatOutputLoadedAt > (world.time - 10 SECONDS)) - tgui_alert_async(src, "You can only try to reload VChat every 10 seconds at most.") - return - - // YW EDIT: disabled until we can fix the lag: verbs -= /client/proc/vchat_export_log - - //Log, disable - log_debug("[key_name(src)] reloaded VChat.") - winset(src, null, "outputwindow.htmloutput.is-visible=false;outputwindow.oldoutput.is-visible=false;outputwindow.chatloadlabel.is-visible=true") - - //The hard way - qdel_null(src.chatOutput) - chatOutput = new /datum/chatOutput(src) //veechat - chatOutput.send_resources() - spawn() - chatOutput.start() - - //This is for getipintel.net. //You're welcome to replace this proc with your own that does your own cool stuff. //Just set the client's ip_reputation var and make sure it makes sense with your config settings (higher numbers are worse results) diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm index d229bf8afe..b500712b90 100644 --- a/code/modules/client/preference_setup/global/setting_datums.dm +++ b/code/modules/client/preference_setup/global/setting_datums.dm @@ -296,7 +296,7 @@ var/list/_client_preferences_by_type key = "SOUND_INSTRUMENT" /datum/client_preference/vchat_enable - description = "Enable/Disable VChat" + description = "Enable/Disable TGChat" key = "VCHAT_ENABLE" enabled_description = "Enabled" disabled_description = "Disabled" diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index 050ffa0b5d..027a6fc87a 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -367,17 +367,17 @@ feedback_add_details("admin_verb","THInstm") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/verb/toggle_vchat() - set name = "Toggle VChat" + set name = "Toggle TGChat" set category = "Preferences" - set desc = "Toggles VChat. Reloading VChat and/or reconnecting required to affect changes." + set desc = "Toggles TGChat. Reloading TGChat and/or reconnecting required to affect changes." var/pref_path = /datum/client_preference/vchat_enable toggle_preference(pref_path) SScharacter_setup.queue_preferences_save(prefs) - to_chat(src, "You have toggled VChat [is_preference_enabled(pref_path) ? "on" : "off"]. \ - You will have to reload VChat and/or reconnect to the server for these changes to take place. \ - VChat message persistence is not guaranteed if you change this again before the start of the next round.") + to_chat(src, "You have toggled TGChat [is_preference_enabled(pref_path) ? "on" : "off"]. \ + You will have to reload TGChat and/or reconnect to the server for these changes to take place. \ + TGChat message persistence is not guaranteed if you change this again before the start of the next round.") /client/verb/toggle_chat_timestamps() set name = "Toggle Chat Timestamps" diff --git a/code/modules/tgchat/README.md b/code/modules/tgchat/README.md new file mode 100644 index 0000000000..71acb47c45 --- /dev/null +++ b/code/modules/tgchat/README.md @@ -0,0 +1,30 @@ +## /TG/ Chat + +/TG/ Chat, which will be referred to as TgChat from this point onwards, is a system in which we can send messages to clients in a controlled and semi-reliable manner. The standard way of sending messages to BYOND clients simply dumps whatever you output to them directly into their chat window, however BYOND allows us to load our own code on the client to change this behaviour in a way that allows us to do some pretty neat things. + +### Message Format + +TgChat handles sending messages from the server to the client through the use of JSON payloads, of which the format will change depending on the type of message and the intended client endpoint. An example of the payload for chat messages is as follows: +```json +{ + "sequence": 0, + "content": { + "type": ". . .", // ?optional + "text": ". . .", // ?optional !atleast-one + "html": ". . .", // ?optional !atleast-one + "avoidHighlighting": 0 // ?optional + }, +} +``` + +### Reliability + +In the past there have been issues where BYOND will silently and without reason lose a message we sent to the client, to detect this and recover from it seamlessly TgChat also has a baked in reliability layer. This reliability layer is very primitive, and simply keeps track of received sequence numbers. Should the client receive an unexpected sequence number TgChat asks the server to resend any missing packets. + +### Ping System + +TgChat supports a round trip time ping measurement, which is displayed to the client so they can know how long it takes for their commands and inputs to reach the server. This is done by sending the client a ping request, `ping/soft`, which tells the client to send a ping to the server. When the server receives said ping it sends a reply, `ping/reply`, to the client with a payload containing the current DateTime which the client can reference against the initial ping request. + +### Chat Tabs, Local Storage, and Highlighting + +To make organizing and managing chat easier and more functional for both players and admins, TgChat has the ability to filter out messages based on their primary tag, such as individual departmental radios, to a dedicated chat tab for easier reading and comprehension. These tabs can also be configured to highlist messages based on a simple keyword search. You can set a multitude of different keywords to search for and they will be highlighting for instant alerting of the client. Said tabs, highlighting rules, and your chat history will persist thanks to use of local storage on the client. Using local storage TgChat can ensure that your preferences are saved and maintained between client restarts and switching between other /TG/ servers. Local Storage is also used to keep your chat history aswell, should you need to scroll through your chat logs. diff --git a/code/modules/tgchat/_legacy.dm b/code/modules/tgchat/_legacy.dm new file mode 100644 index 0000000000..fe01936540 --- /dev/null +++ b/code/modules/tgchat/_legacy.dm @@ -0,0 +1,48 @@ +/// Old VChat Code Stuff + +/* Old bicon code +/proc/expire_bicon_cache(key) + if(GLOB.bicon_cache[key]) + GLOB.bicon_cache -= key + return TRUE + return FALSE + +GLOBAL_LIST_EMPTY(bicon_cache) // Cache of the tag results, not the icons +*/ + +/proc/bicon(var/obj, var/use_class = 1, var/custom_classes = "") + return icon2base64html(obj, custom_classes) + + /* Old bicon code + var/class = use_class ? "class='icon misc [custom_classes]'" : null + if(!obj) + return + + // Try to avoid passing bicon an /icon directly. It is better to pass it an atom so it can cache. + if(isicon(obj)) // Passed an icon directly, nothing to cache-key on, as icon refs get reused *often* + return "" + + // Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with. + var/atom/A = obj + var/key + var/changes_often = ishuman(A) || isobserver(A) // If this ends up with more, move it into a proc or var on atom. + + if(changes_often) + key = "\ref[A]" + else + key = "[istype(A.icon, /icon) ? "\ref[A.icon]" : A.icon]:[A.icon_state]" + + var/base64 = GLOB.bicon_cache[key] + // Non-human atom, no cache + if(!base64) // Doesn't exist, make it. + base64 = icon2base64(A.examine_icon(), key) + GLOB.bicon_cache[key] = base64 + if(changes_often) + addtimer(CALLBACK(GLOBAL_PROC, .proc/expire_bicon_cache, key), 50 SECONDS, TIMER_UNIQUE) + + // May add a class to the img tag created by bicon + if(use_class) + class = "class='icon [A.icon_state] [custom_classes]'" + + return "" + */ diff --git a/code/modules/tgchat/message.dm b/code/modules/tgchat/message.dm new file mode 100644 index 0000000000..69d3a6faf5 --- /dev/null +++ b/code/modules/tgchat/message.dm @@ -0,0 +1,17 @@ +/** + * Message-related procs + * + * Message format (/list): + * - type - Message type, must be one of defines in `code/__DEFINES/chat.dm` + * - text - Plain message text + * - html - HTML message text + * - Optional metadata, can be any key/value pair. + * + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/proc/message_to_html(message) + // Here it is possible to add a switch statement + // to custom-handle various message types. + return message["html"] || message["text"] diff --git a/code/modules/tgchat/to_chat.dm b/code/modules/tgchat/to_chat.dm new file mode 100644 index 0000000000..ae434b36f1 --- /dev/null +++ b/code/modules/tgchat/to_chat.dm @@ -0,0 +1,85 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/** + * Circumvents the message queue and sends the message + * to the recipient (target) as soon as possible. + */ +/proc/to_chat_immediate( + target, + html, + type = null, + text = null, + avoid_highlighting = FALSE, + // FIXME: These flags are now pointless and have no effect + handle_whitespace = TRUE, + trailing_newline = TRUE, + confidential = FALSE +) + // Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "") + html = "[html]" + text = "[text]" + + if(!target) + return + if(!html && !text) + CRASH("Empty or null string in to_chat proc call.") + if(target == world) + target = GLOB.clients + + // Build a message + var/message = list() + if(type) message["type"] = type + if(text) message["text"] = text + if(html) message["html"] = html + if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting + + // send it immediately + SSchat.send_immediate(target, message) + +/** + * Sends the message to the recipient (target). + * + * Recommended way to write to_chat calls: + * ``` + * to_chat(client, + * type = MESSAGE_TYPE_INFO, + * html = "You have found [object]") + * ``` + */ +/proc/to_chat( + target, + html, + type = null, + text = null, + avoid_highlighting = FALSE, + // FIXME: These flags are now pointless and have no effect + handle_whitespace = TRUE, + trailing_newline = TRUE, + confidential = FALSE +) + //if(isnull(Master) || !SSchat?.initialized || !MC_RUNNING(SSchat.init_stage)) + if(isnull(Master) || !SSchat?.subsystem_initialized) + to_chat_immediate(target, html, type, text, avoid_highlighting) + return + + // Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "") + html = "[html]" + text = "[text]" + + if(!target) + return + if(!html && !text) + CRASH("Empty or null string in to_chat proc call.") + if(target == world) + target = GLOB.clients + + // Build a message + var/message = list() + if(type) message["type"] = type + if(text) message["text"] = text + if(html) message["html"] = html + if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting + SSchat.queue(target, message) diff --git a/code/modules/tgui/tgui_window.dm b/code/modules/tgui/tgui_window.dm index 180e18a518..73dfdf2803 100644 --- a/code/modules/tgui/tgui_window.dm +++ b/code/modules/tgui/tgui_window.dm @@ -380,6 +380,8 @@ // Resend the assets for(var/asset in sent_assets) send_asset(asset) + if("chat/resend") + SSchat.handle_resend(client, payload) /datum/tgui_window/vv_edit_var(var_name, var_value) return var_name != NAMEOF(src, id) && ..() diff --git a/code/modules/tgui_panel/audio.dm b/code/modules/tgui_panel/audio.dm new file mode 100644 index 0000000000..32ecd93ab8 --- /dev/null +++ b/code/modules/tgui_panel/audio.dm @@ -0,0 +1,42 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/// Admin music volume, from 0 to 1. +/client/var/admin_music_volume = 1 + +/** + * public + * + * Sends music data to the browser. + * + * Optional settings: + * - pitch: the playback rate + * - start: the start time of the sound + * - end: when the musics stops playing + * + * required url string Must be an https URL. + * optional extra_data list Optional settings. + */ +/datum/tgui_panel/proc/play_music(url, extra_data) + if(!is_ready()) + return + if(!findtext(url, GLOB.is_http_protocol)) + return + var/list/payload = list() + if(length(extra_data) > 0) + for(var/key in extra_data) + payload[key] = extra_data[key] + payload["url"] = url + window.send_message("audio/playMusic", payload) + +/** + * public + * + * Stops playing music through the browser. + */ +/datum/tgui_panel/proc/stop_music() + if(!is_ready()) + return + window.send_message("audio/stopMusic") diff --git a/code/modules/tgui_panel/external.dm b/code/modules/tgui_panel/external.dm new file mode 100644 index 0000000000..a4ce4444ca --- /dev/null +++ b/code/modules/tgui_panel/external.dm @@ -0,0 +1,45 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/client/var/datum/tgui_panel/tgui_panel + +/** + * tgui panel / chat troubleshooting verb + */ +/client/verb/fix_tgui_panel() + set name = "Fix chat" + set category = "OOC" + var/action + log_tgui(src, "Started fixing.", context = "verb/fix_tgui_panel") + + nuke_chat() + + // Failed to fix, using tgalert as fallback + action = tgalert(src, "Did that work?", "", "Yes", "No, switch to old ui") + if (action == "No, switch to old ui") + winset(src, "output", "on-show=&is-disabled=0&is-visible=1") + winset(src, "browseroutput", "is-disabled=1;is-visible=0") + log_tgui(src, "Failed to fix.", context = "verb/fix_tgui_panel") + +/client/proc/nuke_chat() + // Catch all solution (kick the whole thing in the pants) + winset(src, "output", "on-show=&is-disabled=0&is-visible=1") + winset(src, "browseroutput", "is-disabled=1;is-visible=0") + if(!tgui_panel || !istype(tgui_panel)) + log_tgui(src, "tgui_panel datum is missing", + context = "verb/fix_tgui_panel") + tgui_panel = new(src) + tgui_panel.initialize(force = TRUE) + // Force show the panel to see if there are any errors + winset(src, "output", "is-disabled=1&is-visible=0") + winset(src, "browseroutput", "is-disabled=0;is-visible=1") + +/client/verb/refresh_tgui() + set name = "Refresh TGUI" + set category = "OOC" + + for(var/window_id in tgui_windows) + var/datum/tgui_window/window = tgui_windows[window_id] + window.reinitialize() diff --git a/code/modules/tgui_panel/telemetry.dm b/code/modules/tgui_panel/telemetry.dm new file mode 100644 index 0000000000..4dabcbb01a --- /dev/null +++ b/code/modules/tgui_panel/telemetry.dm @@ -0,0 +1,146 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/** + * Maximum number of connection records allowed to analyze. + * Should match the value set in the browser. + */ +#define TGUI_TELEMETRY_MAX_CONNECTIONS 5 + +/** + * Maximum time allocated for sending a telemetry packet. + */ +#define TGUI_TELEMETRY_RESPONSE_WINDOW (30 SECONDS) + +/// Time of telemetry request +/datum/tgui_panel/var/telemetry_requested_at +/// Time of telemetry analysis completion +/datum/tgui_panel/var/telemetry_analyzed_at +/// List of previous client connections +/datum/tgui_panel/var/list/telemetry_connections + +/** + * private + * + * Requests some telemetry from the client. + */ +/datum/tgui_panel/proc/request_telemetry() + telemetry_requested_at = world.time + telemetry_analyzed_at = null + window.send_message("telemetry/request", list( + "limits" = list( + "connections" = TGUI_TELEMETRY_MAX_CONNECTIONS, + ), + )) + +/** + * private + * + * Analyzes a telemetry packet. + * + * Is currently only useful for detecting ban evasion attempts. + */ +/datum/tgui_panel/proc/analyze_telemetry(payload) + if(world.time > telemetry_requested_at + TGUI_TELEMETRY_RESPONSE_WINDOW) + message_admins("[key_name(client)] sent telemetry outside of the allocated time window.") + return + if(telemetry_analyzed_at) + message_admins("[key_name(client)] sent telemetry more than once.") + return + telemetry_analyzed_at = world.time + if(!payload) + return + telemetry_connections = payload["connections"] + var/len = length(telemetry_connections) + if(len == 0) + return + if(len > TGUI_TELEMETRY_MAX_CONNECTIONS) + message_admins("[key_name(client)] was kicked for sending a huge telemetry payload") + qdel(client) + return + + var/ckey = client?.ckey + if (!ckey) + return + + /* FIXME: Stuff we dont have > Can be reimplemented later on + var/list/all_known_alts = GLOB.known_alts.load_known_alts() + var/list/our_known_alts = list() + + for (var/known_alt in all_known_alts) + if (known_alt[1] == ckey) + our_known_alts += known_alt[2] + else if (known_alt[2] == ckey) + our_known_alts += known_alt[1] + + var/list/found + + var/list/query_data = list() + + for(var/i in 1 to len) + if(QDELETED(client)) + // He got cleaned up before we were done + return + var/list/row = telemetry_connections[i] + + // Check for a malformed history object + if (!row || row.len < 3 || (!row["ckey"] || !row["address"] || !row["computer_id"])) + return + + if (!isnull(GLOB.round_id)) + query_data += list(list( + "telemetry_ckey" = row["ckey"], + "address" = row["address"], + "computer_id" = row["computer_id"], + )) + + if (row["ckey"] in our_known_alts) + continue + + if (world.IsBanned(row["ckey"], row["address"], row["computer_id"], real_bans_only = TRUE)) + found = row + break + + CHECK_TICK + + // This fucker has a history of playing on a banned account. + if(found) + var/msg = "[key_name(client)] has a banned account in connection history! (Matched: [found["ckey"]], [found["address"]], [found["computer_id"]])" + message_admins(msg) + send2tgs_adminless_only("Banned-user", msg) + log_admin_private(msg) + log_suspicious_login(msg, access_log_mirror = FALSE) + + // Only log them all at the end, since it's not as important as reporting an evader + for (var/list/one_query as anything in query_data) + var/datum/db_query/query = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("telemetry_connections")] ( + ckey, + telemetry_ckey, + address, + computer_id, + first_round_id, + latest_round_id + ) VALUES( + :ckey, + :telemetry_ckey, + INET_ATON(:address), + :computer_id, + :round_id, + :round_id + ) ON DUPLICATE KEY UPDATE latest_round_id = :round_id + "}, list( + "ckey" = ckey, + "telemetry_ckey" = one_query["telemetry_ckey"], + "address" = one_query["address"], + "computer_id" = one_query["computer_id"], + "round_id" = GLOB.round_id, + )) + query.Execute() + qdel(query) + */ + +#undef TGUI_TELEMETRY_MAX_CONNECTIONS +#undef TGUI_TELEMETRY_RESPONSE_WINDOW diff --git a/code/modules/tgui_panel/tgui_panel.dm b/code/modules/tgui_panel/tgui_panel.dm new file mode 100644 index 0000000000..ffb31cd788 --- /dev/null +++ b/code/modules/tgui_panel/tgui_panel.dm @@ -0,0 +1,102 @@ +/*! + * Copyright (c) 2020 Aleksej Komarov + * SPDX-License-Identifier: MIT + */ + +/** + * tgui_panel datum + * Hosts tgchat and other nice features. + */ +/datum/tgui_panel + var/client/client + var/datum/tgui_window/window + var/broken = FALSE + var/initialized_at + var/oldchat = FALSE + +/datum/tgui_panel/New(client/client, id) + src.client = client + window = new(client, id) + window.subscribe(src, PROC_REF(on_message)) + +/datum/tgui_panel/Del() + window.unsubscribe(src) + window.close() + return ..() + +/** + * public + * + * TRUE if panel is initialized and ready to receive messages. + */ +/datum/tgui_panel/proc/is_ready() + return !broken && window.is_ready() + +/** + * public + * + * Initializes tgui panel. + */ +/datum/tgui_panel/proc/initialize(force = FALSE) + set waitfor = FALSE + // Minimal sleep to defer initialization to after client constructor + sleep(1 TICKS) + initialized_at = world.time + // Perform a clean initialization + window.initialize( + strict_mode = TRUE, + assets = list( + get_asset_datum(/datum/asset/simple/tgui_panel), + )) + window.send_asset(get_asset_datum(/datum/asset/simple/fontawesome)) + window.send_asset(get_asset_datum(/datum/asset/simple/tgfont)) + window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat)) + // Other setup + request_telemetry() + addtimer(CALLBACK(src, PROC_REF(on_initialize_timed_out)), 5 SECONDS) + +/** + * private + * + * Called when initialization has timed out. + */ +/datum/tgui_panel/proc/on_initialize_timed_out() + // Currently does nothing but sending a message to old chat. + // SEND_TEXT(client, "Failed to load fancy chat, click HERE to attempt to reload it.") + +/** + * private + * + * Callback for handling incoming tgui messages. + */ +/datum/tgui_panel/proc/on_message(type, payload) + if(type == "ready") + broken = FALSE + window.send_message("update", list( + "config" = list( + "client" = list( + "ckey" = client.ckey, + "address" = client.address, + "computer_id" = client.computer_id, + ), + "window" = list( + "fancy" = FALSE, + "locked" = FALSE, + ), + ), + )) + return TRUE + if(type == "audio/setAdminMusicVolume") + client.admin_music_volume = payload["volume"] + return TRUE + if(type == "telemetry") + analyze_telemetry(payload) + return TRUE + +/** + * public + * + * Sends a round restart notification. + */ +/datum/tgui_panel/proc/send_roundrestart() + window.send_message("roundrestart") diff --git a/code/modules/vchat/js/vchat.min.js b/code/modules/vchat/js/vchat.min.js index 545fc849f4..915fcac4bb 100644 --- a/code/modules/vchat/js/vchat.min.js +++ b/code/modules/vchat/js/vchat.min.js @@ -1 +1,5 @@ -!function(){var e=console.log;console.log=function(t){send_debug(t),e.apply(console,arguments)};var t=console.error;console.error=function(e){send_debug(e),t.apply(console,arguments)},window.onerror=function(e,t,s,a,n){var o="";return n&&n.stack&&(o=n.stack),send_debug(e+" ("+t+"@"+s+":"+a+") "+n+"|UA: "+navigator.userAgent+"|Stack: "+o),!0}}();var vueapp,vchat_opts={msBeforeDropped:3e4,cookiePrefix:"vst-",alwaysShow:["vc_looc","vc_system"],vchatTabsVer:1},DARKMODE_COLORS={buttonBgColor:"#40628a",buttonTextColor:"#FFFFFF",windowBgColor:"#272727",highlightColor:"#009900",tabTextColor:"#FFFFFF",tabBackgroundColor:"#272727"},LIGHTMODE_COLORS={buttonBgColor:"none",buttonTextColor:"#000000",windowBgColor:"none",highlightColor:"#007700",tabTextColor:"#000000",tabBackgroundColor:"none"},set_storage=set_cookie,get_storage=get_cookie,domparser=new DOMParser;storageAvailable("localStorage")&&(set_storage=set_localstorage,get_storage=get_localstorage);var vchat_state={ready:!1,byond_ip:null,byond_cid:null,byond_ckey:null,lastPingReceived:0,latency_sent:0,lastId:0};function start_vchat(){start_vue(),vchat_state.ready=!0,push_Topic("done_loading"),push_Topic_showingnum(this.showingnum),doWinset("htmloutput",{"is-visible":!0}),doWinset("oldoutput",{"is-visible":!1}),doWinset("chatloadlabel",{"is-visible":!1}),setInterval(check_ping,vchat_opts.msBeforeDropped),send_debug("VChat Loaded!")}function start_vue(){vueapp=new Vue({el:"#app",data:{messages:[],shown_messages:[],unshown_messages:0,archived_messages:[],tabs:[{name:"Main",categories:[],immutable:!0,active:!0}],unread_messages:{},editing:!1,paused:!1,latency:0,reconnecting:!1,ext_styles:"",is_admin:!1,inverted:!1,crushing:3,animated:!1,fontsize:.9,lineheight:130,showingnum:200,type_table:[{matches:".filter_say, .say, .emote, .emotesubtle",becomes:"vc_localchat",pretty:"Local Chat",tooltip:"In-character local messages (say, emote, etc)",required:!1,admin:!1},{matches:".filter_radio, .alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",becomes:"vc_radio",pretty:"Radio Comms",tooltip:"All departments of radio messages",required:!1,admin:!1},{matches:".filter_notice, .notice:not(.pm), .adminnotice, .info, .sinister, .cult",becomes:"vc_info",pretty:"Notices",tooltip:"Non-urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_warning, .warning:not(.pm), .critical, .userdanger, .italics",becomes:"vc_warnings",pretty:"Warnings",tooltip:"Urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_deadsay, .deadsay",becomes:"vc_deadchat",pretty:"Deadchat",tooltip:"All of deadchat",required:!1,admin:!1},{matches:".filter_pray",becomes:"vc_pray",pretty:"Pray",tooltip:"Prayer messages",required:!1,admin:!1},{matches:".ooc, .filter_ooc",becomes:"vc_globalooc",pretty:"Global OOC",tooltip:"The bluewall of global OOC messages",required:!1,admin:!1},{matches:".nif",becomes:"vc_nif",pretty:"NIF Messages",tooltip:"Messages from the NIF itself and people inside",required:!1,admin:!1},{matches:".psay, .pemote",becomes:"vc_pmessage",pretty:"Pred/Prey Messages",tooltip:"Messages from / to absorbed or dominated prey",required:!1,admin:!1},{matches:".mentor_channel, .mentor",becomes:"vc_mentor",pretty:"Mentor messages",tooltip:"Mentorchat and mentor pms",required:!1,admin:!1},{matches:".filter_pm, .pm",becomes:"vc_adminpm",pretty:"Admin PMs",tooltip:"Messages to/from admins ('adminhelps')",required:!1,admin:!1},{matches:".filter_ASAY, .admin_channel",becomes:"vc_adminchat",pretty:"Admin Chat",tooltip:"ASAY messages",required:!1,admin:!0},{matches:".filter_MSAY, .mod_channel",becomes:"vc_modchat",pretty:"Mod Chat",tooltip:"MSAY messages",required:!1,admin:!0},{matches:".filter_ESAY, .event_channel",becomes:"vc_eventchat",pretty:"Event Chat",tooltip:"ESAY messages",required:!1,admin:!0},{matches:".filter_combat, .danger",becomes:"vc_combat",pretty:"Combat Logs",tooltip:"Urist McTraitor has stabbed you with a knife!",required:!1,admin:!1},{matches:".filter_adminlogs, .log_message",becomes:"vc_adminlogs",pretty:"Admin Logs",tooltip:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",required:!1,admin:!0},{matches:".filter_attacklogs",becomes:"vc_attacklogs",pretty:"Attack Logs",tooltip:"Urist McTraitor has shot John Doe",required:!1,admin:!0},{matches:".filter_debuglogs",becomes:"vc_debuglogs",pretty:"Debug Logs",tooltip:"DEBUG: SSPlanets subsystem Recover().",required:!1,admin:!0},{matches:".looc",becomes:"vc_looc",pretty:"Local OOC",tooltip:"Local OOC messages, always enabled",required:!0},{matches:".rlooc",becomes:"vc_rlooc",pretty:"Remote LOOC",tooltip:"Remote LOOC messages",required:!1,admin:!0},{matches:".boldannounce, .filter_system",becomes:"vc_system",pretty:"System Messages",tooltip:"Messages from your client, always enabled",required:!0},{matches:".unsorted",becomes:"vc_unsorted",pretty:"Unsorted",tooltip:"Messages that don't have any filters.",required:!1,admin:!1}]},mounted:function(){this.load_settings();var e=new XMLHttpRequest;e.open("GET","ss13styles.css"),e.onreadystatechange=(function(){this.ext_styles=e.responseText}).bind(this),e.send()},updated:function(){this.editing||this.paused||window.scrollTo(0,document.getElementById("messagebox").scrollHeight)},watch:{reconnecting:function(e,t){!0==e&&!1==t?this.internal_message("Your client has lost connection to the server, or there is severe lag. Your client will reconnect if possible."):!1==e&&!0==t&&this.internal_message("Your client has reconnected to the server.")},inverted:function(e){set_storage("darkmode",e),e?(document.body.classList.add("inverted"),switch_ui_mode(DARKMODE_COLORS)):(document.body.classList.remove("inverted"),switch_ui_mode(LIGHTMODE_COLORS))},crushing:function(e){set_storage("crushing",e)},animated:function(e){set_storage("animated",e)},fontsize:function(e,t){if(isNaN(e)){this.fontsize=t;return}e<.2?this.fontsize=.2:e>5&&(this.fontsize=5),set_storage("fontsize",e)},lineheight:function(e,t){if(!isFinite(e)){this.lineheight=t;return}e<100?this.lineheight=100:e>200&&(this.lineheight=200),set_storage("lineheight",e)},showingnum:function(e,t){if(!isFinite(e)){this.showingnum=t;return}(e=Math.floor(e))<50?this.showingnum=50:e>2e3&&(this.showingnum=2e3),set_storage("showingnum",this.showingnum),push_Topic_showingnum(this.showingnum),this.attempt_archive()},current_categories:function(e,t){e.length&&this.apply_filter(e)}},computed:{active_tab:function(){return this.tabs.find(function(e){return e.active})},ping_classes:function(){return this.latency?"?"==this.latency?"grey":this.latency<0?"red":this.latency<=200?"green":this.latency<=400?"yellow":"grey":this.reconnecting?"red":"green"},current_categories:function(){return this.active_tab==this.tabs[0]?[]:this.active_tab.categories.concat(vchat_opts.alwaysShow)}},methods:{load_settings:function(){this.inverted=get_storage("darkmode",!1),this.crushing=get_storage("crushing",3),this.animated=get_storage("animated",!1),this.fontsize=get_storage("fontsize",.9),this.lineheight=get_storage("lineheight",130),this.showingnum=get_storage("showingnum",200),isNaN(this.crushing)&&(this.crushing=3),isNaN(this.fontsize)&&(this.fontsize=.9),this.load_tabs()},load_tabs:function(){var e=get_storage("tabs");if(e){var t=JSON.parse(e);if(!t.version||!t.tabs){this.internal_message("There was a problem loading your tabs. Any new ones you make will be saved, however.");return}if(!t.version==vchat_opts.vchatTabsVer){this.internal_message("Your saved tabs are for an older version of VChat and must be recreated, sorry.");return}this.tabs.push.apply(this.tabs,t.tabs)}},save_tabs:function(){var e={version:vchat_opts.vchatTabsVer,tabs:[]};this.tabs.forEach(function(t){if(!t.immutable){var s=t.name,a=[];t.categories.forEach(function(e){a.push(e)}),e.tabs.push({name:s,categories:a,immutable:!1,active:!1})}}),set_storage("tabs",JSON.stringify(e))},switchtab:function(e){e!=this.active_tab&&(this.active_tab.active=!1,e.active=!0,e.categories.forEach(function(e){this.unread_messages[e]=0},this),this.apply_filter(this.current_categories))},editmode:function(){this.editing=!this.editing,this.save_tabs()},pause:function(){this.paused=!this.paused},newtab:function(){this.tabs.push({name:"New Tab",categories:[],immutable:!1,active:!1}),this.switchtab(this.tabs[this.tabs.length-1])},renametab:function(){if(!this.active_tab.immutable){var e=this.active_tab,t=window.prompt("Type the desired tab name:",e.name);null!==t&&""!==t&&null!==e&&(e.name=t)}},deltab:function(e){e||(e=this.active_tab),!e.immutable&&(this.switchtab(this.tabs[0]),this.tabs.splice(this.tabs.indexOf(e),1))},movetab:function(e,t){if(e&&!e.immutable){var s=this.tabs.indexOf(e);this.tabs.splice(s+t,0,this.tabs.splice(s,1)[0])}},tab_unread_count:function(e){var t=0,s=this.unread_messages;return e.categories.find(function(e){s[e]&&(t+=s[e])}),t},tab_unread_categories:function(e){var t=!1,s=this.unread_messages;return e.categories.find(function(e){if(s[e])return t=!0,!0}),{red:t,grey:!t}},attempt_archive:function(){if(this.messages.length>this.showingnum){var e=this.messages.splice(0,20);Array.prototype.push.apply(this.archived_messages,e)}},apply_filter:function(e){this.shown_messages.splice(0),this.unshown_messages=0,this.messages.forEach(function(t){e.indexOf(t.category)>-1&&this.shown_messages.push(t)},this),this.archived_messages.forEach(function(t){e.indexOf(t.category)>-1&&this.unshown_messages++},this)},add_message:function(e){let t={time:e.time,category:"error",content:e.message,repeats:1};if(t.category=this.get_category(t.content),"vc_unsorted"==t.category&&(t.content=""+t.content+""),this.crushing){let s=this.messages.slice(-this.crushing);for(let a=s.length-1;a>=0;a--){let n=s[a];n.content==t.content&&(t.repeats+=n.repeats,this.messages.splice(this.messages.indexOf(n),1))}}t.content=t.content.replace(/(\b(https?):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/img,'$1'),this.current_categories.length&&0>this.current_categories.indexOf(t.category)?(isNaN(this.unread_messages[t.category])&&(this.unread_messages[t.category]=0),this.unread_messages[t.category]+=1):this.current_categories.length&&this.shown_messages.push(t),t.id=++vchat_state.lastId,this.attempt_archive(),this.messages.push(t)},internal_message:function(e){let t={time:this.messages.length?this.messages.slice(-1).time+1:0,category:"vc_system",content:"[VChat Internal] "+e+""};t.id=++vchat_state.lastId,this.messages.push(t)},on_mouseup:function(e){let t=e.target;"getSelection"in window&&!1===window.getSelection().isCollapsed||t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)||(focusMapWindow(),e.preventDefault(),e.target.click())},click_message:function(e){let t=e.target;if("A"===t.tagName){e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1;var s=t.getAttribute("href");"?"==s[0]||s.length>=8&&"byond://"==s.substring(0,8)?window.location=s:window.location="byond://?action=openLink&link="+encodeURIComponent(s)}},get_category:function(e){if(!vchat_state.ready){push_Topic("not_ready");return}let t=domparser.parseFromString(e,"text/html").querySelector("span"),s="vc_unsorted";return t&&this.type_table.find(function(e){if(t.msMatchesSelector(e.matches))return s=e.becomes,!0}),s},save_chatlog:function(){var e="",t=this.archived_messages.concat(this.messages),s=this.current_categories;t.forEach(function(t){(0==s.length||s.indexOf(t.category)>=0)&&(e+=t.content,t.repeats>1&&(e+="(x"+t.repeats+")"),e+="
\n")}),e+="";var a=new Date,n=String(a.getHours());n.length<2&&(n="0"+n);var o=String(a.getMinutes());o.length<2&&(o="0"+o);var i=String(a.getDate());i.length<2&&(i="0"+i);var r=String(a.getMonth()+1);r.length<2&&(r="0"+r);var c="log"+(" "+String(a.getFullYear())+"-"+r+"-"+i+" ("+n+" "+o)+").html",l=document.createElement("a");if(void 0!==l.download)l.href="data:attachment/text,"+encodeURI(e),l.target="_blank",l.download=c,l.click();else{var h=new Blob([e],{type:"text/html;charset=utf8;"});saved=window.navigator.msSaveOrOpenBlob(h,c)}},do_latency_test:function(){send_latency_check()},blur_this:function(e){e.target.blur()}}})}function check_ping(){Date.now()-vchat_state.lastPingReceived>vchat_opts.msBeforeDropped&&(vueapp.reconnecting=!0)}function send_latency_check(){vchat_state.latency_sent||(vchat_state.latency_sent=Date.now(),vueapp.latency="?",push_Topic("ping"),setTimeout(function(){"?"==vchat_state.latency_ms&&(vchat_state.latency_ms=999)},1e3),setTimeout(function(){vchat_state.latency_sent=0,vueapp.latency=0},5e3))}function get_latency_check(){vchat_state.latency_sent&&(vueapp.latency=Date.now()-vchat_state.latency_sent)}function byondDecode(e){e=e.replace(/\+/g,"%20");try{e=decodeURIComponent(e)}catch(t){e=unescape(e)}return JSON.parse(e)}function putmessage(e){Array.isArray(e=byondDecode(e))?e.forEach(function(e){vueapp.add_message(e)}):"object"==typeof e&&vueapp.add_message(e)}function system_message(e){vueapp.internal_message(e)}function push_Topic(e){window.location="?_src_=chat&proc="+e}function push_Topic_showingnum(e){window.location="?_src_=chat&showingnum="+e}function focusMapWindow(){window.location="byond://winset?mapwindow.map.focus=true"}function send_debug(e){push_Topic("debug¶m[message]="+encodeURIComponent(e))}function get_event(e){if(!vchat_state.ready){push_Topic("not_ready");return}var t={evttype:"internal_error",event:e};switch((t=byondDecode(e)).evttype){case"internal_error":system_message("Event parse error: "+e);break;case"byond_player":send_client_data(),vueapp.is_admin="true"===t.admin,vchat_state.byond_ip=t.address,vchat_state.byond_cid=t.cid,vchat_state.byond_ckey=t.ckey,set_storage("ip",vchat_state.byond_ip),set_storage("cid",vchat_state.byond_cid),set_storage("ckey",vchat_state.byond_ckey);break;case"keepalive":vchat_state.lastPingReceived=Date.now(),vueapp.reconnecting=!1;break;case"pong":get_latency_check();break;case"availability":push_Topic("done_loading");break;default:system_message("Didn't know what to do with event: "+e)}}function send_client_data(){push_Topic("ident¶m[clientdata]="+JSON.stringify({ip:get_storage("ip"),cid:get_storage("cid"),ckey:get_storage("ckey")}))}function set_localstorage(e,t){window.localStorage.setItem(vchat_opts.cookiePrefix+e,t)}function get_localstorage(e,t){let s=window.localStorage.getItem(vchat_opts.cookiePrefix+e);return"null"===s||null===s?s=t:"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||(s=+s),s}function set_cookie(e,t){let s=new Date;s.setFullYear(s.getFullYear()+1);let a=s.toUTCString();document.cookie=vchat_opts.cookiePrefix+e+"="+t+";expires="+a+";path=/"}function get_cookie(e,t){var s={cookie:null,localstorage:null,indexeddb:null};let a=document.cookie.split(";"),n={};a.forEach(function(e){let s=e.replace(vchat_opts.cookiePrefix,"").trim(),a=s.search("="),o=decodeURIComponent(s.substring(0,a)),i=decodeURIComponent(s.substring(a+1));"null"==i||null===i?i=t:"true"===i?i=!0:"false"===i?i=!1:isNaN(i)||(i=+i),n[o]=i}),s.cookie=n[e]}var SKIN_BUTTONS=["rpane.textb","rpane.infob","rpane.wikib","rpane.forumb","rpane.rulesb","rpane.github","rpane.discord","rpane.mapb","rpane.changelog","mainwindow.saybutton","mainwindow.mebutton","mainwindow.hotkey_toggle"],SKIN_ELEMENTS=["mainwindow","mainwindow.mainvsplit","mainwindow.tooltip","rpane","rpane.rpanewindow","rpane.mediapanel",];function switch_ui_mode(e){doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".background-color"]=e.buttonBgColor,t},{})),doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".text-color"]=e.buttonTextColor,t},{})),doWinset(SKIN_ELEMENTS.reduce(function(t,s){return t[s+".background-color"]=e.windowBgColor,t},{})),doWinset("infowindow",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor}),doWinset("infowindow.info",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor,"highlight-color":e.highlightColor,"tab-text-color":e.tabTextColor,"tab-background-color":e.tabBackgroundColor})}function doWinset(e,t){void 0===t&&(t=e,e=null);var s="byond://winset?";e&&(s+="id="+e+"&"),s+=Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&"),window.location=s} \ No newline at end of file +<<<<<<< HEAD +!function(){var e=console.log;console.log=function(t){send_debug(t),e.apply(console,arguments)};var t=console.error;console.error=function(e){send_debug(e),t.apply(console,arguments)},window.onerror=function(e,t,s,a,n){var o="";return n&&n.stack&&(o=n.stack),send_debug(e+" ("+t+"@"+s+":"+a+") "+n+"|UA: "+navigator.userAgent+"|Stack: "+o),!0}}();var vueapp,vchat_opts={msBeforeDropped:3e4,cookiePrefix:"vst-",alwaysShow:["vc_looc","vc_system"],vchatTabsVer:1},DARKMODE_COLORS={buttonBgColor:"#40628a",buttonTextColor:"#FFFFFF",windowBgColor:"#272727",highlightColor:"#009900",tabTextColor:"#FFFFFF",tabBackgroundColor:"#272727"},LIGHTMODE_COLORS={buttonBgColor:"none",buttonTextColor:"#000000",windowBgColor:"none",highlightColor:"#007700",tabTextColor:"#000000",tabBackgroundColor:"none"},set_storage=set_cookie,get_storage=get_cookie,domparser=new DOMParser;storageAvailable("localStorage")&&(set_storage=set_localstorage,get_storage=get_localstorage);var vchat_state={ready:!1,byond_ip:null,byond_cid:null,byond_ckey:null,lastPingReceived:0,latency_sent:0,lastId:0};function start_vchat(){start_vue(),vchat_state.ready=!0,push_Topic("done_loading"),push_Topic_showingnum(this.showingnum),doWinset("htmloutput",{"is-visible":!0}),doWinset("oldoutput",{"is-visible":!1}),doWinset("chatloadlabel",{"is-visible":!1}),setInterval(check_ping,vchat_opts.msBeforeDropped),send_debug("VChat Loaded!")}function start_vue(){vueapp=new Vue({el:"#app",data:{messages:[],shown_messages:[],unshown_messages:0,archived_messages:[],tabs:[{name:"Main",categories:[],immutable:!0,active:!0}],unread_messages:{},editing:!1,paused:!1,latency:0,reconnecting:!1,ext_styles:"",is_admin:!1,inverted:!1,crushing:3,animated:!1,fontsize:.9,lineheight:130,showingnum:200,type_table:[{matches:".filter_say, .say, .emote, .emotesubtle",becomes:"vc_localchat",pretty:"Local Chat",tooltip:"In-character local messages (say, emote, etc)",required:!1,admin:!1},{matches:".filter_radio, .alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",becomes:"vc_radio",pretty:"Radio Comms",tooltip:"All departments of radio messages",required:!1,admin:!1},{matches:".filter_notice, .notice:not(.pm), .adminnotice, .info, .sinister, .cult",becomes:"vc_info",pretty:"Notices",tooltip:"Non-urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_warning, .warning:not(.pm), .critical, .userdanger, .italics",becomes:"vc_warnings",pretty:"Warnings",tooltip:"Urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_deadsay, .deadsay",becomes:"vc_deadchat",pretty:"Deadchat",tooltip:"All of deadchat",required:!1,admin:!1},{matches:".filter_pray",becomes:"vc_pray",pretty:"Pray",tooltip:"Prayer messages",required:!1,admin:!1},{matches:".ooc, .filter_ooc",becomes:"vc_globalooc",pretty:"Global OOC",tooltip:"The bluewall of global OOC messages",required:!1,admin:!1},{matches:".nif",becomes:"vc_nif",pretty:"NIF Messages",tooltip:"Messages from the NIF itself and people inside",required:!1,admin:!1},{matches:".psay, .pemote",becomes:"vc_pmessage",pretty:"Pred/Prey Messages",tooltip:"Messages from / to absorbed or dominated prey",required:!1,admin:!1},{matches:".mentor_channel, .mentor",becomes:"vc_mentor",pretty:"Mentor messages",tooltip:"Mentorchat and mentor pms",required:!1,admin:!1},{matches:".filter_pm, .pm",becomes:"vc_adminpm",pretty:"Admin PMs",tooltip:"Messages to/from admins ('adminhelps')",required:!1,admin:!1},{matches:".filter_ASAY, .admin_channel",becomes:"vc_adminchat",pretty:"Admin Chat",tooltip:"ASAY messages",required:!1,admin:!0},{matches:".filter_MSAY, .mod_channel",becomes:"vc_modchat",pretty:"Mod Chat",tooltip:"MSAY messages",required:!1,admin:!0},{matches:".filter_ESAY, .event_channel",becomes:"vc_eventchat",pretty:"Event Chat",tooltip:"ESAY messages",required:!1,admin:!0},{matches:".filter_combat, .danger",becomes:"vc_combat",pretty:"Combat Logs",tooltip:"Urist McTraitor has stabbed you with a knife!",required:!1,admin:!1},{matches:".filter_adminlogs, .log_message",becomes:"vc_adminlogs",pretty:"Admin Logs",tooltip:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",required:!1,admin:!0},{matches:".filter_attacklogs",becomes:"vc_attacklogs",pretty:"Attack Logs",tooltip:"Urist McTraitor has shot John Doe",required:!1,admin:!0},{matches:".filter_debuglogs",becomes:"vc_debuglogs",pretty:"Debug Logs",tooltip:"DEBUG: SSPlanets subsystem Recover().",required:!1,admin:!0},{matches:".looc",becomes:"vc_looc",pretty:"Local OOC",tooltip:"Local OOC messages, always enabled",required:!0},{matches:".rlooc",becomes:"vc_rlooc",pretty:"Remote LOOC",tooltip:"Remote LOOC messages",required:!1,admin:!0},{matches:".boldannounce, .filter_system",becomes:"vc_system",pretty:"System Messages",tooltip:"Messages from your client, always enabled",required:!0},{matches:".unsorted",becomes:"vc_unsorted",pretty:"Unsorted",tooltip:"Messages that don't have any filters.",required:!1,admin:!1}]},mounted:function(){this.load_settings();var e=new XMLHttpRequest;e.open("GET","ss13styles.css"),e.onreadystatechange=(function(){this.ext_styles=e.responseText}).bind(this),e.send()},updated:function(){this.editing||this.paused||window.scrollTo(0,document.getElementById("messagebox").scrollHeight)},watch:{reconnecting:function(e,t){!0==e&&!1==t?this.internal_message("Your client has lost connection to the server, or there is severe lag. Your client will reconnect if possible."):!1==e&&!0==t&&this.internal_message("Your client has reconnected to the server.")},inverted:function(e){set_storage("darkmode",e),e?(document.body.classList.add("inverted"),switch_ui_mode(DARKMODE_COLORS)):(document.body.classList.remove("inverted"),switch_ui_mode(LIGHTMODE_COLORS))},crushing:function(e){set_storage("crushing",e)},animated:function(e){set_storage("animated",e)},fontsize:function(e,t){if(isNaN(e)){this.fontsize=t;return}e<.2?this.fontsize=.2:e>5&&(this.fontsize=5),set_storage("fontsize",e)},lineheight:function(e,t){if(!isFinite(e)){this.lineheight=t;return}e<100?this.lineheight=100:e>200&&(this.lineheight=200),set_storage("lineheight",e)},showingnum:function(e,t){if(!isFinite(e)){this.showingnum=t;return}(e=Math.floor(e))<50?this.showingnum=50:e>2e3&&(this.showingnum=2e3),set_storage("showingnum",this.showingnum),push_Topic_showingnum(this.showingnum),this.attempt_archive()},current_categories:function(e,t){e.length&&this.apply_filter(e)}},computed:{active_tab:function(){return this.tabs.find(function(e){return e.active})},ping_classes:function(){return this.latency?"?"==this.latency?"grey":this.latency<0?"red":this.latency<=200?"green":this.latency<=400?"yellow":"grey":this.reconnecting?"red":"green"},current_categories:function(){return this.active_tab==this.tabs[0]?[]:this.active_tab.categories.concat(vchat_opts.alwaysShow)}},methods:{load_settings:function(){this.inverted=get_storage("darkmode",!1),this.crushing=get_storage("crushing",3),this.animated=get_storage("animated",!1),this.fontsize=get_storage("fontsize",.9),this.lineheight=get_storage("lineheight",130),this.showingnum=get_storage("showingnum",200),isNaN(this.crushing)&&(this.crushing=3),isNaN(this.fontsize)&&(this.fontsize=.9),this.load_tabs()},load_tabs:function(){var e=get_storage("tabs");if(e){var t=JSON.parse(e);if(!t.version||!t.tabs){this.internal_message("There was a problem loading your tabs. Any new ones you make will be saved, however.");return}if(!t.version==vchat_opts.vchatTabsVer){this.internal_message("Your saved tabs are for an older version of VChat and must be recreated, sorry.");return}this.tabs.push.apply(this.tabs,t.tabs)}},save_tabs:function(){var e={version:vchat_opts.vchatTabsVer,tabs:[]};this.tabs.forEach(function(t){if(!t.immutable){var s=t.name,a=[];t.categories.forEach(function(e){a.push(e)}),e.tabs.push({name:s,categories:a,immutable:!1,active:!1})}}),set_storage("tabs",JSON.stringify(e))},switchtab:function(e){e!=this.active_tab&&(this.active_tab.active=!1,e.active=!0,e.categories.forEach(function(e){this.unread_messages[e]=0},this),this.apply_filter(this.current_categories))},editmode:function(){this.editing=!this.editing,this.save_tabs()},pause:function(){this.paused=!this.paused},newtab:function(){this.tabs.push({name:"New Tab",categories:[],immutable:!1,active:!1}),this.switchtab(this.tabs[this.tabs.length-1])},renametab:function(){if(!this.active_tab.immutable){var e=this.active_tab,t=window.prompt("Type the desired tab name:",e.name);null!==t&&""!==t&&null!==e&&(e.name=t)}},deltab:function(e){e||(e=this.active_tab),!e.immutable&&(this.switchtab(this.tabs[0]),this.tabs.splice(this.tabs.indexOf(e),1))},movetab:function(e,t){if(e&&!e.immutable){var s=this.tabs.indexOf(e);this.tabs.splice(s+t,0,this.tabs.splice(s,1)[0])}},tab_unread_count:function(e){var t=0,s=this.unread_messages;return e.categories.find(function(e){s[e]&&(t+=s[e])}),t},tab_unread_categories:function(e){var t=!1,s=this.unread_messages;return e.categories.find(function(e){if(s[e])return t=!0,!0}),{red:t,grey:!t}},attempt_archive:function(){if(this.messages.length>this.showingnum){var e=this.messages.splice(0,20);Array.prototype.push.apply(this.archived_messages,e)}},apply_filter:function(e){this.shown_messages.splice(0),this.unshown_messages=0,this.messages.forEach(function(t){e.indexOf(t.category)>-1&&this.shown_messages.push(t)},this),this.archived_messages.forEach(function(t){e.indexOf(t.category)>-1&&this.unshown_messages++},this)},add_message:function(e){let t={time:e.time,category:"error",content:e.message,repeats:1};if(t.category=this.get_category(t.content),"vc_unsorted"==t.category&&(t.content=""+t.content+""),this.crushing){let s=this.messages.slice(-this.crushing);for(let a=s.length-1;a>=0;a--){let n=s[a];n.content==t.content&&(t.repeats+=n.repeats,this.messages.splice(this.messages.indexOf(n),1))}}t.content=t.content.replace(/(\b(https?):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/img,'$1'),this.current_categories.length&&0>this.current_categories.indexOf(t.category)?(isNaN(this.unread_messages[t.category])&&(this.unread_messages[t.category]=0),this.unread_messages[t.category]+=1):this.current_categories.length&&this.shown_messages.push(t),t.id=++vchat_state.lastId,this.attempt_archive(),this.messages.push(t)},internal_message:function(e){let t={time:this.messages.length?this.messages.slice(-1).time+1:0,category:"vc_system",content:"[VChat Internal] "+e+""};t.id=++vchat_state.lastId,this.messages.push(t)},on_mouseup:function(e){let t=e.target;"getSelection"in window&&!1===window.getSelection().isCollapsed||t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)||(focusMapWindow(),e.preventDefault(),e.target.click())},click_message:function(e){let t=e.target;if("A"===t.tagName){e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1;var s=t.getAttribute("href");"?"==s[0]||s.length>=8&&"byond://"==s.substring(0,8)?window.location=s:window.location="byond://?action=openLink&link="+encodeURIComponent(s)}},get_category:function(e){if(!vchat_state.ready){push_Topic("not_ready");return}let t=domparser.parseFromString(e,"text/html").querySelector("span"),s="vc_unsorted";return t&&this.type_table.find(function(e){if(t.msMatchesSelector(e.matches))return s=e.becomes,!0}),s},save_chatlog:function(){var e="",t=this.archived_messages.concat(this.messages),s=this.current_categories;t.forEach(function(t){(0==s.length||s.indexOf(t.category)>=0)&&(e+=t.content,t.repeats>1&&(e+="(x"+t.repeats+")"),e+="
\n")}),e+="";var a=new Date,n=String(a.getHours());n.length<2&&(n="0"+n);var o=String(a.getMinutes());o.length<2&&(o="0"+o);var i=String(a.getDate());i.length<2&&(i="0"+i);var r=String(a.getMonth()+1);r.length<2&&(r="0"+r);var c="log"+(" "+String(a.getFullYear())+"-"+r+"-"+i+" ("+n+" "+o)+").html",l=document.createElement("a");if(void 0!==l.download)l.href="data:attachment/text,"+encodeURI(e),l.target="_blank",l.download=c,l.click();else{var h=new Blob([e],{type:"text/html;charset=utf8;"});saved=window.navigator.msSaveOrOpenBlob(h,c)}},do_latency_test:function(){send_latency_check()},blur_this:function(e){e.target.blur()}}})}function check_ping(){Date.now()-vchat_state.lastPingReceived>vchat_opts.msBeforeDropped&&(vueapp.reconnecting=!0)}function send_latency_check(){vchat_state.latency_sent||(vchat_state.latency_sent=Date.now(),vueapp.latency="?",push_Topic("ping"),setTimeout(function(){"?"==vchat_state.latency_ms&&(vchat_state.latency_ms=999)},1e3),setTimeout(function(){vchat_state.latency_sent=0,vueapp.latency=0},5e3))}function get_latency_check(){vchat_state.latency_sent&&(vueapp.latency=Date.now()-vchat_state.latency_sent)}function byondDecode(e){e=e.replace(/\+/g,"%20");try{e=decodeURIComponent(e)}catch(t){e=unescape(e)}return JSON.parse(e)}function putmessage(e){Array.isArray(e=byondDecode(e))?e.forEach(function(e){vueapp.add_message(e)}):"object"==typeof e&&vueapp.add_message(e)}function system_message(e){vueapp.internal_message(e)}function push_Topic(e){window.location="?_src_=chat&proc="+e}function push_Topic_showingnum(e){window.location="?_src_=chat&showingnum="+e}function focusMapWindow(){window.location="byond://winset?mapwindow.map.focus=true"}function send_debug(e){push_Topic("debug¶m[message]="+encodeURIComponent(e))}function get_event(e){if(!vchat_state.ready){push_Topic("not_ready");return}var t={evttype:"internal_error",event:e};switch((t=byondDecode(e)).evttype){case"internal_error":system_message("Event parse error: "+e);break;case"byond_player":send_client_data(),vueapp.is_admin="true"===t.admin,vchat_state.byond_ip=t.address,vchat_state.byond_cid=t.cid,vchat_state.byond_ckey=t.ckey,set_storage("ip",vchat_state.byond_ip),set_storage("cid",vchat_state.byond_cid),set_storage("ckey",vchat_state.byond_ckey);break;case"keepalive":vchat_state.lastPingReceived=Date.now(),vueapp.reconnecting=!1;break;case"pong":get_latency_check();break;case"availability":push_Topic("done_loading");break;default:system_message("Didn't know what to do with event: "+e)}}function send_client_data(){push_Topic("ident¶m[clientdata]="+JSON.stringify({ip:get_storage("ip"),cid:get_storage("cid"),ckey:get_storage("ckey")}))}function set_localstorage(e,t){window.localStorage.setItem(vchat_opts.cookiePrefix+e,t)}function get_localstorage(e,t){let s=window.localStorage.getItem(vchat_opts.cookiePrefix+e);return"null"===s||null===s?s=t:"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||(s=+s),s}function set_cookie(e,t){let s=new Date;s.setFullYear(s.getFullYear()+1);let a=s.toUTCString();document.cookie=vchat_opts.cookiePrefix+e+"="+t+";expires="+a+";path=/"}function get_cookie(e,t){var s={cookie:null,localstorage:null,indexeddb:null};let a=document.cookie.split(";"),n={};a.forEach(function(e){let s=e.replace(vchat_opts.cookiePrefix,"").trim(),a=s.search("="),o=decodeURIComponent(s.substring(0,a)),i=decodeURIComponent(s.substring(a+1));"null"==i||null===i?i=t:"true"===i?i=!0:"false"===i?i=!1:isNaN(i)||(i=+i),n[o]=i}),s.cookie=n[e]}var SKIN_BUTTONS=["rpane.textb","rpane.infob","rpane.wikib","rpane.forumb","rpane.rulesb","rpane.github","rpane.discord","rpane.mapb","rpane.changelog","mainwindow.saybutton","mainwindow.mebutton","mainwindow.hotkey_toggle"],SKIN_ELEMENTS=["mainwindow","mainwindow.mainvsplit","mainwindow.tooltip","rpane","rpane.rpanewindow","rpane.mediapanel",];function switch_ui_mode(e){doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".background-color"]=e.buttonBgColor,t},{})),doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".text-color"]=e.buttonTextColor,t},{})),doWinset(SKIN_ELEMENTS.reduce(function(t,s){return t[s+".background-color"]=e.windowBgColor,t},{})),doWinset("infowindow",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor}),doWinset("infowindow.info",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor,"highlight-color":e.highlightColor,"tab-text-color":e.tabTextColor,"tab-background-color":e.tabBackgroundColor})}function doWinset(e,t){void 0===t&&(t=e,e=null);var s="byond://winset?";e&&(s+="id="+e+"&"),s+=Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&"),window.location=s} +======= +!function(){var e=console.log;console.log=function(t){send_debug(t),e.apply(console,arguments)};var t=console.error;console.error=function(e){send_debug(e),t.apply(console,arguments)},window.onerror=function(e,t,s,a,n){var o="";return n&&n.stack&&(o=n.stack),send_debug(e+" ("+t+"@"+s+":"+a+") "+n+"|UA: "+navigator.userAgent+"|Stack: "+o),!0}}();var vueapp,vchat_opts={msBeforeDropped:3e4,cookiePrefix:"vst-",alwaysShow:["vc_looc","vc_system"],vchatTabsVer:1},DARKMODE_COLORS={buttonBgColor:"#40628a",buttonTextColor:"#FFFFFF",windowBgColor:"#272727",highlightColor:"#009900",tabTextColor:"#FFFFFF",tabBackgroundColor:"#272727"},LIGHTMODE_COLORS={buttonBgColor:"none",buttonTextColor:"#000000",windowBgColor:"none",highlightColor:"#007700",tabTextColor:"#000000",tabBackgroundColor:"none"},set_storage=set_cookie,get_storage=get_cookie,domparser=new DOMParser;storageAvailable("localStorage")&&(set_storage=set_localstorage,get_storage=get_localstorage);var vchat_state={ready:!1,byond_ip:null,byond_cid:null,byond_ckey:null,lastPingReceived:0,latency_sent:0,lastId:0};function start_vchat(){start_vue(),vchat_state.ready=!0,push_Topic("done_loading"),push_Topic_showingnum(this.showingnum),doWinset("htmloutput",{"is-visible":!0}),doWinset("oldoutput",{"is-visible":!1}),doWinset("chatloadlabel",{"is-visible":!1}),setInterval(check_ping,vchat_opts.msBeforeDropped),send_debug("VChat Loaded!")}function start_vue(){vueapp=new Vue({el:"#app",data:{messages:[],shown_messages:[],unshown_messages:0,archived_messages:[],tabs:[{name:"Main",categories:[],immutable:!0,active:!0}],unread_messages:{},editing:!1,paused:!1,latency:0,reconnecting:!1,ext_styles:"",is_admin:!1,inverted:!1,crushing:3,animated:!1,fontsize:.9,lineheight:130,showingnum:200,type_table:[{matches:".filter_say, .say, .emote, .emotesubtle",becomes:"vc_localchat",pretty:"Local Chat",tooltip:"In-character local messages (say, emote, etc)",required:!1,admin:!1},{matches:".filter_radio, .alert, .syndradio, .centradio, .airadio, .entradio, .comradio, .secradio, .engradio, .medradio, .sciradio, .supradio, .srvradio, .expradio, .radio, .deptradio, .newscaster",becomes:"vc_radio",pretty:"Radio Comms",tooltip:"All departments of radio messages",required:!1,admin:!1},{matches:".filter_notice, .notice:not(.pm), .adminnotice, .info, .sinister, .cult",becomes:"vc_info",pretty:"Notices",tooltip:"Non-urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_warning, .warning:not(.pm), .critical, .userdanger, .italics",becomes:"vc_warnings",pretty:"Warnings",tooltip:"Urgent messages from the game and items",required:!1,admin:!1},{matches:".filter_deadsay, .deadsay",becomes:"vc_deadchat",pretty:"Deadchat",tooltip:"All of deadchat",required:!1,admin:!1},{matches:".filter_pray",becomes:"vc_pray",pretty:"Pray",tooltip:"Prayer messages",required:!1,admin:!1},{matches:".ooc, .filter_ooc",becomes:"vc_globalooc",pretty:"Global OOC",tooltip:"The bluewall of global OOC messages",required:!1,admin:!1},{matches:".nif",becomes:"vc_nif",pretty:"NIF Messages",tooltip:"Messages from the NIF itself and people inside",required:!1,admin:!1},{matches:".psay, .pemote",becomes:"vc_pmessage",pretty:"Pred/Prey Messages",tooltip:"Messages from / to absorbed or dominated prey",required:!1,admin:!1},{matches:".mentor_channel, .mentor",becomes:"vc_mentor",pretty:"Mentor messages",tooltip:"Mentorchat and mentor pms",required:!1,admin:!1},{matches:".filter_pm, .pm",becomes:"vc_adminpm",pretty:"Admin PMs",tooltip:"Messages to/from admins ('adminhelps')",required:!1,admin:!1},{matches:".filter_ASAY, .admin_channel",becomes:"vc_adminchat",pretty:"Admin Chat",tooltip:"ASAY messages",required:!1,admin:!0},{matches:".filter_MSAY, .mod_channel",becomes:"vc_modchat",pretty:"Mod Chat",tooltip:"MSAY messages",required:!1,admin:!0},{matches:".filter_ESAY, .event_channel",becomes:"vc_eventchat",pretty:"Event Chat",tooltip:"ESAY messages",required:!1,admin:!0},{matches:".filter_combat, .danger",becomes:"vc_combat",pretty:"Combat Logs",tooltip:"Urist McTraitor has stabbed you with a knife!",required:!1,admin:!1},{matches:".filter_adminlogs, .log_message",becomes:"vc_adminlogs",pretty:"Admin Logs",tooltip:"ADMIN LOG: Urist McAdmin has jumped to coordinates X, Y, Z",required:!1,admin:!0},{matches:".filter_attacklogs",becomes:"vc_attacklogs",pretty:"Attack Logs",tooltip:"Urist McTraitor has shot John Doe",required:!1,admin:!0},{matches:".filter_debuglogs",becomes:"vc_debuglogs",pretty:"Debug Logs",tooltip:"DEBUG: SSPlanets subsystem Recover().",required:!1,admin:!0},{matches:".looc",becomes:"vc_looc",pretty:"Local OOC",tooltip:"Local OOC messages, always enabled",required:!0},{matches:".rlooc",becomes:"vc_rlooc",pretty:"Remote LOOC",tooltip:"Remote LOOC messages",required:!1,admin:!0},{matches:".boldannounce, .filter_system",becomes:"vc_system",pretty:"System Messages",tooltip:"Messages from your client, always enabled",required:!0},{matches:".unsorted",becomes:"vc_unsorted",pretty:"Unsorted",tooltip:"Messages that don't have any filters.",required:!1,admin:!1}]},mounted:function(){this.load_settings();var e=new XMLHttpRequest;e.open("GET","ss13styles.css"),e.onreadystatechange=(function(){this.ext_styles=e.responseText}).bind(this),e.send()},updated:function(){this.editing||this.paused||window.scrollTo(0,document.getElementById("messagebox").scrollHeight)},watch:{reconnecting:function(e,t){!0==e&&!1==t?this.internal_message("Your client has lost connection to the server, or there is severe lag. Your client will reconnect if possible."):!1==e&&!0==t&&this.internal_message("Your client has reconnected to the server.")},inverted:function(e){set_storage("darkmode",e),e?(document.body.classList.add("inverted"),switch_ui_mode(DARKMODE_COLORS)):(document.body.classList.remove("inverted"),switch_ui_mode(LIGHTMODE_COLORS))},crushing:function(e){set_storage("crushing",e)},animated:function(e){set_storage("animated",e)},fontsize:function(e,t){if(isNaN(e)){this.fontsize=t;return}e<.2?this.fontsize=.2:e>5&&(this.fontsize=5),set_storage("fontsize",e)},lineheight:function(e,t){if(!isFinite(e)){this.lineheight=t;return}e<100?this.lineheight=100:e>200&&(this.lineheight=200),set_storage("lineheight",e)},showingnum:function(e,t){if(!isFinite(e)){this.showingnum=t;return}(e=Math.floor(e))<50?this.showingnum=50:e>2e3&&(this.showingnum=2e3),set_storage("showingnum",this.showingnum),push_Topic_showingnum(this.showingnum),this.attempt_archive()},current_categories:function(e,t){e.length&&this.apply_filter(e)}},computed:{active_tab:function(){return this.tabs.find(function(e){return e.active})},ping_classes:function(){return this.latency?"?"==this.latency?"grey":this.latency<0?"red":this.latency<=200?"green":this.latency<=400?"yellow":"grey":this.reconnecting?"red":"green"},current_categories:function(){return this.active_tab==this.tabs[0]?[]:this.active_tab.categories.concat(vchat_opts.alwaysShow)}},methods:{load_settings:function(){this.inverted=get_storage("darkmode",!1),this.crushing=get_storage("crushing",3),this.animated=get_storage("animated",!1),this.fontsize=get_storage("fontsize",.9),this.lineheight=get_storage("lineheight",130),this.showingnum=get_storage("showingnum",200),isNaN(this.crushing)&&(this.crushing=3),isNaN(this.fontsize)&&(this.fontsize=.9),this.load_tabs()},load_tabs:function(){var e=get_storage("tabs");if(e){var t=JSON.parse(e);if(!t.version||!t.tabs){this.internal_message("There was a problem loading your tabs. Any new ones you make will be saved, however.");return}if(!t.version==vchat_opts.vchatTabsVer){this.internal_message("Your saved tabs are for an older version of VChat and must be recreated, sorry.");return}this.tabs.push.apply(this.tabs,t.tabs)}},save_tabs:function(){var e={version:vchat_opts.vchatTabsVer,tabs:[]};this.tabs.forEach(function(t){if(!t.immutable){var s=t.name,a=[];t.categories.forEach(function(e){a.push(e)}),e.tabs.push({name:s,categories:a,immutable:!1,active:!1})}}),set_storage("tabs",JSON.stringify(e))},switchtab:function(e){e!=this.active_tab&&(this.active_tab.active=!1,e.active=!0,e.categories.forEach(function(e){this.unread_messages[e]=0},this),this.apply_filter(this.current_categories))},editmode:function(){this.editing=!this.editing,this.save_tabs()},pause:function(){this.paused=!this.paused},newtab:function(){this.tabs.push({name:"New Tab",categories:[],immutable:!1,active:!1}),this.switchtab(this.tabs[this.tabs.length-1])},renametab:function(){if(!this.active_tab.immutable){var e=this.active_tab,t=window.prompt("Type the desired tab name:",e.name);null!==t&&""!==t&&null!==e&&(e.name=t)}},deltab:function(e){e||(e=this.active_tab),!e.immutable&&(this.switchtab(this.tabs[0]),this.tabs.splice(this.tabs.indexOf(e),1))},movetab:function(e,t){if(e&&!e.immutable){var s=this.tabs.indexOf(e);this.tabs.splice(s+t,0,this.tabs.splice(s,1)[0])}},tab_unread_count:function(e){var t=0,s=this.unread_messages;return e.categories.find(function(e){s[e]&&(t+=s[e])}),t},tab_unread_categories:function(e){var t=!1,s=this.unread_messages;return e.categories.find(function(e){if(s[e])return t=!0,!0}),{red:t,grey:!t}},attempt_archive:function(){if(this.messages.length>this.showingnum){var e=this.messages.splice(0,20);Array.prototype.push.apply(this.archived_messages,e)}},apply_filter:function(e){this.shown_messages.splice(0),this.unshown_messages=0,this.messages.forEach(function(t){e.indexOf(t.category)>-1&&this.shown_messages.push(t)},this),this.archived_messages.forEach(function(t){e.indexOf(t.category)>-1&&this.unshown_messages++},this)},add_message:function(e){let t={time:e.time,category:"error",content:e.message,repeats:1};if(t.category=this.get_category(t.content),"vc_unsorted"==t.category&&(t.content=""+t.content+""),this.crushing){let s=this.messages.slice(-this.crushing);for(let a=s.length-1;a>=0;a--){let n=s[a];n.content==t.content&&(t.repeats+=n.repeats,this.messages.splice(this.messages.indexOf(n),1))}}t.content=t.content.replace(/(\b(https?):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/img,'$1'),this.current_categories.length&&0>this.current_categories.indexOf(t.category)?(isNaN(this.unread_messages[t.category])&&(this.unread_messages[t.category]=0),this.unread_messages[t.category]+=1):this.current_categories.length&&this.shown_messages.push(t),t.id=++vchat_state.lastId,this.attempt_archive(),this.messages.push(t)},internal_message:function(e){let t={time:this.messages.length?this.messages.slice(-1).time+1:0,category:"vc_system",content:"[VChat Internal] "+e+""};t.id=++vchat_state.lastId,this.messages.push(t)},on_mouseup:function(e){let t=e.target;"getSelection"in window&&!1===window.getSelection().isCollapsed||t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)||(focusMapWindow(),e.preventDefault(),e.target.click())},click_message:function(e){let t=e.target;if("A"===t.tagName){e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1;var s=t.getAttribute("href");"?"==s[0]||s.length>=8&&"byond://"==s.substring(0,8)?window.location=s:window.location="byond://?action=openLink&link="+encodeURIComponent(s)}},get_category:function(e){if(!vchat_state.ready){push_Topic("not_ready");return}let t=domparser.parseFromString(e,"text/html").querySelector("span"),s="vc_unsorted";return t&&this.type_table.find(function(e){if(t.msMatchesSelector(e.matches))return s=e.becomes,!0}),s},save_chatlog:function(){var e="",t=this.archived_messages.concat(this.messages),s=this.current_categories;t.forEach(function(t){(0==s.length||s.indexOf(t.category)>=0)&&(e+=t.content,t.repeats>1&&(e+="(x"+t.repeats+")"),e+="
\n")}),e+="";var a=new Date,n=String(a.getHours());n.length<2&&(n="0"+n);var o=String(a.getMinutes());o.length<2&&(o="0"+o);var i=String(a.getDate());i.length<2&&(i="0"+i);var r=String(a.getMonth()+1);r.length<2&&(r="0"+r);var c="log"+(" "+String(a.getFullYear())+"-"+r+"-"+i+" ("+n+" "+o)+").html",l=document.createElement("a");if(void 0!==l.download)l.href="data:attachment/text,"+encodeURI(e),l.target="_blank",l.download=c,l.click();else{var h=new Blob([e],{type:"text/html;charset=utf8;"});saved=window.navigator.msSaveOrOpenBlob(h,c)}},do_latency_test:function(){send_latency_check()},blur_this:function(e){e.target.blur()}}})}function check_ping(){Date.now()-vchat_state.lastPingReceived>vchat_opts.msBeforeDropped&&(vueapp.reconnecting=!0)}function send_latency_check(){vchat_state.latency_sent||(vchat_state.latency_sent=Date.now(),vueapp.latency="?",push_Topic("ping"),setTimeout(function(){"?"==vchat_state.latency_ms&&(vchat_state.latency_ms=999)},1e3),setTimeout(function(){vchat_state.latency_sent=0,vueapp.latency=0},5e3))}function get_latency_check(){vchat_state.latency_sent&&(vueapp.latency=Date.now()-vchat_state.latency_sent)}function byondDecode(e){e=e.replace(/\+/g,"%20");try{e=decodeURIComponent(e)}catch(t){e=unescape(e)}return JSON.parse(e)}function putmessage(e){Array.isArray(e=byondDecode(e))?e.forEach(function(e){vueapp.add_message(e)}):"object"==typeof e&&vueapp.add_message(e)}function system_message(e){vueapp.internal_message(e)}function push_Topic(e){window.location="?_src_=chat&proc="+e}function push_Topic_showingnum(e){window.location="?_src_=chat&showingnum="+e}function focusMapWindow(){window.location="byond://winset?mapwindow.map.focus=true"}function send_debug(e){push_Topic("debug¶m[message]="+encodeURIComponent(e))}function get_event(e){if(!vchat_state.ready){push_Topic("not_ready");return}var t={evttype:"internal_error",event:e};switch((t=byondDecode(e)).evttype){case"internal_error":system_message("Event parse error: "+e);break;case"byond_player":send_client_data(),vueapp.is_admin="true"===t.admin,vchat_state.byond_ip=t.address,vchat_state.byond_cid=t.cid,vchat_state.byond_ckey=t.ckey,set_storage("ip",vchat_state.byond_ip),set_storage("cid",vchat_state.byond_cid),set_storage("ckey",vchat_state.byond_ckey);break;case"keepalive":vchat_state.lastPingReceived=Date.now(),vueapp.reconnecting=!1;break;case"pong":get_latency_check();break;case"availability":push_Topic("done_loading");break;default:system_message("Didn't know what to do with event: "+e)}}function send_client_data(){push_Topic("ident¶m[clientdata]="+JSON.stringify({ip:get_storage("ip"),cid:get_storage("cid"),ckey:get_storage("ckey")}))}function set_localstorage(e,t){window.localStorage.setItem(vchat_opts.cookiePrefix+e,t)}function get_localstorage(e,t){let s=window.localStorage.getItem(vchat_opts.cookiePrefix+e);return"null"===s||null===s?s=t:"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||(s=+s),s}function set_cookie(e,t){let s=new Date;s.setFullYear(s.getFullYear()+1);let a=s.toUTCString();document.cookie=vchat_opts.cookiePrefix+e+"="+t+";expires="+a+";path=/"}function get_cookie(e,t){var s={cookie:null,localstorage:null,indexeddb:null};let a=document.cookie.split(";"),n={};a.forEach(function(e){let s=e.replace(vchat_opts.cookiePrefix,"").trim(),a=s.search("="),o=decodeURIComponent(s.substring(0,a)),i=decodeURIComponent(s.substring(a+1));"null"==i||null===i?i=t:"true"===i?i=!0:"false"===i?i=!1:isNaN(i)||(i=+i),n[o]=i}),s.cookie=n[e]}var SKIN_BUTTONS=["rpane.textb","rpane.infob","rpane.wikib","rpane.forumb","rpane.rulesb","rpane.github","rpane.discord","rpane.mapb","rpane.changelog","mainwindow.saybutton","mainwindow.mebutton","mainwindow.hotkey_toggle"],SKIN_ELEMENTS=["mainwindow","mainwindow.mainvsplit","mainwindow.tooltip","rpane","rpane.rpanewindow","rpane.mediapanel",];function switch_ui_mode(e){doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".background-color"]=e.buttonBgColor,t},{})),doWinset(SKIN_BUTTONS.reduce(function(t,s){return t[s+".text-color"]=e.buttonTextColor,t},{})),doWinset(SKIN_ELEMENTS.reduce(function(t,s){return t[s+".background-color"]=e.windowBgColor,t},{})),doWinset("infowindow",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor}),doWinset("infowindow.info",{"background-color":e.tabBackgroundColor,"text-color":e.tabTextColor,"highlight-color":e.highlightColor,"tab-text-color":e.tabTextColor,"tab-background-color":e.tabBackgroundColor})}function doWinset(e,t){void 0===t&&(t=e,e=null);var s="byond://winset?";e&&(s+="id="+e+"&"),s+=Object.keys(t).map(function(e){return e+"="+encodeURIComponent(t[e])}).join("&"),window.location=s} +>>>>>>> 097d78a0e0... Merge pull request #14625 from ItsSelis/selis-tgchat diff --git a/interface/skin.dmf b/interface/skin.dmf index 2d929bcd81..7f3d37acf8 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -1250,46 +1250,28 @@ window "outputwindow" size = 640x480 anchor1 = -1,-1 anchor2 = -1,-1 + background-color = none saved-params = "pos;size;is-minimized;is-maximized" - titlebar = false - statusbar = false - can-close = false - can-minimize = false - can-resize = false is-pane = true - elem "chatloadlabel" - type = LABEL - pos = 0,0 - size = 640x480 - anchor1 = 0,0 - anchor2 = 100,100 - font-family = "sans-serif" - font-size = 24 - font-style = "bold" - text-color = #ffffff - background-color = #222222 - saved-params = "" - text = "Chat is loading.\nIf nothing happens after 20s,\nuse OOC > \"Reload VChat\"." - elem "htmloutput" + elem "browseroutput" type = BROWSER pos = 0,0 size = 640x480 anchor1 = 0,0 anchor2 = 100,100 is-visible = false + is-disabled = true saved-params = "" - elem "oldoutput" + elem "output" type = OUTPUT pos = 0,0 size = 640x480 anchor1 = 0,0 anchor2 = 100,100 - is-visible = false is-default = true saved-params = "" style = ".system {color:#FF0000;}" enable-http-images = true - max-lines = 0 window "prefs_markings_subwindow" elem "prefs_markings_subwindow" diff --git a/code/stylesheet.dm b/interface/stylesheet.dm similarity index 89% rename from code/stylesheet.dm rename to interface/stylesheet.dm index 232ed7ac75..aba8698485 100644 --- a/code/stylesheet.dm +++ b/interface/stylesheet.dm @@ -1,3 +1,11 @@ +/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +/// !!!!!!!!!!HEY LISTEN!!!!!!!!!!!!!!!!!!!!!!!! +/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +// If you modify this file you ALSO need to modify tgui/packages/tgui-panel/styles/tgchat/chat-light.scss and chat-dark.scss +// BUT you have to use PX font sizes with are on a x8 scale of these font sizes +// Sample font-size: DM: 8 CSS: 64px + /client/script = {"\n\n\n
\n'+c+"
\n\n\n"]),d=(new Date).toISOString().substring(0,19).replace(/[-:]/g,"").replace("T","-");window.navigator.msSaveBlob(l,"ss13-chatlog-"+d+".html")}},e}();window.__chatRenderer__||(window.__chatRenderer__=new w);var x=window.__chatRenderer__;t.chatRenderer=x},3517:function(e,t){"use strict";function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n9999)return{};o||(o=document.createDocumentFragment()),t||(t=[]);var h=u?u(r[0]):r[0],v=h.length,g=r.index+r[0].indexOf(h);f=t+a.CONNECTION_LOST_AFTER;!r.connectionLostAt&&u&&e.dispatch(c((0,o.connectionLost)())),r.connectionLostAt&&!u&&e.dispatch(c((0,o.connectionRestored)()))}}),1e3),function(e){return function(n){var i=n.type;return i===r.pingSuccess.type||i===r.pingSoft.type?(t=Date.now(),e(n)):i===o.roundRestarted.type?e(c(n)):e(n)}}}},64882:function(e,t,n){"use strict";t.__esModule=!0,t.gameReducer=void 0;var r=n(16163),o={roundId:null,roundTime:null,roundRestartedAt:null,connectionLostAt:null};t.gameReducer=function(e,t){void 0===e&&(e=o);var n=t.type,i=(t.payload,t.meta);return"roundrestart"===n?Object.assign({},e,{roundRestartedAt:i.now}):n===r.connectionLost.type?Object.assign({},e,{connectionLostAt:i.now}):n===r.connectionRestored.type?Object.assign({},e,{connectionLostAt:null}):e}},41641:function(e,t){"use strict";t.__esModule=!0,t.selectGame=void 0;t.selectGame=function(e){return e.game}},53923:function(e,t,n){"use strict";t.__esModule=!0,t.setupPanelFocusHacks=void 0;var r=n(13212),o=n(80835),i=n(68566),a=function(){return setImmediate((function(){return(0,i.focusMap)()}))};t.setupPanelFocusHacks=function(){var e=!1,t=null;window.addEventListener("focusin",(function(t){e=(0,o.canStealFocus)(t.target)})),window.addEventListener("mousedown",(function(e){t=[e.screenX,e.screenY]})),window.addEventListener("mouseup",(function(n){if(t){var o=[n.screenX,n.screenY];(0,r.vecLength)((0,r.vecSubtract)(o,t))>=10&&(e=!0)}e||a()})),o.globalEvents.on("keydown",(function(e){e.isModifierKey()||a()}))}},55622:function(e,t,n){"use strict";t.__esModule=!0,t.PingIndicator=void 0;var r=n(58734),o=n(75052),i=n(5339),a=n(32289),c=n(71558),u=n(80482);t.PingIndicator=function(e,t){var n=(0,a.useSelector)(t,u.selectPing),s=o.Color.lookup(n.networkQuality,[new o.Color(220,40,40),new o.Color(220,200,40),new o.Color(60,220,40)]),l=n.roundtrip?(0,i.toFixed)(n.roundtrip):"--";return(0,r.createVNode)(1,"div","Ping",[(0,r.createComponentVNode)(2,c.Box,{className:"Ping__indicator",backgroundColor:s}),l],0)}},82046:function(e,t,n){"use strict";t.__esModule=!0,t.pingSuccess=t.pingSoft=t.pingReply=t.pingFail=void 0;var r=n(32289),o=(0,r.createAction)("ping/reply");t.pingReply=o;var i=(0,r.createAction)("ping/soft");t.pingSoft=i;var a=(0,r.createAction)("ping/success",(function(e){return{payload:{lastId:e.id,roundtrip:.5*(Date.now()-e.sentAt)}}}));t.pingSuccess=a;var c=(0,r.createAction)("ping/fail");t.pingFail=c},67300:function(e,t){"use strict";t.__esModule=!0,t.PING_TIMEOUT=t.PING_ROUNDTRIP_WORST=t.PING_ROUNDTRIP_BEST=t.PING_QUEUE_SIZE=t.PING_MAX_FAILS=void 0;t.PING_TIMEOUT=2e3;t.PING_MAX_FAILS=3;t.PING_QUEUE_SIZE=8;t.PING_ROUNDTRIP_BEST=50;t.PING_ROUNDTRIP_WORST=200},47319:function(e,t,n){"use strict";t.__esModule=!0,t.pingReducer=t.pingMiddleware=t.PingIndicator=void 0;var r=n(52348);t.pingMiddleware=r.pingMiddleware;var o=n(55622);t.PingIndicator=o.PingIndicator;var i=n(28975);t.pingReducer=i.pingReducer},52348:function(e,t,n){"use strict";t.__esModule=!0,t.pingMiddleware=void 0;var r=n(82046),o=n(67300);t.pingMiddleware=function(e){var t=!1,n=0,i=[],a=function(){for(var t=0;to.PING_TIMEOUT&&(i[t]=null,e.dispatch((0,r.pingFail)()))}var c={index:n,sentAt:Date.now()};i[n]=c,Byond.sendMessage("ping",{index:n}),n=(n+1)%o.PING_QUEUE_SIZE};return function(e){return function(n){var o=n.type,c=n.payload;if(t||(t=!0,a()),o===r.pingSoft.type)return c.afk||a(),e(n);if(o===r.pingReply.type){var u=c.index,s=i[u];if(!s)return;return i[u]=null,e((0,r.pingSuccess)(s))}return e(n)}}}},28975:function(e,t,n){"use strict";t.__esModule=!0,t.pingReducer=void 0;var r=n(5339),o=n(82046),i=n(67300);t.pingReducer=function(e,t){void 0===e&&(e={});var n=t.type,a=t.payload;if(n===o.pingSuccess.type){var c=a.roundtrip,u=e.roundtripAvg||c,s=Math.round(.4*u+.6*c);return{roundtrip:c,roundtripAvg:s,failCount:0,networkQuality:1-(0,r.scale)(s,i.PING_ROUNDTRIP_BEST,i.PING_ROUNDTRIP_WORST)}}if(n===o.pingFail.type){var l=e.failCount,f=void 0===l?0:l,d=(0,r.clamp01)(e.networkQuality-f/i.PING_MAX_FAILS),p=Object.assign({},e,{failCount:f+1,networkQuality:d});return f>i.PING_MAX_FAILS&&(p.roundtrip=undefined,p.roundtripAvg=undefined),p}return e}},80482:function(e,t){"use strict";t.__esModule=!0,t.selectPing=void 0;t.selectPing=function(e){return e.ping}},26491:function(e,t,n){"use strict";t.__esModule=!0,t.ReconnectButton=void 0;var r=n(58734),o=n(71558),i=null;setInterval((function(){Byond.winget("","url").then((function(e){e&&!e.match(/:0$/)&&(i=e)}))}),5e3);t.ReconnectButton=function(){return i?(0,r.createFragment)([(0,r.createComponentVNode)(2,o.Button,{color:"white",onClick:function(){Byond.command(".reconnect")},children:"Reconnect"}),(0,r.createComponentVNode)(2,o.Button,{color:"white",onClick:function(){location.href="byond://"+i,Byond.command(".quit")},children:"Relaunch game"})],4):null}},45679:function(e,t,n){"use strict";t.__esModule=!0,t.SettingsPanel=t.SettingsGeneral=void 0;var r=n(58734),o=n(5339),i=n(62188),a=n(32289),c=n(71558),u=n(13489),s=n(8719),l=n(32353),f=n(93164),d=n(32112),p=n(14173),h=["id"];t.SettingsPanel=function(e,t){var n=(0,a.useSelector)(t,p.selectActiveTab),o=(0,a.useDispatch)(t);return(0,r.createComponentVNode)(2,c.Stack,{fill:!0,children:[(0,r.createComponentVNode)(2,c.Stack.Item,{children:(0,r.createComponentVNode)(2,c.Section,{fitted:!0,fill:!0,minHeight:"8em",children:(0,r.createComponentVNode)(2,c.Tabs,{vertical:!0,children:d.SETTINGS_TABS.map((function(e){return(0,r.createComponentVNode)(2,c.Tabs.Tab,{selected:e.id===n,onClick:function(){return o((0,f.changeSettingsTab)({tabId:e.id}))},children:e.name},e.id)}))})})}),(0,r.createComponentVNode)(2,c.Stack.Item,{grow:1,basis:0,children:["general"===n&&(0,r.createComponentVNode)(2,v),"chatPage"===n&&(0,r.createComponentVNode)(2,u.ChatPageSettings),"textHighlight"===n&&(0,r.createComponentVNode)(2,g)]})]})};var v=function(e,t){var n=(0,a.useSelector)(t,p.selectSettings),u=n.theme,h=n.fontFamily,v=n.fontSize,g=n.lineHeight,m=(0,a.useDispatch)(t),y=(0,i.useLocalState)(t,"freeFont",!1),b=y[0],_=y[1];return(0,r.createComponentVNode)(2,c.Section,{children:[(0,r.createComponentVNode)(2,c.LabeledList,{children:[(0,r.createComponentVNode)(2,c.LabeledList.Item,{label:"Theme",children:(0,r.createComponentVNode)(2,c.Dropdown,{selected:u,options:l.THEMES,onSelected:function(e){return m((0,f.updateSettings)({theme:e}))}})}),(0,r.createComponentVNode)(2,c.LabeledList.Item,{label:"Font style",children:(0,r.createComponentVNode)(2,c.Stack,{inline:!0,align:"baseline",children:[(0,r.createComponentVNode)(2,c.Stack.Item,{children:!b&&(0,r.createComponentVNode)(2,c.Dropdown,{selected:h,options:d.FONTS,onSelected:function(e){return m((0,f.updateSettings)({fontFamily:e}))}})||(0,r.createComponentVNode)(2,c.Input,{value:h,onChange:function(e,t){return m((0,f.updateSettings)({fontFamily:t}))}})}),(0,r.createComponentVNode)(2,c.Stack.Item,{children:(0,r.createComponentVNode)(2,c.Button,{content:"Custom font",icon:b?"lock-open":"lock",color:b?"good":"bad",ml:1,onClick:function(){_(!b)}})})]})}),(0,r.createComponentVNode)(2,c.LabeledList.Item,{label:"Font size",children:(0,r.createComponentVNode)(2,c.NumberInput,{width:"4em",step:1,stepPixelSize:10,minValue:8,maxValue:32,value:v,unit:"px",format:function(e){return(0,o.toFixed)(e)},onChange:function(e,t){return m((0,f.updateSettings)({fontSize:t}))}})}),(0,r.createComponentVNode)(2,c.LabeledList.Item,{label:"Line height",children:(0,r.createComponentVNode)(2,c.NumberInput,{width:"4em",step:.01,stepPixelSize:2,minValue:.8,maxValue:5,value:g,format:function(e){return(0,o.toFixed)(e,2)},onDrag:function(e,t){return m((0,f.updateSettings)({lineHeight:t}))}})})]}),(0,r.createComponentVNode)(2,c.Divider),(0,r.createComponentVNode)(2,c.Button,{icon:"save",onClick:function(){return m((0,s.saveChatToDisk)())},children:"Save chat log"})]})};t.SettingsGeneral=v;var g=function(e,t){var n=(0,a.useSelector)(t,p.selectHighlightSettings),o=(0,a.useDispatch)(t);return(0,r.createComponentVNode)(2,c.Section,{fill:!0,scrollable:!0,height:"200px",children:[(0,r.createComponentVNode)(2,c.Section,{p:0,children:(0,r.createComponentVNode)(2,c.Flex,{direction:"column",children:[n.map((function(e,t){return(0,r.createComponentVNode)(2,m,{id:e,mb:t+1===n.length?0:"10px"},t)})),n.length=0||(o[n]=e[n]);return o}(e,h),i=(0,a.useSelector)(t,p.selectHighlightSettingById),u=(0,a.useDispatch)(t),s=i[n],l=s.highlightColor,d=s.highlightText,v=s.highlightWholeMessage,g=s.matchWord,m=s.matchCase;return(0,r.normalizeProps)((0,r.createComponentVNode)(2,c.Flex.Item,Object.assign({},o,{children:[(0,r.createComponentVNode)(2,c.Flex,{mb:1,color:"label",align:"baseline",children:[(0,r.createComponentVNode)(2,c.Flex.Item,{grow:!0,children:(0,r.createComponentVNode)(2,c.Button,{content:"Delete",color:"transparent",icon:"times",onClick:function(){return u((0,f.removeHighlightSetting)({id:n}))}})}),(0,r.createComponentVNode)(2,c.Flex.Item,{children:(0,r.createComponentVNode)(2,c.Button.Checkbox,{checked:v,content:"Whole Message",tooltip:"If this option is selected, the entire message will be highlighted in yellow.",mr:"5px",onClick:function(){return u((0,f.updateHighlightSetting)({id:n,highlightWholeMessage:!v}))}})}),(0,r.createComponentVNode)(2,c.Flex.Item,{children:(0,r.createComponentVNode)(2,c.Button.Checkbox,{content:"Exact",checked:g,tooltipPosition:"bottom-start",tooltip:"If this option is selected, only exact matches (no extra letters before or after) will trigger. Not compatible with punctuation. Overriden if regex is used.",onClick:function(){return u((0,f.updateHighlightSetting)({id:n,matchWord:!g}))}})}),(0,r.createComponentVNode)(2,c.Flex.Item,{children:(0,r.createComponentVNode)(2,c.Button.Checkbox,{content:"Case",tooltip:"If this option is selected, the highlight will be case-sensitive.",checked:m,onClick:function(){return u((0,f.updateHighlightSetting)({id:n,matchCase:!m}))}})}),(0,r.createComponentVNode)(2,c.Flex.Item,{shrink:0,children:[(0,r.createComponentVNode)(2,c.ColorBox,{mr:1,color:l}),(0,r.createComponentVNode)(2,c.Input,{width:"5em",monospace:!0,placeholder:"#ffffff",value:l,onInput:function(e,t){return u((0,f.updateHighlightSetting)({id:n,highlightColor:t}))}})]})]}),(0,r.createComponentVNode)(2,c.TextArea,{height:"3em",value:d,placeholder:"Put words to highlight here. Separate terms with commas, i.e. (term1, term2, term3)",onChange:function(e,t){return u((0,f.updateHighlightSetting)({id:n,highlightText:t}))}})]})))}},93164:function(e,t,n){"use strict";t.__esModule=!0,t.updateSettings=t.updateHighlightSetting=t.toggleSettings=t.removeHighlightSetting=t.openChatSettings=t.loadSettings=t.changeSettingsTab=t.addHighlightSetting=void 0;var r=n(32289),o=n(93475),i=(0,r.createAction)("settings/update");t.updateSettings=i;var a=(0,r.createAction)("settings/load");t.loadSettings=a;var c=(0,r.createAction)("settings/changeTab");t.changeSettingsTab=c;var u=(0,r.createAction)("settings/toggle");t.toggleSettings=u;var s=(0,r.createAction)("settings/openChatTab");t.openChatSettings=s;var l=(0,r.createAction)("settings/addHighlightSetting",(function(){return{payload:(0,o.createHighlightSetting)()}}));t.addHighlightSetting=l;var f=(0,r.createAction)("settings/removeHighlightSetting");t.removeHighlightSetting=f;var d=(0,r.createAction)("settings/updateHighlightSetting");t.updateHighlightSetting=d},32112:function(e,t){"use strict";t.__esModule=!0,t.SETTINGS_TABS=t.MAX_HIGHLIGHT_SETTINGS=t.FONTS_DISABLED=t.FONTS=void 0;t.SETTINGS_TABS=[{id:"general",name:"General"},{id:"textHighlight",name:"Text Highlights"},{id:"chatPage",name:"Chat Tabs"}];var n="Default";t.FONTS_DISABLED=n;var r=[n,"Verdana","Arial","Arial Black","Comic Sans MS","Impact","Lucida Sans Unicode","Tahoma","Trebuchet MS","Courier New","Lucida Console"];t.FONTS=r;t.MAX_HIGHLIGHT_SETTINGS=10},25417:function(e,t,n){"use strict";t.__esModule=!0,t.useSettings=void 0;var r=n(32289),o=n(93164),i=n(14173);t.useSettings=function(e){var t=(0,r.useSelector)(e,i.selectSettings),n=(0,r.useDispatch)(e);return Object.assign({},t,{visible:t.view.visible,toggle:function(){return n((0,o.toggleSettings)())},update:function(e){return n((0,o.updateSettings)(e))}})}},46568:function(e,t,n){"use strict";t.__esModule=!0,t.useSettings=t.settingsReducer=t.settingsMiddleware=t.SettingsPanel=void 0;var r=n(25417);t.useSettings=r.useSettings;var o=n(41725);t.settingsMiddleware=o.settingsMiddleware;var i=n(7907);t.settingsReducer=i.settingsReducer;var a=n(45679);t.SettingsPanel=a.SettingsPanel},41725:function(e,t,n){"use strict";t.__esModule=!0,t.settingsMiddleware=void 0;var r=n(22800),o=n(32353),i=n(93164),a=n(14173),c=n(32112),u=null,s=null,l=null;t.settingsMiddleware=function(e){var t=!1;return function(n){return function(f){var d,p,h=f.type,v=f.payload;if(t||(t=!0,r.storage.get("panel-settings").then((function(t){e.dispatch((0,i.loadSettings)(t))}))),h===i.updateSettings.type||h===i.loadSettings.type||h===i.addHighlightSetting.type||h===i.removeHighlightSetting.type||h===i.updateHighlightSetting.type){var g=null==v?void 0:v.theme;g&&(0,o.setClientTheme)(g),n(f);var m=(0,a.selectSettings)(e.getState());return p=m.fontSize,l=p+"px",(d=m.fontFamily)===c.FONTS_DISABLED&&(d=null),s=d,function(){var e="";null!==s&&(e="font-family: "+s+" !important;");var t="body * :not(.Icon) {\n "+e+"\n }";null===u&&(u=document.createElement("style"),document.querySelector("head").append(u)),u.innerText=t,document.body.style.setProperty("font-size",l)}(),void r.storage.set("panel-settings",m)}return n(f)}}}},93475:function(e,t,n){"use strict";t.__esModule=!0,t.createHighlightSetting=t.createDefaultHighlightSetting=void 0;var r=n(48744),o=function(e){return Object.assign({id:(0,r.createUuid)(),highlightText:"",highlightColor:"#ffdd44",highlightWholeMessage:!0,matchWord:!1,matchCase:!1},e)};t.createHighlightSetting=o;t.createDefaultHighlightSetting=function(e){return o(Object.assign({id:"default"},e))}},7907:function(e,t,n){"use strict";t.__esModule=!0,t.settingsReducer=void 0;var r,o=n(93164),i=n(93475),a=n(32112),c=["id"];var u=(0,i.createDefaultHighlightSetting)(),s={version:1,fontSize:13,fontFamily:a.FONTS[0],lineHeight:1.2,theme:"light",adminMusicVolume:.5,highlightText:"",highlightColor:"#ffdd44",highlightSettings:[u.id],highlightSettingById:(r={},r[u.id]=u,r),view:{visible:!1,activeTab:a.SETTINGS_TABS[0].id}};t.settingsReducer=function(e,t){void 0===e&&(e=s);var n=t.type,r=t.payload;if(n===o.updateSettings.type)return Object.assign({},e,r);if(n===o.loadSettings.type){if(null==r||!r.version)return e;delete r.view;var i=Object.assign({},e,r);i.highlightSettings?i.highlightSettingById[u.id]||(i.highlightSettings=[u.id].concat(i.highlightSettings),i.highlightSettingById[u.id]=u):(i.highlightSettings=[u.id],i.highlightSettingById[u.id]=u);var l=i.highlightSettingById[u.id];return l.highlightColor=i.highlightColor,l.highlightText=i.highlightText,i}if(n===o.toggleSettings.type)return Object.assign({},e,{view:Object.assign({},e.view,{visible:!e.view.visible})});if(n===o.openChatSettings.type)return Object.assign({},e,{view:Object.assign({},e.view,{visible:!0,activeTab:"chatPage"})});if(n===o.changeSettingsTab.type){var f=r.tabId;return Object.assign({},e,{view:Object.assign({},e.view,{activeTab:f})})}if(n===o.addHighlightSetting.type){var d,p=r;return e.highlightSettings.length>=a.MAX_HIGHLIGHT_SETTINGS?e:Object.assign({},e,{highlightSettings:[].concat(e.highlightSettings,[p.id]),highlightSettingById:Object.assign({},e.highlightSettingById,(d={},d[p.id]=p,d))})}if(n===o.removeHighlightSetting.type){var h=r.id,v=Object.assign({},e,{highlightSettings:[].concat(e.highlightSettings),highlightSettingById:Object.assign({},e.highlightSettingById)});return h===u.id?v.highlightSettings[u.id]=u:(delete v.highlightSettingById[h],v.highlightSettings=v.highlightSettings.filter((function(e){return e!==h})),v.highlightSettings.length||(v.highlightSettings.push(u.id),v.highlightSettingById[u.id]=u)),v}if(n===o.updateHighlightSetting.type){var g=r.id,m=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(r,c),y=Object.assign({},e,{highlightSettings:[].concat(e.highlightSettings),highlightSettingById:Object.assign({},e.highlightSettingById)});return g===u.id&&(m.highlightText&&(y.highlightText=m.highlightText),m.highlightColor&&(y.highlightColor=m.highlightColor)),y.highlightSettingById[g]&&(y.highlightSettingById[g]=Object.assign({},y.highlightSettingById[g],m)),y}return e}},14173:function(e,t){"use strict";t.__esModule=!0,t.selectSettings=t.selectHighlightSettings=t.selectHighlightSettingById=t.selectActiveTab=void 0;t.selectSettings=function(e){return e.settings};t.selectActiveTab=function(e){return e.settings.view.activeTab};t.selectHighlightSettings=function(e){return e.settings.highlightSettings};t.selectHighlightSettingById=function(e){return e.settings.highlightSettingById}},97078:function(e,t,n){"use strict";t.__esModule=!0,t.telemetryMiddleware=void 0;var r=n(22800);function o(){o=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(k){s=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var i=t&&t.prototype instanceof p?t:p,a=Object.create(i.prototype),c=new N(o||[]);return r(a,"_invoke",{value:x(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(k){return{type:"throw",arg:k}}}e.wrap=l;var d={};function p(){}function h(){}function v(){}var g={};s(g,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(O([])));y&&y!==t&&n.call(y,a)&&(g=y);var b=v.prototype=p.prototype=Object.create(g);function _(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,c){var u=f(e[r],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return o("throw",e,a,c)}))}c(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function x(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return M()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=S(a,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=f(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(undefined===r)return t.delegate=null,"throw"===n&&e.iterator["return"]&&(t.method="return",t.arg=undefined,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=f(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=undefined),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function O(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),d}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=undefined),d}},e}function i(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,o)}var a=(0,n(66905).createLogger)("telemetry");t.telemetryMiddleware=function(e){var t,n;return function(c){return function(u){var s,l=u.type,f=u.payload;if("telemetry/request"!==l)return"backend/update"===l?(c(u),void(s=o().mark((function h(){var i,c,u,s;return o().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(c=null==f||null==(i=f.config)?void 0:i.client){o.next=4;break}return a.error("backend/update payload is missing client data!"),o.abrupt("return");case 4:if(t){o.next=13;break}return o.next=7,r.storage.get("telemetry");case 7:if(o.t0=o.sent,o.t0){o.next=10;break}o.t0={};case 10:(t=o.t0).connections||(t.connections=[]),a.debug("retrieved telemetry from storage",t);case 13:u=!1,t.connections.find((function(e){return n=c,(t=e).ckey===n.ckey&&t.address===n.address&&t.computer_id===n.computer_id;var t,n}))||(u=!0,t.connections.unshift(c),t.connections.length>10&&t.connections.pop()),u&&(a.debug("saving telemetry to storage",t),r.storage.set("telemetry",t)),n&&(s=n,n=null,e.dispatch({type:"telemetry/request",payload:s}));case 18:case"end":return o.stop()}}),h)})),function(){var e=this,t=arguments;return new Promise((function(n,r){var o=s.apply(e,t);function a(e){i(o,n,r,a,c,"next",e)}function c(e){i(o,n,r,a,c,"throw",e)}a(undefined)}))})()):c(u);if(!t)return a.debug("deferred"),void(n=f);a.debug("sending");var d=(null==f?void 0:f.limits)||{},p=t.connections.slice(0,d.connections);Byond.sendMessage("telemetry",{connections:p})}}}},32353:function(e,t){"use strict";t.__esModule=!0,t.setClientTheme=t.THEMES=void 0;t.THEMES=["light","dark"];var n="#202020",r="#171717",o="#a4bad6",i=null;t.setClientTheme=function(e){if(clearInterval(i),Byond.command(".output statbrowser:set_theme "+e),i=setTimeout((function(){Byond.command(".output statbrowser:set_theme "+e)}),1500),"light"===e)return Byond.winset({"infowindow.background-color":"none","infowindow.text-color":"#000000","info.background-color":"none","info.text-color":"#000000","browseroutput.background-color":"none","browseroutput.text-color":"#000000","outputwindow.background-color":"none","outputwindow.text-color":"#000000","mainwindow.background-color":"none","split.background-color":"none","changelog.background-color":"none","changelog.text-color":"#000000","rules.background-color":"none","rules.text-color":"#000000","wiki.background-color":"none","wiki.text-color":"#000000","forum.background-color":"none","forum.text-color":"#000000","github.background-color":"none","github.text-color":"#000000","report-issue.background-color":"none","report-issue.text-color":"#000000","output.background-color":"none","output.text-color":"#000000","statwindow.background-color":"none","statwindow.text-color":"#000000","stat.background-color":"#FFFFFF","stat.tab-background-color":"none","stat.text-color":"#000000","stat.tab-text-color":"#000000","stat.prefix-color":"#000000","stat.suffix-color":"#000000","saybutton.background-color":"none","saybutton.text-color":"#000000","oocbutton.background-color":"none","oocbutton.text-color":"#000000","mebutton.background-color":"none","mebutton.text-color":"#000000","asset_cache_browser.background-color":"none","asset_cache_browser.text-color":"#000000","tooltip.background-color":"none","tooltip.text-color":"#000000","input.background-color":"#FFFFFF","input.text-color":"#000000"});"dark"===e&&Byond.winset({"infowindow.background-color":n,"infowindow.text-color":o,"info.background-color":n,"info.text-color":o,"browseroutput.background-color":n,"browseroutput.text-color":o,"outputwindow.background-color":n,"outputwindow.text-color":o,"mainwindow.background-color":n,"split.background-color":n,"changelog.background-color":"#494949","changelog.text-color":o,"rules.background-color":"#494949","rules.text-color":o,"wiki.background-color":"#494949","wiki.text-color":o,"forum.background-color":"#494949","forum.text-color":o,"github.background-color":"#3a3a3a","github.text-color":o,"report-issue.background-color":"#492020","report-issue.text-color":o,"output.background-color":r,"output.text-color":o,"statwindow.background-color":r,"statwindow.text-color":o,"stat.background-color":r,"stat.tab-background-color":n,"stat.text-color":o,"stat.tab-text-color":o,"stat.prefix-color":o,"stat.suffix-color":o,"saybutton.background-color":n,"saybutton.text-color":o,"oocbutton.background-color":n,"oocbutton.text-color":o,"mebutton.background-color":n,"mebutton.text-color":o,"asset_cache_browser.background-color":n,"asset_cache_browser.text-color":o,"tooltip.background-color":n,"tooltip.text-color":o,"input.background-color":r,"input.text-color":o})}},37655:function(e,t){"use strict";t.__esModule=!0,t.resolveAsset=t.assetMiddleware=void 0;var n=[/v4shim/i],r={};t.resolveAsset=function(e){return r[e]||e};t.assetMiddleware=function(e){return function(e){return function(t){var o=t,i=o.type,a=o.payload;if("asset/stylesheet"!==i)if("asset/mappings"!==i)e(t);else for(var c=function(){var e=s[u];if(n.some((function(t){return t.test(e)})))return"continue";var t=a[e],o=e.split(".").pop();r[e]=t,"css"===o&&Byond.loadCss(t),"js"===o&&Byond.loadJs(t)},u=0,s=Object.keys(a);u=0||(o[n]=e[n]);return o}(e,a);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Box,Object.assign({className:(0,o.classes)(["BlockQuote",t])},n)))}},65969:function(e,t,n){"use strict";t.__esModule=!0,t.unit=t.halfUnit=t.computeBoxProps=t.computeBoxClassName=t.Box=void 0;var r=n(59641),o=n(58734),i=n(33421),a=n(78419),c=["as","className","children"];var u=function(e){return"string"==typeof e?e.endsWith("px")&&!Byond.IS_LTE_IE8?parseFloat(e)/12+"rem":e:"number"==typeof e?Byond.IS_LTE_IE8?12*e+"px":e+"rem":void 0};t.unit=u;var s=function(e){return"string"==typeof e?u(e):"number"==typeof e?u(.5*e):void 0};t.halfUnit=s;var l=function(e){return"string"==typeof e&&a.CSS_COLORS.includes(e)},f=function(e){return function(t,n){"number"!=typeof n&&"string"!=typeof n||(t[e]=n)}},d=function(e,t){return function(n,r){"number"!=typeof r&&"string"!=typeof r||(n[e]=t(r))}},p=function(e,t){return function(n,r){r&&(n[e]=t)}},h=function(e,t,n){return function(r,o){if("number"==typeof o||"string"==typeof o)for(var i=0;i0&&(t.style=u),t};t.computeBoxProps=m;var y=function(e){var t=e.textColor||e.color,n=e.backgroundColor;return(0,r.classes)([l(t)&&"color-"+t,l(n)&&"color-bg-"+n])};t.computeBoxClassName=y;var b=function(e){var t=e.as,n=void 0===t?"div":t,r=e.className,a=e.children,u=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,c);if("function"==typeof a)return a(m(e));var s="string"==typeof r?r+" "+y(u):y(u),l=m(u);return(0,o.createVNode)(i.VNodeFlags.HtmlElement,n,s,a,i.ChildFlags.UnknownChildren,l,undefined)};t.Box=b,b.defaultHooks=r.pureComponentHooks},66033:function(e,t,n){"use strict";t.__esModule=!0,t.ButtonInput=t.ButtonFile=t.ButtonConfirm=t.ButtonCheckbox=t.Button=void 0;var r=n(58734),o=n(42678),i=n(59641),a=n(66905),c=n(65969),u=n(61043),s=n(83526),l=["className","fluid","icon","iconRotation","iconSpin","iconColor","iconPosition","iconSize","color","disabled","selected","tooltip","tooltipPosition","ellipsis","compact","circular","content","children","onclick","onClick","verticalAlignContent"],f=["checked"],d=["confirmContent","confirmColor","confirmIcon","icon","color","content","onClick"],p=["fluid","content","icon","iconRotation","iconSpin","tooltip","tooltipPosition","color","placeholder","maxLength"],h=["onSelectFiles","accept","multiple"];function v(){v=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(k){u=function(e,t,n){return e[t]=n}}function s(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),c=new N(o||[]);return r(a,"_invoke",{value:x(e,n,c)}),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(k){return{type:"throw",arg:k}}}e.wrap=s;var f={};function d(){}function p(){}function h(){}var g={};u(g,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(O([])));y&&y!==t&&n.call(y,i)&&(g=y);var b=h.prototype=d.prototype=Object.create(g);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function o(r,i,a,c){var u=l(e[r],e,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return o("throw",e,a,c)}))}c(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function x(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return M()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=S(a,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(undefined===r)return t.delegate=null,"throw"===n&&e.iterator["return"]&&(t.method="return",t.arg=undefined,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=undefined),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function O(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),f}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=undefined),f}},e}function g(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){g(i,r,o,a,c,"next",e)}function c(e){g(i,r,o,a,c,"throw",e)}a(undefined)}))}}function y(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,b(e,t)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function _(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var w=(0,a.createLogger)("Button"),x=function(e){var t=e.className,n=e.fluid,a=e.icon,f=e.iconRotation,d=e.iconSpin,p=e.iconColor,h=e.iconPosition,v=e.iconSize,g=e.color,m=e.disabled,y=e.selected,b=e.tooltip,x=e.tooltipPosition,S=e.ellipsis,C=e.compact,E=e.circular,N=e.content,O=e.children,M=e.onclick,k=e.onClick,T=e.verticalAlignContent,I=_(e,l),A=!(!N&&!O);M&&w.warn("Lowercase 'onclick' is not supported on Button and lowercase prop names are discouraged in general. Please use a camelCase'onClick' instead and read: https://infernojs.org/docs/guides/event-handling"),I.onClick=function(e){!m&&k&&k(e)},Byond.IS_LTE_IE8&&(I.unselectable=!0);var P=(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,i.classes)(["Button",n&&"Button--fluid",m&&"Button--disabled",y&&"Button--selected",A&&"Button--hasContent",S&&"Button--ellipsis",E&&"Button--circular",C&&"Button--compact",h&&"Button--iconPosition--"+h,T&&"Button--flex",T&&n&&"Button--flex--fluid",T&&"Button--verticalAlignContent--"+T,g&&"string"==typeof g?"Button--color--"+g:"Button--color--default",t,(0,c.computeBoxClassName)(I)]),(0,r.createVNode)(1,"div","Button__content",[a&&"right"!==h&&(0,r.createComponentVNode)(2,u.Icon,{name:a,color:p,rotation:f,spin:d}),N,O,a&&"right"===h&&(0,r.createComponentVNode)(2,u.Icon,{name:a,color:p,rotation:f,spin:d,fontSize:v})],0),2,Object.assign({tabIndex:!m&&"0",onKeyDown:function(t){if(!1!==e.captureKeys){var n=window.event?t.which:t.keyCode;if(n===o.KEY_SPACE||n===o.KEY_ENTER)return t.preventDefault(),void(!m&&k&&k(t));n!==o.KEY_ESCAPE||t.preventDefault()}}},(0,c.computeBoxProps)(I))));return b&&(P=(0,r.createComponentVNode)(2,s.Tooltip,{content:b,position:x,children:P})),P};t.Button=x,x.defaultHooks=i.pureComponentHooks;var S=function(e){var t=e.checked,n=_(e,f);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,x,Object.assign({color:"transparent",icon:t?"check-square-o":"square-o",selected:t},n)))};t.ButtonCheckbox=S,x.Checkbox=S;var C=function(e){function t(){var t;return(t=e.call(this)||this).state={clickedOnce:!1},t.handleClick=function(){t.state.clickedOnce&&t.setClickedOnce(!1)},t}y(t,e);var n=t.prototype;return n.setClickedOnce=function(e){var t=this;this.setState({clickedOnce:e}),e?setTimeout((function(){return window.addEventListener("click",t.handleClick)})):window.removeEventListener("click",this.handleClick)},n.render=function(){var e=this,t=this.props,n=t.confirmContent,o=void 0===n?"Confirm?":n,i=t.confirmColor,a=void 0===i?"bad":i,c=t.confirmIcon,u=t.icon,s=t.color,l=t.content,f=t.onClick,p=_(t,d);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,x,Object.assign({content:this.state.clickedOnce?o:l,icon:this.state.clickedOnce?c:u,color:this.state.clickedOnce?a:s,onClick:function(){return e.state.clickedOnce?f():e.setClickedOnce(!0)}},p)))},t}(r.Component);t.ButtonConfirm=C,x.Confirm=C;var E=function(e){function t(){var t;return(t=e.call(this)||this).inputRef=(0,r.createRef)(),t.state={inInput:!1},t}y(t,e);var n=t.prototype;return n.setInInput=function(e){if(this.setState({inInput:e}),this.inputRef){var t=this.inputRef.current;if(e){t.value=this.props.currentValue||"";try{t.focus(),t.select()}catch(n){}}}},n.commitResult=function(e){if(this.inputRef){var t=this.inputRef.current;if(""!==t.value)return void this.props.onCommit(e,t.value);if(!this.props.defaultValue)return;this.props.onCommit(e,this.props.defaultValue)}},n.render=function(){var e=this,t=this.props,n=t.fluid,a=t.content,l=t.icon,f=t.iconRotation,d=t.iconSpin,h=t.tooltip,v=t.tooltipPosition,g=t.color,m=void 0===g?"default":g,y=(t.placeholder,t.maxLength,_(t,p)),b=(0,r.normalizeProps)((0,r.createComponentVNode)(2,c.Box,Object.assign({className:(0,i.classes)(["Button",n&&"Button--fluid","Button--color--"+m])},y,{onClick:function(){return e.setInInput(!0)},children:[l&&(0,r.createComponentVNode)(2,u.Icon,{name:l,rotation:f,spin:d}),(0,r.createVNode)(1,"div",null,a,0),(0,r.createVNode)(64,"input","NumberInput__input",null,1,{style:{display:this.state.inInput?undefined:"none","text-align":"left"},onBlur:function(t){e.state.inInput&&(e.setInInput(!1),e.commitResult(t))},onKeyDown:function(t){if(t.keyCode===o.KEY_ENTER)return e.setInInput(!1),void e.commitResult(t);t.keyCode===o.KEY_ESCAPE&&e.setInInput(!1)}},null,this.inputRef)]})));return h&&(b=(0,r.createComponentVNode)(2,s.Tooltip,{content:h,position:v,children:b})),b},t}(r.Component);t.ButtonInput=E,x.Input=E;var N=function(e){function t(){var t;return(t=e.call(this)||this).inputRef=(0,r.createRef)(),t}y(t,e);var n=t.prototype;return n.read=function(){var e=m(v().mark((function t(e){var n;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Array.from(e).map((function(e){var t=new FileReader;return new Promise((function(n){t.onload=function(){return n(t.result)},t.readAsText(e)}))})),t.next=3,Promise.all(n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(t){return e.apply(this,arguments)}}(),n.render=function(){var e,t=this,n=this.props,o=n.onSelectFiles,i=n.accept,a=n.multiple,c=_(n,h),u=(0,r.createVNode)(64,"input",null,null,1,{hidden:!0,type:"file",accept:i,multiple:a,onChange:(e=m(v().mark((function s(){var e,n;return v().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(e=t.inputRef.current.files).length){r.next=6;break}return r.next=4,t.read(e);case 4:n=r.sent,o(a?n:n[0]);case 6:case"end":return r.stop()}}),s)}))),function(){return e.apply(this,arguments)})},null,this.inputRef);return(0,r.createFragment)([(0,r.normalizeProps)((0,r.createComponentVNode)(2,x,Object.assign({},c,{onClick:function(){t.inputRef.current.click()}}))),u],0)},t}(r.Component);t.ButtonFile=N,x.File=N},63774:function(e,t,n){"use strict";t.__esModule=!0,t.ByondUi=void 0;var r=n(58734),o=n(59641),i=n(84710),a=n(66905),c=n(65969),u=["params"],s=["params"],l=["params"];function f(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=(0,a.createLogger)("ByondUi"),h=[];window.addEventListener("beforeunload",(function(){for(var e=0;e=0||(o[n]=e[n]);return o}(t,c),m=this.state.viewBox,y=function(e,t,n,r){if(0===e.length)return[];var i=(0,o.zipWith)(Math.min).apply(void 0,e),a=(0,o.zipWith)(Math.max).apply(void 0,e);n!==undefined&&(i[0]=n[0],a[0]=n[1]),r!==undefined&&(i[1]=r[0],a[1]=r[1]);var c=(0,o.map)((function(e){return(0,o.zipWith)((function(e,t,n,r){return(e-t)/(n-t)*r}))(e,i,a,t)}))(e);return c}(i,m,u,s);if(y.length>0){var b=y[0],_=y[y.length-1];y.push([m[0]+v,_[1]]),y.push([m[0]+v,-v]),y.push([-v,-v]),y.push([-v,b[1]])}var w=function(e){for(var t="",n=0;n=0||(o[n]=e[n]);return o}(t,a);return(0,r.createComponentVNode)(2,o.Box,{mb:1,children:[(0,r.createVNode)(1,"div","Table",[(0,r.createVNode)(1,"div","Table__cell",(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Button,Object.assign({fluid:!0,color:s,icon:n?"chevron-down":"chevron-right",onClick:function(){return e.setState({open:!n})}},d,{children:l}))),2),f&&(0,r.createVNode)(1,"div","Table__cell Table__cell--collapsing",f,0)],0),n&&(0,r.createComponentVNode)(2,o.Box,{mt:1,children:c})]})},u}(r.Component);t.Collapsible=u},93857:function(e,t,n){"use strict";t.__esModule=!0,t.ColorBox=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["content","children","className","color","backgroundColor"];var c=function(e){var t=e.content,n=(e.children,e.className),c=e.color,u=e.backgroundColor,s=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,a);return s.color=t?null:"transparent",s.backgroundColor=c||u,(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["ColorBox",n,(0,i.computeBoxClassName)(s)]),t||".",0,Object.assign({},(0,i.computeBoxProps)(s))))};t.ColorBox=c,c.defaultHooks=o.pureComponentHooks},29532:function(e,t,n){"use strict";t.__esModule=!0,t.UnsavedChangesDialog=t.Dialog=void 0;var r=n(58734),o=n(65969),i=n(66033),a=function(e){var t=e.title,n=e.onClose,a=e.children,c=e.width,u=e.height;return(0,r.createVNode)(1,"div","Dialog",(0,r.createComponentVNode)(2,o.Box,{className:"Dialog__content",width:c||"370px",height:u,children:[(0,r.createVNode)(1,"div","Dialog__header",[(0,r.createVNode)(1,"div","Dialog__title",t,0),(0,r.createComponentVNode)(2,o.Box,{mr:2,children:(0,r.createComponentVNode)(2,i.Button,{mr:"-3px",width:"26px",lineHeight:"22px",textAlign:"center",color:"transparent",icon:"window-close-o",tooltip:"Close",tooltipPosition:"bottom-start",onClick:n})})],4),a]}),2)};t.Dialog=a;var c=function(e){var t=e.onClick,n=e.children;return(0,r.createComponentVNode)(2,i.Button,{onClick:t,className:"Dialog__button",verticalAlignContent:"middle",children:n})};a.Button=c;t.UnsavedChangesDialog=function(e){var t=e.documentName,n=e.onSave,o=e.onDiscard,i=e.onClose;return(0,r.createComponentVNode)(2,a,{title:"Notepad",onClose:i,children:[(0,r.createVNode)(1,"div","Dialog__body",[(0,r.createTextVNode)("Do you want to save changes to "),t,(0,r.createTextVNode)("?")],0),(0,r.createVNode)(1,"div","Dialog__footer",[(0,r.createComponentVNode)(2,c,{onClick:n,children:"Save"}),(0,r.createComponentVNode)(2,c,{onClick:o,children:"Don't Save"}),(0,r.createComponentVNode)(2,c,{onClick:i,children:"Cancel"})],4)]})}},50530:function(e,t,n){"use strict";t.__esModule=!0,t.Dimmer=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["className","children"];t.Dimmer=function(e){var t=e.className,n=e.children,c=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,a);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Box,Object.assign({className:(0,o.classes)(["Dimmer"].concat(t))},c,{children:(0,r.createVNode)(1,"div","Dimmer__inner",n,0)})))}},29397:function(e,t,n){"use strict";t.__esModule=!0,t.Divider=void 0;var r=n(58734),o=n(59641);t.Divider=function(e){var t=e.vertical,n=e.hidden;return(0,r.createVNode)(1,"div",(0,o.classes)(["Divider",n&&"Divider--hidden",t?"Divider--vertical":"Divider--horizontal"]))}},49948:function(e,t,n){"use strict";t.__esModule=!0,t.DraggableControl=void 0;var r=n(58734),o=n(5339),i=n(59641),a=n(12451);function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}var u=function(e,t){return e.screenX*t[0]+e.screenY*t[1]},s=function(e){var t,n;function i(t){var n;return(n=e.call(this,t)||this).inputRef=(0,r.createRef)(),n.state={value:t.value,dragging:!1,editing:!1,internalValue:null,origin:null,suppressingFlicker:!1},n.flickerTimer=null,n.suppressFlicker=function(){var e=n.props.suppressFlicker;e>0&&(n.setState({suppressingFlicker:!0}),clearTimeout(n.flickerTimer),n.flickerTimer=setTimeout((function(){n.setState({suppressingFlicker:!1})}),e))},n.handleDragStart=function(e){var t=n.props,r=t.value,o=t.dragMatrix;n.state.editing||(document.body.style["pointer-events"]="none",n.ref=e.target,n.setState({dragging:!1,origin:u(e,o),value:r,internalValue:r}),n.timer=setTimeout((function(){n.setState({dragging:!0})}),250),n.dragInterval=setInterval((function(){var t=n.state,r=t.dragging,o=t.value,i=n.props.onDrag;r&&i&&i(e,o)}),n.props.updateRate||400),document.addEventListener("mousemove",n.handleDragMove),document.addEventListener("mouseup",n.handleDragEnd))},n.handleDragMove=function(e){var t=n.props,r=t.minValue,i=t.maxValue,a=t.step,c=t.stepPixelSize,s=t.dragMatrix;n.setState((function(t){var n=Object.assign({},t),l=u(e,s)-n.origin;if(t.dragging){var f=Number.isFinite(r)?r%a:0;n.internalValue=(0,o.clamp)(n.internalValue+l*a/c,r-a,i+a),n.value=(0,o.clamp)(n.internalValue-n.internalValue%a+f,r,i),n.origin=u(e,s)}else Math.abs(l)>4&&(n.dragging=!0);return n}))},n.handleDragEnd=function(e){var t=n.props,r=t.onChange,o=t.onDrag,i=n.state,a=i.dragging,c=i.value,u=i.internalValue;if(document.body.style["pointer-events"]="auto",clearTimeout(n.timer),clearInterval(n.dragInterval),n.setState({dragging:!1,editing:!a,origin:null}),document.removeEventListener("mousemove",n.handleDragMove),document.removeEventListener("mouseup",n.handleDragEnd),a)n.suppressFlicker(),r&&r(e,c),o&&o(e,c);else if(n.inputRef){var s=n.inputRef.current;s.value=u;try{s.focus(),s.select()}catch(l){}}},n}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,c(t,n),i.prototype.render=function(){var e=this,t=this.state,n=t.dragging,i=t.editing,c=t.value,u=t.suppressingFlicker,s=this.props,l=s.animated,f=s.value,d=s.unit,p=s.minValue,h=s.maxValue,v=s.unclamped,g=s.format,m=s.onChange,y=s.onDrag,b=s.children,_=s.height,w=s.lineHeight,x=s.fontSize,S=f;(n||u)&&(S=c);var C=(0,r.createFragment)([!l||n||u?g?g(S):S:(0,r.createComponentVNode)(2,a.AnimatedNumber,{value:S,format:g}),d?" "+d:""],0),E=(0,r.createVNode)(64,"input","NumberInput__input",null,1,{style:{display:i?undefined:"none",height:_,"line-height":w,"font-size":x},onBlur:function(t){var n;i&&(n=v?parseFloat(t.target.value):(0,o.clamp)(parseFloat(t.target.value),p,h),Number.isNaN(n)?e.setState({editing:!1}):(e.setState({editing:!1,value:n}),e.suppressFlicker(),m&&m(t,n),y&&y(t,n)))},onKeyDown:function(t){var n;if(13===t.keyCode)return n=v?parseFloat(t.target.value):(0,o.clamp)(parseFloat(t.target.value),p,h),Number.isNaN(n)?void e.setState({editing:!1}):(e.setState({editing:!1,value:n}),e.suppressFlicker(),m&&m(t,n),void(y&&y(t,n)));27!==t.keyCode||e.setState({editing:!1})}},null,this.inputRef);return b({dragging:n,editing:i,value:f,displayValue:S,displayElement:C,inputElement:E,handleDragStart:this.handleDragStart})},i}(r.Component);t.DraggableControl=s,s.defaultHooks=i.pureComponentHooks,s.defaultProps={minValue:-Infinity,maxValue:+Infinity,step:1,stepPixelSize:1,suppressFlicker:50,dragMatrix:[1,0]}},51413:function(e,t,n){"use strict";t.__esModule=!0,t.Dropdown=void 0;var r=n(58734),o=n(92935),i=n(59641),a=n(65969),c=n(66033),u=n(61043),s=n(70468),l=["icon","iconRotation","iconSpin","clipSelectedText","color","dropdownStyle","over","nochevron","width","onClick","onSelected","selected","disabled","displayText","buttons"],f=["className"];function d(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}var h={placement:"left-start",modifiers:[{name:"eventListeners",enabled:!1}]},v={width:0,height:0,top:0,right:0,bottom:0,left:0,x:0,y:0,toJSON:function(){return null}},g="Layout Dropdown__menu",m=function(e){var t,n;function v(){for(var t,n=arguments.length,r=new Array(n),o=0;o200?t.className="Layout Dropdown__menu-scroll":t.className=g;var n=this.props.options,a=(void 0===n?[]:n).map((function(t){var n,o;return"string"==typeof t?(o=t,n=t):null!==t&&(o=t.displayText,n=t.value),(0,r.createVNode)(1,"div",(0,i.classes)(["Dropdown__menuentry",e.state.selected===n&&"selected"]),o,0,{onClick:function(){e.setSelected(n)}},n)})),c=a.length?a:"No Options Found";(0,r.render)((0,r.createVNode)(1,"div",null,c,0),t,(function(){var e=v.singletonPopper;e===undefined?(e=(0,o.createPopper)(v.virtualElement,t,Object.assign({},h,{placement:"bottom-start"})),v.singletonPopper=e):(e.setOptions(Object.assign({},h,{placement:"bottom-start"})),e.update())}),this.context)}},m.setOpen=function(e){var t=this;this.setState((function(t){return Object.assign({},t,{open:e})})),e?setTimeout((function(){t.openMenu(),window.addEventListener("click",t.handleClick)})):(this.closeMenu(),window.removeEventListener("click",this.handleClick))},m.setSelected=function(e){this.setState((function(t){return Object.assign({},t,{selected:e})})),this.setOpen(!1),this.props.onSelected&&this.props.onSelected(e)},m.getOptionValue=function(e){return"string"==typeof e?e:e.value},m.getSelectedIndex=function(){var e=this,t=this.state.selected||this.props.selected,n=this.props.options;return(void 0===n?[]:n).findIndex((function(n){return e.getOptionValue(n)===t}))},m.toPrevious=function(){if(!(this.props.options.length<1)){var e=this.getSelectedIndex(),t=this.props.options.length-1;e>=0||(e=0);var n=0===e?t:e-1;this.setSelected(this.getOptionValue(this.props.options[n]))}},m.toNext=function(){if(!(this.props.options.length<1)){var e=this.getSelectedIndex(),t=this.props.options.length-1;e>=0||(e=t);var n=e===t?0:e+1;this.setSelected(this.getOptionValue(this.props.options[n]))}},m.render=function(){var e=this,t=this.props,n=t.icon,o=t.iconRotation,p=t.iconSpin,h=t.clipSelectedText,v=void 0===h||h,g=t.color,m=void 0===g?"default":g,y=(t.dropdownStyle,t.over),b=t.nochevron,_=t.width,w=t.onClick,x=(t.onSelected,t.selected,t.disabled),S=t.displayText,C=t.buttons,E=d(t,l),N=E.className,O=d(E,f),M=y?!this.state.open:this.state.open;return(0,r.createComponentVNode)(2,s.Stack,{fill:!0,children:[(0,r.createComponentVNode)(2,s.Stack.Item,{width:_,children:(0,r.normalizeProps)((0,r.createComponentVNode)(2,a.Box,Object.assign({width:"100%",className:(0,i.classes)(["Dropdown__control","Button","Button--color--"+m,x&&"Button--disabled",N]),onClick:function(t){x&&!e.state.open||(e.setOpen(!e.state.open),w&&w(t))}},O,{children:[n&&(0,r.createComponentVNode)(2,u.Icon,{name:n,rotation:o,spin:p,mr:1}),(0,r.createVNode)(1,"span","Dropdown__selected-text",S||this.state.selected,0,{style:{overflow:v?"hidden":"visible"}}),b||(0,r.createVNode)(1,"span","Dropdown__arrow-button",(0,r.createComponentVNode)(2,u.Icon,{name:M?"chevron-up":"chevron-down"}),2)]})))}),C&&(0,r.createFragment)([(0,r.createComponentVNode)(2,s.Stack.Item,{height:"100%",children:(0,r.createComponentVNode)(2,c.Button,{height:"100%",icon:"chevron-left",disabled:x,onClick:function(){x||e.toPrevious()}})}),(0,r.createComponentVNode)(2,s.Stack.Item,{height:"100%",children:(0,r.createComponentVNode)(2,c.Button,{height:"100%",icon:"chevron-right",disabled:x,onClick:function(){x||e.toNext()}})})],4)]})},v}(r.Component);t.Dropdown=m,m.renderedMenu=void 0,m.singletonPopper=void 0,m.currentOpenMenu=void 0,m.virtualElement={getBoundingClientRect:function(){var e,t;return null!=(e=null==(t=m.currentOpenMenu)?void 0:t.getBoundingClientRect())?e:v}}},7764:function(e,t,n){"use strict";t.__esModule=!0,t.FitText=void 0;var r=n(58734);function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}var i=function(e){var t,n;function i(){var t;return(t=e.call(this)||this).ref=(0,r.createRef)(),t.state={fontSize:0},t.resize=t.resize.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)),window.addEventListener("resize",t.resize),t}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,o(t,n);var a=i.prototype;return a.componentDidUpdate=function(e){e.children!==this.props.children&&this.resize()},a.componentWillUnmount=function(){window.removeEventListener("resize",this.resize)},a.resize=function(){var e=this.ref.current;if(e){for(var t=this.props.maxWidth,n=0,r=this.props.maxFontSize,o=0;o<10;o++){var i,a=Math.round((n+r)/2);e.style.fontSize=a+"px";var c=e.offsetWidth-t;if(c>0)r=a;else{if(!(c<(null!=(i=this.props.acceptableDifference)?i:5)))break;n=a}}this.setState({fontSize:Math.round((n+r)/2)})}},a.componentDidMount=function(){this.resize()},a.render=function(){var e;return(0,r.createVNode)(1,"span",null,this.props.children,0,{style:Object.assign({"font-size":this.state.fontSize+"px"},"object"==typeof(null==(e=this.props.native)?void 0:e.style)&&this.props.native.style)},null,this.ref)},i}(r.Component);t.FitText=i},21456:function(e,t,n){"use strict";t.__esModule=!0,t.computeFlexProps=t.computeFlexItemProps=t.computeFlexItemClassName=t.computeFlexClassName=t.Flex=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["className","direction","wrap","align","justify","inline"],c=["className"],u=["className","style","grow","order","shrink","basis","align"],s=["className"];function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var f=function(e){return(0,o.classes)(["Flex",e.inline&&"Flex--inline",Byond.IS_LTE_IE10&&"Flex--iefix",Byond.IS_LTE_IE10&&"column"===e.direction&&"Flex--iefix--column",(0,i.computeBoxClassName)(e)])};t.computeFlexClassName=f;var d=function(e){e.className;var t=e.direction,n=e.wrap,r=e.align,o=e.justify,c=(e.inline,l(e,a));return(0,i.computeBoxProps)(Object.assign({style:Object.assign({},c.style,{"flex-direction":t,"flex-wrap":!0===n?"wrap":n,"align-items":r,"justify-content":o})},c))};t.computeFlexProps=d;var p=function(e){var t=e.className,n=l(e,c);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)([t,f(n)]),null,1,Object.assign({},d(n))))};t.Flex=p,p.defaultHooks=o.pureComponentHooks;var h=function(e){return(0,o.classes)(["Flex__item",Byond.IS_LTE_IE10&&"Flex__item--iefix",(0,i.computeBoxClassName)(e)])};t.computeFlexItemClassName=h;var v=function(e){e.className;var t,n=e.style,r=e.grow,o=e.order,a=e.shrink,c=e.basis,s=e.align,f=l(e,u),d=null!=(t=null!=c?c:e.width)?t:r!==undefined?0:undefined;return(0,i.computeBoxProps)(Object.assign({style:Object.assign({},n,{"flex-grow":r!==undefined&&Number(r),"flex-shrink":a!==undefined&&Number(a),"flex-basis":(0,i.unit)(d),order:o,"align-self":s})},f))};t.computeFlexItemProps=v;var g=function(e){var t=e.className,n=l(e,s);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)([t,h(e)]),null,1,Object.assign({},v(n))))};g.defaultHooks=o.pureComponentHooks,p.Item=g},95251:function(e,t,n){"use strict";t.__esModule=!0,t.GridColumn=t.Grid=void 0;var r=n(58734),o=n(1813),i=n(59641),a=["children"],c=["size","style"];function u(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var s=function(e){var t=e.children,n=u(e,a);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,o.Table,Object.assign({},n,{children:(0,r.createComponentVNode)(2,o.Table.Row,{children:t})})))};t.Grid=s,s.defaultHooks=i.pureComponentHooks;var l=function(e){var t=e.size,n=void 0===t?1:t,i=e.style,a=u(e,c);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,o.Table.Cell,Object.assign({style:Object.assign({width:n+"%"},i)},a)))};t.GridColumn=l,s.defaultHooks=i.pureComponentHooks,s.Column=l},61043:function(e,t,n){"use strict";t.__esModule=!0,t.IconStack=t.Icon=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["style"],c=["name","size","spin","className","rotation"],u=["className","children"];function s(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var l=/-o$/,f=function(e){var t=e.style,n=s(e,a),u=n.name,f=n.size,d=n.spin,p=n.className,h=n.rotation,v=s(n,c);f&&(t||(t={}),t["font-size"]=100*f+"%"),h&&(t||(t={}),t.transform="rotate("+h+"deg)"),v.style=t;var g=(0,i.computeBoxProps)(v),m="";if(u.startsWith("tg-"))m=u;else{var y=l.test(u),b=u.replace(l,"");m=y?"far ":"fas ",!b.startsWith("fa-")&&(m+="fa-"),m+=b,d&&(m+=" fa-spin")}return(0,r.normalizeProps)((0,r.createVNode)(1,"i",(0,o.classes)(["Icon",m,p,(0,i.computeBoxClassName)(v)]),null,1,Object.assign({},g)))};t.Icon=f,f.defaultHooks=o.pureComponentHooks;var d=function(e){var t=e.className,n=e.children,a=s(e,u);return(0,r.normalizeProps)((0,r.createVNode)(1,"span",(0,o.classes)(["IconStack",t,(0,i.computeBoxClassName)(a)]),n,0,Object.assign({},(0,i.computeBoxProps)(a))))};t.IconStack=d,f.Stack=d},68615:function(e,t,n){"use strict";t.__esModule=!0,t.InfinitePlane=void 0;var r=n(58734),o=n(65969),i=n(70468),a=n(41042),c=n(66033),u=["children","backgroundImage","imageWidth","initialLeft","initialTop"];function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){var t,n;function f(){var t;return(t=e.call(this)||this).state={mouseDown:!1,left:0,top:0,lastLeft:0,lastTop:0,zoom:1},t.handleMouseDown=t.handleMouseDown.bind(s(t)),t.handleMouseMove=t.handleMouseMove.bind(s(t)),t.handleZoomIncrease=t.handleZoomIncrease.bind(s(t)),t.handleZoomDecrease=t.handleZoomDecrease.bind(s(t)),t.onMouseUp=t.onMouseUp.bind(s(t)),t.doOffsetMouse=t.doOffsetMouse.bind(s(t)),t}n=e,(t=f).prototype=Object.create(n.prototype),t.prototype.constructor=t,l(t,n);var d=f.prototype;return d.componentDidMount=function(){window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("mousedown",this.doOffsetMouse),window.addEventListener("mousemove",this.doOffsetMouse),window.addEventListener("mouseup",this.doOffsetMouse)},d.componentWillUnmount=function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousedown",this.doOffsetMouse),window.removeEventListener("mousemove",this.doOffsetMouse),window.removeEventListener("mouseup",this.doOffsetMouse)},d.doOffsetMouse=function(e){var t=this.state.zoom;e.screenZoomX=e.screenX*Math.pow(t,-1),e.screenZoomY=e.screenY*Math.pow(t,-1)},d.handleMouseDown=function(e){this.setState((function(t){return{mouseDown:!0,lastLeft:e.clientX-t.left,lastTop:e.clientY-t.top}}))},d.onMouseUp=function(){this.setState({mouseDown:!1})},d.handleZoomIncrease=function(e){var t=this.props.onZoomChange,n=this.state.zoom,r=Math.min(n+.1,1.5);this.setState({zoom:r}),t&&t(r)},d.handleZoomDecrease=function(e){var t=this.props.onZoomChange,n=this.state.zoom,r=Math.max(n-.1,.5);this.setState({zoom:r}),t&&t(r)},d.handleMouseMove=function(e){var t,n,r=this.props,o=r.onBackgroundMoved,i=r.initialLeft,a=void 0===i?0:i,c=r.initialTop,u=void 0===c?0:c;this.state.mouseDown&&(this.setState((function(r){return t=e.clientX-r.lastLeft,n=e.clientY-r.lastTop,{left:t,top:n}})),o&&o(t+a,n+u))},d.render=function(){var e=this.props,t=e.children,n=e.backgroundImage,s=e.imageWidth,l=e.initialLeft,f=void 0===l?0:l,d=e.initialTop,p=void 0===d?0:d,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,u),v=this.state,g=v.left,m=v.top,y=v.zoom,b=f+g,_=p+m;return(0,r.normalizeProps)((0,r.createVNode)(1,"div",null,[(0,r.createVNode)(1,"div",null,null,1,{onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,style:{position:"fixed",height:"100%",width:"100%","background-image":'url("'+n+'")',"background-position":b+"px "+_+"px","background-repeat":"repeat","background-size":y*s+"px"}}),(0,r.createVNode)(1,"div",null,t,0,{onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,style:{position:"fixed",transform:"translate("+b+"px, "+_+"px) scale("+y+")","transform-origin":"top left",height:"100%",width:"100%"}}),(0,r.createComponentVNode)(2,i.Stack,{position:"absolute",width:"100%",children:[(0,r.createComponentVNode)(2,i.Stack.Item,{children:(0,r.createComponentVNode)(2,c.Button,{icon:"minus",onClick:this.handleZoomDecrease})}),(0,r.createComponentVNode)(2,i.Stack.Item,{grow:1,children:(0,r.createComponentVNode)(2,a.ProgressBar,{minValue:.5,value:y,maxValue:1.5,children:[y,"x"]})}),(0,r.createComponentVNode)(2,i.Stack.Item,{children:(0,r.createComponentVNode)(2,c.Button,{icon:"plus",onClick:this.handleZoomIncrease})})]})],4,Object.assign({},(0,o.computeBoxProps)(Object.assign({},h,{style:Object.assign({},h.style,{overflow:"hidden",position:"relative"})}))),null,this.ref))},f}(r.Component);t.InfinitePlane=f},76402:function(e,t,n){"use strict";t.__esModule=!0,t.toInputValue=t.Input=void 0;var r=n(58734),o=n(42678),i=n(59641),a=n(65969),c=["selfClear","onInput","onChange","onEnter","value","maxLength","placeholder"],u=["className","fluid","monospace"];function s(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var f=function(e){return"number"!=typeof e&&"string"!=typeof e?"":String(e)};t.toInputValue=f;var d=function(e){var t,n;function d(){var t;return(t=e.call(this)||this).inputRef=(0,r.createRef)(),t.state={editing:!1},t.handleInput=function(e){var n=t.state.editing,r=t.props.onInput;n||t.setEditing(!0),r&&r(e,e.target.value)},t.handleFocus=function(e){t.state.editing||t.setEditing(!0)},t.handleBlur=function(e){var n=t.state.editing,r=t.props.onChange;n&&(t.setEditing(!1),r&&r(e,e.target.value))},t.handleKeyDown=function(e){var n=t.props,r=n.onInput,i=n.onChange,a=n.onEnter;return e.keyCode===o.KEY_ENTER?(t.setEditing(!1),i&&i(e,e.target.value),r&&r(e,e.target.value),a&&a(e,e.target.value),void(t.props.selfClear?e.target.value="":e.target.blur())):e.keyCode===o.KEY_ESCAPE?t.props.onEscape?void t.props.onEscape(e):(t.setEditing(!1),e.target.value=f(t.props.value),void e.target.blur()):void 0},t}n=e,(t=d).prototype=Object.create(n.prototype),t.prototype.constructor=t,l(t,n);var p=d.prototype;return p.componentDidMount=function(){var e=this,t=this.props.value,n=this.inputRef.current;n&&(n.value=f(t)),(this.props.autoFocus||this.props.autoSelect)&&setTimeout((function(){n.focus(),e.props.autoSelect&&n.select()}),1)},p.componentDidUpdate=function(e,t){var n=this.state.editing,r=e.value,o=this.props.value,i=this.inputRef.current;i&&!n&&r!==o&&(i.value=f(o))},p.setEditing=function(e){this.setState({editing:e})},p.render=function(){var e=this.props,t=(e.selfClear,e.onInput,e.onChange,e.onEnter,e.value,e.maxLength),n=e.placeholder,o=s(e,c),l=o.className,f=o.fluid,d=o.monospace,p=s(o,u);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,a.Box,Object.assign({className:(0,i.classes)(["Input",f&&"Input--fluid",d&&"Input--monospace",l])},p,{children:[(0,r.createVNode)(1,"div","Input__baseline",".",16),(0,r.createVNode)(64,"input","Input__input",null,1,{placeholder:n,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,maxLength:t},null,this.inputRef)]})))},d}(r.Component);t.Input=d},76844:function(e,t,n){"use strict";t.__esModule=!0,t.KeyListener=void 0;var r=n(58734),o=n(17192);function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var a=function(e){var t,n;function r(){var t;return(t=e.call(this)||this).dispose=void 0,t.dispose=(0,o.listenForKeyEvents)((function(e){t.props.onKey&&t.props.onKey(e),e.isDown()&&t.props.onKeyDown&&t.props.onKeyDown(e),e.isUp()&&t.props.onKeyUp&&t.props.onKeyUp(e)})),t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var a=r.prototype;return a.componentWillUnmount=function(){this.dispose()},a.render=function(){return null},r}(r.Component);t.KeyListener=a},66020:function(e,t,n){"use strict";t.__esModule=!0,t.Knob=void 0;var r=n(58734),o=n(5339),i=n(59641),a=n(65969),c=n(49948),u=n(44499),s=["animated","format","maxValue","minValue","unclamped","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","style","fillValue","color","ranges","size","bipolar","children"];t.Knob=function(e){if(Byond.IS_LTE_IE8)return(0,r.normalizeProps)((0,r.createComponentVNode)(2,u.NumberInput,Object.assign({},e)));var t=e.animated,n=e.format,l=e.maxValue,f=e.minValue,d=e.unclamped,p=e.onChange,h=e.onDrag,v=e.step,g=e.stepPixelSize,m=e.suppressFlicker,y=e.unit,b=e.value,_=e.className,w=e.style,x=e.fillValue,S=e.color,C=e.ranges,E=void 0===C?{}:C,N=e.size,O=void 0===N?1:N,M=e.bipolar,k=(e.children,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,s));return(0,r.normalizeProps)((0,r.createComponentVNode)(2,c.DraggableControl,Object.assign({dragMatrix:[0,-1]},{animated:t,format:n,maxValue:l,minValue:f,unclamped:d,onChange:p,onDrag:h,step:v,stepPixelSize:g,suppressFlicker:m,unit:y,value:b},{children:function(e){var t=e.dragging,n=(e.editing,e.value),c=e.displayValue,u=e.displayElement,s=e.inputElement,d=e.handleDragStart,p=(0,o.scale)(null!=x?x:c,f,l),h=(0,o.scale)(c,f,l),v=S||(0,o.keyOfMatchingRange)(null!=x?x:n,E)||"default",g=Math.min(270*(h-.5),225);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,i.classes)(["Knob","Knob--color--"+v,M&&"Knob--bipolar",_,(0,a.computeBoxClassName)(k)]),[(0,r.createVNode)(1,"div","Knob__circle",(0,r.createVNode)(1,"div","Knob__cursorBox",(0,r.createVNode)(1,"div","Knob__cursor"),2,{style:{transform:"rotate("+g+"deg)"}}),2),t&&(0,r.createVNode)(1,"div","Knob__popupValue",u,0),(0,r.createVNode)(32,"svg","Knob__ring Knob__ringTrackPivot",(0,r.createVNode)(32,"circle","Knob__ringTrack",null,1,{cx:"50",cy:"50",r:"50"}),2,{viewBox:"0 0 100 100"}),(0,r.createVNode)(32,"svg","Knob__ring Knob__ringFillPivot",(0,r.createVNode)(32,"circle","Knob__ringFill",null,1,{style:{"stroke-dashoffset":Math.max(((M?2.75:2)-1.5*p)*Math.PI*50,0)},cx:"50",cy:"50",r:"50"}),2,{viewBox:"0 0 100 100"}),s],0,Object.assign({},(0,a.computeBoxProps)(Object.assign({style:Object.assign({"font-size":O+"em"},w)},k)),{onMouseDown:d})))}})))}},56240:function(e,t,n){"use strict";t.__esModule=!0,t.LabeledControls=void 0;var r=n(58734),o=n(21456),i=["children","wrap"],a=["label","children","mx"];function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var u=function(e){var t=e.children,n=e.wrap,a=c(e,i);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,o.Flex,Object.assign({mx:-.5,wrap:n,align:"stretch",justify:"space-between"},a,{children:t})))};t.LabeledControls=u;u.Item=function(e){var t=e.label,n=e.children,i=e.mx,u=void 0===i?1:i,s=c(e,a);return(0,r.createComponentVNode)(2,o.Flex.Item,{mx:u,children:(0,r.normalizeProps)((0,r.createComponentVNode)(2,o.Flex,Object.assign({height:"100%",direction:"column",align:"center",textAlign:"center",justify:"space-between"},s,{children:[(0,r.createComponentVNode)(2,o.Flex.Item),(0,r.createComponentVNode)(2,o.Flex.Item,{children:n}),(0,r.createComponentVNode)(2,o.Flex.Item,{color:"label",children:t})]})))})}},84867:function(e,t,n){"use strict";t.__esModule=!0,t.LabeledList=void 0;var r=n(58734),o=n(59641),i=n(65969),a=n(29397),c=function(e){var t=e.children;return(0,r.createVNode)(1,"table","LabeledList",t,0)};t.LabeledList=c,c.defaultHooks=o.pureComponentHooks;var u=function(e){var t=e.className,n=e.label,a=e.labelColor,c=void 0===a?"label":a,u=e.labelWrap,s=e.color,l=e.textAlign,f=e.buttons,d=e.content,p=e.children,h=e.verticalAlign,v=void 0===h?"baseline":h;return(0,r.createVNode)(1,"tr",(0,o.classes)(["LabeledList__row",t]),[(0,r.createComponentVNode)(2,i.Box,{as:"td",color:c,className:(0,o.classes)(["LabeledList__cell",!u&&"LabeledList__label--nowrap"]),verticalAlign:v,children:n?"string"==typeof n?n+":":n:null}),(0,r.createComponentVNode)(2,i.Box,{as:"td",color:s,textAlign:l,className:(0,o.classes)(["LabeledList__cell","LabeledList__content"]),colSpan:f?undefined:2,verticalAlign:v,children:[d,p]}),f&&(0,r.createVNode)(1,"td","LabeledList__cell LabeledList__buttons",f,0)],0)};u.defaultHooks=o.pureComponentHooks;var s=function(e){var t=e.size?(0,i.unit)(Math.max(0,e.size-1)):0;return(0,r.createVNode)(1,"tr","LabeledList__row",(0,r.createVNode)(1,"td",null,(0,r.createComponentVNode)(2,a.Divider),2,{colSpan:3,style:{"padding-top":t,"padding-bottom":t}}),2)};s.defaultHooks=o.pureComponentHooks,c.Item=u,c.Divider=s},34927:function(e,t,n){"use strict";t.__esModule=!0,t.MenuBar=t.Dropdown=void 0;var r=n(58734),o=n(59641),i=n(65969),a=n(66905),c=n(61043),u=["open","openWidth","children","disabled","display","onMouseOver","onClick","onOutsideClick"],s=["className"];function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}var p=function(e){function t(t){var n;return(n=e.call(this,t)||this).handleClick=void 0,n.handleClick=function(e){n.props.menuRef.current?n.props.menuRef.current.contains(e.target)?a.logger.log("Menu.handleClick(): Inside"):(a.logger.log("Menu.handleClick(): Outside"),n.props.onOutsideClick()):a.logger.log("Menu.handleClick(): No ref")},n}f(t,e);var n=t.prototype;return n.componentWillMount=function(){window.addEventListener("click",this.handleClick)},n.componentWillUnmount=function(){window.removeEventListener("click",this.handleClick)},n.render=function(){var e=this.props,t=e.width,n=e.children;return(0,r.createVNode)(1,"div","MenuBar__menu",n,0,{style:{width:t}})},t}(r.Component),h=function(e){function t(t){var n;return(n=e.call(this,t)||this).menuRef=void 0,n.menuRef=(0,r.createRef)(),n}return f(t,e),t.prototype.render=function(){var e=this.props,t=e.open,n=e.openWidth,a=e.children,c=e.disabled,f=e.display,d=e.onMouseOver,h=e.onClick,v=e.onOutsideClick,g=l(e,u),m=g.className,y=l(g,s);return(0,r.createVNode)(1,"div",null,[(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Box,Object.assign({className:(0,o.classes)(["MenuBar__MenuBarButton","MenuBar__font","MenuBar__hover",m])},y,{onClick:c?undefined:h,onmouseover:d,children:(0,r.createVNode)(1,"span","MenuBar__MenuBarButton-text",f,0)}))),t&&(0,r.createComponentVNode)(2,p,{width:n,menuRef:this.menuRef,onOutsideClick:v,children:a})],0,null,null,this.menuRef)},t}(r.Component),v=function(e){var t=e.entry,n=e.children,o=e.openWidth,i=e.display,a=e.setOpenMenuBar,c=e.openMenuBar,u=e.setOpenOnHover,s=e.openOnHover,l=e.disabled,f=e.className;return(0,r.createComponentVNode)(2,h,{openWidth:o,display:i,disabled:l,open:c===t,className:f,onClick:function(){a(c===t?null:t),u(!s)},onOutsideClick:function(){a(null),u(!1)},onMouseOver:function(){s&&a(t)},children:n})};t.Dropdown=v;v.MenuItemToggle=function(e){var t=e.value,n=e.displayText,a=e.onClick,u=e.checked;return(0,r.createComponentVNode)(2,i.Box,{className:(0,o.classes)(["MenuBar__font","MenuBar__MenuItem","MenuBar__MenuItemToggle","MenuBar__hover"]),onClick:function(){return a(t)},children:[(0,r.createVNode)(1,"div","MenuBar__MenuItemToggle__check",u&&(0,r.createComponentVNode)(2,c.Icon,{size:1.3,name:"check"}),0),n]})};v.MenuItem=function(e){var t=e.value,n=e.displayText,a=e.onClick;return(0,r.createComponentVNode)(2,i.Box,{className:(0,o.classes)(["MenuBar__font","MenuBar__MenuItem","MenuBar__hover"]),onClick:function(){return a(t)},children:n})};v.Separator=function(){return(0,r.createVNode)(1,"div","MenuBar__Separator")};var g=function(e){var t=e.children;return(0,r.createComponentVNode)(2,i.Box,{className:"MenuBar",children:t})};t.MenuBar=g,g.Dropdown=v},60639:function(e,t,n){"use strict";t.__esModule=!0,t.Modal=void 0;var r=n(58734),o=n(59641),i=n(65969),a=n(50530),c=["className","children","onEnter"];t.Modal=function(e){var t,n=e.className,u=e.children,s=e.onEnter,l=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,c);return s&&(t=function(e){13===(e.which||e.keyCode)&&s(e)}),(0,r.createComponentVNode)(2,a.Dimmer,{onKeyDown:t,children:(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Modal",n,(0,i.computeBoxClassName)(l)]),u,0,Object.assign({},(0,i.computeBoxProps)(l))))})}},91646:function(e,t,n){"use strict";t.__esModule=!0,t.NoticeBox=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["className","color","info","warning","success","danger"];var c=function(e){var t=e.className,n=e.color,c=e.info,u=(e.warning,e.success),s=e.danger,l=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,a);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Box,Object.assign({className:(0,o.classes)(["NoticeBox",n&&"NoticeBox--color--"+n,c&&"NoticeBox--type--info",u&&"NoticeBox--type--success",s&&"NoticeBox--type--danger",t])},l)))};t.NoticeBox=c,c.defaultHooks=o.pureComponentHooks},44499:function(e,t,n){"use strict";t.__esModule=!0,t.NumberInput=void 0;var r=n(58734),o=n(5339),i=n(59641),a=n(12451),c=n(65969);function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}var s=function(e){var t,n;function s(t){var n;n=e.call(this,t)||this;var i=t.value;return n.inputRef=(0,r.createRef)(),n.state={value:i,dragging:!1,editing:!1,internalValue:null,origin:null,suppressingFlicker:!1},n.flickerTimer=null,n.suppressFlicker=function(){var e=n.props.suppressFlicker;e>0&&(n.setState({suppressingFlicker:!0}),clearTimeout(n.flickerTimer),n.flickerTimer=setTimeout((function(){return n.setState({suppressingFlicker:!1})}),e))},n.handleDragStart=function(e){var t=n.props.value;n.state.editing||(document.body.style["pointer-events"]="none",n.ref=e.target,n.setState({dragging:!1,origin:e.screenY,value:t,internalValue:t}),n.timer=setTimeout((function(){n.setState({dragging:!0})}),250),n.dragInterval=setInterval((function(){var t=n.state,r=t.dragging,o=t.value,i=n.props.onDrag;r&&i&&i(e,o)}),n.props.updateRate||400),document.addEventListener("mousemove",n.handleDragMove),document.addEventListener("mouseup",n.handleDragEnd))},n.handleDragMove=function(e){var t=n.props,r=t.minValue,i=t.maxValue,a=t.step,c=t.stepPixelSize;n.setState((function(t){var n=Object.assign({},t),u=n.origin-e.screenY;if(t.dragging){var s=Number.isFinite(r)?r%a:0;n.internalValue=(0,o.clamp)(n.internalValue+u*a/c,r-a,i+a),n.value=(0,o.clamp)(n.internalValue-n.internalValue%a+s,r,i),n.origin=e.screenY}else Math.abs(u)>4&&(n.dragging=!0);return n}))},n.handleDragEnd=function(e){var t=n.props,r=t.onChange,o=t.onDrag,i=n.state,a=i.dragging,c=i.value,u=i.internalValue;if(document.body.style["pointer-events"]="auto",clearTimeout(n.timer),clearInterval(n.dragInterval),n.setState({dragging:!1,editing:!a,origin:null}),document.removeEventListener("mousemove",n.handleDragMove),document.removeEventListener("mouseup",n.handleDragEnd),a)n.suppressFlicker(),r&&r(e,c),o&&o(e,c);else if(n.inputRef){var s=n.inputRef.current;s.value=u;try{s.focus(),s.select()}catch(l){}}},n}return n=e,(t=s).prototype=Object.create(n.prototype),t.prototype.constructor=t,u(t,n),s.prototype.render=function(){var e=this,t=this.state,n=t.dragging,u=t.editing,s=t.value,l=t.suppressingFlicker,f=this.props,d=f.className,p=f.fluid,h=f.animated,v=f.value,g=f.unit,m=f.minValue,y=f.maxValue,b=f.height,_=f.width,w=f.lineHeight,x=f.fontSize,S=f.format,C=f.onChange,E=f.onDrag,N=v;(n||l)&&(N=s);var O=(0,r.createVNode)(1,"div","NumberInput__content",[!h||n||l?S?S(N):N:(0,r.createComponentVNode)(2,a.AnimatedNumber,{value:N,format:S}),g?" "+g:""],0,{unselectable:Byond.IS_LTE_IE8});return(0,r.createComponentVNode)(2,c.Box,{className:(0,i.classes)(["NumberInput",p&&"NumberInput--fluid",d]),minWidth:_,minHeight:b,lineHeight:w,fontSize:x,onMouseDown:this.handleDragStart,children:[(0,r.createVNode)(1,"div","NumberInput__barContainer",(0,r.createVNode)(1,"div","NumberInput__bar",null,1,{style:{height:(0,o.clamp)((N-m)/(y-m)*100,0,100)+"%"}}),2),O,(0,r.createVNode)(64,"input","NumberInput__input",null,1,{style:{display:u?undefined:"none",height:b,"line-height":w,"font-size":x},onBlur:function(t){if(u){var n=(0,o.clamp)(parseFloat(t.target.value),m,y);Number.isNaN(n)?e.setState({editing:!1}):(e.setState({editing:!1,value:n}),e.suppressFlicker(),C&&C(t,n),E&&E(t,n))}},onKeyDown:function(t){if(13===t.keyCode){var n=(0,o.clamp)(parseFloat(t.target.value),m,y);return Number.isNaN(n)?void e.setState({editing:!1}):(e.setState({editing:!1,value:n}),e.suppressFlicker(),C&&C(t,n),void(E&&E(t,n)))}27!==t.keyCode||e.setState({editing:!1})}},null,this.inputRef)]})},s}(r.Component);t.NumberInput=s,s.defaultHooks=i.pureComponentHooks,s.defaultProps={minValue:-Infinity,maxValue:+Infinity,step:1,stepPixelSize:1,suppressFlicker:50}},38221:function(e,t,n){"use strict";t.__esModule=!0,t.Popper=void 0;var r=n(92935),o=n(58734);function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var a=function(e){var t,n;function a(){var t;return(t=e.call(this)||this).renderedContent=void 0,t.popperInstance=void 0,a.id+=1,t}n=e,(t=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var c=a.prototype;return c.componentDidMount=function(){var e=this,t=this.props,n=t.additionalStyles,i=t.options;if(this.renderedContent=document.createElement("div"),n)for(var a=0,c=Object.entries(n);a=0||(o[n]=e[n]);return o}(e,u),y=(0,o.scale)(n,l,d),b=g!==undefined,_=p||(0,o.keyOfMatchingRange)(n,v)||"default",w=(0,a.computeBoxProps)(m),x=["ProgressBar",t,(0,a.computeBoxClassName)(m)],S={width:100*(0,o.clamp01)(y)+"%"};return c.CSS_COLORS.includes(_)||"default"===_?x.push("ProgressBar--color--"+_):(w.style=(w.style||"")+"border-color: "+_+";",S["background-color"]=_),(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,i.classes)(x),[(0,r.createVNode)(1,"div","ProgressBar__fill ProgressBar__fill--animated",null,1,{style:S}),(0,r.createVNode)(1,"div","ProgressBar__content",b?g:(0,o.toFixed)(100*y)+"%",0)],4,Object.assign({},w)))};t.ProgressBar=s,s.defaultHooks=i.pureComponentHooks},85326:function(e,t,n){"use strict";t.__esModule=!0,t.RestrictedInput=void 0;var r=n(58734),o=n(59641),i=n(5339),a=n(65969),c=n(42678),u=["onChange","onEnter","onInput","value"],s=["className","fluid","monospace"];function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=function(e,t,n,r){var o=t||0,a=n||0===n?n:1e4;if(!e||!e.length)return String(o);var c=r?parseFloat(e.replace(/[^\-\d.]/g,"")):parseInt(e.replace(/[^\-\d]/g,""),10);return isNaN(c)?String(o):String((0,i.clamp)(c,o,a))},p=function(e){var t,n;function i(){var t;return(t=e.call(this)||this).inputRef=(0,r.createRef)(),t.state={editing:!1},t.handleBlur=function(e){t.state.editing&&t.setEditing(!1)},t.handleChange=function(e){var n=t.props,r=n.maxValue,o=n.minValue,i=n.onChange,a=n.allowFloats;e.target.value=d(e.target.value,o,r,a),i&&i(e,+e.target.value)},t.handleFocus=function(e){t.state.editing||t.setEditing(!0)},t.handleInput=function(e){var n=t.state.editing,r=t.props.onInput;n||t.setEditing(!0),r&&r(e,+e.target.value)},t.handleKeyDown=function(e){var n=t.props,r=n.maxValue,o=n.minValue,i=n.onChange,a=n.onEnter,u=n.allowFloats;if(e.keyCode===c.KEY_ENTER){var s=d(e.target.value,o,r,u);return t.setEditing(!1),i&&i(e,+s),a&&a(e,+s),void e.target.blur()}if(e.keyCode===c.KEY_ESCAPE)return t.props.onEscape?void t.props.onEscape(e):(t.setEditing(!1),e.target.value=t.props.value,void e.target.blur())},t}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,f(t,n);var p=i.prototype;return p.componentDidMount=function(){var e,t=this,n=this.props,r=n.maxValue,o=n.minValue,i=n.allowFloats,a=null==(e=this.props.value)?void 0:e.toString(),c=this.inputRef.current;c&&(c.value=d(a,o,r,i)),(this.props.autoFocus||this.props.autoSelect)&&setTimeout((function(){c.focus(),t.props.autoSelect&&c.select()}),1)},p.componentDidUpdate=function(e,t){var n,r,o=this.props,i=o.maxValue,a=o.minValue,c=o.allowFloats,u=this.state.editing,s=null==(n=e.value)?void 0:n.toString(),l=null==(r=this.props.value)?void 0:r.toString(),f=this.inputRef.current;f&&!u&&l!==s&&l!==f.value&&(f.value=d(l,a,i,c))},p.setEditing=function(e){this.setState({editing:e})},p.render=function(){var e=this.props,t=(e.onChange,e.onEnter,e.onInput,e.value,l(e,u)),n=t.className,i=t.fluid,c=t.monospace,f=l(t,s);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,a.Box,Object.assign({className:(0,o.classes)(["Input",i&&"Input--fluid",c&&"Input--monospace",n])},f,{children:[(0,r.createVNode)(1,"div","Input__baseline",".",16),(0,r.createVNode)(64,"input","Input__input",null,1,{onChange:this.handleChange,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,type:"number"},null,this.inputRef)]})))},i}(r.Component);t.RestrictedInput=p},64036:function(e,t,n){"use strict";t.__esModule=!0,t.RoundGauge=void 0;var r=n(58734),o=n(5339),i=n(59641),a=n(12451),c=n(65969),u=["value","minValue","maxValue","ranges","alertAfter","alertBefore","format","size","className","style"];t.RoundGauge=function(e){if(Byond.IS_LTE_IE8)return(0,r.normalizeProps)((0,r.createComponentVNode)(2,a.AnimatedNumber,Object.assign({},e)));var t=e.value,n=e.minValue,s=void 0===n?1:n,l=e.maxValue,f=void 0===l?1:l,d=e.ranges,p=e.alertAfter,h=e.alertBefore,v=e.format,g=e.size,m=void 0===g?1:g,y=e.className,b=e.style,_=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,u),w=(0,o.scale)(t,s,f),x=(0,o.clamp01)(w),S=d?{}:{primary:[0,1]};d&&Object.keys(d).forEach((function(e){var t=d[e];S[e]=[(0,o.scale)(t[0],s,f),(0,o.scale)(t[1],s,f)]}));var C=function(){if(p&&h&&pt)return!0}else if(pt)return!0;return!1}()&&(0,o.keyOfMatchingRange)(x,S);return(0,r.createComponentVNode)(2,c.Box,{inline:!0,children:[(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,i.classes)(["RoundGauge",y,(0,c.computeBoxClassName)(_)]),(0,r.createVNode)(32,"svg",null,[(p||h)&&(0,r.createVNode)(32,"g",(0,i.classes)(["RoundGauge__alert",C?"active RoundGauge__alert--"+C:""]),(0,r.createVNode)(32,"path",null,null,1,{d:"M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z"}),2),(0,r.createVNode)(32,"g",null,(0,r.createVNode)(32,"circle","RoundGauge__ringTrack",null,1,{cx:"50",cy:"50",r:"45"}),2),(0,r.createVNode)(32,"g",null,Object.keys(S).map((function(e,t){var n=S[e];return(0,r.createVNode)(32,"circle","RoundGauge__ringFill RoundGauge--color--"+e,null,1,{style:{"stroke-dashoffset":Math.max((2-(n[1]-n[0]))*Math.PI*50,0)},transform:"rotate("+(180+180*n[0])+" 50 50)",cx:"50",cy:"50",r:"45"},t)})),0),(0,r.createVNode)(32,"g","RoundGauge__needle",[(0,r.createVNode)(32,"polygon","RoundGauge__needleLine",null,1,{points:"46,50 50,0 54,50"}),(0,r.createVNode)(32,"circle","RoundGauge__needleMiddle",null,1,{cx:"50",cy:"50",r:"8"})],4,{transform:"rotate("+(180*x-90)+" 50 50)"})],0,{viewBox:"0 0 100 50"}),2,Object.assign({},(0,c.computeBoxProps)(Object.assign({style:Object.assign({"font-size":m+"em"},b)},_))))),(0,r.createComponentVNode)(2,a.AnimatedNumber,{value:t,format:v,size:m})]})}},41355:function(e,t,n){"use strict";t.__esModule=!0,t.Section=void 0;var r=n(58734),o=n(59641),i=n(80835),a=n(65969),c=["className","title","buttons","fill","fitted","scrollable","scrollableHorizontal","flexGrow","noTopPadding","stretchContents","children","onScroll"];function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}var s=function(e){var t,n;function s(t){var n;return(n=e.call(this,t)||this).scrollableRef=void 0,n.scrollable=void 0,n.onScroll=void 0,n.scrollableHorizontal=void 0,n.scrollableRef=t.scrollableRef||(0,r.createRef)(),n.scrollable=t.scrollable,n.onScroll=t.onScroll,n.scrollableHorizontal=t.scrollableHorizontal,n}n=e,(t=s).prototype=Object.create(n.prototype),t.prototype.constructor=t,u(t,n);var l=s.prototype;return l.componentDidMount=function(){(this.scrollable||this.scrollableHorizontal)&&((0,i.addScrollableNode)(this.scrollableRef.current),this.onScroll&&this.scrollableRef.current&&(this.scrollableRef.current.onscroll=this.onScroll))},l.componentWillUnmount=function(){(this.scrollable||this.scrollableHorizontal)&&(0,i.removeScrollableNode)(this.scrollableRef.current)},l.render=function(){var e=this.props,t=e.className,n=e.title,i=e.buttons,u=e.fill,s=e.fitted,l=e.scrollable,f=e.scrollableHorizontal,d=e.flexGrow,p=e.noTopPadding,h=e.stretchContents,v=e.children,g=e.onScroll,m=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,c),y=(0,o.canRender)(n)||(0,o.canRender)(i);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Section",Byond.IS_LTE_IE8&&"Section--iefix",u&&"Section--fill",s&&"Section--fitted",l&&"Section--scrollable",f&&"Section--scrollableHorizontal",d&&"Section--flex",t,(0,a.computeBoxClassName)(m)]),[y&&(0,r.createVNode)(1,"div","Section__title",[(0,r.createVNode)(1,"span","Section__titleText",n,0),(0,r.createVNode)(1,"div","Section__buttons",i,0)],4),(0,r.createVNode)(1,"div","Section__rest",(0,r.createVNode)(1,"div",(0,o.classes)(["Section__content",!!h&&"Section__content--stretchContents",!!p&&"Section__content--noTopPadding"]),v,0,{onScroll:g},null,this.scrollableRef),0)],0,Object.assign({},(0,a.computeBoxProps)(m))))},s}(r.Component);t.Section=s},1513:function(e,t,n){"use strict";t.__esModule=!0,t.Slider=void 0;var r=n(58734),o=n(5339),i=n(59641),a=n(65969),c=n(49948),u=n(44499),s=["animated","format","maxValue","minValue","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","fillValue","color","ranges","children"];t.Slider=function(e){if(Byond.IS_LTE_IE8)return(0,r.normalizeProps)((0,r.createComponentVNode)(2,u.NumberInput,Object.assign({},e)));var t=e.animated,n=e.format,l=e.maxValue,f=e.minValue,d=e.onChange,p=e.onDrag,h=e.step,v=e.stepPixelSize,g=e.suppressFlicker,m=e.unit,y=e.value,b=e.className,_=e.fillValue,w=e.color,x=e.ranges,S=void 0===x?{}:x,C=e.children,E=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,s),N=C!==undefined;return(0,r.normalizeProps)((0,r.createComponentVNode)(2,c.DraggableControl,Object.assign({dragMatrix:[1,0]},{animated:t,format:n,maxValue:l,minValue:f,onChange:d,onDrag:p,step:h,stepPixelSize:v,suppressFlicker:g,unit:m,value:y},{children:function(e){var t=e.dragging,n=(e.editing,e.value),c=e.displayValue,u=e.displayElement,s=e.inputElement,d=e.handleDragStart,p=_!==undefined&&null!==_,h=((0,o.scale)(n,f,l),(0,o.scale)(null!=_?_:c,f,l)),v=(0,o.scale)(c,f,l),g=w||(0,o.keyOfMatchingRange)(null!=_?_:n,S)||"default";return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,i.classes)(["Slider","ProgressBar","ProgressBar--color--"+g,b,(0,a.computeBoxClassName)(E)]),[(0,r.createVNode)(1,"div",(0,i.classes)(["ProgressBar__fill",p&&"ProgressBar__fill--animated"]),null,1,{style:{width:100*(0,o.clamp01)(h)+"%",opacity:.4}}),(0,r.createVNode)(1,"div","ProgressBar__fill",null,1,{style:{width:100*(0,o.clamp01)(Math.min(h,v))+"%"}}),(0,r.createVNode)(1,"div","Slider__cursorOffset",[(0,r.createVNode)(1,"div","Slider__cursor"),(0,r.createVNode)(1,"div","Slider__pointer"),t&&(0,r.createVNode)(1,"div","Slider__popupValue",u,0)],0,{style:{width:100*(0,o.clamp01)(v)+"%"}}),(0,r.createVNode)(1,"div","ProgressBar__content",N?C:u,0),s],0,Object.assign({},(0,a.computeBoxProps)(E),{onMouseDown:d})))}})))}},70468:function(e,t,n){"use strict";t.__esModule=!0,t.Stack=void 0;var r=n(58734),o=n(59641),i=n(21456),a=["className","vertical","fill"],c=["className","innerRef"],u=["className","hidden"];function s(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var l=function(e){var t=e.className,n=e.vertical,c=e.fill,u=s(e,a);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Stack",c&&"Stack--fill",n?"Stack--vertical":"Stack--horizontal",t,(0,i.computeFlexClassName)(e)]),null,1,Object.assign({},(0,i.computeFlexProps)(Object.assign({direction:n?"column":"row"},u)))))};t.Stack=l;l.Item=function(e){var t=e.className,n=e.innerRef,a=s(e,c);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Stack__item",t,(0,i.computeFlexItemClassName)(a)]),null,1,Object.assign({},(0,i.computeFlexItemProps)(a)),null,n))};l.Divider=function(e){var t=e.className,n=e.hidden,a=s(e,u);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Stack__item","Stack__divider",n&&"Stack__divider--hidden",t,(0,i.computeFlexItemClassName)(a)]),null,1,Object.assign({},(0,i.computeFlexItemProps)(a))))}},86670:function(e,t,n){"use strict";t.__esModule=!0,t.StyleableSection=void 0;var r=n(58734),o=n(65969);t.StyleableSection=function(e){return(0,r.createComponentVNode)(2,o.Box,{style:e.style,children:[(0,r.createComponentVNode)(2,o.Box,{"class":"Section__title",style:e.titleStyle,children:[(0,r.createComponentVNode)(2,o.Box,{"class":"Section__titleText",style:e.textStyle,children:e.title}),(0,r.createVNode)(1,"div","Section__buttons",e.titleSubtext,0)]}),(0,r.createComponentVNode)(2,o.Box,{"class":"Section__rest",children:(0,r.createComponentVNode)(2,o.Box,{"class":"Section__content",children:e.children})})]})}},1813:function(e,t,n){"use strict";t.__esModule=!0,t.TableRow=t.TableCell=t.Table=void 0;var r=n(58734),o=n(59641),i=n(65969),a=["className","collapsing","children"],c=["className","header"],u=["className","collapsing","header"];function s(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var l=function(e){var t=e.className,n=e.collapsing,c=e.children,u=s(e,a);return(0,r.normalizeProps)((0,r.createVNode)(1,"table",(0,o.classes)(["Table",n&&"Table--collapsing",t,(0,i.computeBoxClassName)(u)]),(0,r.createVNode)(1,"tbody",null,c,0),2,Object.assign({},(0,i.computeBoxProps)(u))))};t.Table=l,l.defaultHooks=o.pureComponentHooks;var f=function(e){var t=e.className,n=e.header,a=s(e,c);return(0,r.normalizeProps)((0,r.createVNode)(1,"tr",(0,o.classes)(["Table__row",n&&"Table__row--header",t,(0,i.computeBoxClassName)(e)]),null,1,Object.assign({},(0,i.computeBoxProps)(a))))};t.TableRow=f,f.defaultHooks=o.pureComponentHooks;var d=function(e){var t=e.className,n=e.collapsing,a=e.header,c=s(e,u);return(0,r.normalizeProps)((0,r.createVNode)(1,"td",(0,o.classes)(["Table__cell",n&&"Table__cell--collapsing",a&&"Table__cell--header",t,(0,i.computeBoxClassName)(e)]),null,1,Object.assign({},(0,i.computeBoxProps)(c))))};t.TableCell=d,d.defaultHooks=o.pureComponentHooks,l.Row=f,l.Cell=d},26657:function(e,t,n){"use strict";t.__esModule=!0,t.Tabs=void 0;var r=n(58734),o=n(59641),i=n(65969),a=n(61043),c=["className","vertical","fill","fluid","children"],u=["className","selected","color","icon","leftSlot","rightSlot","children"];function s(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var l=function(e){var t=e.className,n=e.vertical,a=e.fill,u=e.fluid,l=e.children,f=s(e,c);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Tabs",n?"Tabs--vertical":"Tabs--horizontal",a&&"Tabs--fill",u&&"Tabs--fluid",t,(0,i.computeBoxClassName)(f)]),l,0,Object.assign({},(0,i.computeBoxProps)(f))))};t.Tabs=l;l.Tab=function(e){var t=e.className,n=e.selected,c=e.color,l=e.icon,f=e.leftSlot,d=e.rightSlot,p=e.children,h=s(e,u);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Tab","Tabs__Tab","Tab--color--"+c,n&&"Tab--selected",t].concat((0,i.computeBoxClassName)(h))),[(0,o.canRender)(f)&&(0,r.createVNode)(1,"div","Tab__left",f,0)||!!l&&(0,r.createVNode)(1,"div","Tab__left",(0,r.createComponentVNode)(2,a.Icon,{name:l}),2),(0,r.createVNode)(1,"div","Tab__text",p,0),(0,o.canRender)(d)&&(0,r.createVNode)(1,"div","Tab__right",d,0)],0,Object.assign({},(0,i.computeBoxProps)(h))))}},7395:function(e,t,n){"use strict";t.__esModule=!0,t.TextArea=void 0;var r=n(58734),o=n(59641),i=n(65969),a=n(76402),c=n(42678),u=["onChange","onKeyDown","onKeyPress","onInput","onFocus","onBlur","onEnter","value","maxLength","placeholder","scrollbar","noborder","displayedValue"],s=["className","fluid","nowrap"];function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=function(e){var t,n;function d(t,n){var o;(o=e.call(this,t,n)||this).textareaRef=t.innerRef||(0,r.createRef)(),o.state={editing:!1,scrolledAmount:0};var i=t.dontUseTabForIndent,u=void 0!==i&&i;return o.handleOnInput=function(e){var t=o.state.editing,n=o.props.onInput;t||o.setEditing(!0),n&&n(e,e.target.value)},o.handleOnChange=function(e){var t=o.state.editing,n=o.props.onChange;t&&o.setEditing(!1),n&&n(e,e.target.value)},o.handleKeyPress=function(e){var t=o.state.editing,n=o.props.onKeyPress;t||o.setEditing(!0),n&&n(e,e.target.value)},o.handleKeyDown=function(e){var t=o.state.editing,n=o.props,r=n.onChange,i=n.onInput,s=n.onEnter,l=n.onKey;if(e.keyCode===c.KEY_ENTER)return o.setEditing(!1),r&&r(e,e.target.value),i&&i(e,e.target.value),s&&s(e,e.target.value),void(o.props.selfClear&&(e.target.value="",e.target.blur()));if(e.keyCode===c.KEY_ESCAPE)return o.props.onEscape&&o.props.onEscape(e),o.setEditing(!1),void(o.props.selfClear?e.target.value="":(e.target.value=(0,a.toInputValue)(o.props.value),e.target.blur()));if((t||o.setEditing(!0),l&&l(e,e.target.value),!u)&&(e.keyCode||e.which)===c.KEY_TAB){e.preventDefault();var f=e.target,d=f.value,p=f.selectionStart,h=f.selectionEnd;e.target.value=d.substring(0,p)+"\t"+d.substring(h),e.target.selectionEnd=p+1,i&&i(e,e.target.value)}},o.handleFocus=function(e){o.state.editing||o.setEditing(!0)},o.handleBlur=function(e){var t=o.state.editing,n=o.props.onChange;t&&(o.setEditing(!1),n&&n(e,e.target.value))},o.handleScroll=function(e){var t=o.props.displayedValue,n=o.textareaRef.current;t&&n&&o.setState({scrolledAmount:n.scrollTop})},o}n=e,(t=d).prototype=Object.create(n.prototype),t.prototype.constructor=t,f(t,n);var p=d.prototype;return p.componentDidMount=function(){var e=this,t=this.props.value,n=this.textareaRef.current;n&&(n.value=(0,a.toInputValue)(t)),(this.props.autoFocus||this.props.autoSelect)&&setTimeout((function(){n.focus(),e.props.autoSelect&&n.select()}),1)},p.componentDidUpdate=function(e,t){var n=e.value,r=this.props.value,o=this.textareaRef.current;o&&"string"==typeof r&&n!==r&&(o.value=(0,a.toInputValue)(r))},p.setEditing=function(e){this.setState({editing:e})},p.getValue=function(){return this.textareaRef.current&&this.textareaRef.current.value},p.render=function(){var e=this.props,t=(e.onChange,e.onKeyDown,e.onKeyPress,e.onInput,e.onFocus,e.onBlur,e.onEnter,e.value,e.maxLength),n=e.placeholder,a=e.scrollbar,c=e.noborder,f=e.displayedValue,d=l(e,u),p=d.className,h=d.fluid,v=d.nowrap,g=l(d,s),m=this.state.scrolledAmount;return(0,r.normalizeProps)((0,r.createComponentVNode)(2,i.Box,Object.assign({className:(0,o.classes)(["TextArea",h&&"TextArea--fluid",c&&"TextArea--noborder",p])},g,{children:[!!f&&(0,r.createComponentVNode)(2,i.Box,{position:"absolute",width:"100%",height:"100%",overflow:"hidden",children:(0,r.createVNode)(1,"div",(0,o.classes)(["TextArea__textarea","TextArea__textarea_custom"]),f,0,{style:{transform:"translateY(-"+m+"px)"}})}),(0,r.createVNode)(128,"textarea",(0,o.classes)(["TextArea__textarea",a&&"TextArea__textarea--scrollable",v&&"TextArea__nowrap"]),null,1,{placeholder:n,onChange:this.handleOnChange,onKeyDown:this.handleKeyDown,onKeyPress:this.handleKeyPress,onInput:this.handleOnInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onScroll:this.handleScroll,maxLength:t,style:{color:f?"rgba(0, 0, 0, 0)":"inherit"}},null,this.textareaRef)]})))},d}(r.Component);t.TextArea=d},36279:function(e,t,n){"use strict";t.__esModule=!0,t.TimeDisplay=void 0;var r=n(43820),o=n(58734);function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var a=function(e){return"number"==typeof e&&Number.isFinite(e)&&!Number.isNaN(e)},c=function(e){var t,n;function o(t){var n;return(n=e.call(this,t)||this).timer=null,n.last_seen_value=undefined,n.state={value:0},a(t.value)&&(n.state.value=Number(t.value),n.last_seen_value=Number(t.value)),n}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var c=o.prototype;return c.componentDidUpdate=function(){var e=this;this.props.auto!==undefined&&(clearInterval(this.timer),this.timer=setInterval((function(){return e.tick()}),1e3))},c.tick=function(){var e=Number(this.state.value);this.props.value!==this.last_seen_value&&(this.last_seen_value=this.props.value,e=this.props.value);var t="up"===this.props.auto?10:-10,n=Math.max(0,e+t);this.setState({value:n})},c.componentDidMount=function(){var e=this;this.props.auto!==undefined&&(this.timer=setInterval((function(){return e.tick()}),1e3))},c.componentWillUnmount=function(){clearInterval(this.timer)},c.render=function(){var e=this.state.value;return a(e)?(0,r.formatTime)(e):this.state.value||null},o}(o.Component);t.TimeDisplay=c},83526:function(e,t,n){"use strict";t.__esModule=!0,t.Tooltip=void 0;var r=n(58734),o=n(92935);function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}var a={modifiers:[{name:"eventListeners",enabled:!1}]},c={width:0,height:0,top:0,right:0,bottom:0,left:0,x:0,y:0,toJSON:function(){return null}},u=function(e){var t,n;function c(){return e.apply(this,arguments)||this}n=e,(t=c).prototype=Object.create(n.prototype),t.prototype.constructor=t,i(t,n);var u=c.prototype;return u.getDOMNode=function(){return(0,r.findDOMfromVNode)(this.$LI,!0)},u.componentDidMount=function(){var e=this,t=this.getDOMNode();t&&(t.addEventListener("mouseenter",(function(){var n=c.renderedTooltip;n===undefined&&((n=document.createElement("div")).className="Tooltip",document.body.appendChild(n),c.renderedTooltip=n),c.currentHoveredElement=t,n.style.opacity="1",e.renderPopperContent()})),t.addEventListener("mouseleave",(function(){e.fadeOut()})))},u.fadeOut=function(){c.currentHoveredElement===this.getDOMNode()&&(c.currentHoveredElement=undefined,c.renderedTooltip.style.opacity="0")},u.renderPopperContent=function(){var e=this,t=c.renderedTooltip;t&&(0,r.render)((0,r.createVNode)(1,"span",null,this.props.content,0),t,(function(){var n=c.singletonPopper;n===undefined?(n=(0,o.createPopper)(c.virtualElement,t,Object.assign({},a,{placement:e.props.position||"auto"})),c.singletonPopper=n):(n.setOptions(Object.assign({},a,{placement:e.props.position||"auto"})),n.update())}),this.context)},u.componentDidUpdate=function(){c.currentHoveredElement===this.getDOMNode()&&this.renderPopperContent()},u.componentWillUnmount=function(){this.fadeOut()},u.render=function(){return this.props.children},c}(r.Component);t.Tooltip=u,u.renderedTooltip=void 0,u.singletonPopper=void 0,u.currentHoveredElement=void 0,u.virtualElement={getBoundingClientRect:function(){var e,t;return null!=(e=null==(t=u.currentHoveredElement)?void 0:t.getBoundingClientRect())?e:c}}},4827:function(e,t,n){"use strict";t.__esModule=!0,t.TrackOutsideClicks=void 0;var r=n(58734);function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}var i=function(e){var t,n;function i(){var t;return(t=e.call(this)||this).ref=(0,r.createRef)(),t.handleOutsideClick=t.handleOutsideClick.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)),document.addEventListener("click",t.handleOutsideClick),t}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,o(t,n);var a=i.prototype;return a.componentWillUnmount=function(){document.removeEventListener("click",this.handleOutsideClick)},a.handleOutsideClick=function(e){e.target instanceof Node&&this.ref.current&&!this.ref.current.contains(e.target)&&this.props.onOutsideClick()},a.render=function(){return(0,r.createVNode)(1,"div",null,this.props.children,0,null,null,this.ref)},i}(r.Component);t.TrackOutsideClicks=i},71558:function(e,t,n){"use strict";t.__esModule=!0,t.TrackOutsideClicks=t.Tooltip=t.TimeDisplay=t.TextArea=t.Tabs=t.Table=t.StyleableSection=t.Stack=t.Slider=t.Section=t.RoundGauge=t.RestrictedInput=t.ProgressBar=t.Popper=t.NumberInput=t.NoticeBox=t.Modal=t.MenuBar=t.LabeledList=t.LabeledControls=t.Knob=t.KeyListener=t.Input=t.InfinitePlane=t.Icon=t.Grid=t.Flex=t.FitText=t.Dropdown=t.DraggableControl=t.Divider=t.Dimmer=t.Dialog=t.ColorBox=t.Collapsible=t.Chart=t.ByondUi=t.Button=t.Box=t.BlockQuote=t.Blink=t.Autofocus=t.AnimatedNumber=void 0;var r=n(12451);t.AnimatedNumber=r.AnimatedNumber;var o=n(36310);t.Autofocus=o.Autofocus;var i=n(78836);t.Blink=i.Blink;var a=n(40817);t.BlockQuote=a.BlockQuote;var c=n(65969);t.Box=c.Box;var u=n(66033);t.Button=u.Button;var s=n(63774);t.ByondUi=s.ByondUi;var l=n(9267);t.Chart=l.Chart;var f=n(31510);t.Collapsible=f.Collapsible;var d=n(93857);t.ColorBox=d.ColorBox;var p=n(50530);t.Dimmer=p.Dimmer;var h=n(29397);t.Divider=h.Divider;var v=n(49948);t.DraggableControl=v.DraggableControl;var g=n(51413);t.Dropdown=g.Dropdown;var m=n(21456);t.Flex=m.Flex;var y=n(7764);t.FitText=y.FitText;var b=n(95251);t.Grid=b.Grid;var _=n(61043);t.Icon=_.Icon;var w=n(68615);t.InfinitePlane=w.InfinitePlane;var x=n(76402);t.Input=x.Input;var S=n(76844);t.KeyListener=S.KeyListener;var C=n(66020);t.Knob=C.Knob;var E=n(56240);t.LabeledControls=E.LabeledControls;var N=n(84867);t.LabeledList=N.LabeledList;var O=n(34927);t.MenuBar=O.MenuBar;var M=n(60639);t.Modal=M.Modal;var k=n(91646);t.NoticeBox=k.NoticeBox;var T=n(44499);t.NumberInput=T.NumberInput;var I=n(41042);t.ProgressBar=I.ProgressBar;var A=n(38221);t.Popper=A.Popper;var P=n(85326);t.RestrictedInput=P.RestrictedInput;var L=n(64036);t.RoundGauge=L.RoundGauge;var V=n(41355);t.Section=V.Section;var B=n(1513);t.Slider=B.Slider;var j=n(86670);t.StyleableSection=j.StyleableSection;var R=n(70468);t.Stack=R.Stack;var D=n(1813);t.Table=D.Table;var F=n(26657);t.Tabs=F.Tabs;var K=n(7395);t.TextArea=K.TextArea;var U=n(36279);t.TimeDisplay=U.TimeDisplay;var Y=n(4827);t.TrackOutsideClicks=Y.TrackOutsideClicks;var H=n(83526);t.Tooltip=H.Tooltip;var z=n(29532);t.Dialog=z.Dialog},78419:function(e,t){"use strict";t.__esModule=!0,t.getGasLabel=t.getGasFromId=t.getGasColor=t.UI_UPDATE=t.UI_INTERACTIVE=t.UI_DISABLED=t.UI_CLOSE=t.T0C=t.RADIO_CHANNELS=t.CSS_COLORS=t.COLORS=void 0;t.T0C=273.15;t.UI_INTERACTIVE=2;t.UI_UPDATE=1;t.UI_DISABLED=0;t.UI_CLOSE=-1;t.COLORS={department:{captain:"#c06616",security:"#e74c3c",medbay:"#3498db",science:"#9b59b6",engineering:"#f1c40f",cargo:"#f39c12",centcom:"#00c100",other:"#c38312"},manifest:{command:"#3333FF",security:"#8e0000",medical:"#006600",engineering:"#b27300",science:"#a65ba6",cargo:"#bb9040",planetside:"#555555",civilian:"#a32800",miscellaneous:"#666666",silicon:"#222222"},damageType:{oxy:"#3498db",toxin:"#2ecc71",burn:"#e67e22",brute:"#e74c3c"},reagent:{acidicbuffer:"#fbc314",basicbuffer:"#3853a4"}};t.CSS_COLORS=["black","white","red","orange","yellow","olive","green","teal","blue","violet","purple","pink","brown","grey","good","average","bad","label"];t.RADIO_CHANNELS=[{name:"Mercenary",freq:1213,color:"#6D3F40"},{name:"Raider",freq:1277,color:"#6D3F40"},{name:"Special Ops",freq:1341,color:"#5C5C8A"},{name:"AI Private",freq:1343,color:"#FF00FF"},{name:"Response Team",freq:1345,color:"#5C5C8A"},{name:"Supply",freq:1347,color:"#5F4519"},{name:"Service",freq:1349,color:"#6eaa2c"},{name:"Science",freq:1351,color:"#993399"},{name:"Command",freq:1353,color:"#193A7A"},{name:"Medical",freq:1355,color:"#008160"},{name:"Engineering",freq:1357,color:"#A66300"},{name:"Security",freq:1359,color:"#A30000"},{name:"Explorer",freq:1361,color:"#555555"},{name:"Talon",freq:1363,color:"#555555"},{name:"Common",freq:1459,color:"#008000"},{name:"Entertainment",freq:1461,color:"#339966"},{name:"Security(I)",freq:1475,color:"#008000"},{name:"Medical(I)",freq:1485,color:"#008000"}];var n=[{id:"oxygen",name:"Oxygen",label:"O\u2082",color:"blue"},{id:"nitrogen",name:"Nitrogen",label:"N\u2082",color:"green"},{id:"carbon_dioxide",name:"Carbon Dioxide",label:"CO\u2082",color:"grey"},{id:"phoron",name:"Phoron",label:"Phoron",color:"pink"},{id:"volatile_fuel",name:"Volatile Fuel",label:"EXP",color:"teal"},{id:"nitrous_oxide",name:"Nitrous Oxide",label:"N\u2082O",color:"red"},{id:"other",name:"Other",label:"Other",color:"white"},{id:"pressure",name:"Pressure",label:"Pressure",color:"average"},{id:"temperature",name:"Temperature",label:"Temperature",color:"yellow"}];t.getGasLabel=function(e,t){if(!e)return t||"None";for(var r=e.toLowerCase(),o=e.replace(/(^\w{1})|(\s+\w{1})/g,(function(e){return e.toUpperCase()})),i=0;i=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),d}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=undefined),d}},e}function u(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,c,"next",e)}function c(e){u(i,r,o,a,c,"throw",e)}a(undefined)}))}}var l,f,d,p,h,v=(0,i.createLogger)("drag"),g=null!=(r=window.devicePixelRatio)?r:1,m=Byond.windowId,y=!1,b=!1,_=[0,0];t.setWindowKey=function(e){m=e};var w=function(){return[window.screenLeft*g,window.screenTop*g]};t.getWindowPosition=w;var x=function(){return[window.innerWidth*g,window.innerHeight*g]};t.getWindowSize=x;var S=function(e){var t=(0,o.vecAdd)(e,_);return Byond.winset(Byond.windowId,{pos:t[0]+","+t[1]})},C=function(e){return Byond.winset(Byond.windowId,{size:e[0]+"x"+e[1]})},E=function(){return[window.screen.availWidth*g,window.screen.availHeight*g]},N=function(e,t,n){void 0===n&&(n=50);for(var r,o=[t],i=0;iu&&(o[a]=u-t[a],i=!0)}return[i,o]};t.dragStartHandler=function(e){var t;v.log("drag start"),y=!0,f=(0,o.vecSubtract)([e.screenX,e.screenY],w()),null==(t=e.target)||t.focus(),document.addEventListener("mousemove",A),document.addEventListener("mouseup",I),A(e)};var I=function V(e){v.log("drag end"),A(e),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",V),y=!1,O()},A=function(e){y&&(e.preventDefault(),S((0,o.vecSubtract)([e.screenX,e.screenY],f)))};t.resizeStartHandler=function(e,t){return function(n){var r;d=[e,t],v.log("resize start",d),b=!0,f=(0,o.vecSubtract)([n.screenX,n.screenY],w()),p=x(),null==(r=n.target)||r.focus(),document.addEventListener("mousemove",L),document.addEventListener("mouseup",P),L(n)}};var P=function B(e){v.log("resize end",h),L(e),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",B),b=!1,O()},L=function(e){if(b){e.preventDefault();var t=(0,o.vecSubtract)([e.screenX,e.screenY],w()),n=(0,o.vecSubtract)(t,f);(h=(0,o.vecAdd)(p,(0,o.vecMultiply)(d,n),[1,1]))[0]=Math.max(h[0],150*g),h[1]=Math.max(h[1],50*g),C(h)}}},80835:function(e,t,n){"use strict";t.__esModule=!0,t.setupGlobalEvents=t.removeScrollableNode=t.globalEvents=t.canStealFocus=t.addScrollableNode=t.KeyEvent=void 0;var r=n(42678),o=new(n(20474).EventEmitter);t.globalEvents=o;var i,a=!1;t.setupGlobalEvents=function(e){void 0===e&&(e={}),a=!!e.ignoreWindowFocus};var c=!0,u=function m(e,t){a?c=!0:(i&&(clearTimeout(i),i=null),t?i=setTimeout((function(){return m(e)})):c!==e&&(c=e,o.emit(e?"window-focus":"window-blur"),o.emit("window-focus-change",e)))},s=null,l=function(e){var t=String(e.tagName).toLowerCase();return"input"===t||"textarea"===t};t.canStealFocus=l;var f=function y(){s&&(s.removeEventListener("blur",y),s=null)},d=null,p=null,h=[];t.addScrollableNode=function(e){h.push(e)};t.removeScrollableNode=function(e){var t=h.indexOf(e);t>=0&&h.splice(t,1)};window.addEventListener("mousemove",(function(e){var t=e.target;t!==p&&(p=t,function(e){if(!s&&c)for(var t=document.body;e&&e!==t;){if(h.includes(e)){if(e.contains(d))return;return d=e,void e.focus()}e=e.parentElement}}(t))})),window.addEventListener("focusin",(function(e){if(p=null,d=e.target,u(!0),l(e.target))return t=e.target,f(),void(s=t).addEventListener("blur",f);var t})),window.addEventListener("focusout",(function(e){p=null,u(!1,!0)})),window.addEventListener("blur",(function(e){p=null,u(!1,!0)})),window.addEventListener("beforeunload",(function(e){u(!1)}));var v={},g=function(){function e(e,t,n){this.event=void 0,this.type=void 0,this.code=void 0,this.ctrl=void 0,this.shift=void 0,this.alt=void 0,this.repeat=void 0,this._str=void 0,this.event=e,this.type=t,this.code=e.keyCode,this.ctrl=e.ctrlKey,this.shift=e.shiftKey,this.alt=e.altKey,this.repeat=!!n}var t=e.prototype;return t.hasModifierKeys=function(){return this.ctrl||this.alt||this.shift},t.isModifierKey=function(){return this.code===r.KEY_CTRL||this.code===r.KEY_SHIFT||this.code===r.KEY_ALT},t.isDown=function(){return"keydown"===this.type},t.isUp=function(){return"keyup"===this.type},t.toString=function(){return this._str||(this._str="",this.ctrl&&(this._str+="Ctrl+"),this.alt&&(this._str+="Alt+"),this.shift&&(this._str+="Shift+"),this.code>=48&&this.code<=90?this._str+=String.fromCharCode(this.code):this.code>=r.KEY_F1&&this.code<=r.KEY_F12?this._str+="F"+(this.code-111):this._str+="["+this.code+"]"),this._str},e}();t.KeyEvent=g,document.addEventListener("keydown",(function(e){if(!l(e.target)){var t=e.keyCode,n=new g(e,"keydown",v[t]);o.emit("keydown",n),o.emit("key",n),v[t]=!0}})),document.addEventListener("keyup",(function(e){if(!l(e.target)){var t=e.keyCode,n=new g(e,"keyup");o.emit("keyup",n),o.emit("key",n),v[t]=!1}}))},68566:function(e,t){"use strict";t.__esModule=!0,t.focusWindow=t.focusMap=void 0;t.focusMap=function(){Byond.winset("mapwindow.map",{focus:!0})};t.focusWindow=function(){Byond.winset(Byond.windowId,{focus:!0})}},43820:function(e,t){"use strict";t.__esModule=!0,t.formatTime=t.formatSiUnit=t.formatSiBaseTenUnit=t.formatPower=t.formatMoney=t.formatDb=t.formatCommaNumber=void 0;var n=["f","p","n","\u03bc","m"," ","k","M","G","T","P","E","Z","Y","R","Q","F","N","H"],r=n.indexOf(" "),o=function(e,t,o){if(void 0===t&&(t=-r),void 0===o&&(o=""),!isFinite(e))return e.toString();var i=Math.floor(Math.log10(Math.abs(e))),a=Math.max(3*t,i),c=Math.floor(a/3),u=n[Math.min(c+r,n.length-1)],s=(e/Math.pow(1e3,c)).toFixed(2);return s.endsWith(".00")?s=s.slice(0,-3):s.endsWith(".0")&&(s=s.slice(0,-2)),(s+" "+u.trim()+o).trim()};t.formatSiUnit=o;t.formatPower=function(e,t){return void 0===t&&(t=0),o(e,t,"W")};t.formatMoney=function(e,t){if(void 0===t&&(t=0),!Number.isFinite(e))return String(e);var n=Number(e.toFixed(t)),r=n<0,o=Math.abs(n).toString().split(".");o[0]=o[0].replace(/\B(?=(\d{3})+(?!\d))/g,"\u2009");var i=o.join(".");return r?"-"+i:i};t.formatDb=function(e){var t=20*Math.log10(e),n=t>=0?"+":"-",r=Math.abs(t);return""+n+(r=r===Infinity?"Inf":r.toFixed(2))+" dB"};var i=["","\xb7 10\xb3","\xb7 10\u2076","\xb7 10\u2079","\xb7 10\xb9\xb2","\xb7 10\xb9\u2075","\xb7 10\xb9\u2078","\xb7 10\xb2\xb9","\xb7 10\xb2\u2074","\xb7 10\xb2\u2077","\xb7 10\xb3\u2070","\xb7 10\xb3\xb3","\xb7 10\xb3\u2076","\xb7 10\xb3\u2079"];t.formatSiBaseTenUnit=function(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=""),!isFinite(e))return"NaN";var r=Math.floor(Math.log10(e)),o=Math.max(3*t,r),a=Math.floor(o/3),c=i[a],u=e/Math.pow(1e3,a),s=Math.max(0,2-o%3);return(u.toFixed(s)+" "+c+" "+n).trim()};t.formatTime=function(e,t){void 0===t&&(t="default");var n=Math.floor(e/10),r=Math.floor(n/3600),o=Math.floor(n%3600/60),i=n%60;return"short"===t?""+(r>0?r+"h":"")+(o>0?o+"m":"")+(i>0?i+"s":""):String(r).padStart(2,"0")+":"+String(o).padStart(2,"0")+":"+String(i).padStart(2,"0")};t.formatCommaNumber=function(e){if(!Number.isFinite(e))return e;var t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")}},17192:function(e,t,n){"use strict";t.__esModule=!0,t.setupHotKeys=t.releaseHotKey=t.releaseHeldKeys=t.listenForKeyEvents=t.acquireHotKey=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{"default":e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var c=o?Object.getOwnPropertyDescriptor(e,a):null;c&&(c.get||c.set)?Object.defineProperty(r,a,c):r[a]=e[a]}r["default"]=e,n&&n.set(e,r);return r}(n(42678)),o=n(80835);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}var a=(0,n(66905).createLogger)("hotkeys"),c={},u=[r.KEY_ESCAPE,r.KEY_ENTER,r.KEY_SPACE,r.KEY_TAB,r.KEY_CTRL,r.KEY_SHIFT,r.KEY_UP,r.KEY_DOWN,r.KEY_LEFT,r.KEY_RIGHT,r.KEY_F5],s={},l=[],f=function(e){var t=String(e);if("Ctrl+F5"!==t&&"Ctrl+R"!==t){if("Ctrl+F"!==t&&!(e.event.defaultPrevented||e.isModifierKey()||u.includes(e.code))){var n,r=16===(n=e.code)?"Shift":17===n?"Ctrl":18===n?"Alt":33===n?"Northeast":34===n?"Southeast":35===n?"Southwest":36===n?"Northwest":37===n?"West":38===n?"North":39===n?"East":40===n?"South":45===n?"Insert":46===n?"Delete":n>=48&&n<=57||n>=65&&n<=90?String.fromCharCode(n):n>=96&&n<=105?"Numpad"+(n-96):n>=112&&n<=123?"F"+(n-111):188===n?",":189===n?"-":190===n?".":void 0;if(r){var o=c[r];if(o)return a.debug("macro",o),Byond.command(o);if(e.isDown()&&!s[r]){s[r]=!0;var i='KeyDown "'+r+'"';return a.debug(i),Byond.command(i)}if(e.isUp()&&s[r]){s[r]=!1;var l='KeyUp "'+r+'"';return a.debug(l),Byond.command(l)}}}}else location.reload()};t.acquireHotKey=function(e){u.push(e)};t.releaseHotKey=function(e){var t=u.indexOf(e);t>=0&&u.splice(t,1)};var d=function(){for(var e=0,t=Object.keys(s);e=0||(o[n]=e[n]);return o}var l=function(e){var t=e.className,n=e.theme,a=void 0===n?"nanotrasen":n,u=e.children,l=s(e,c);return(0,r.createVNode)(1,"div","theme-"+a,(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Layout",t,(0,i.computeBoxClassName)(l)]),u,0,Object.assign({},(0,i.computeBoxProps)(l)))),2)};t.Layout=l;var f=function(e){var t=e.className,n=e.scrollable,a=e.children,c=s(e,u);return(0,r.normalizeProps)((0,r.createVNode)(1,"div",(0,o.classes)(["Layout__content",n&&"Layout__content--scrollable",t,(0,i.computeBoxClassName)(c)]),a,0,Object.assign({},(0,i.computeBoxProps)(c))))};f.defaultHooks={onComponentDidMount:function(e){return(0,a.addScrollableNode)(e)},onComponentWillUnmount:function(e){return(0,a.removeScrollableNode)(e)}},l.Content=f},23554:function(e,t,n){"use strict";t.__esModule=!0,t.NtosWindow=void 0;var r=n(58734),o=n(37655),i=n(62188),a=n(71558),c=n(62986),u=function(e,t){var n=e.title,u=e.width,s=void 0===u?575:u,l=e.height,f=void 0===l?700:l,d=e.children,p=(0,i.useBackend)(t),h=p.act,v=p.data,g=v.PC_device_theme,m=v.PC_batteryicon,y=v.PC_showbatteryicon,b=v.PC_batterypercent,_=v.PC_ntneticon,w=v.PC_stationdate,x=v.PC_stationtime,S=v.PC_programheaders,C=void 0===S?[]:S,E=v.PC_showexitprogram;return(0,r.createComponentVNode)(2,c.Window,{title:n,width:s,height:f,theme:g,children:(0,r.createVNode)(1,"div","NtosWindow",[(0,r.createVNode)(1,"div","NtosWindow__header NtosHeader",[(0,r.createVNode)(1,"div","NtosHeader__left",[(0,r.createComponentVNode)(2,a.Box,{inline:!0,bold:!0,mr:2,children:[(0,r.createComponentVNode)(2,a.Button,{width:"26px",lineHeight:"22px",textAlign:"left",tooltip:w,color:"transparent",icon:"calendar",tooltipPosition:"bottom"}),x]}),(0,r.createComponentVNode)(2,a.Box,{inline:!0,italic:!0,mr:2,opacity:.33,children:"syndicate"===g?"Syndix":"NtOS"})],4),(0,r.createVNode)(1,"div","NtosHeader__right",[C.map((function(e){return(0,r.createComponentVNode)(2,a.Box,{inline:!0,mr:1,children:(0,r.createVNode)(1,"img","NtosHeader__icon",null,1,{src:(0,o.resolveAsset)(e.icon)})},e.icon)})),(0,r.createComponentVNode)(2,a.Box,{inline:!0,children:_&&(0,r.createVNode)(1,"img","NtosHeader__icon",null,1,{src:(0,o.resolveAsset)(_)})}),!(!y||!m)&&(0,r.createComponentVNode)(2,a.Box,{inline:!0,mr:1,children:[(0,r.createVNode)(1,"img","NtosHeader__icon",null,1,{src:(0,o.resolveAsset)(m)}),b&&b]}),!!E&&(0,r.createComponentVNode)(2,a.Button,{width:"26px",lineHeight:"22px",textAlign:"center",color:"transparent",icon:"window-minimize-o",tooltip:"Minimize",tooltipPosition:"bottom",onClick:function(){return h("PC_minimize")}}),!!E&&(0,r.createComponentVNode)(2,a.Button,{mr:"-3px",width:"26px",lineHeight:"22px",textAlign:"center",color:"transparent",icon:"window-close-o",tooltip:"Close",tooltipPosition:"bottom-start",onClick:function(){return h("PC_exit")}}),!E&&(0,r.createComponentVNode)(2,a.Button,{mr:"-3px",width:"26px",lineHeight:"22px",textAlign:"center",color:"transparent",icon:"power-off",tooltip:"Power off",tooltipPosition:"bottom-start",onClick:function(){return h("PC_shutdown")}})],0)],4),d],0)})};t.NtosWindow=u;u.Content=function(e){return(0,r.createVNode)(1,"div","NtosWindow__content",(0,r.normalizeProps)((0,r.createComponentVNode)(2,c.Window.Content,Object.assign({},e))),2)}},1566:function(e,t,n){"use strict";t.__esModule=!0,t.Pane=void 0;var r=n(58734),o=n(59641),i=n(62188),a=n(71558),c=n(31642),u=n(65883),s=["theme","children","className"],l=["className","fitted","children"];function f(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}var d=function(e,t){var n=e.theme,l=e.children,d=e.className,p=f(e,s),h=(0,i.useBackend)(t).suspended,v=(0,c.useDebug)(t).debugLayout;return(0,r.normalizeProps)((0,r.createComponentVNode)(2,u.Layout,Object.assign({className:(0,o.classes)(["Window",d]),theme:n},p,{children:(0,r.createComponentVNode)(2,a.Box,{fillPositionedParent:!0,className:v&&"debug-layout",children:!h&&l})})))};t.Pane=d;d.Content=function(e){var t=e.className,n=e.fitted,i=e.children,a=f(e,l);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,u.Layout.Content,Object.assign({className:(0,o.classes)(["Window__content",t])},a,{children:n&&i||(0,r.createVNode)(1,"div","Window__contentPadding",i,0)})))}},62986:function(e,t,n){"use strict";t.__esModule=!0,t.Window=void 0;var r=n(58734),o=n(59641),i=n(32289),a=n(40946),c=n(62188),u=n(71558),s=n(78419),l=n(31642),f=(n(90525),n(59509)),d=n(66905),p=n(65883),h=["className","fitted","children"];function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}var g=(0,d.createLogger)("Window"),m=[400,600],y=function(e){var t,n;function u(){return e.apply(this,arguments)||this}n=e,(t=u).prototype=Object.create(n.prototype),t.prototype.constructor=t,v(t,n);var d=u.prototype;return d.componentDidMount=function(){var e=(0,c.useBackend)(this.context).suspended,t=this.props.canClose,n=void 0===t||t;e||(Byond.winset(Byond.windowId,{"can-close":Boolean(n)}),g.log("mounting"),this.updateGeometry())},d.componentDidUpdate=function(e){(this.props.width!==e.width||this.props.height!==e.height)&&this.updateGeometry()},d.updateGeometry=function(){var e,t=(0,c.useBackend)(this.context).config,n=Object.assign({size:m},t.window);this.props.width&&this.props.height&&(n.size=[this.props.width,this.props.height]),null!=(e=t.window)&&e.key&&(0,f.setWindowKey)(t.window.key),(0,f.recallWindowGeometry)(n)},d.render=function(){var e,t=this.props,n=t.canClose,u=void 0===n||n,d=t.theme,h=t.title,v=t.children,m=t.buttons,y=(0,c.useBackend)(this.context),b=y.config,w=y.suspended,x=(0,l.useDebug)(this.context).debugLayout,S=(0,i.useDispatch)(this.context),C=null==(e=b.window)?void 0:e.fancy,E=b.user&&(b.user.observer?b.status=0||(o[n]=e[n]);return o}(e,h);return(0,r.normalizeProps)((0,r.createComponentVNode)(2,p.Layout.Content,Object.assign({className:(0,o.classes)(["Window__content",t])},a,{children:n&&i||(0,r.createVNode)(1,"div","Window__contentPadding",i,0)})))};var b=function(e){switch(e){case s.UI_INTERACTIVE:return"good";case s.UI_UPDATE:return"average";case s.UI_DISABLED:default:return"bad"}},_=function(e,t){var n=e.className,c=e.title,s=e.status,l=e.canClose,f=e.fancy,d=e.onDragStart,p=e.onClose,h=e.children,v=((0,i.useDispatch)(t),"string"==typeof c&&c===c.toLowerCase()&&(0,a.toTitleCase)(c)||c);return(0,r.createVNode)(1,"div",(0,o.classes)(["TitleBar",n]),[s===undefined&&(0,r.createComponentVNode)(2,u.Icon,{className:"TitleBar__statusIcon",name:"tools",opacity:.5})||(0,r.createComponentVNode)(2,u.Icon,{className:"TitleBar__statusIcon",color:b(s),name:"eye"}),(0,r.createVNode)(1,"div","TitleBar__dragZone",null,1,{onMousedown:function(e){return f&&d(e)}}),(0,r.createVNode)(1,"div","TitleBar__title",[v,!!h&&(0,r.createVNode)(1,"div","TitleBar__buttons",h,0)],0),!1,Boolean(f&&l)&&(0,r.createVNode)(1,"div","TitleBar__close TitleBar__clickable",Byond.IS_LTE_IE8?"x":"\xd7",0,{onclick:p})],0)}},2798:function(e,t,n){"use strict";t.__esModule=!0,t.Window=t.Pane=t.NtosWindow=t.Layout=void 0;var r=n(65883);t.Layout=r.Layout;var o=n(23554);t.NtosWindow=o.NtosWindow;var i=n(1566);t.Pane=i.Pane;var a=n(62986);t.Window=a.Window},27803:function(e,t){"use strict";t.__esModule=!0,t.captureExternalLinks=void 0;t.captureExternalLinks=function(){document.addEventListener("click",(function(e){for(var t=e.target;;){if(!t||t===document.body)return;if("a"===String(t.tagName).toLowerCase())break;t=t.parentElement}var n=t.getAttribute("href")||"";if(!("?"===n.charAt(0)||n.startsWith("byond://"))){e.preventDefault();var r=n;r.toLowerCase().startsWith("www")&&(r="https://"+r),Byond.sendMessage({type:"openLink",url:r})}}))}},66905:function(e,t,n){"use strict";t.__esModule=!0,t.logger=t.createLogger=void 0;n(60207);var r=0,o=1,i=2,a=3,c=4,u=function(e,t){void 0===t&&(t="Generic");for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o=i){var a=[t].concat(r).map((function(e){return"string"==typeof e?e:e instanceof Error?e.stack||String(e):JSON.stringify(e)})).filter((function(e){return e})).join(" ")+"\nUser Agent: "+navigator.userAgent;Byond.sendMessage({type:"log",ns:t,message:a})}},s=function(e){return{debug:function(){for(var t=arguments.length,n=new Array(t),o=0;o0&&(0,o.round)(c.width)/e.offsetWidth||1,s=e.offsetHeight>0&&(0,o.round)(c.height)/e.offsetHeight||1);var l=((0,r.isElement)(e)?(0,i["default"])(e):window).visualViewport,f=!(0,a["default"])()&&n,d=(c.left+(f&&l?l.offsetLeft:0))/u,p=(c.top+(f&&l?l.offsetTop:0))/s,h=c.width/u,g=c.height/s;return{width:h,height:g,top:p,right:d+h,bottom:p+g,left:d,x:d,y:p}};var r=n(75011),o=n(14194),i=c(n(1866)),a=c(n(45407));function c(e){return e&&e.__esModule?e:{"default":e}}},35823:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t,n,r){var o="clippingParents"===t?function(e){var t=(0,a["default"])((0,d["default"])(e)),n=["absolute","fixed"].indexOf((0,s["default"])(e).position)>=0,r=n&&(0,l.isHTMLElement)(e)?(0,c["default"])(e):e;if(!(0,l.isElement)(r))return[];return t.filter((function(e){return(0,l.isElement)(e)&&(0,p["default"])(e,r)&&"body"!==(0,h["default"])(e)}))}(e):[].concat(t),i=[].concat(o,[n]),u=i[0],f=i.reduce((function(t,n){var o=y(e,n,r);return t.top=(0,v.max)(o.top,t.top),t.right=(0,v.min)(o.right,t.right),t.bottom=(0,v.min)(o.bottom,t.bottom),t.left=(0,v.max)(o.left,t.left),t}),y(e,u,r));return f.width=f.right-f.left,f.height=f.bottom-f.top,f.x=f.left,f.y=f.top,f};var r=n(83996),o=m(n(75047)),i=m(n(37407)),a=m(n(97262)),c=m(n(66689)),u=m(n(36748)),s=m(n(77060)),l=n(75011),f=m(n(97617)),d=m(n(84330)),p=m(n(89691)),h=m(n(72793)),g=m(n(14834)),v=n(14194);function m(e){return e&&e.__esModule?e:{"default":e}}function y(e,t,n){return t===r.viewport?(0,g["default"])((0,o["default"])(e,n)):(0,l.isElement)(t)?function(e,t){var n=(0,f["default"])(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):(0,g["default"])((0,i["default"])((0,u["default"])(e)))}},4254:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t,n){void 0===n&&(n=!1);var f=(0,a.isHTMLElement)(t),d=(0,a.isHTMLElement)(t)&&function(e){var t=e.getBoundingClientRect(),n=(0,l.round)(t.width)/e.offsetWidth||1,r=(0,l.round)(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),p=(0,u["default"])(t),h=(0,r["default"])(e,d,n),g={scrollLeft:0,scrollTop:0},v={x:0,y:0};(f||!f&&!n)&&(("body"!==(0,i["default"])(t)||(0,s["default"])(p))&&(g=(0,o["default"])(t)),(0,a.isHTMLElement)(t)?((v=(0,r["default"])(t,!0)).x+=t.clientLeft,v.y+=t.clientTop):p&&(v.x=(0,c["default"])(p)));return{x:h.left+g.scrollLeft-v.x,y:h.top+g.scrollTop-v.y,width:h.width,height:h.height}};var r=f(n(97617)),o=f(n(86394)),i=f(n(72793)),a=n(75011),c=f(n(44653)),u=f(n(36748)),s=f(n(9135)),l=n(14194);function f(e){return e&&e.__esModule?e:{"default":e}}},77060:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return(0,o["default"])(e).getComputedStyle(e)};var r,o=(r=n(1866))&&r.__esModule?r:{"default":r}},36748:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return(((0,r.isElement)(e)?e.ownerDocument:e.document)||window.document).documentElement};var r=n(75011)},37407:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t,n=(0,r["default"])(e),u=(0,a["default"])(e),s=null==(t=e.ownerDocument)?void 0:t.body,l=(0,c.max)(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),f=(0,c.max)(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),d=-u.scrollLeft+(0,i["default"])(e),p=-u.scrollTop;"rtl"===(0,o["default"])(s||n).direction&&(d+=(0,c.max)(n.clientWidth,s?s.clientWidth:0)-l);return{width:l,height:f,x:d,y:p}};var r=u(n(36748)),o=u(n(77060)),i=u(n(44653)),a=u(n(10416)),c=n(14194);function u(e){return e&&e.__esModule?e:{"default":e}}},89821:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}},92957:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t=(0,o["default"])(e),n=e.offsetWidth,r=e.offsetHeight;Math.abs(t.width-n)<=1&&(n=t.width);Math.abs(t.height-r)<=1&&(r=t.height);return{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}};var r,o=(r=n(97617))&&r.__esModule?r:{"default":r}},72793:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return e?(e.nodeName||"").toLowerCase():null}},86394:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return e!==(0,o["default"])(e)&&(0,i.isHTMLElement)(e)?(0,a["default"])(e):(0,r["default"])(e)};var r=c(n(10416)),o=c(n(1866)),i=n(75011),a=c(n(89821));function c(e){return e&&e.__esModule?e:{"default":e}}},66689:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t=(0,r["default"])(e),n=f(e);for(;n&&(0,c["default"])(n)&&"static"===(0,i["default"])(n).position;)n=f(n);if(n&&("html"===(0,o["default"])(n)||"body"===(0,o["default"])(n)&&"static"===(0,i["default"])(n).position))return t;return n||function(e){var t=/firefox/i.test((0,s["default"])());if(/Trident/i.test((0,s["default"])())&&(0,a.isHTMLElement)(e)){if("fixed"===(0,i["default"])(e).position)return null}var n=(0,u["default"])(e);(0,a.isShadowRoot)(n)&&(n=n.host);for(;(0,a.isHTMLElement)(n)&&["html","body"].indexOf((0,o["default"])(n))<0;){var r=(0,i["default"])(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t};var r=l(n(1866)),o=l(n(72793)),i=l(n(77060)),a=n(75011),c=l(n(46795)),u=l(n(84330)),s=l(n(36110));function l(e){return e&&e.__esModule?e:{"default":e}}function f(e){return(0,a.isHTMLElement)(e)&&"fixed"!==(0,i["default"])(e).position?e.offsetParent:null}},84330:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){if("html"===(0,r["default"])(e))return e;return e.assignedSlot||e.parentNode||((0,i.isShadowRoot)(e)?e.host:null)||(0,o["default"])(e)};var r=a(n(72793)),o=a(n(36748)),i=n(75011);function a(e){return e&&e.__esModule?e:{"default":e}}},89523:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function u(e){if(["html","body","#document"].indexOf((0,i["default"])(e))>=0)return e.ownerDocument.body;if((0,a.isHTMLElement)(e)&&(0,o["default"])(e))return e;return u((0,r["default"])(e))};var r=c(n(84330)),o=c(n(9135)),i=c(n(72793)),a=n(75011);function c(e){return e&&e.__esModule?e:{"default":e}}},75047:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t){var n=(0,r["default"])(e),c=(0,o["default"])(e),u=n.visualViewport,s=c.clientWidth,l=c.clientHeight,f=0,d=0;if(u){s=u.width,l=u.height;var p=(0,a["default"])();(p||!p&&"fixed"===t)&&(f=u.offsetLeft,d=u.offsetTop)}return{width:s,height:l,x:f+(0,i["default"])(e),y:d}};var r=c(n(1866)),o=c(n(36748)),i=c(n(44653)),a=c(n(45407));function c(e){return e&&e.__esModule?e:{"default":e}}},1866:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}},10416:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t=(0,o["default"])(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}};var r,o=(r=n(1866))&&r.__esModule?r:{"default":r}},44653:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return(0,r["default"])((0,o["default"])(e)).left+(0,i["default"])(e).scrollLeft};var r=a(n(97617)),o=a(n(36748)),i=a(n(10416));function a(e){return e&&e.__esModule?e:{"default":e}}},75011:function(e,t,n){"use strict";t.__esModule=!0,t.isElement=function(e){var t=(0,o["default"])(e).Element;return e instanceof t||e instanceof Element},t.isHTMLElement=function(e){var t=(0,o["default"])(e).HTMLElement;return e instanceof t||e instanceof HTMLElement},t.isShadowRoot=function(e){if("undefined"==typeof ShadowRoot)return!1;var t=(0,o["default"])(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot};var r,o=(r=n(1866))&&r.__esModule?r:{"default":r}},45407:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(){return!/^((?!chrome|android).)*safari/i.test((0,o["default"])())};var r,o=(r=n(36110))&&r.__esModule?r:{"default":r}},9135:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t=(0,o["default"])(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)};var r,o=(r=n(77060))&&r.__esModule?r:{"default":r}},46795:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return["table","td","th"].indexOf((0,o["default"])(e))>=0};var r,o=(r=n(72793))&&r.__esModule?r:{"default":r}},97262:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function u(e,t){var n;void 0===t&&(t=[]);var c=(0,r["default"])(e),s=c===(null==(n=e.ownerDocument)?void 0:n.body),l=(0,i["default"])(c),f=s?[l].concat(l.visualViewport||[],(0,a["default"])(c)?c:[]):c,d=t.concat(f);return s?d:d.concat(u((0,o["default"])(f)))};var r=c(n(89523)),o=c(n(84330)),i=c(n(1866)),a=c(n(9135));function c(e){return e&&e.__esModule?e:{"default":e}}},83996:function(e,t){"use strict";t.__esModule=!0,t.write=t.viewport=t.variationPlacements=t.top=t.start=t.right=t.reference=t.read=t.popper=t.placements=t.modifierPhases=t.main=t.left=t.end=t.clippingParents=t.bottom=t.beforeWrite=t.beforeRead=t.beforeMain=t.basePlacements=t.auto=t.afterWrite=t.afterRead=t.afterMain=void 0;var n=t.top="top",r=t.bottom="bottom",o=t.right="right",i=t.left="left",a=t.auto="auto",c=t.basePlacements=[n,r,o,i],u=t.start="start",s=t.end="end",l=(t.clippingParents="clippingParents",t.viewport="viewport",t.popper="popper",t.reference="reference",t.variationPlacements=c.reduce((function(e,t){return e.concat([t+"-"+u,t+"-"+s])}),[]),t.placements=[].concat(c,[a]).reduce((function(e,t){return e.concat([t,t+"-"+u,t+"-"+s])}),[]),t.beforeRead="beforeRead"),f=t.read="read",d=t.afterRead="afterRead",p=t.beforeMain="beforeMain",h=t.main="main",g=t.afterMain="afterMain",v=t.beforeWrite="beforeWrite",m=t.write="write",y=t.afterWrite="afterWrite";t.modifierPhases=[l,f,d,p,h,g,v,m,y]},92935:function(e,t,n){"use strict";t.__esModule=!0;var r={popperGenerator:!0,detectOverflow:!0,createPopperBase:!0,createPopper:!0,createPopperLite:!0};t.popperGenerator=t.detectOverflow=t.createPopperLite=t.createPopperBase=t.createPopper=void 0;var o=n(83996);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===o[e]||(t[e]=o[e]))}));var i=n(97934);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===i[e]||(t[e]=i[e]))}));var a=n(50252);t.popperGenerator=a.popperGenerator,t.detectOverflow=a.detectOverflow,t.createPopperBase=a.createPopper;var c=n(1728);t.createPopper=c.createPopper;var u=n(88037);t.createPopperLite=u.createPopper},38621:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r,o=(r=n(72793))&&r.__esModule?r:{"default":r},i=n(75011);t["default"]={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},a=t.elements[e];(0,i.isHTMLElement)(a)&&(0,o["default"])(a)&&(Object.assign(a.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?a.removeAttribute(e):a.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],a=t.attributes[e]||{},c=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});(0,i.isHTMLElement)(r)&&(0,o["default"])(r)&&(Object.assign(r.style,c),Object.keys(a).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]}},90860:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=d(n(85312)),o=d(n(92957)),i=d(n(89691)),a=d(n(66689)),c=d(n(86274)),u=n(52855),s=d(n(10632)),l=d(n(59597)),f=n(83996);function d(e){return e&&e.__esModule?e:{"default":e}}var p=function(e,t){return e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e,(0,s["default"])("number"!=typeof e?e:(0,l["default"])(e,f.basePlacements))};t["default"]={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,i=e.name,s=e.options,l=n.elements.arrow,d=n.modifiersData.popperOffsets,h=(0,r["default"])(n.placement),g=(0,c["default"])(h),v=[f.left,f.right].indexOf(h)>=0?"height":"width";if(l&&d){var m=p(s.padding,n),y=(0,o["default"])(l),b="y"===g?f.top:f.left,_="y"===g?f.bottom:f.right,w=n.rects.reference[v]+n.rects.reference[g]-d[g]-n.rects.popper[v],x=d[g]-n.rects.reference[g],S=(0,a["default"])(l),C=S?"y"===g?S.clientHeight||0:S.clientWidth||0:0,E=w/2-x/2,N=m[b],O=C-y[v]-m[_],M=C/2-y[v]/2+E,k=(0,u.within)(N,M,O),T=g;n.modifiersData[i]=((t={})[T]=k,t.centerOffset=k-M,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&(0,i["default"])(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]}},15224:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,t.mapToStyles=p;var r=n(83996),o=f(n(66689)),i=f(n(1866)),a=f(n(36748)),c=f(n(77060)),u=f(n(85312)),s=f(n(48218)),l=n(14194);function f(e){return e&&e.__esModule?e:{"default":e}}var d={top:"auto",right:"auto",bottom:"auto",left:"auto"};function p(e){var t,n=e.popper,u=e.popperRect,s=e.placement,f=e.variation,p=e.offsets,h=e.position,g=e.gpuAcceleration,v=e.adaptive,m=e.roundOffsets,y=e.isFixed,b=p.x,_=void 0===b?0:b,w=p.y,x=void 0===w?0:w,S="function"==typeof m?m({x:_,y:x}):{x:_,y:x};_=S.x,x=S.y;var C=p.hasOwnProperty("x"),E=p.hasOwnProperty("y"),N=r.left,O=r.top,M=window;if(v){var k=(0,o["default"])(n),T="clientHeight",I="clientWidth";if(k===(0,i["default"])(n)&&(k=(0,a["default"])(n),"static"!==(0,c["default"])(k).position&&"absolute"===h&&(T="scrollHeight",I="scrollWidth")),s===r.top||(s===r.left||s===r.right)&&f===r.end)O=r.bottom,x-=(y&&k===M&&M.visualViewport?M.visualViewport.height:k[T])-u.height,x*=g?1:-1;if(s===r.left||(s===r.top||s===r.bottom)&&f===r.end)N=r.right,_-=(y&&k===M&&M.visualViewport?M.visualViewport.width:k[I])-u.width,_*=g?1:-1}var A,P=Object.assign({position:h},v&&d),L=!0===m?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:(0,l.round)(n*o)/o||0,y:(0,l.round)(r*o)/o||0}}({x:_,y:x},(0,i["default"])(n)):{x:_,y:x};return _=L.x,x=L.y,g?Object.assign({},P,((A={})[O]=E?"0":"",A[N]=C?"0":"",A.transform=(M.devicePixelRatio||1)<=1?"translate("+_+"px, "+x+"px)":"translate3d("+_+"px, "+x+"px, 0)",A)):Object.assign({},P,((t={})[O]=E?x+"px":"",t[N]=C?_+"px":"",t.transform="",t))}t["default"]={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,c=n.roundOffsets,l=void 0===c||c,f={placement:(0,u["default"])(t.placement),variation:(0,s["default"])(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,p(Object.assign({},f,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,p(Object.assign({},f,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}}},59953:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r,o=(r=n(1866))&&r.__esModule?r:{"default":r};var i={passive:!0};t["default"]={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,a=r.scroll,c=void 0===a||a,u=r.resize,s=void 0===u||u,l=(0,o["default"])(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return c&&f.forEach((function(e){e.addEventListener("scroll",n.update,i)})),s&&l.addEventListener("resize",n.update,i),function(){c&&f.forEach((function(e){e.removeEventListener("scroll",n.update,i)})),s&&l.removeEventListener("resize",n.update,i)}},data:{}}},21128:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=l(n(72310)),o=l(n(85312)),i=l(n(53379)),a=l(n(49883)),c=l(n(67450)),u=n(83996),s=l(n(48218));function l(e){return e&&e.__esModule?e:{"default":e}}t["default"]={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,l=e.name;if(!t.modifiersData[l]._skip){for(var f=n.mainAxis,d=void 0===f||f,p=n.altAxis,h=void 0===p||p,g=n.fallbackPlacements,v=n.padding,m=n.boundary,y=n.rootBoundary,b=n.altBoundary,_=n.flipVariations,w=void 0===_||_,x=n.allowedAutoPlacements,S=t.options.placement,C=(0,o["default"])(S),E=g||(C===S||!w?[(0,r["default"])(S)]:function(e){if((0,o["default"])(e)===u.auto)return[];var t=(0,r["default"])(e);return[(0,i["default"])(e),t,(0,i["default"])(t)]}(S)),N=[S].concat(E).reduce((function(e,n){return e.concat((0,o["default"])(n)===u.auto?(0,c["default"])(t,{placement:n,boundary:m,rootBoundary:y,padding:v,flipVariations:w,allowedAutoPlacements:x}):n)}),[]),O=t.rects.reference,M=t.rects.popper,k=new Map,T=!0,I=N[0],A=0;A=0,j=B?"width":"height",R=(0,a["default"])(t,{placement:P,boundary:m,rootBoundary:y,altBoundary:b,padding:v}),D=B?V?u.right:u.left:V?u.bottom:u.top;O[j]>M[j]&&(D=(0,r["default"])(D));var F=(0,r["default"])(D),Y=[];if(d&&Y.push(R[L]<=0),h&&Y.push(R[D]<=0,R[F]<=0),Y.every((function(e){return e}))){I=P,T=!1;break}k.set(P,Y)}if(T)for(var K=function(e){var t=N.find((function(t){var n=k.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return I=t,"break"},U=w?3:1;U>0;U--){if("break"===K(U))break}t.placement!==I&&(t.modifiersData[l]._skip=!0,t.placement=I,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},17945:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r,o=n(83996),i=(r=n(49883))&&r.__esModule?r:{"default":r};function a(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function c(e){return[o.top,o.right,o.bottom,o.left].some((function(t){return e[t]>=0}))}t["default"]={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,u=t.modifiersData.preventOverflow,s=(0,i["default"])(t,{elementContext:"reference"}),l=(0,i["default"])(t,{altBoundary:!0}),f=a(s,r),d=a(l,o,u),p=c(f),h=c(d);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:d,isReferenceHidden:p,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":h})}}},97934:function(e,t,n){"use strict";t.__esModule=!0,t.preventOverflow=t.popperOffsets=t.offset=t.hide=t.flip=t.eventListeners=t.computeStyles=t.arrow=t.applyStyles=void 0;var r=d(n(38621));t.applyStyles=r["default"];var o=d(n(90860));t.arrow=o["default"];var i=d(n(15224));t.computeStyles=i["default"];var a=d(n(59953));t.eventListeners=a["default"];var c=d(n(21128));t.flip=c["default"];var u=d(n(17945));t.hide=u["default"];var s=d(n(90642));t.offset=s["default"];var l=d(n(23786));t.popperOffsets=l["default"];var f=d(n(78230));function d(e){return e&&e.__esModule?e:{"default":e}}t.preventOverflow=f["default"]},90642:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,t.distanceAndSkiddingToXY=a;var r,o=(r=n(85312))&&r.__esModule?r:{"default":r},i=n(83996);function a(e,t,n){var r=(0,o["default"])(e),a=[i.left,i.top].indexOf(r)>=0?-1:1,c="function"==typeof n?n(Object.assign({},t,{placement:e})):n,u=c[0],s=c[1];return u=u||0,s=(s||0)*a,[i.left,i.right].indexOf(r)>=0?{x:s,y:u}:{x:u,y:s}}t["default"]={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,c=void 0===o?[0,0]:o,u=i.placements.reduce((function(e,n){return e[n]=a(n,t.rects,c),e}),{}),s=u[t.placement],l=s.x,f=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=f),t.modifiersData[r]=u}}},23786:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r,o=(r=n(85694))&&r.__esModule?r:{"default":r};t["default"]={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=(0,o["default"])({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}}},78230:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(83996),o=h(n(85312)),i=h(n(86274)),a=h(n(4320)),c=n(52855),u=h(n(92957)),s=h(n(66689)),l=h(n(49883)),f=h(n(48218)),d=h(n(23941)),p=n(14194);function h(e){return e&&e.__esModule?e:{"default":e}}t["default"]={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,h=e.name,g=n.mainAxis,v=void 0===g||g,m=n.altAxis,y=void 0!==m&&m,b=n.boundary,_=n.rootBoundary,w=n.altBoundary,x=n.padding,S=n.tether,C=void 0===S||S,E=n.tetherOffset,N=void 0===E?0:E,O=(0,l["default"])(t,{boundary:b,rootBoundary:_,padding:x,altBoundary:w}),M=(0,o["default"])(t.placement),k=(0,f["default"])(t.placement),T=!k,I=(0,i["default"])(M),A=(0,a["default"])(I),P=t.modifiersData.popperOffsets,L=t.rects.reference,V=t.rects.popper,B="function"==typeof N?N(Object.assign({},t.rects,{placement:t.placement})):N,j="number"==typeof B?{mainAxis:B,altAxis:B}:Object.assign({mainAxis:0,altAxis:0},B),R=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(P){if(v){var F,Y="y"===I?r.top:r.left,K="y"===I?r.bottom:r.right,U="y"===I?"height":"width",H=P[I],G=H+O[Y],z=H-O[K],W=C?-V[U]/2:0,$=k===r.start?L[U]:V[U],q=k===r.start?-V[U]:-L[U],X=t.elements.arrow,Q=C&&X?(0,u["default"])(X):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:(0,d["default"])(),J=Z[Y],ee=Z[K],te=(0,c.within)(0,L[U],Q[U]),ne=T?L[U]/2-W-te-J-j.mainAxis:$-te-J-j.mainAxis,re=T?-L[U]/2+W+te+ee+j.mainAxis:q+te+ee+j.mainAxis,oe=t.elements.arrow&&(0,s["default"])(t.elements.arrow),ie=oe?"y"===I?oe.clientTop||0:oe.clientLeft||0:0,ae=null!=(F=null==R?void 0:R[I])?F:0,ce=H+ne-ae-ie,ue=H+re-ae,se=(0,c.within)(C?(0,p.min)(G,ce):G,H,C?(0,p.max)(z,ue):z);P[I]=se,D[I]=se-H}if(y){var le,fe="x"===I?r.top:r.left,de="x"===I?r.bottom:r.right,pe=P[A],he="y"===A?"height":"width",ge=pe+O[fe],ve=pe-O[de],me=-1!==[r.top,r.left].indexOf(M),ye=null!=(le=null==R?void 0:R[A])?le:0,be=me?ge:pe-L[he]-V[he]-ye+j.altAxis,_e=me?pe+L[he]+V[he]-ye-j.altAxis:ve,we=C&&me?(0,c.withinMaxClamp)(be,pe,_e):(0,c.within)(C?be:ge,pe,C?_e:ve);P[A]=we,D[A]=we-pe}t.modifiersData[h]=D}},requiresIfExists:["offset"]}},88037:function(e,t,n){"use strict";t.__esModule=!0,t.defaultModifiers=t.createPopper=void 0;var r=n(50252);t.popperGenerator=r.popperGenerator,t.detectOverflow=r.detectOverflow;var o=u(n(59953)),i=u(n(23786)),a=u(n(15224)),c=u(n(38621));function u(e){return e&&e.__esModule?e:{"default":e}}var s=t.defaultModifiers=[o["default"],i["default"],a["default"],c["default"]];t.createPopper=(0,r.popperGenerator)({defaultModifiers:s})},1728:function(e,t,n){"use strict";t.__esModule=!0;var r={createPopper:!0,createPopperLite:!0,defaultModifiers:!0,popperGenerator:!0,detectOverflow:!0};t.defaultModifiers=t.createPopperLite=t.createPopper=void 0;var o=n(50252);t.popperGenerator=o.popperGenerator,t.detectOverflow=o.detectOverflow;var i=v(n(59953)),a=v(n(23786)),c=v(n(15224)),u=v(n(38621)),s=v(n(90642)),l=v(n(21128)),f=v(n(78230)),d=v(n(90860)),p=v(n(17945)),h=n(88037);t.createPopperLite=h.createPopper;var g=n(97934);function v(e){return e&&e.__esModule?e:{"default":e}}Object.keys(g).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===g[e]||(t[e]=g[e]))}));var m=t.defaultModifiers=[i["default"],a["default"],c["default"],u["default"],s["default"],l["default"],f["default"],d["default"],p["default"]];t.createPopperLite=t.createPopper=(0,o.popperGenerator)({defaultModifiers:m})},67450:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t){void 0===t&&(t={});var n=t,c=n.placement,u=n.boundary,s=n.rootBoundary,l=n.padding,f=n.flipVariations,d=n.allowedAutoPlacements,p=void 0===d?o.placements:d,h=(0,r["default"])(c),g=h?f?o.variationPlacements:o.variationPlacements.filter((function(e){return(0,r["default"])(e)===h})):o.basePlacements,v=g.filter((function(e){return p.indexOf(e)>=0}));0===v.length&&(v=g);var m=v.reduce((function(t,n){return t[n]=(0,i["default"])(e,{placement:n,boundary:u,rootBoundary:s,padding:l})[(0,a["default"])(n)],t}),{});return Object.keys(m).sort((function(e,t){return m[e]-m[t]}))};var r=c(n(48218)),o=n(83996),i=c(n(49883)),a=c(n(85312));function c(e){return e&&e.__esModule?e:{"default":e}}},85694:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t,n=e.reference,c=e.element,u=e.placement,s=u?(0,r["default"])(u):null,l=u?(0,o["default"])(u):null,f=n.x+n.width/2-c.width/2,d=n.y+n.height/2-c.height/2;switch(s){case a.top:t={x:f,y:n.y-c.height};break;case a.bottom:t={x:f,y:n.y+n.height};break;case a.right:t={x:n.x+n.width,y:d};break;case a.left:t={x:n.x-c.width,y:d};break;default:t={x:n.x,y:n.y}}var p=s?(0,i["default"])(s):null;if(null!=p){var h="y"===p?"height":"width";switch(l){case a.start:t[p]=t[p]-(n[h]/2-c[h]/2);break;case a.end:t[p]=t[p]+(n[h]/2-c[h]/2)}}return t};var r=c(n(85312)),o=c(n(48218)),i=c(n(86274)),a=n(83996);function c(e){return e&&e.__esModule?e:{"default":e}}},63889:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=undefined,n(e())}))}))),t}}},49883:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e,t){void 0===t&&(t={});var n=t,d=n.placement,p=void 0===d?e.placement:d,h=n.strategy,g=void 0===h?e.strategy:h,v=n.boundary,m=void 0===v?u.clippingParents:v,y=n.rootBoundary,b=void 0===y?u.viewport:y,_=n.elementContext,w=void 0===_?u.popper:_,x=n.altBoundary,S=void 0!==x&&x,C=n.padding,E=void 0===C?0:C,N=(0,l["default"])("number"!=typeof E?E:(0,f["default"])(E,u.basePlacements)),O=w===u.popper?u.reference:u.popper,M=e.rects.popper,k=e.elements[S?O:w],T=(0,r["default"])((0,s.isElement)(k)?k:k.contextElement||(0,o["default"])(e.elements.popper),m,b,g),I=(0,i["default"])(e.elements.reference),A=(0,a["default"])({reference:I,element:M,strategy:"absolute",placement:p}),P=(0,c["default"])(Object.assign({},M,A)),L=w===u.popper?P:I,V={top:T.top-L.top+N.top,bottom:L.bottom-T.bottom+N.bottom,left:T.left-L.left+N.left,right:L.right-T.right+N.right},B=e.modifiersData.offset;if(w===u.popper&&B){var j=B[p];Object.keys(V).forEach((function(e){var t=[u.right,u.bottom].indexOf(e)>=0?1:-1,n=[u.top,u.bottom].indexOf(e)>=0?"y":"x";V[e]+=j[n]*t}))}return V};var r=d(n(35823)),o=d(n(36748)),i=d(n(97617)),a=d(n(85694)),c=d(n(14834)),u=n(83996),s=n(75011),l=d(n(10632)),f=d(n(59597));function d(e){return e&&e.__esModule?e:{"default":e}}},59597:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}},4320:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return"x"===e?"y":"x"}},85312:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return e.split("-")[0]};n(83996)},23941:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(){return{top:0,right:0,bottom:0,left:0}}},86274:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}},72310:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return e.replace(/left|right|bottom|top/g,(function(e){return n[e]}))};var n={left:"right",right:"left",bottom:"top",top:"bottom"}},53379:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return e.replace(/start|end/g,(function(e){return n[e]}))};var n={start:"end",end:"start"}},48218:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return e.split("-")[1]}},14194:function(e,t){"use strict";t.__esModule=!0,t.round=t.min=t.max=void 0;t.max=Math.max,t.min=Math.min,t.round=Math.round},27343:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}},10632:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){return Object.assign({},(0,o["default"])(),e)};var r,o=(r=n(23941))&&r.__esModule?r:{"default":r}},47307:function(e,t,n){"use strict";t.__esModule=!0,t["default"]=function(e){var t=function(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}(e);return r.modifierPhases.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])};var r=n(83996)},14834:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}},36110:function(e,t){"use strict";t.__esModule=!0,t["default"]=function(){var e=navigator.userAgentData;if(null!=e&&e.brands&&Array.isArray(e.brands))return e.brands.map((function(e){return e.brand+"/"+e.version})).join(" ");return navigator.userAgent}},52855:function(e,t,n){"use strict";t.__esModule=!0,t.within=o,t.withinMaxClamp=function(e,t,n){var r=o(e,t,n);return r>n?n:r};var r=n(14194);function o(e,t,n){return(0,r.max)(e,(0,r.min)(t,n))}},85964:function(e){"use strict";e.exports=function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(){function e(e,t){return e.__proto__=t,e}return e}(),t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,o,i){return r=n()?Reflect.construct:function(){function e(e,n,r){var o=[null];o.push.apply(o,n);var i=new(Function.bind.apply(e,o));return r&&t(i,r.prototype),i}return e}(),r.apply(null,arguments)}function o(e){return i(e)||a(e)||c(e)||s()}function i(e){if(Array.isArray(e))return u(e)}function a(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),o=1;o/gm),X=v(/\${[\w\W]*}/gm),Q=v(/^data-[\-\w.\u00B7-\uFFFF]/),Z=v(/^aria-[\-\w]+$/),J=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ee=v(/^(?:\w+script|data):/i),te=v(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ne=v(/^html$/i),re=function(){function e(){return"undefined"==typeof window?null:window}return e}(),oe=function(){function t(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(r=n.currentScript.getAttribute(o));var i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML:function(){function e(e){return e}return e}(),createScriptURL:function(){function e(e){return e}return e}()})}catch(a){return null}}return t}();function ie(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:re(),n=function(){function e(e){return ie(e)}return e}();if(n.version="2.4.7",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,i=t.document,a=t.DocumentFragment,c=t.HTMLTemplateElement,u=t.Node,s=t.Element,l=t.NodeFilter,f=t.NamedNodeMap,d=void 0===f?t.NamedNodeMap||t.MozNamedAttrMap:f,p=t.HTMLFormElement,h=t.DOMParser,v=t.trustedTypes,m=s.prototype,y=B(m,"cloneNode"),b=B(m,"nextSibling"),_=B(m,"childNodes"),A=B(m,"parentNode");if("function"==typeof c){var P=i.createElement("template");P.content&&P.content.ownerDocument&&(i=P.content.ownerDocument)}var ae=oe(v,r),ce=ae?ae.createHTML(""):"",ue=i,se=ue.implementation,le=ue.createNodeIterator,fe=ue.createDocumentFragment,de=ue.getElementsByTagName,pe=r.importNode,he={};try{he=V(i).documentMode?i.documentMode:{}}catch(Pt){}var ge={};n.isSupported="function"==typeof A&&se&&se.createHTMLDocument!==undefined&&9!==he;var ve,me,ye=$,be=q,_e=X,we=Q,xe=Z,Se=ee,Ce=te,Ee=J,Ne=null,Oe=L({},[].concat(o(j),o(R),o(D),o(Y),o(U))),Me=null,ke=L({},[].concat(o(H),o(G),o(z),o(W))),Te=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ie=null,Ae=null,Pe=!0,Le=!0,Ve=!1,Be=!0,je=!1,Re=!1,De=!1,Fe=!1,Ye=!1,Ke=!1,Ue=!1,He=!0,Ge=!1,ze="user-content-",We=!0,$e=!1,qe={},Xe=null,Qe=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ze=null,Je=L({},["audio","video","img","source","image","track"]),et=null,tt=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",rt="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml",it=ot,at=!1,ct=null,ut=L({},[nt,rt,ot],E),st=["application/xhtml+xml","text/html"],lt="text/html",ft=null,dt=i.createElement("form"),pt=function(){function e(e){return e instanceof RegExp||e instanceof Function}return e}(),ht=function(){function t(t){ft&&ft===t||(t&&"object"===e(t)||(t={}),t=V(t),ve=ve=-1===st.indexOf(t.PARSER_MEDIA_TYPE)?lt:t.PARSER_MEDIA_TYPE,me="application/xhtml+xml"===ve?E:C,Ne="ALLOWED_TAGS"in t?L({},t.ALLOWED_TAGS,me):Oe,Me="ALLOWED_ATTR"in t?L({},t.ALLOWED_ATTR,me):ke,ct="ALLOWED_NAMESPACES"in t?L({},t.ALLOWED_NAMESPACES,E):ut,et="ADD_URI_SAFE_ATTR"in t?L(V(tt),t.ADD_URI_SAFE_ATTR,me):tt,Ze="ADD_DATA_URI_TAGS"in t?L(V(Je),t.ADD_DATA_URI_TAGS,me):Je,Xe="FORBID_CONTENTS"in t?L({},t.FORBID_CONTENTS,me):Qe,Ie="FORBID_TAGS"in t?L({},t.FORBID_TAGS,me):{},Ae="FORBID_ATTR"in t?L({},t.FORBID_ATTR,me):{},qe="USE_PROFILES"in t&&t.USE_PROFILES,Pe=!1!==t.ALLOW_ARIA_ATTR,Le=!1!==t.ALLOW_DATA_ATTR,Ve=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,je=t.SAFE_FOR_TEMPLATES||!1,Re=t.WHOLE_DOCUMENT||!1,Ye=t.RETURN_DOM||!1,Ke=t.RETURN_DOM_FRAGMENT||!1,Ue=t.RETURN_TRUSTED_TYPE||!1,Fe=t.FORCE_BODY||!1,He=!1!==t.SANITIZE_DOM,Ge=t.SANITIZE_NAMED_PROPS||!1,We=!1!==t.KEEP_CONTENT,$e=t.IN_PLACE||!1,Ee=t.ALLOWED_URI_REGEXP||Ee,it=t.NAMESPACE||ot,Te=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&pt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&pt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),je&&(Le=!1),Ke&&(Ye=!0),qe&&(Ne=L({},o(U)),Me=[],!0===qe.html&&(L(Ne,j),L(Me,H)),!0===qe.svg&&(L(Ne,R),L(Me,G),L(Me,W)),!0===qe.svgFilters&&(L(Ne,D),L(Me,G),L(Me,W)),!0===qe.mathMl&&(L(Ne,Y),L(Me,z),L(Me,W))),t.ADD_TAGS&&(Ne===Oe&&(Ne=V(Ne)),L(Ne,t.ADD_TAGS,me)),t.ADD_ATTR&&(Me===ke&&(Me=V(Me)),L(Me,t.ADD_ATTR,me)),t.ADD_URI_SAFE_ATTR&&L(et,t.ADD_URI_SAFE_ATTR,me),t.FORBID_CONTENTS&&(Xe===Qe&&(Xe=V(Xe)),L(Xe,t.FORBID_CONTENTS,me)),We&&(Ne["#text"]=!0),Re&&L(Ne,["html","head","body"]),Ne.table&&(L(Ne,["tbody"]),delete Ie.tbody),g&&g(t),ft=t)}return t}(),gt=L({},["mi","mo","mn","ms","mtext"]),vt=L({},["foreignobject","desc","title","annotation-xml"]),mt=L({},["title","style","font","a","script"]),yt=L({},R);L(yt,D),L(yt,F);var bt=L({},Y);L(bt,K);var _t=function(){function e(e){var t=A(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});var n=C(e.tagName),r=C(t.tagName);return!!ct[e.namespaceURI]&&(e.namespaceURI===rt?t.namespaceURI===ot?"svg"===n:t.namespaceURI===nt?"svg"===n&&("annotation-xml"===r||gt[r]):Boolean(yt[n]):e.namespaceURI===nt?t.namespaceURI===ot?"math"===n:t.namespaceURI===rt?"math"===n&&vt[r]:Boolean(bt[n]):e.namespaceURI===ot?!(t.namespaceURI===rt&&!vt[r])&&!(t.namespaceURI===nt&&!gt[r])&&!bt[n]&&(mt[n]||!yt[n]):!("application/xhtml+xml"!==ve||!ct[e.namespaceURI]))}return e}(),wt=function(){function e(e){S(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(Pt){try{e.outerHTML=ce}catch(Pt){e.remove()}}}return e}(),xt=function(){function e(e,t){try{S(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(Pt){S(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Me[e])if(Ye||Ke)try{wt(t)}catch(Pt){}else try{t.setAttribute(e,"")}catch(Pt){}}return e}(),St=function(){function e(e){var t,n;if(Fe)e=""+e;else{var r=N(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ve&&it===ot&&(e=''+e+"");var o=ae?ae.createHTML(e):e;if(it===ot)try{t=(new h).parseFromString(o,ve)}catch(Pt){}if(!t||!t.documentElement){t=se.createDocument(it,"template",null);try{t.documentElement.innerHTML=at?ce:o}catch(Pt){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),it===ot?de.call(t,Re?"html":"body")[0]:Re?t.documentElement:a}return e}(),Ct=function(){function e(e){return le.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)}return e}(),Et=function(){function e(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)}return e}(),Nt=function(){function t(t){return"object"===e(u)?t instanceof u:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}return t}(),Ot=function(){function e(e,t,r){ge[e]&&w(ge[e],(function(e){e.call(n,t,r,ft)}))}return e}(),Mt=function(){function e(e){var t;if(Ot("beforeSanitizeElements",e,null),Et(e))return wt(e),!0;if(T(/[\u0080-\uFFFF]/,e.nodeName))return wt(e),!0;var r=me(e.nodeName);if(Ot("uponSanitizeElement",e,{tagName:r,allowedTags:Ne}),e.hasChildNodes()&&!Nt(e.firstElementChild)&&(!Nt(e.content)||!Nt(e.content.firstElementChild))&&T(/<[/\w]/g,e.innerHTML)&&T(/<[/\w]/g,e.textContent))return wt(e),!0;if("select"===r&&T(/