[
  {
    "path": ".gitignore",
    "content": "## Build generated\nbuild/\nDerivedData/\n\n## Various settings\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata/\n\n## Other\n*.moved-aside\n*.xcuserstate\n\n## Obj-C/Swift specific\n*.hmap\n*.ipa\n*.dSYM.zip\n*.dSYM\n\n## Playgrounds\ntimeline.xctimeline\nplayground.xcworkspace\n\n# Swift Package Manager\n#\n# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.\n# Packages/\n.build/\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:4.2\nimport PackageDescription\n\nlet package = Package(\n    name: \"slash\",\n    products: [.executable(name: \"slash\", targets: [\"slash\"])],\n    targets: [.target(name:  \"slash\", path: \"Sources\")]\n)\n"
  },
  {
    "path": "README.md",
    "content": "<img src=\"GitHub/slash_logo_small.png\" alt=\"logo\" width=\"200px;\"/>\n\nSlack terminal client.\n\n</br>\n\n![screenshot](GitHub/scr.png)\n\n## Getting started\n\nTo use `slash` install it via:\n\n`brew install https://raw.githubusercontent.com/slash-hq/slash/master/slash.rb` \n\nand start it by running:\n\n```\nslash\n```\n\nSlash can be used with the [development token](https://api.slack.com/docs/oauth-test-tokens) too:\n\n```\nslash <token>\n```\n\n## Keys\n\n```\nEnter  : Send a message\nTab    : Switch channel\nUp/Down: Scroll messages\nCtrl-C : Quit\n```\n\n## Commands\n\n```\n/openurl <number> : open url with <number>\n```\n\n<img src=\"GitHub/openurl_example.png\" alt=\"logo\" width=\"800px;\"/>\n\n## Retro mode\n\nThanks too [cool-retro-term](https://github.com/Swordfish90/cool-retro-term) project slash can run in retro mode\n\n![screenshot](GitHub/scr_retro.png)\n\n## Issues\n\nPlease make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.\n\n## How to contribute?\n\n1. Fork this repository and clone to your Mac.\n1. Open `slash.xcodeproj` in Xcode\n1. Build\n1. Open `Terminal` and run `<DerivedData>/Build/Products/Debug/slash`\n1. Make your changes, test and submit pull request!\n\n## FAQ\n\n1. Can I connect to multiple Slack teams?\n\n  Yes, simply start multiple `slash` instances and login to a different team in each of them.\n\n## License\n\nApache License, Version 2.0\n"
  },
  {
    "path": "Sources/Application.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass Application {\n    \n    private let terminalDevice                  : TerminalDevice\n    private let messagesListView                : MessagesListView\n    private let userInputView                   : UserInputView\n    private let channelsListView                : ChannelsListView\n    private let webClient                       : SlackWebClient\n    private let context                         : SlackContext\n    private let rtmClient                       : SlackRealTimeClient\n    \n    private var messages                        = Array<MessagesListRow>()\n    private var links                           = [String]()\n    private var selectedChannel: String?        = nil\n    private var replyIdCounter                  = 0\n    private var unreadChannelsIds               = Set<String>()\n    private let adapter                         = SlackAdapter()\n\n    init(usingDevice device: TerminalDevice, authenticatedBy token: String) throws {\n        \n        self.terminalDevice = device\n        \n        self.messagesListView = MessagesListView(self.terminalDevice)\n        self.channelsListView = ChannelsListView(self.terminalDevice)\n        self.userInputView = UserInputView(self.terminalDevice)\n        \n        self.webClient = SlackWebClient(authenticatedBy: token)\n        \n        self.terminalDevice.flush(\n            TerminalCanvas()\n                .hideCursor()\n                .color(R.color.connectingTextColor)\n                .cursor(1, 1)\n                .text(R.string.connecting).buffer)\n        \n        let team = try self.webClient.rtm()\n        \n        self.rtmClient = try SlackRealTimeClient(team.wssUrl)\n        self.context = SlackContext(withTeam: team)\n        \n        if let defaultChannel = self.context.defaultChannel {\n            self.selectedChannel = defaultChannel\n            let defaultChannelName = self.context.name(forId: defaultChannel) ?? \"\"\n            self.userInputView.placeholder = String(format: R.string.inputPlaceholder, defaultChannelName)\n            self.userInputView.draw()\n            self.reloadChannel(defaultChannel, clearChat: false)\n        }\n        \n        DispatchQueue.global(qos: .background).async { [unowned self] in\n            while true {\n                do {\n                    while true {\n                        if let event = try self.rtmClient.waitForEvent() {\n                            self.handleRealTimeSessionEvent(event)\n                        }\n                    }\n                } catch {\n                    self.appendRow(MessagesListRow(spans: [TextSpan(String(format: R.string.connectionError, \"\\(error)\"))]))\n                }\n            }\n        }\n    }\n    \n    func handleRealTimeSessionEvent(_ event: SlackEvent) {\n        \n        switch event {\n            \n        case .hello:\n            \n            self.appendRow(MessagesListRow(spans: [TextSpan(String(format: R.string.hello, self.context.teamName), withColor: R.color.helloTextColor)]))\n            \n        case .reply(let replyId, let ts):\n            \n            if let index = self.messages.index(where: { $0.id == \"pending\\(replyId)\" }) {\n                let old = self.messages.remove(at: index)\n                var newSpans = [TextSpan]()\n                newSpans.append(TextSpan(adapter.formatSlackTimestamp(\"\\(Date().timeIntervalSince1970)\") + \" \", withColor: R.color.messageTimeTextColor))\n                newSpans.append(contentsOf: old.spans)\n                self.messages.insert(MessagesListRow(channel: old.channel, id: ts, spans: newSpans), at: index)\n                self.messagesListView.draw(self.messages)\n            }\n            \n        case .message(let message):\n            \n            if let selectedChannel = self.selectedChannel {\n                if message.channel == selectedChannel {\n                    self.appendRow(self.messageListRowFor(message: message))\n                } else {\n                    self.unreadChannelsIds.insert(message.channel)\n                    self.channelsListView.draw(self.context, selectionId: self.selectedChannel, unreadIds: self.unreadChannelsIds)\n                }\n            }\n            \n        case .messageChanged(let message):\n            \n            if let index = self.messages.index(where: { $0.id == message.ts && $0.channel == message.channel }) {\n                self.messages[index] = self.messageListRowFor(message: message)\n                self.messagesListView.draw(messages)\n            }\n            \n        case .messageDeleted(let ts, let channel):\n            \n            if let index = self.messages.index(where: { $0.id == ts && $0.channel == channel }) {\n                self.messages.remove(at: index)\n                self.messagesListView.draw(self.messages)\n            }\n            \n        case .presenceChange(let user, let presence):\n\n            if let index = self.context.users.index(where: { $0.id == user }) {\n                let old = self.context.users.remove(at: index)\n                self.context.users.insert(SlackUser(id: old.id, name: old.name, color: old.color, presence: presence), at: index)\n                self.channelsListView.draw(self.context, selectionId: self.selectedChannel, unreadIds: self.unreadChannelsIds)\n            }\n            \n        case .teamRename(let newName):\n            \n            self.context.teamName = newName\n            \n            self.channelsListView.draw(self.context, selectionId: self.selectedChannel, unreadIds: self.unreadChannelsIds)\n            \n        case .desktopNotification(let title, let message):\n\n            #if os(Linux)\n                // Linux notifications not implemented yet\n            #else\n                Process.launchedProcess(launchPath: \"/usr/bin/osascript\", arguments: [\"-e\", \"display notification \\\"\\(message)\\\" with title \\\"slash: \\(title)\\\"\"])\n            #endif\n            return\n\n        case .messageReactionAdded(let reaction, let channel, let ts):\n\n            if channel == self.selectedChannel {\n                \n                self.messagesListView.draw(self.messages)\n            }\n\n        case .unknown(let message):\n            \n            return self.appendRow(MessagesListRow(spans: [\"?\", \" : \", TextSpan(message)]))\n            \n        default:\n            \n            break\n        }\n    }\n    \n    func notifyTerminalSizeHasChanged() {\n        self.messagesListView.draw(self.messages)\n        self.channelsListView.draw(self.context, selectionId: self.selectedChannel)\n        self.userInputView.draw()\n    }\n    \n    private func messageListRowFor(message: SlackMessage) -> MessagesListRow {\n        let spans = self.adapter.textSpansFor(message: message, withContext: self.context, andLinks: &self.links)\n        return MessagesListRow(channel: message.channel, id: message.ts, spans: spans)\n    }\n    \n    func appendRow(_ row: MessagesListRow) {\n        self.messages.insert(row, at: 0)\n        self.messagesListView.draw(messages)\n    }\n\n    func reloadChannel(_ channelId: String, clearChat: Bool = true) {\n        let loadingRow = MessagesListRow(spans: [TextSpan(R.string.loading, withColor: R.color.loadingTextColor)])\n        if clearChat {\n            self.messagesListView.draw([loadingRow])\n        } else {\n            self.messages.append(loadingRow)\n            self.messagesListView.draw(self.messages)\n        }\n        DispatchQueue.global(qos: .background).async { [unowned self] in\n            do {\n                let rows = try self.webClient.history(for: channelId).map {\n                    self.messageListRowFor(message: $0)\n                }\n                //TODO notify about the results in a common queue for all the background tasks.\n                self.messages.removeAll(keepingCapacity: true)\n                self.messages.append(contentsOf: rows)\n                self.messagesListView.draw(self.messages)\n                self.channelsListView.draw(self.context, selectionId: self.selectedChannel, unreadIds: self.unreadChannelsIds)\n                self.userInputView.draw()\n            } catch {\n                //TODO handle error case.\n            }\n        }\n    }\n    \n    func run() {\n        \n        self.messagesListView.draw(self.messages)\n        \n        while true {\n            \n            let key = self.terminalDevice.key()\n        \n            switch key {\n                \n            case .ctrlC:\n                \n                try? self.terminalDevice.reset()\n                exit(1)\n                \n            case .enter:\n                \n                guard !self.userInputView.input.isEmpty, let targetChannel = self.selectedChannel, let me = self.context.me else {\n                    continue\n                }\n\n                let message = self.userInputView.input\n                \n                if !self.executeLocalCommand(message) {\n                    try? self.rtmClient.send(targetChannel, message: message, replyId: replyIdCounter)\n                    \n                    let pendingMessage = MessagesListRow(channel: targetChannel, id: \"pending\\(replyIdCounter)\", spans: [\n                        TextSpan(me.name, withColor: Utils.xterm256Color(forUser: me)),\n                        TextSpan(\": \", withColor: R.color.messagePrefixTextColor),\n                        TextSpan(message, withColor: R.color.messageTextColor)], pending: true)\n                    \n                    self.messages.insert(pendingMessage, at: 0)\n                    \n                    self.replyIdCounter = self.replyIdCounter + 1\n                    \n                    self.messagesListView.draw(self.messages)\n                }\n                                \n                self.userInputView.input = \"\"\n                self.userInputView.cursor = 0\n                self.userInputView.draw()\n\n            case .backspace:\n                \n                if self.userInputView.input.isEmpty || self.userInputView.cursor <= 0 {\n                    continue\n                }\n                self.userInputView.input.remove(at:\n                    userInputView.input.index(self.userInputView.input.startIndex, offsetBy: self.userInputView.cursor-1))\n                self.userInputView.cursor = max(0, self.userInputView.cursor - 1)\n                self.userInputView.draw()\n                \n            case .arrowLeft:\n                \n                self.userInputView.cursor = max(0, userInputView.cursor - 1)\n                self.userInputView.draw()\n                \n            case .arrowRight:\n                \n                self.userInputView.cursor = min(userInputView.input.count, userInputView.cursor + 1)\n                self.userInputView.draw()\n                \n            case .arrowUp:\n                \n                self.messagesListView.scroll = self.messagesListView.scroll + 1\n                self.messagesListView.draw(self.messages)\n                \n            case .arrowDown:\n                \n                guard self.messagesListView.scroll > 0 else {\n                    break\n                }\n                \n                self.messagesListView.scroll = self.messagesListView.scroll - 1\n                self.messagesListView.draw(self.messages)\n    \n            case .tab(let withShift):\n            \n                guard let suggestion = self.context.suggestRecipient(for: self.selectedChannel, unreadIds: self.unreadChannelsIds, backwardSearch: withShift) else {\n                    continue\n                }\n                \n                self.userInputView.input = \"\"\n                self.userInputView.cursor = 0\n                self.messagesListView.scroll = 0\n                \n                self.unreadChannelsIds.remove(suggestion.id)\n                \n                self.selectedChannel = suggestion.id\n                self.userInputView.placeholder = String(format: R.string.inputPlaceholder, suggestion.name)\n                self.channelsListView.draw(self.context, selectionId: suggestion.id, unreadIds: self.unreadChannelsIds)\n            \n                self.reloadChannel(suggestion.id)\n                self.links.removeAll()\n                self.userInputView.draw()\n                \n            case .other(let character):\n                \n                self.userInputView.input.insert(character,\n                    at: self.userInputView.input.index(self.userInputView.input.startIndex,\n                       offsetBy: self.userInputView.cursor))\n                \n                self.userInputView.cursor = userInputView.cursor + 1\n                self.userInputView.draw()\n\n            default: break\n                \n            }\n        }\n    }\n    \n    /// Execute a local \"slash\" command.\n    ///\n    /// The currently supported list of local commands are;\n    ///\n    /// - /openurl {space separated list of numbers}: opens numbered link in default browser\n    ///\n    func executeLocalCommand(_ command: String) -> Bool {\n        if (command.hasPrefix(\"/openurl\")) {\n            let pieces = command.components(separatedBy: [\",\", \" \"])\n            let linkNumbers = pieces.compactMap { Int($0) }\n            for linkNumber in linkNumbers {\n                let url = self.links[linkNumber - 1]\n                Utils.shell(\"open\", url)\n            }\n            return true\n        }\n        \n        return false\n    }\n}\n"
  },
  {
    "path": "Sources/ChannelsListView.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\n\nimport Foundation\n\nstruct ChannelListRow {\n    \n    let id: String\n    let name: String\n}\n\nclass ChannelsListView {\n    \n    private let canvas = TerminalCanvas()\n    \n    private let terminalDevice: TerminalDevice\n    \n    init(_ device: TerminalDevice) {\n        self.terminalDevice = device\n    }\n\n    func drawRow(_ text: String, row: Int, highlight: Bool = false, blink: Bool = false) {\n        \n        let availableWidth = R.dimen.channelsListWidth\n        \n        let paddedName = text.count > availableWidth ? String(text[..<text.index(text.startIndex, offsetBy: availableWidth)]) :\n            text.padding(toLength: availableWidth, withPad: \" \", startingAt: 0)\n        \n        self.canvas\n            .cursor(1, row)\n            .blink(blink)\n            .background(highlight ? R.color.channelListBgColorSelected : R.color.channelListBgColor)\n            .text(paddedName)\n    }\n    \n    func draw(_ context: SlackContext, selectionId: String? = nil, unreadIds: Set<String> = []) {\n        \n        let size = self.terminalDevice.size\n        \n        let avaibleHeight = size.height\n        \n        guard size.width > 0 && avaibleHeight > 0 else { return }\n        \n        var offset = 1\n        \n        self.canvas\n            .clear()\n            .hideCursor()\n        \n        // Draw team name.\n        \n        self.canvas\n            .color(R.color.teamNameTextColor)\n            .background(R.color.teamNameBackgroundColor)\n            .cursor(1, 1)\n            .text(context.teamName.padding(toLength: R.dimen.channelsListWidth, withPad: \" \", startingAt: 0))\n        \n        offset = offset + 1\n        \n        // Draw channels.\n        \n        self.canvas.color(R.color.channelNameTextColor);\n        \n        for channel in context.channels {\n            if (!channel.isMember) {\n                continue\n            }\n        \n            self.drawRow(\"#\" + channel.name, row: offset, highlight: channel.id == selectionId, blink: unreadIds.contains(channel.id))\n            \n            offset = offset + 1\n            if offset > avaibleHeight {\n                break\n            }\n        }\n        \n        // Draw groups.\n        \n        self.canvas.color(R.color.groupNameTextColor);\n        \n        if offset < avaibleHeight {\n            for group in context.groups {\n                \n                self.drawRow(\"#\" + group.name, row: offset, highlight: group.id == selectionId, blink: unreadIds.contains(group.id))\n                \n                offset = offset + 1\n                if offset > avaibleHeight {\n                    break\n                }\n            }\n        }\n        \n        // Draw members.\n        \n        if offset < avaibleHeight {\n            for im in context.ims {\n                let slackUser = context.user(forId: im.user) ?? SlackUser(id: \"\", name: \"\", color: \"\", presence: .away)\n                if slackUser.presence == .active {\n                    self.canvas.color(Utils.xterm256Color(forUser: slackUser))\n                } else {\n                    self.canvas.color(R.color.channelListTextColorAway)\n                }\n                self.drawRow(\"@\" + (context.user(forId: im.user)?.name ?? \"\"), row: offset, highlight: im.id == selectionId, blink: unreadIds.contains(im.id))\n                offset = offset + 1\n                if offset > avaibleHeight {\n                    break\n                }\n            }\n        }\n        \n        self.canvas\n            .color(R.color.channelNameTextColor)\n            .background(R.color.channelListBgColor)\n        \n        while offset <= avaibleHeight {\n            self.canvas\n                .cursor(1, offset)\n                .text(String(repeating: \" \", count: R.dimen.channelsListWidth))\n            offset = offset + 1\n        }\n        \n        self.canvas.reset()\n        \n        terminalDevice.flush(self.canvas.buffer)\n    }\n}\n"
  },
  {
    "path": "Sources/CrashReporter.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nstruct CrashReporter {\n    \n    private static var terminalDevice: TerminalDevice? = nil\n    \n    static func watch(usingDevice device: TerminalDevice) {\n        \n        CrashReporter.terminalDevice = device\n        \n        NSSetUncaughtExceptionHandler { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGABRT) { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGILL) { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGSEGV) { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGFPE) { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGBUS) { _ in\n            CrashReporter.report()\n        }\n        \n        signal(SIGPIPE) { _ in\n            CrashReporter.report()\n        }\n    }\n    \n    private static func report() {\n        \n        try? CrashReporter.terminalDevice?.reset()\n        \n        let stacktrace = Thread.callStackSymbols.joined(separator: \"\\n\")\n        \n        let title = \"Crash detected\".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? \"\"\n        \n        let body =  (\"I found the following crash in the app:\\n```\" + stacktrace + \"```\")\n            .addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? \"\"\n        \n        CrashReporter.terminalDevice?.flush(TerminalCanvas()\n            .reset()\n            .clear()\n            .text(\"Oooops.... we are really sorry but slash has crashed ☠️ :\\n\\nSTACKTRACE:\\n\\n\")\n            .text(stacktrace)\n            .text(\"\\n\\n\")\n            .text(\"Please copy this very long link to the browser, to help us with fixing the crash 🙇 \\n\\nhttps://github.com/slash-hq/slash/issues/new?title=\\(title)&body=\\(body))\\n\\n\")\n            .text(\"Thank you, \\nslash Team\\n\\n\")\n        .buffer)\n        \n        exit(1)\n    }\n}\n"
  },
  {
    "path": "Sources/MessagesListView.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nstruct MessagesListRow {\n    \n    let channel: String?\n    let id: String?\n    let spans: [TextSpan]\n    let pending: Bool\n    \n    init(channel: String? = nil, id: String? = nil, spans: [TextSpan], pending: Bool = false) {\n        self.channel = channel\n        self.id = id\n        self.spans = spans\n        self.pending = pending\n    }\n}\n\nclass MessagesListView {\n    \n    private let canvas = TerminalCanvas()\n    private let textLayout = TextLayout()\n    \n    private let terminalDevice: TerminalDevice\n    \n    init(_ device: TerminalDevice) {\n        self.terminalDevice = device\n    }\n    \n    var scroll = 0\n    \n    func draw(_ rows: Array<MessagesListRow>) {\n        \n        let size = self.terminalDevice.size\n        let bottomPadding = 2\n        \n        guard size.width > 0 && size.height > bottomPadding else {\n            return\n        }\n        \n        let avaibleHeight = size.height - bottomPadding\n        \n        self.canvas\n            .clear()\n            .hideCursor()\n        \n        let column = R.dimen.channelsListWidth + 2\n        \n        var rayOffset = avaibleHeight\n        var scrollOffset = self.scroll\n        \n        // Draw from the bottom to the top.\n        \n        lines: for row in rows {\n            \n            let lines = self.textLayout.layout(row.spans, alignToWidth: size.width - column - 1)\n            \n            for line in lines.reversed() {\n                \n                if scrollOffset > 0 {\n                    scrollOffset = scrollOffset - 1\n                    continue\n                }\n                \n                self.canvas\n                    .cursor(column-1, rayOffset)\n                    .background(R.color.messagesListBgColor)\n                    .text(\" \")\n                    .buffer.append(contentsOf: line)\n                \n                rayOffset = rayOffset - 1\n                if rayOffset < 1 {\n                    break lines\n                }\n            }\n        }\n        \n        // Clear the top if needed.\n    \n        if rayOffset > 0 {\n            for i in 1...rayOffset {\n                self.canvas\n                    .cursor(R.dimen.channelsListWidth + 1, i)\n                    .color(R.color.defaulTextColor)\n                    .background(R.color.messagesListBgColor)\n                    .text(String(repeating: \" \", count: size.width - R.dimen.channelsListWidth))\n            }\n        }\n        \n        self.canvas.reset()\n        \n        terminalDevice.flush(self.canvas.buffer)\n    }\n}\n"
  },
  {
    "path": "Sources/R.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass R {\n    \n    class string {\n        \n        // Cool emojis: 🚫❕❗️📢📣🚀🐌🌊💦🌪❄️💥💡🗑⏱🔪💉🌡🚿🎈🎁🏷🔖🔐🔒🔓🔏⚠️💩\n    \n        static let inputPlaceholder = \"Message #%@...\"\n        \n        static let unknownMessageAuthor = \"(unknown)\"\n        \n        static let directMessageAuthor = \"private\"\n        \n        static let hello = \"Connected to %@ team.\"\n        \n        static let unknownMessageChannel = \"??\"\n        \n        static let connecting = \"Connecting 💤 ...\"\n        \n        static let loading = \"Loading 💤 ...\"\n        \n        static let connectionError = \"⚠️  Connection error occured (%@)\"\n        \n        static let me = \"me\"\n        \n        static let authHelpMessage = \"🔒  Visit ( %@ ) to login using OAuth2...\"\n        \n        static let authConfirmation =\n            \"<html><body><center>\" +\n                \"<br><br><img width=\\\"200\\\" src=\\\"https://github.com/slash-hq/slash/blob/master/GitHub/slash_logo_small.png?raw=true\\\" /><br>\" +\n                \"<h4><span style=\\\"font-family: Verdana; color: #CCC;\\\">You can close this window now and continue in the terminal.</span></h4><br>\" +\n                \"<img width=\\\"600\\\"src=\\\"https://github.com/slash-hq/slash/blob/master/GitHub/scr.png?raw=true\\\"/>\" +\n            \"</center></body></html>\"\n    }\n    \n    class color {\n        \n        // XTERM-256 palette: https://jonasjacek.github.io/colors/\n        \n        static let defaultBgColor = -1\n        \n        static let defaulTextColor = -1\n        \n        static let connectingTextColor = 255\n        \n        static let helloTextColor = 255\n        \n        static let commandTextColor = 201\n        \n        static let userInputTextColor = 231\n        \n        static let userInputBackgorundColor = 16\n        \n        static let userInputPlaceholderTextColor = 242\n        \n        static let userInputSeparatorTextColor = 255\n        \n        static let messageAuthorTextColor = 158\n        \n        static let messagePrefixTextColor = 104\n        \n        static let messageTextColor = 252\n        \n        static let messageTimeTextColor = 24\n        \n        static let messageHighlightedBgColor = 154\n        \n        static let teamNameTextColor = 15\n        \n        static let teamNameBackgroundColor = 234\n        \n        static let channelNameTextColor = 38\n        \n        static let groupNameTextColor = 190\n        \n        static let directMessageTextColor = 240\n        \n        static let channelListTextColorAway = 239\n        \n        static let channelListBgColor = 232\n        \n        static let channelListBgColorSelected = 15\n        \n        static let channelListBgColorNotRead = 148\n        \n        static let messagesListBgColor = 0\n        \n        static let loadingTextColor = 11\n        \n        static let linkTextColor = 11\n        \n        static let mentionTextColor = 37\n        \n        static let reactionTextColor = 15\n    }\n    \n    class dimen {\n        \n        static let channelsListWidth = 17\n    }\n}\n"
  },
  {
    "path": "Sources/Server.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass Request {\n    \n    enum HttpVersion { case http10, http11 }\n    \n    var httpVersion = HttpVersion.http10\n    \n    var method = \"\"\n    \n    var path = \"\"\n    \n    var query = [(String, String)]()\n    \n    var headers = [(String, String)]()\n    \n    var body = [UInt8]()\n    \n    var contentLength = 0\n    \n    func hasToken(_ token: String, forHeader headerName: String) -> Bool {\n        guard let (_, value) = headers.filter({ $0.0 == headerName }).first else {\n            return false\n        }\n        return value\n            .components(separatedBy: \",\")\n            .filter({ $0.trimmingCharacters(in: .whitespaces).lowercased() == token })\n            .count > 0\n    }\n}\n\nclass Response {\n    \n    init() { }\n    \n    init(_ status: Status = Status.ok) {\n        self.status = status.rawValue\n    }\n    \n    init(_ status: Int = Status.ok.rawValue) {\n        self.status = status\n    }\n    \n    init(_ body: Array<UInt8>) {\n        self.body.append(contentsOf: body)\n    }\n    \n    init(_ body: ArraySlice<UInt8>) {\n        self.body.append(contentsOf: body)\n    }\n    \n    var status = Status.ok.rawValue\n    \n    var headers = [(String, String)]()\n    \n    var body = [UInt8]()\n    \n    var processingSuccesor: IncomingDataProcessor? = nil\n}\n\nclass TextResponse: Response {\n    \n    init(_ status: Int = Status.ok.rawValue, _ text: String) {\n        super.init(status)\n        self.headers.append((\"Content-Type\", \"text/plain\"))\n        self.body = [UInt8](text.utf8)\n    }\n}\n\nclass HtmlResponse: Response {\n    \n    init(_ status: Int = Status.ok.rawValue, _ text: String) {\n        super.init(status)\n        self.headers.append((\"Content-Type\", \"text/html\"))\n        self.body = [UInt8](text.utf8)\n    }\n}\n\nenum Status: Int {\n    case `continue` = 100\n    case switchingProtocols = 101\n    case ok = 200\n    case created = 201\n    case accepted = 202\n    case noContent = 204\n    case resetContent = 205\n    case partialContent = 206\n    case movedPerm = 301\n    case notModified = 304\n    case badRequest = 400\n    case unauthorized = 401\n    case forbidden = 403\n    case notFound = 404\n}\n\nextension UInt8 {\n    \n    static var\n    lf: UInt8 = 10,\n    cr: UInt8 = 13,\n    space: UInt8 = 32,\n    colon: UInt8 = 58,\n    ampersand: UInt8 = 38,\n    lessThan: UInt8 = 60,\n    greaterThan: UInt8 = 62,\n    slash: UInt8 = 47,\n    equal: UInt8 = 61,\n    doubleQuotes: UInt8 = 34,\n    openingParenthesis: UInt8 = 40,\n    closingParenthesis: UInt8 = 41,\n    comma: UInt8 = 44\n}\n\nenum AsyncError: Error {\n    case parse(String)\n    case async(String)\n    case socketCreation(String)\n    case setReUseAddr(String)\n    case setNoSigPipeFailed(String)\n    case setNonBlockFailed(String)\n    case setReuseAddrFailed(String)\n    case bindFailed(String)\n    case listenFailed(String)\n    case writeFailed(String)\n    case getPeerNameFailed(String)\n    case convertingPeerNameFailed\n    case getNameInfoFailed(String)\n    case acceptFailed(String)\n    case readFailed(String)\n    case httpError(String)\n}\n\nprotocol TcpServer {\n    \n    init(_ port: in_port_t) throws\n    \n    func wait(_ callback: ((TcpServerEvent) -> Void)) throws\n    \n    func write(_ socket: Int32, _ data: Array<UInt8>, _ done: @escaping (() -> TcpWriteDoneAction)) throws\n    \n    func finish(_ socket: Int32)\n}\n\nenum TcpWriteDoneAction {\n    \n    case `continue`\n    \n    case terminate\n}\n\nenum TcpServerEvent {\n    \n    case connect(String, Int32)\n    \n    case disconnect(String, Int32)\n    \n    case data(String, Int32, ArraySlice<UInt8>)\n}\n\nclass HttpIncomingDataPorcessor: Hashable, IncomingDataProcessor {\n    \n    private enum State {\n        case waitingForHeaders\n        case waitingForBody\n    }\n    \n    private var state = State.waitingForHeaders\n    \n    private let socket: Int32\n    private var buffer = Array<UInt8>()\n    private var request = Request()\n    private let callback: ((Request) throws -> Void)\n    \n    init(_ socket: Int32, _ closure: @escaping ((Request) throws -> Void)) {\n        self.socket = socket\n        self.callback = closure\n    }\n    \n    static func == (lhs: HttpIncomingDataPorcessor, rhs: HttpIncomingDataPorcessor) -> Bool {\n        return lhs.socket == rhs.socket\n    }\n    \n    var hashValue: Int { return Int(self.socket) }\n    \n    func process(_ chunk: ArraySlice<UInt8>) throws {\n        \n        switch self.state {\n            \n        case .waitingForHeaders:\n            \n            guard self.buffer.count + chunk.count < 4096 else {\n                throw AsyncError.parse(\"Headers size exceeds that limit.\")\n            }\n            \n            var iterator = chunk.makeIterator()\n            \n            while let byte = iterator.next() {\n                if byte != UInt8.cr {\n                    buffer.append(byte)\n                }\n                if buffer.count >= 2 && buffer[buffer.count-1] == UInt8.lf && buffer[buffer.count-2] == UInt8.lf {\n                    self.buffer.removeLast(2)\n                    self.request = try self.consumeHeader(buffer)\n                    self.buffer.removeAll(keepingCapacity: true)\n                    let left = [UInt8](iterator)\n                    self.state = .waitingForBody\n                    try self.process(left[0..<left.count])\n                    break\n                }\n            }\n            \n        case .waitingForBody:\n            \n            guard self.request.body.count + chunk.count <= request.contentLength else {\n                throw AsyncError.parse(\"Peer sent more data then required ('Content-Length' = \\(request.contentLength).\")\n            }\n            \n            request.body.append(contentsOf: chunk)\n            \n            if request.body.count == request.contentLength {\n                self.state = .waitingForHeaders\n                try self.callback(request)\n            }\n        }\n    }\n    \n    private func consumeHeader(_ data: [UInt8]) throws -> Request {\n        \n        let lines = data.split(separator: UInt8.lf)\n        \n        guard let requestLine = lines.first else {\n            throw AsyncError.httpError(\"No status line.\")\n        }\n        \n        let requestLineTokens = requestLine.split(separator: UInt8.space)\n        \n        guard requestLineTokens.count >= 3 else {\n            throw AsyncError.httpError(\"Invalid status line.\")\n        }\n        \n        let request = Request()\n        \n        if requestLineTokens[2] == [0x48, 0x54,  0x54,  0x50, 0x2f, 0x31, 0x2e, 0x30] {\n            request.httpVersion = .http10\n        } else if requestLineTokens[2] == [0x48, 0x54,  0x54,  0x50, 0x2f, 0x31, 0x2e, 0x31] {\n            request.httpVersion = .http11\n        } else {\n            throw AsyncError.parse(\"Invalid http version: \\(requestLineTokens[2])\")\n        }\n        \n        request.headers = lines\n            .dropFirst()\n            .map { line in\n                let headerTokens = line.split(separator: UInt8.colon, maxSplits: 1)\n                if let name = headerTokens.first, let value = headerTokens.last {\n                    if let nameString = String(bytes: name, encoding: .ascii),\n                        let valueString = String(bytes: value, encoding: .ascii) {\n                        return (nameString.lowercased(), valueString.trimmingCharacters(in: .whitespaces))\n                    }\n                }\n                return (\"\", \"\")\n        }\n        \n        if let (_, value) = request.headers\n            .filter({ $0.0 == \"content-length\" })\n            .first {\n            guard let contentLength = Int(value) else {\n                throw AsyncError.parse(\"Invalid 'Content-Length' header value \\(value).\")\n            }\n            request.contentLength = contentLength\n        }\n        \n        guard let method = String(bytes: requestLineTokens[0], encoding: .ascii) else {\n            throw AsyncError.parse(\"Invalid 'method' value \\(requestLineTokens[0]).\")\n        }\n        \n        request.method = method\n        \n        guard let path = String(bytes: requestLineTokens[1], encoding: .ascii) else {\n            throw AsyncError.parse(\"Invalid 'path' value \\(requestLineTokens[1]).\")\n        }\n        \n        let queryComponents = path.components(separatedBy: \"?\")\n        \n        if queryComponents.count > 1, let first = queryComponents.first, let last = queryComponents.last {\n            request.path = first\n            request.query = last\n                .components(separatedBy: \"&\")\n                .reduce([(String, String)]()) { (c, s) -> [(String, String)] in\n                    let tokens = s.components(separatedBy: \"=\")\n                    if let name = tokens.first, let value = tokens.last {\n                        if let nameDecoded = name.removingPercentEncoding, let valueDecoded = value.removingPercentEncoding {\n                            return c + [(nameDecoded, tokens.count > 1 ? valueDecoded : \"\")]\n                        }\n                    }\n                    return c\n            }\n        } else {\n            request.path = path\n        }\n        \n        return request\n    }\n}\n\nclass Server {\n    \n    private var processors = [Int32 : IncomingDataProcessor]()\n    \n    private let server: TcpServer\n    \n    init(_ port: in_port_t = 8080) throws {\n        #if os(Linux)\n            self.server = try LinuxAsyncServer(port)\n        #else\n            self.server = try MacOSAsyncTCPServer(port)\n        #endif\n    }\n    \n    func serve(_ callback: @escaping ((request: Request, responder: ((Response) -> Void))) -> Void) throws {\n        \n        try self.server.wait { event in\n            \n            switch event {\n                \n            case .connect(_, let socket):\n                \n                self.processors[socket] = HttpIncomingDataPorcessor(socket) { request in\n                    callback((request, { response in\n                        let keepIOSession = self.supportsKeepAlive(request.headers) || request.httpVersion == .http11\n                        var data = [UInt8]()\n                        data.reserveCapacity(1024)\n                        data.append(contentsOf: [UInt8](\"HTTP/\\(request.httpVersion == .http10 ? \"1.0\" : \"1.1\") \\(response.status) OK\\r\\n\".utf8))\n                        for (name, value) in response.headers {\n                            data.append(contentsOf: [UInt8](\"\\(name): \\(value)\\r\\n\".utf8))\n                        }\n                        if (keepIOSession) {\n                            data.append(contentsOf: [UInt8](\"Connection: keep-alive\\r\\n\".utf8))\n                        }\n                        data.append(contentsOf: [UInt8](\"Content-Length: \\(response.body.count)\\r\\n\".utf8))\n                        data.append(contentsOf: [13, 10])\n                        data.append(contentsOf: response.body)\n                        do {\n                            try self.server.write(socket, data) {\n                                if let sucessor = response.processingSuccesor {\n                                    self.processors[socket] = sucessor\n                                    return .continue\n                                }\n                                return keepIOSession ? .continue : .terminate\n                            }\n                        } catch {\n                            self.processors.removeValue(forKey: socket)\n                        }\n                    }))\n                }\n                \n            case .disconnect(_, let socket):\n                \n                self.processors.removeValue(forKey: socket)\n                \n            case .data(_, let socket, let chunk):\n                \n                do {\n                    try self.processors[socket]?.process(chunk)\n                } catch {\n                    self.processors.removeValue(forKey: socket)\n                    self.server.finish(socket)\n                }\n            }\n        }\n    }\n    \n    private func supportsKeepAlive(_ headers: Array<(String, String)>) -> Bool {\n        if let (_, value) = headers.filter({ $0.0 == \"connection\" }).first {\n            return \"keep-alive\" == value.trimmingCharacters(in: CharacterSet.whitespaces)\n        }\n        return false\n    }\n    \n    private func closeConnection(_ headers: Array<(String, String)>) -> Bool {\n        if let (_, value) = headers.filter({ $0.0 == \"connection\" }).first {\n            return \"close\" == value.trimmingCharacters(in: CharacterSet.whitespaces)\n        }\n        return false\n    }\n}\n\nprotocol IncomingDataProcessor {\n    \n    func process(_ chunk: ArraySlice<UInt8>) throws\n}\n\nextension Process {\n    \n    static var pid: Int {\n        return Int(getpid())\n    }\n    \n    static var tid: UInt64 {\n        #if os(Linux)\n            return UInt64(pthread_self())\n        #else\n            var tid: __uint64_t = 0\n            pthread_threadid_np(nil, &tid);\n            return UInt64(tid)\n        #endif\n    }\n    \n    static var error: String {\n        return String(cString: UnsafePointer(strerror(errno)))\n    }\n}\n\nclass MacOSAsyncTCPServer: TcpServer {\n    \n    private var backlog = Dictionary<Int32, Array<(chunk: [UInt8], done: (() -> TcpWriteDoneAction))>>()\n    private var peers = Set<Int32>()\n    \n    private let kernelQueue: KernelQueue\n    private let server: UInt\n    \n    required init(_ port: in_port_t = 8080) throws {\n        \n        self.kernelQueue = try KernelQueue()\n        \n        self.server = UInt(try MacOSAsyncTCPServer.nonBlockingSocketForListenening(port))\n        \n        self.kernelQueue.subscribe(server, .read)\n    }\n    \n    func write(_ socket: Int32, _ data: Array<UInt8>, _ done: @escaping (() -> TcpWriteDoneAction)) throws {\n        \n        let result = Socket.write(socket, data, data.count)\n        \n        if result == -1 {\n            defer { self.finish(socket) }\n            throw AsyncError.writeFailed(Process.error)\n        }\n        \n        if result == data.count {\n            if done() == .terminate {\n                self.finish(socket)\n            }\n            return\n        }\n        \n        self.backlog[socket]?.append(([UInt8](data[result..<data.count]), done))\n        self.kernelQueue.resume(UInt(socket), .write)\n    }\n    \n    func wait(_ callback: ((TcpServerEvent) -> Void)) throws {\n        try self.kernelQueue.wait { signal in\n            switch signal.event {\n            case .read:\n                if signal.ident == self.server {\n                    let client = try MacOSAsyncTCPServer.acceptAndConfigureClientSocket(Int32(signal.ident))\n                    self.peers.insert(client)\n                    self.backlog[Int32(client)] = []\n                    kernelQueue.subscribe(UInt(client), .read)\n                    kernelQueue.subscribe(UInt(client), .write)\n                    kernelQueue.pause(UInt(client), .write)\n                    callback(.connect(\"\", Int32(client)))\n                } else {\n                    var chunk = [UInt8](repeating: 0, count: signal.data)\n                    let result = Socket.read(Int32(signal.ident), &chunk, signal.data)\n                    if result <= 0 {\n                        finish(Int32(signal.ident))\n                        callback(.disconnect(\"\", Int32(signal.ident)))\n                    } else {\n                        callback(.data(\"\", Int32(signal.ident), chunk[0..<result]))\n                    }\n                }\n            case .write:\n                while let backlogElement = self.backlog[Int32(signal.ident)]?.first {\n                    var chunk = backlogElement.chunk\n                    let result = Socket.write(Int32(signal.ident), chunk, min(chunk.count, signal.data))\n                    if result == -1 {\n                        finish(Int32(signal.ident))\n                        callback(.disconnect(\"\", Int32(signal.ident)))\n                        return\n                    }\n                    if result < chunk.count {\n                        let leftData = [UInt8](chunk[result..<chunk.count])\n                        self.backlog[Int32(signal.ident)]?.remove(at: 0)\n                        self.backlog[Int32(signal.ident)]?.insert((chunk: leftData, done: backlogElement.done), at: 0)\n                        return\n                    }\n                    self.backlog[Int32(signal.ident)]?.removeFirst()\n                    if backlogElement.done() == .terminate {\n                        self.finish(Int32(signal.ident))\n                        callback(.disconnect(\"\", Int32(signal.ident)))\n                        return\n                    }\n                }\n                self.kernelQueue.pause(signal.ident, .write)\n            case .error:\n                if signal.ident == self.server {\n                    throw AsyncError.async(Process.error)\n                } else {\n                    self.finish(Int32(signal.ident))\n                    callback(.disconnect(\"\", Int32(signal.ident)))\n                }\n            }\n        }\n    }\n    \n    deinit {\n        closeAllOpenedSockets()\n    }\n    \n    func finish(_ socket: Int32) {\n        self.backlog[socket] = []\n        self.peers.remove(socket)\n        let _ = Socket.close(socket)\n    }\n    \n    func closeAllOpenedSockets() {\n        for client in self.peers {\n            let _ = Socket.close(client)\n        }\n        self.peers.removeAll(keepingCapacity: true)\n        let _ = Socket.close(Int32(server))\n    }\n    \n    static func nonBlockingSocketForListenening(_ port: in_port_t = 8080) throws -> Int32 {\n        \n        let server = Darwin.socket(AF_INET, SOCK_STREAM, 0)\n        \n        guard server != -1 else {\n            throw AsyncError.socketCreation(Process.error)\n        }\n        \n        var value: Int32 = 1\n        if Darwin.setsockopt(server, SOL_SOCKET, SO_REUSEADDR, &value, socklen_t(MemoryLayout<Int32>.size)) == -1 {\n            defer { let _ = Socket.close(server) }\n            throw AsyncError.setReuseAddrFailed(Process.error)\n        }\n        \n        try setSocketNonBlocking(server)\n        try setSocketNoSigPipe(server)\n        \n        var addr = anyAddrForPort(port)\n        \n        if withUnsafePointer(to: &addr, { Darwin.bind(server, UnsafePointer<sockaddr>(OpaquePointer($0)), socklen_t(MemoryLayout<sockaddr_in>.size)) }) == -1 {\n            defer { let _ = Socket.close(server) }\n            throw AsyncError.bindFailed(Process.error)\n        }\n        \n        if Darwin.listen(server, SOMAXCONN) == -1 {\n            defer { let _ = Socket.close(server) }\n            throw AsyncError.listenFailed(Process.error)\n        }\n        \n        return server\n    }\n    \n    static func acceptAndConfigureClientSocket(_ socket: Int32) throws -> Int32 {\n        \n        guard case let client = Darwin.accept(socket, nil, nil), client != -1 else {\n            throw AsyncError.acceptFailed(Process.error)\n        }\n        \n        try self.setSocketNonBlocking(client)\n        try self.setSocketNoSigPipe(client)\n        \n        return client\n    }\n    \n    static func anyAddrForPort(_ port: in_port_t) -> sockaddr_in {\n        var addr = sockaddr_in()\n        addr.sin_len = __uint8_t(MemoryLayout<sockaddr_in>.size)\n        addr.sin_family = sa_family_t(AF_INET)\n        addr.sin_port = port.bigEndian\n        addr.sin_addr = in_addr(s_addr: in_addr_t(0))\n        addr.sin_zero = (0, 0, 0, 0, 0, 0, 0, 0)\n        return addr\n    }\n    \n    static func setSocketNonBlocking(_ socket: Int32) throws {\n        if Darwin.fcntl(socket, F_SETFL, Darwin.fcntl(socket, F_GETFL, 0) | O_NONBLOCK) == -1 {\n            throw AsyncError.setNonBlockFailed(Process.error)\n        }\n    }\n    \n    static func setSocketNoSigPipe(_ socket: Int32) throws {\n        var value = 1\n        if Darwin.setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &value, socklen_t(MemoryLayout<Int32>.size)) == -1 {\n            throw AsyncError.setNoSigPipeFailed(Process.error)\n        }\n    }\n}\n\nclass KernelQueue {\n    \n    private var events = Array<kevent>(repeating: kevent(), count: 256)\n    private var changes = Array<kevent>()\n    \n    private let queue: Int32\n    \n    enum Subscription { case read, write }\n    enum Event { case read, write, error }\n    \n    init() throws {\n        guard case let queue = kqueue(), queue != -1 else {\n            throw AsyncError.async(Process.error)\n        }\n        self.queue = queue\n    }\n    \n    func subscribe(_ ident: UInt, _ event: Subscription) {\n        switch event {\n        case .read  : changes.append(self.event(UInt(ident), Int16(EVFILT_READ), UInt16(EV_ADD) | UInt16(EV_ENABLE)))\n        case .write : changes.append(self.event(UInt(ident), Int16(EVFILT_WRITE), UInt16(EV_ADD) | UInt16(EV_ENABLE)))\n        }\n    }\n    \n    func unsubscribe(_ ident: UInt, _ event: Subscription) {\n        switch event {\n        case .read  : changes.append(self.event(UInt(ident), Int16(EVFILT_READ), UInt16(EV_DELETE)))\n        case .write : changes.append(self.event(UInt(ident), Int16(EVFILT_WRITE), UInt16(EV_DELETE)))\n        }\n    }\n    \n    func pause(_ ident: UInt, _ event: Subscription) {\n        switch event {\n        case .read  : changes.append(self.event(UInt(ident), Int16(EVFILT_READ), UInt16(EV_DISABLE)))\n        case .write : changes.append(self.event(UInt(ident), Int16(EVFILT_WRITE), UInt16(EV_DISABLE)))\n        }\n    }\n    \n    func resume(_ ident: UInt, _ event: Subscription) {\n        switch event {\n        case .read  : changes.append(self.event(UInt(ident), Int16(EVFILT_READ), UInt16(EV_ENABLE)))\n        case .write : changes.append(self.event(UInt(ident), Int16(EVFILT_WRITE), UInt16(EV_ENABLE)))\n        }\n    }\n    \n    private func event(_ ident: UInt, _ filter: Int16, _ flags: UInt16) -> kevent {\n        return kevent(ident: ident, filter: filter, flags: flags, fflags: 0, data: 0, udata: nil)\n    }\n    \n    func wait(_ callback: (_ tuple: (event: Event, ident: UInt, data: Int)) throws -> (Void)) throws {\n        \n        if !changes.isEmpty {\n            if kevent(self.queue, &changes, Int32(changes.count), nil, 0, nil) == -1 {\n                throw AsyncError.async(Process.error)\n            }\n        }\n        \n        self.changes.removeAll(keepingCapacity: true)\n        \n        guard case let count = kevent(self.queue, nil, 0, &events, Int32(events.count), nil), count != -1 else {\n            throw AsyncError.async(Process.error)\n        }\n        \n        for event in events[0..<Int(count)] {\n            \n            if Int32(event.flags) & EV_EOF != 0 || Int32(event.flags) & EV_ERROR != 0 {\n                try callback((.error, event.ident, 0))\n                continue\n            }\n            if Int32(event.filter) == EVFILT_READ {\n                try callback((.read, event.ident, event.data))\n                continue\n            }\n            if Int32(event.filter) == EVFILT_WRITE {\n                try callback((.write, event.ident, event.data))\n                continue\n            }\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "Sources/SlackAdapter.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\n\nimport Foundation\n\nclass SlackAdapter {\n    \n    private let dateFormatter: DateFormatter = {\n        let formatter = DateFormatter()\n        formatter.dateFormat = \"HH:mm\"\n        return formatter\n    }()\n    \n    private let emojiDecoder = SlackEmojiDecoder()\n    \n    func formatSlackTimestamp(_ slackTs: String) -> String {\n        if let timestamp = Double(slackTs) {\n            let date = Date(timeIntervalSince1970: timestamp)\n            return self.dateFormatter.string(from: date)\n        } else {\n            return slackTs\n        }\n    }\n    \n    func textSpansFor(message: SlackMessage, withContext context: SlackContext, andLinks links: inout [String]) -> [TextSpan] {\n        \n        let slackUser = context.user(forId: message.user) ?? SlackUser(id: \"\", name: \"unknown\", color: \"\", presence: .away)\n        \n        var spans = [TextSpan]()\n        \n        spans.append(TextSpan(self.formatSlackTimestamp(message.ts), withColor: R.color.messageTimeTextColor))\n        spans.append(TextSpan(\" \\(slackUser.name)\", withColor: Utils.xterm256Color(forUser: slackUser)))\n        spans.append(TextSpan(\": \", withColor: R.color.messagePrefixTextColor))\n        spans.append(contentsOf: self.spansFor(message: message.text, withContext: context, andLinks: &links))\n        \n        if !message.reactions.isEmpty {\n            let content = \"\\n      \" + message.reactions.map({ emojiDecoder.decode( \":\" + $0.name + \":\" ) + reactionCounter(forCount: $0.count) } ).joined(separator: \" \")\n            \n            spans.append(TextSpan(content, withColor: R.color.reactionTextColor, withBackground: R.color.defaultBgColor))\n        }\n        \n        return spans\n    }\n    \n    func reactionCounter(forCount count: Int) -> String {\n        if count <= 1 {\n            return \"\"\n        }\n        return String(String(describing: count).map({ c in //TODO - Do it better with 'U+2080 + x' formula.\n            switch c {\n            case \"0\": return \"₀\"\n            case \"1\": return \"₁\"\n            case \"2\": return \"₂\"\n            case \"3\": return \"₃\"\n            case \"4\": return \"₄\"\n            case \"5\": return \"₅\"\n            case \"6\": return \"₆\"\n            case \"7\": return \"₇\"\n            case \"8\": return \"₈\"\n            case \"9\": return \"₉\"\n            default : return \" \"\n            }\n        }))\n    }\n    \n    func spansFor(message: String, withContext context: SlackContext, andLinks links: inout [String]) -> [TextSpan] {\n        \n        var spans = [TextSpan]()\n        \n        for token in self.lex(for: message) {\n            switch token {\n            case .plain(let text):\n                let presentableText = self.emojiDecoder.decode(self.decodeEscapedHTMLEntities(text))\n                spans.append(TextSpan(presentableText, withColor: R.color.messageTextColor))\n            case .escaped(let encodedText):\n                guard let first = encodedText.first else {\n                    continue\n                }\n                switch first {\n                    case \"#\":\n                        fallthrough\n                    case \"@\":\n                        let idStartIndex = encodedText.index(encodedText.startIndex, offsetBy: 1)\n                        if idStartIndex < encodedText.endIndex {\n                            let id = encodedText[idStartIndex..<(encodedText.index(of: \"|\") ?? encodedText.endIndex)]\n                            if let name = context.name(forId: String(id)) {\n                                spans.append(TextSpan(name, withColor: R.color.mentionTextColor))\n                            }\n                        }\n                    case \"!\":\n                        let escapedTokens = encodedText.components(separatedBy: \"|\")\n                        if let command = escapedTokens.first {\n                            let commandName = escapedTokens.count > 1 ? escapedTokens[1] : command\n                            spans.append(TextSpan(commandName, withColor: R.color.commandTextColor))\n                        }\n                    default /* link */:\n                        let escapedTokens = encodedText.components(separatedBy: \"|\")\n                        if let url = escapedTokens.first {\n                            links.append(url)\n                            if let name = escapedTokens.last, escapedTokens.count > 1 {\n                                 spans.append(TextSpan(self.decodeEscapedHTMLEntities(name), withColor: R.color.linkTextColor))\n                            } else {\n                                 spans.append(TextSpan(url, withColor: R.color.linkTextColor))\n                            }\n                            spans.append(TextSpan(\"[\" + String(links.count) + \"]\", withColor: R.color.messageTextColor))\n                        }\n                }\n            }\n        }\n        return spans\n    }\n    \n    enum Token { case plain(String), escaped(String) }\n    \n    private func lex(for message: String) -> [Token] {\n\n        var tokens = [Token]()\n        \n        var buffer = [Character]()\n        buffer.reserveCapacity(message.count)\n        \n        var plainFlag = true\n        \n        for (index, character) in message.enumerated() {\n            switch character {\n                case \"<\":\n                    if !buffer.isEmpty {\n                        tokens.append(.plain(String(buffer)))\n                    }\n                    buffer.removeAll(keepingCapacity: true)\n                    plainFlag = false\n                case \">\":\n                    if !buffer.isEmpty {\n                        tokens.append(.escaped(String(buffer)))\n                    }\n                    buffer.removeAll(keepingCapacity: true)\n                    plainFlag = true\n                default:\n                    buffer.append(character)\n                    if index == message.count - 1 {\n                        tokens.append(plainFlag ? .plain(String(buffer)) : .escaped(String(buffer)))\n                    }\n            }\n        }\n        \n        return tokens\n    }\n    \n    private func decodeEscapedHTMLEntities(_ text: String) -> String {\n        return text\n            .replacingOccurrences(of: \"&amp;\", with: \"&\")\n            .replacingOccurrences(of: \"&lt;\", with: \"<\")\n            .replacingOccurrences(of: \"&gt;\", with: \">\")\n    }\n}\n"
  },
  {
    "path": "Sources/SlackChannel.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nstruct SlackChannel {\n    \n    let id: String\n    let name: String\n    let members: [String]\n    let topic: String\n    let general: Bool\n    let isMember: Bool\n}\n"
  },
  {
    "path": "Sources/SlackContext.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nclass SlackContext {\n    \n    var teamName : String\n    var selfId   : String\n    \n    var users    = [SlackUser]()\n    var channels = [SlackChannel]()\n    var groups   = [SlackGroup]()\n    var ims      = [SlackIM]()\n    \n    init(withTeam team: SlackTeam) {\n        self.teamName = team.name\n        self.selfId = team.selfId\n        self.users.append(contentsOf: team.users)\n        self.channels.append(contentsOf: team.channels)\n        self.groups.append(contentsOf: team.groups)\n        self.ims.append(contentsOf: team.ims)\n    }\n    \n    func suggestRecipient(for selection: String?, unreadIds: Set<String> = [], backwardSearch: Bool) -> (id: String, name: String)? {\n        \n        let channels = self.channels.filter({ $0.isMember }).map { ($0.id, $0.name) }\n        let groups = self.groups.map { ($0.id, $0.name) }\n        let ims = self.ims.map { im in\n            (im.id, (self.users.filter({ $0.id == im.user }).first?.name) ?? \"\")\n        }\n        \n        let candidates = (channels + groups + ims).filter { unreadIds.isEmpty ? true : (unreadIds.contains($0.0) || $0.0 == selection) }\n        \n        var suggestion: (id: String, name: String)? = nil\n        \n        if let current = candidates.index(where: { $0.0 == selection }) {\n            if backwardSearch {\n                let next = current - 1\n                if next < 0 {\n                    suggestion = candidates.last\n                } else {\n                    suggestion = candidates[next]\n                }\n            } else {\n                let next = current + 1\n                if next >= candidates.count {\n                    suggestion = candidates.first\n                } else {\n                    suggestion = candidates[next]\n                }\n            }\n        }\n        \n        return suggestion\n    }\n    \n    func name(forId id: String) -> String? {\n        \n        var name = self.channels.filter({ $0.id == id }).first?.name\n        \n        if name == nil {\n            name = self.groups.filter({ $0.id == id }).first?.name\n        }\n        \n        if name == nil {\n            if let im = self.ims.filter({ $0.id == id }).first {\n                if let user = self.users.filter({ $0.id == im.user }).first {\n                    name = user.name\n                }\n            }\n        }\n        \n        if name == nil {\n            if let user = self.users.filter({ $0.id == id }).first {\n                return user.name\n            }\n        }\n        \n        return name\n    }\n    \n    func user(forId id: String) -> SlackUser? {\n        return self.users.filter({ $0.id == id }).first\n    }\n    \n    var me: SlackUser? {\n        return self.users.filter({ $0.id == self.selfId }).first\n    }\n    \n    var defaultChannel: String? {\n        return self.channels.filter({ $0.general }).first?.id\n    }\n\n}\n"
  },
  {
    "path": "Sources/SlackEmojiDecoder.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass SlackEmojiDecoder {\n    \n    func decode(_ text: String) -> String {\n        //TODO - improve this by iterating only once over the text.\n        return text\n            .replacingOccurrences(of: \":skin-tone-1:\", with: \"🏻\")\n            .replacingOccurrences(of: \":skin-tone-2:\", with: \"🏻\")\n            .replacingOccurrences(of: \":skin-tone-3:\", with: \"🏼\")\n            .replacingOccurrences(of: \":skin-tone-4:\", with: \"🏽\")\n            .replacingOccurrences(of: \":skin-tone-5:\", with: \"🏾\")\n            .replacingOccurrences(of: \":skin-tone-6:\", with: \"🏿\")\n            .replacingOccurrences(of: \":100:\", with: \"💯\")\n            .replacingOccurrences(of: \"<3\", with: \"❤️\")\n            .replacingOccurrences(of: \"</3\", with: \"💔\")\n            .replacingOccurrences(of: \":)\", with: \"😄\")\n            .replacingOccurrences(of: \"8)\", with: \"😎\")\n            .replacingOccurrences(of: \":1234:\", with: \"🔢\")\n            .replacingOccurrences(of: \":grinning:\", with: \"😀\")\n            .replacingOccurrences(of: \":grimacing:\", with: \"😬\")\n            .replacingOccurrences(of: \":grin:\", with: \"😁\")\n            .replacingOccurrences(of: \":joy:\", with: \"😂\")\n            .replacingOccurrences(of: \":smiley:\", with: \"😃\")\n            .replacingOccurrences(of: \":smile:\", with: \"😄\")\n            .replacingOccurrences(of: \":simple_smile:\", with: \"🙂\")\n            .replacingOccurrences(of: \":slightly_smiling_face:\", with: \"🙂\")\n            .replacingOccurrences(of: \":sweat_smile:\", with: \"😅\")\n            .replacingOccurrences(of: \":laughing:\", with: \"😆\")\n            .replacingOccurrences(of: \":innocent:\", with: \"😇\")\n            .replacingOccurrences(of: \":wink:\", with: \"😉\")\n            .replacingOccurrences(of: \":blush:\", with: \"😊\")\n            .replacingOccurrences(of: \":slightly_smiling:\", with: \"🙂\")\n            .replacingOccurrences(of: \":upside_down:\", with: \"🙃\")\n            .replacingOccurrences(of: \":relaxed:\", with: \"☺️\")\n            .replacingOccurrences(of: \":yum:\", with: \"😋\")\n            .replacingOccurrences(of: \":relieved:\", with: \"😌\")\n            .replacingOccurrences(of: \":heart_eyes:\", with: \"😍\")\n            .replacingOccurrences(of: \":kissing_heart:\", with: \"😘\")\n            .replacingOccurrences(of: \":kissing:\", with: \"😗\")\n            .replacingOccurrences(of: \":kissing_smiling_eyes:\", with: \"😙\")\n            .replacingOccurrences(of: \":kissing_closed_eyes:\", with: \"😚\")\n            .replacingOccurrences(of: \":stuck_out_tongue_winking_eye:\", with: \"😜\")\n            .replacingOccurrences(of: \":stuck_out_tongue_closed_eyes:\", with: \"😝\")\n            .replacingOccurrences(of: \":stuck_out_tongue:\", with: \"😛\")\n            .replacingOccurrences(of: \":money_mouth:\", with: \"🤑\")\n            .replacingOccurrences(of: \":nerd:\", with: \"🤓\")\n            .replacingOccurrences(of: \":sunglasses:\", with: \"😎\")\n            .replacingOccurrences(of: \":hugging:\", with: \"🤗\")\n            .replacingOccurrences(of: \":smirk:\", with: \"😏\")\n            .replacingOccurrences(of: \":no_mouth:\", with: \"😶\")\n            .replacingOccurrences(of: \":neutral_face:\", with: \"😐\")\n            .replacingOccurrences(of: \":expressionless:\", with: \"😑\")\n            .replacingOccurrences(of: \":unamused:\", with: \"😒\")\n            .replacingOccurrences(of: \":rolling_eyes:\", with: \"🙄\")\n            .replacingOccurrences(of: \":thinking:\", with: \"🤔\")\n            .replacingOccurrences(of: \":flushed:\", with: \"😳\")\n            .replacingOccurrences(of: \":disappointed:\", with: \"😞\")\n            .replacingOccurrences(of: \":worried:\", with: \"😟\")\n            .replacingOccurrences(of: \":angry:\", with: \"😠\")\n            .replacingOccurrences(of: \":rage:\", with: \"😡\")\n            .replacingOccurrences(of: \":pensive:\", with: \"😔\")\n            .replacingOccurrences(of: \":confused:\", with: \"😕\")\n            .replacingOccurrences(of: \":slightly_sad:\", with: \"🙁\")\n            .replacingOccurrences(of: \":white_frowning:\", with: \"☹\")\n            .replacingOccurrences(of: \":persevere:\", with: \"😣\")\n            .replacingOccurrences(of: \":confounded:\", with: \"😖\")\n            .replacingOccurrences(of: \":tired_face:\", with: \"😫\")\n            .replacingOccurrences(of: \":weary:\", with: \"😩\")\n            .replacingOccurrences(of: \":triumph:\", with: \"😤\")\n            .replacingOccurrences(of: \":open_mouth:\", with: \"😮\")\n            .replacingOccurrences(of: \":scream:\", with: \"😱\")\n            .replacingOccurrences(of: \":fearful:\", with: \"😨\")\n            .replacingOccurrences(of: \":cold_sweat:\", with: \"😰\")\n            .replacingOccurrences(of: \":hushed:\", with: \"😯\")\n            .replacingOccurrences(of: \":frowning:\", with: \"😦\")\n            .replacingOccurrences(of: \":anguished:\", with: \"😧\")\n            .replacingOccurrences(of: \":cry:\", with: \"😢\")\n            .replacingOccurrences(of: \":disappointed_relieved:\", with: \"😥\")\n            .replacingOccurrences(of: \":sleepy:\", with: \"😪\")\n            .replacingOccurrences(of: \":sweat:\", with: \"😓\")\n            .replacingOccurrences(of: \":sob:\", with: \"😭\")\n            .replacingOccurrences(of: \":dizzy_face:\", with: \"😵\")\n            .replacingOccurrences(of: \":astonished:\", with: \"😲\")\n            .replacingOccurrences(of: \":zipper_mouth:\", with: \"🤐\")\n            .replacingOccurrences(of: \":mask:\", with: \"😷\")\n            .replacingOccurrences(of: \":thermometer_face:\", with: \"🤒\")\n            .replacingOccurrences(of: \":bandage_face:\", with: \"🤕\")\n            .replacingOccurrences(of: \":sleeping:\", with: \"😴\")\n            .replacingOccurrences(of: \":zzz:\", with: \"💤\")\n            .replacingOccurrences(of: \":hankey:\", with: \"💩\")\n            .replacingOccurrences(of: \":smiling_imp:\", with: \"😈\")\n            .replacingOccurrences(of: \":imp:\", with: \"👿\")\n            .replacingOccurrences(of: \":japanese_ogre:\", with: \"👹\")\n            .replacingOccurrences(of: \":japanese_goblin:\", with: \"👺\")\n            .replacingOccurrences(of: \":skull:\", with: \"💀\")\n            .replacingOccurrences(of: \":ghost:\", with: \"👻\")\n            .replacingOccurrences(of: \":alien:\", with: \"👽\")\n            .replacingOccurrences(of: \":robot:\", with: \"🤖\")\n            .replacingOccurrences(of: \":smiley_cat:\", with: \"😺\")\n            .replacingOccurrences(of: \":smile_cat:\", with: \"😸\")\n            .replacingOccurrences(of: \":joy_cat:\", with: \"😹\")\n            .replacingOccurrences(of: \":heart_eyes_cat:\", with: \"😻\")\n            .replacingOccurrences(of: \":smirk_cat:\", with: \"😼\")\n            .replacingOccurrences(of: \":kissing_cat:\", with: \"😽\")\n            .replacingOccurrences(of: \":scream_cat:\", with: \"🙀\")\n            .replacingOccurrences(of: \":crying_cat_face:\", with: \"😿\")\n            .replacingOccurrences(of: \":pouting_cat:\", with: \"😾\")\n            .replacingOccurrences(of: \":raised_hands:\", with: \"🙌\")\n            .replacingOccurrences(of: \":clap:\", with: \"👏\")\n            .replacingOccurrences(of: \":wave:\", with: \"👋\")\n            .replacingOccurrences(of: \":+1:\", with: \"👍\")\n            .replacingOccurrences(of: \":-1:\", with: \"👎\")\n            .replacingOccurrences(of: \":facepunch:\", with: \"👊\")\n            .replacingOccurrences(of: \":fist:\", with: \"✊\")\n            .replacingOccurrences(of: \":v:\", with: \"✌️\")\n            .replacingOccurrences(of: \":ok_hand:\", with: \"👌\")\n            .replacingOccurrences(of: \":hand:\", with: \"✋\")\n            .replacingOccurrences(of: \":open_hands:\", with: \"👐\")\n            .replacingOccurrences(of: \":muscle:\", with: \"💪\")\n            .replacingOccurrences(of: \":pray:\", with: \"🙏\")\n            .replacingOccurrences(of: \":point_up:\", with: \"☝️\")\n            .replacingOccurrences(of: \":point_up_2:\", with: \"👆\")\n            .replacingOccurrences(of: \":point_down:\", with: \"👇\")\n            .replacingOccurrences(of: \":point_left:\", with: \"👈\")\n            .replacingOccurrences(of: \":point_right:\", with: \"👉\")\n            .replacingOccurrences(of: \":middle_finger:\", with: \"🖕\")\n            .replacingOccurrences(of: \":splayed_fingers:\", with: \"🖐\")\n            .replacingOccurrences(of: \":sign_of_horns:\", with: \"🤘\")\n            .replacingOccurrences(of: \":vulcan_salute:\", with: \"🖖\")\n            .replacingOccurrences(of: \":writing_hand:\", with: \"✍\")\n            .replacingOccurrences(of: \":nail_care:\", with: \"💅\")\n            .replacingOccurrences(of: \":lips:\", with: \"👄\")\n            .replacingOccurrences(of: \":tongue:\", with: \"👅\")\n            .replacingOccurrences(of: \":ear:\", with: \"👂\")\n            .replacingOccurrences(of: \":nose:\", with: \"👃\")\n            .replacingOccurrences(of: \":eye:\", with: \"👁\")\n            .replacingOccurrences(of: \":eyes:\", with: \"👀\")\n            .replacingOccurrences(of: \":bust_in_silhouette:\", with: \"👤\")\n            .replacingOccurrences(of: \":busts_in_silhouette:\", with: \"👥\")\n            .replacingOccurrences(of: \":speaking_head:\", with: \"🗣\")\n            .replacingOccurrences(of: \":baby:\", with: \"👶\")\n            .replacingOccurrences(of: \":boy:\", with: \"👦\")\n            .replacingOccurrences(of: \":girl:\", with: \"👧\")\n            .replacingOccurrences(of: \":man:\", with: \"👨\")\n            .replacingOccurrences(of: \":woman:\", with: \"👩\")\n            .replacingOccurrences(of: \":person_with_blond_hair:\", with: \"👱\")\n            .replacingOccurrences(of: \":older_man:\", with: \"👴\")\n            .replacingOccurrences(of: \":older_woman:\", with: \"👵\")\n            .replacingOccurrences(of: \":man_with_gua_pi_mao:\", with: \"👲\")\n            .replacingOccurrences(of: \":man_with_turban:\", with: \"👳\")\n            .replacingOccurrences(of: \":cop:\", with: \"👮\")\n            .replacingOccurrences(of: \":construction_worker:\", with: \"👷\")\n            .replacingOccurrences(of: \":guardsman:\", with: \"💂\")\n            .replacingOccurrences(of: \":sleuth:\", with: \"🕵\")\n            .replacingOccurrences(of: \":santa:\", with: \"🎅\")\n            .replacingOccurrences(of: \":angel:\", with: \"👼\")\n            .replacingOccurrences(of: \":princess:\", with: \"👸\")\n            .replacingOccurrences(of: \":bride_with_veil:\", with: \"👰\")\n            .replacingOccurrences(of: \":runner:\", with: \"🏃\")\n            .replacingOccurrences(of: \":walking:\", with: \"🚶\")\n            .replacingOccurrences(of: \":dancer:\", with: \"💃\")\n            .replacingOccurrences(of: \":dancers:\", with: \"👯\")\n            .replacingOccurrences(of: \":couple:\", with: \"👫\")\n            .replacingOccurrences(of: \":two_men_holding_hands:\", with: \"👬\")\n            .replacingOccurrences(of: \":two_women_holding_hands:\", with: \"👭\")\n            .replacingOccurrences(of: \":bow:\", with: \"🙇\")\n            .replacingOccurrences(of: \":information_desk_person:\", with: \"💁\")\n            .replacingOccurrences(of: \":no_good:\", with: \"🙅\")\n            .replacingOccurrences(of: \":ok_woman:\", with: \"🙆\")\n            .replacingOccurrences(of: \":raising_hand:\", with: \"🙋\")\n            .replacingOccurrences(of: \":person_with_pouting_face:\", with: \"🙎\")\n            .replacingOccurrences(of: \":person_frowning:\", with: \"🙍\")\n            .replacingOccurrences(of: \":haircut:\", with: \"💇\")\n            .replacingOccurrences(of: \":massage:\", with: \"💆\")\n            .replacingOccurrences(of: \":couple_with_heart:\", with: \"💑\")\n            .replacingOccurrences(of: \":female_couple_with_heart:\", with: \"👩‍❤️‍👩\")\n            .replacingOccurrences(of: \":male_couple_with_heart:\", with: \"👨‍❤️‍👨\")\n            .replacingOccurrences(of: \":couplekiss:\", with: \"💏\")\n            .replacingOccurrences(of: \":female_couplekiss:\", with: \"👩‍❤️‍💋‍👩\")\n            .replacingOccurrences(of: \":male_couplekiss:\", with: \"👨‍❤️‍💋‍👨\")\n            .replacingOccurrences(of: \":family:\", with: \"👪\")\n            .replacingOccurrences(of: \":family_man_woman_girl:\", with: \"👨‍👩‍👧\")\n            .replacingOccurrences(of: \":family_man_woman_girl_boy:\", with: \"👨‍👩‍👧‍👦\")\n            .replacingOccurrences(of: \":family_man_woman_boys:\", with: \"👨‍👩‍👦‍👦\")\n            .replacingOccurrences(of: \":family_man_woman_girls:\", with: \"👨‍👩‍👧‍👧\")\n            .replacingOccurrences(of: \":family_women_boy:\", with: \"👩‍👩‍👦\")\n            .replacingOccurrences(of: \":family_women_girl:\", with: \"👩‍👩‍👧\")\n            .replacingOccurrences(of: \":family_women_girl_boy:\", with: \"👩‍👩‍👧‍👦\")\n            .replacingOccurrences(of: \":family_women_boys:\", with: \"👩‍👩‍👦‍👦\")\n            .replacingOccurrences(of: \":family_women_girls:\", with: \"👩‍👩‍👧‍👧\")\n            .replacingOccurrences(of: \":family_men_boy:\", with: \"👨‍👨‍👦\")\n            .replacingOccurrences(of: \":family_men_girl:\", with: \"👨‍👨‍👧\")\n            .replacingOccurrences(of: \":family_men_girl_boy:\", with: \"👨‍👨‍👧‍👦\")\n            .replacingOccurrences(of: \":family_men_boys:\", with: \"👨‍👨‍👦‍👦\")\n            .replacingOccurrences(of: \":family_men_girls:\", with: \"👨‍👨‍👧‍👧\")\n            .replacingOccurrences(of: \":womans_clothes:\", with: \"👚\")\n            .replacingOccurrences(of: \":shirt:\", with: \"👕\")\n            .replacingOccurrences(of: \":jeans:\", with: \"👖\")\n            .replacingOccurrences(of: \":necktie:\", with: \"👔\")\n            .replacingOccurrences(of: \":dress:\", with: \"👗\")\n            .replacingOccurrences(of: \":bikini:\", with: \"👙\")\n            .replacingOccurrences(of: \":kimono:\", with: \"👘\")\n            .replacingOccurrences(of: \":lipstick:\", with: \"💄\")\n            .replacingOccurrences(of: \":kiss:\", with: \"💋\")\n            .replacingOccurrences(of: \":footprints:\", with: \"👣\")\n            .replacingOccurrences(of: \":high_heel:\", with: \"👠\")\n            .replacingOccurrences(of: \":sandal:\", with: \"👡\")\n            .replacingOccurrences(of: \":boot:\", with: \"👢\")\n            .replacingOccurrences(of: \":mans_shoe:\", with: \"👞\")\n            .replacingOccurrences(of: \":athletic_shoe:\", with: \"👟\")\n            .replacingOccurrences(of: \":womans_hat:\", with: \"👒\")\n            .replacingOccurrences(of: \":tophat:\", with: \"🎩\")\n            .replacingOccurrences(of: \":helmet:\", with: \"⛑\")\n            .replacingOccurrences(of: \":mortar_board:\", with: \"🎓\")\n            .replacingOccurrences(of: \":crown:\", with: \"👑\")\n            .replacingOccurrences(of: \":school_satchel:\", with: \"🎒\")\n            .replacingOccurrences(of: \":pouch:\", with: \"👝\")\n            .replacingOccurrences(of: \":purse:\", with: \"👛\")\n            .replacingOccurrences(of: \":handbag:\", with: \"👜\")\n            .replacingOccurrences(of: \":briefcase:\", with: \"💼\")\n            .replacingOccurrences(of: \":eyeglasses:\", with: \"👓\")\n            .replacingOccurrences(of: \":dark_sunglasses:\", with: \"🕶\")\n            .replacingOccurrences(of: \":ring:\", with: \"💍\")\n            .replacingOccurrences(of: \":closed_umbrella:\", with: \"🌂\")\n            .replacingOccurrences(of: \":dog:\", with: \"🐶\")\n            .replacingOccurrences(of: \":cat:\", with: \"🐱\")\n            .replacingOccurrences(of: \":mouse:\", with: \"🐭\")\n            .replacingOccurrences(of: \":hamster:\", with: \"🐹\")\n            .replacingOccurrences(of: \":rabbit:\", with: \"🐰\")\n            .replacingOccurrences(of: \":bear:\", with: \"🐻\")\n            .replacingOccurrences(of: \":panda_face:\", with: \"🐼\")\n            .replacingOccurrences(of: \":koala:\", with: \"🐨\")\n            .replacingOccurrences(of: \":tiger:\", with: \"🐯\")\n            .replacingOccurrences(of: \":lion_face:\", with: \"🦁\")\n            .replacingOccurrences(of: \":cow:\", with: \"🐮\")\n            .replacingOccurrences(of: \":pig:\", with: \"🐷\")\n            .replacingOccurrences(of: \":pig_nose:\", with: \"🐽\")\n            .replacingOccurrences(of: \":frog:\", with: \"🐸\")\n            .replacingOccurrences(of: \":octopus:\", with: \"🐙\")\n            .replacingOccurrences(of: \":monkey_face:\", with: \"🐵\")\n            .replacingOccurrences(of: \":see_no_evil:\", with: \"🙈\")\n            .replacingOccurrences(of: \":hear_no_evil:\", with: \"🙉\")\n            .replacingOccurrences(of: \":speak_no_evil:\", with: \"🙊\")\n            .replacingOccurrences(of: \":monkey:\", with: \"🐒\")\n            .replacingOccurrences(of: \":chicken:\", with: \"🐔\")\n            .replacingOccurrences(of: \":penguin:\", with: \"🐧\")\n            .replacingOccurrences(of: \":bird:\", with: \"🐦\")\n            .replacingOccurrences(of: \":baby_chick:\", with: \"🐤\")\n            .replacingOccurrences(of: \":hatching_chick:\", with: \"🐣\")\n            .replacingOccurrences(of: \":hatched_chick:\", with: \"🐥\")\n            .replacingOccurrences(of: \":wolf:\", with: \"🐺\")\n            .replacingOccurrences(of: \":boar:\", with: \"🐗\")\n            .replacingOccurrences(of: \":horse:\", with: \"🐴\")\n            .replacingOccurrences(of: \":unicorn_face:\", with: \"🦄\")\n            .replacingOccurrences(of: \":bee:\", with: \"🐝\")\n            .replacingOccurrences(of: \":bug:\", with: \"🐛\")\n            .replacingOccurrences(of: \":snail:\", with: \"🐌\")\n            .replacingOccurrences(of: \":beetle:\", with: \"🐞\")\n            .replacingOccurrences(of: \":ant:\", with: \"🐜\")\n            .replacingOccurrences(of: \":spider:\", with: \"🕷\")\n            .replacingOccurrences(of: \":scorpion:\", with: \"🦂\")\n            .replacingOccurrences(of: \":crab:\", with: \"🦀\")\n            .replacingOccurrences(of: \":snake:\", with: \"🐍\")\n            .replacingOccurrences(of: \":turtle:\", with: \"🐢\")\n            .replacingOccurrences(of: \":tropical_fish:\", with: \"🐠\")\n            .replacingOccurrences(of: \":fish:\", with: \"🐟\")\n            .replacingOccurrences(of: \":blowfish:\", with: \"🐡\")\n            .replacingOccurrences(of: \":dolphin:\", with: \"🐬\")\n            .replacingOccurrences(of: \":whale:\", with: \"🐳\")\n            .replacingOccurrences(of: \":whale2:\", with: \"🐋\")\n            .replacingOccurrences(of: \":crocodile:\", with: \"🐊\")\n            .replacingOccurrences(of: \":leopard:\", with: \"🐆\")\n            .replacingOccurrences(of: \":tiger2:\", with: \"🐅\")\n            .replacingOccurrences(of: \":water_buffalo:\", with: \"🐃\")\n            .replacingOccurrences(of: \":ox:\", with: \"🐂\")\n            .replacingOccurrences(of: \":cow2:\", with: \"🐄\")\n            .replacingOccurrences(of: \":dromedary_camel:\", with: \"🐪\")\n            .replacingOccurrences(of: \":camel:\", with: \"🐫\")\n            .replacingOccurrences(of: \":elephant:\", with: \"🐘\")\n            .replacingOccurrences(of: \":goat:\", with: \"🐐\")\n            .replacingOccurrences(of: \":ram:\", with: \"🐏\")\n            .replacingOccurrences(of: \":sheep:\", with: \"🐑\")\n            .replacingOccurrences(of: \":racehorse:\", with: \"🐎\")\n            .replacingOccurrences(of: \":pig2:\", with: \"🐖\")\n            .replacingOccurrences(of: \":rat:\", with: \"🐀\")\n            .replacingOccurrences(of: \":mouse2:\", with: \"🐁\")\n            .replacingOccurrences(of: \":rooster:\", with: \"🐓\")\n            .replacingOccurrences(of: \":turkey:\", with: \"🦃\")\n            .replacingOccurrences(of: \":dove_of_peace:\", with: \"🕊\")\n            .replacingOccurrences(of: \":dog2:\", with: \"🐕\")\n            .replacingOccurrences(of: \":poodle:\", with: \"🐩\")\n            .replacingOccurrences(of: \":cat2:\", with: \"🐈\")\n            .replacingOccurrences(of: \":rabbit2:\", with: \"🐇\")\n            .replacingOccurrences(of: \":chipmunk:\", with: \"🐿\")\n            .replacingOccurrences(of: \":feet:\", with: \"🐾\")\n            .replacingOccurrences(of: \":dragon:\", with: \"🐉\")\n            .replacingOccurrences(of: \":dragon_face:\", with: \"🐲\")\n            .replacingOccurrences(of: \":cactus:\", with: \"🌵\")\n            .replacingOccurrences(of: \":christmas_tree:\", with: \"🎄\")\n            .replacingOccurrences(of: \":evergreen_tree:\", with: \"🌲\")\n            .replacingOccurrences(of: \":deciduous_tree:\", with: \"🌳\")\n            .replacingOccurrences(of: \":palm_tree:\", with: \"🌴\")\n            .replacingOccurrences(of: \":seedling:\", with: \"🌱\")\n            .replacingOccurrences(of: \":herb:\", with: \"🌿\")\n            .replacingOccurrences(of: \":shamrock:\", with: \"☘\")\n            .replacingOccurrences(of: \":four_leaf_clover:\", with: \"🍀\")\n            .replacingOccurrences(of: \":bamboo:\", with: \"🎍\")\n            .replacingOccurrences(of: \":tanabata_tree:\", with: \"🎋\")\n            .replacingOccurrences(of: \":leaves:\", with: \"🍃\")\n            .replacingOccurrences(of: \":fallen_leaf:\", with: \"🍂\")\n            .replacingOccurrences(of: \":maple_leaf:\", with: \"🍁\")\n            .replacingOccurrences(of: \":ear_of_rice:\", with: \"🌾\")\n            .replacingOccurrences(of: \":hibiscus:\", with: \"🌺\")\n            .replacingOccurrences(of: \":sunflower:\", with: \"🌻\")\n            .replacingOccurrences(of: \":rose:\", with: \"🌹\")\n            .replacingOccurrences(of: \":tulip:\", with: \"🌷\")\n            .replacingOccurrences(of: \":blossom:\", with: \"🌼\")\n            .replacingOccurrences(of: \":cherry_blossom:\", with: \"🌸\")\n            .replacingOccurrences(of: \":bouquet:\", with: \"💐\")\n            .replacingOccurrences(of: \":mushroom:\", with: \"🍄\")\n            .replacingOccurrences(of: \":chestnut:\", with: \"🌰\")\n            .replacingOccurrences(of: \":jack_o_lantern:\", with: \"🎃\")\n            .replacingOccurrences(of: \":shell:\", with: \"🐚\")\n            .replacingOccurrences(of: \":spider_web:\", with: \"🕸\")\n            .replacingOccurrences(of: \":earth_americas:\", with: \"🌎\")\n            .replacingOccurrences(of: \":earth_africa:\", with: \"🌍\")\n            .replacingOccurrences(of: \":earth_asia:\", with: \"🌏\")\n            .replacingOccurrences(of: \":full_moon:\", with: \"🌕\")\n            .replacingOccurrences(of: \":waning_gibbous_moon:\", with: \"🌖\")\n            .replacingOccurrences(of: \":last_quarter_moon:\", with: \"🌗\")\n            .replacingOccurrences(of: \":waning_crescent_moon:\", with: \"🌘\")\n            .replacingOccurrences(of: \":new_moon:\", with: \"🌑\")\n            .replacingOccurrences(of: \":waxing_crescent_moon:\", with: \"🌒\")\n            .replacingOccurrences(of: \":first_quarter_moon:\", with: \"🌓\")\n            .replacingOccurrences(of: \":moon:\", with: \"🌔\")\n            .replacingOccurrences(of: \":new_moon_with_face:\", with: \"🌚\")\n            .replacingOccurrences(of: \":full_moon_with_face:\", with: \"🌝\")\n            .replacingOccurrences(of: \":first_quarter_moon_with_face:\", with: \"🌛\")\n            .replacingOccurrences(of: \":last_quarter_moon_with_face:\", with: \"🌜\")\n            .replacingOccurrences(of: \":sun_with_face:\", with: \"🌞\")\n            .replacingOccurrences(of: \":crescent_moon:\", with: \"🌙\")\n            .replacingOccurrences(of: \":star:\", with: \"⭐\")\n            .replacingOccurrences(of: \":star2:\", with: \"🌟\")\n            .replacingOccurrences(of: \":dizzy:\", with: \"💫\")\n            .replacingOccurrences(of: \":sparkles:\", with: \"✨\")\n            .replacingOccurrences(of: \":comet:\", with: \"☄\")\n            .replacingOccurrences(of: \":sunny:\", with: \"☀️\")\n            .replacingOccurrences(of: \":white_sun_with_small_cloud:\", with: \"🌤\")\n            .replacingOccurrences(of: \":partly_sunny:\", with: \"⛅\")\n            .replacingOccurrences(of: \":white_sun_behind_cloud:\", with: \"🌥\")\n            .replacingOccurrences(of: \":white_sun_behind_cloud_with_rain:\", with: \"🌦\")\n            .replacingOccurrences(of: \":cloud:\", with: \"☁️\")\n            .replacingOccurrences(of: \":cloud_with_rain:\", with: \"🌧\")\n            .replacingOccurrences(of: \":thunder_cloud_and_rain:\", with: \"⛈\")\n            .replacingOccurrences(of: \":cloud_with_lightning:\", with: \"🌩\")\n            .replacingOccurrences(of: \":zap:\", with: \"⚡\")\n            .replacingOccurrences(of: \":fire:\", with: \"🔥\")\n            .replacingOccurrences(of: \":boom:\", with: \"💥\")\n            .replacingOccurrences(of: \":snowflake:\", with: \"❄️\")\n            .replacingOccurrences(of: \":cloud_with_snow:\", with: \"🌨\")\n            .replacingOccurrences(of: \":snowman:\", with: \"⛄\")\n            .replacingOccurrences(of: \":snowman_with_snow:\", with: \"☃\")\n            .replacingOccurrences(of: \":wind_blowing_face:\", with: \"🌬\")\n            .replacingOccurrences(of: \":dash:\", with: \"💨\")\n            .replacingOccurrences(of: \":cloud_with_tornado:\", with: \"🌪\")\n            .replacingOccurrences(of: \":fog:\", with: \"🌫\")\n            .replacingOccurrences(of: \":umbrella_without_rain:\", with: \"☂\")\n            .replacingOccurrences(of: \":umbrella:\", with: \"☔\")\n            .replacingOccurrences(of: \":droplet:\", with: \"💧\")\n            .replacingOccurrences(of: \":sweat_drops:\", with: \"💦\")\n            .replacingOccurrences(of: \":ocean:\", with: \"🌊\")\n            .replacingOccurrences(of: \":green_apple:\", with: \"🍏\")\n            .replacingOccurrences(of: \":apple:\", with: \"🍎\")\n            .replacingOccurrences(of: \":pear:\", with: \"🍐\")\n            .replacingOccurrences(of: \":tangerine:\", with: \"🍊\")\n            .replacingOccurrences(of: \":lemon:\", with: \"🍋\")\n            .replacingOccurrences(of: \":banana:\", with: \"🍌\")\n            .replacingOccurrences(of: \":watermelon:\", with: \"🍉\")\n            .replacingOccurrences(of: \":grapes:\", with: \"🍇\")\n            .replacingOccurrences(of: \":strawberry:\", with: \"🍓\")\n            .replacingOccurrences(of: \":melon:\", with: \"🍈\")\n            .replacingOccurrences(of: \":cherries:\", with: \"🍒\")\n            .replacingOccurrences(of: \":peach:\", with: \"🍑\")\n            .replacingOccurrences(of: \":pineapple:\", with: \"🍍\")\n            .replacingOccurrences(of: \":tomato:\", with: \"🍅\")\n            .replacingOccurrences(of: \":eggplant:\", with: \"🍆\")\n            .replacingOccurrences(of: \":hot_pepper:\", with: \"🌶\")\n            .replacingOccurrences(of: \":corn:\", with: \"🌽\")\n            .replacingOccurrences(of: \":sweet_potato:\", with: \"🍠\")\n            .replacingOccurrences(of: \":honey_pot:\", with: \"🍯\")\n            .replacingOccurrences(of: \":bread:\", with: \"🍞\")\n            .replacingOccurrences(of: \":cheese_wedge:\", with: \"🧀\")\n            .replacingOccurrences(of: \":poultry_leg:\", with: \"🍗\")\n            .replacingOccurrences(of: \":meat_on_bone:\", with: \"🍖\")\n            .replacingOccurrences(of: \":fried_shrimp:\", with: \"🍤\")\n            .replacingOccurrences(of: \":egg:\", with: \"🍳\")\n            .replacingOccurrences(of: \":hamburger:\", with: \"🍔\")\n            .replacingOccurrences(of: \":fries:\", with: \"🍟\")\n            .replacingOccurrences(of: \":hot_dog:\", with: \"🌭\")\n            .replacingOccurrences(of: \":pizza:\", with: \"🍕\")\n            .replacingOccurrences(of: \":spaghetti:\", with: \"🍝\")\n            .replacingOccurrences(of: \":taco:\", with: \"🌮\")\n            .replacingOccurrences(of: \":burrito:\", with: \"🌯\")\n            .replacingOccurrences(of: \":ramen:\", with: \"🍜\")\n            .replacingOccurrences(of: \":stew:\", with: \"🍲\")\n            .replacingOccurrences(of: \":fish_cake:\", with: \"🍥\")\n            .replacingOccurrences(of: \":sushi:\", with: \"🍣\")\n            .replacingOccurrences(of: \":bento:\", with: \"🍱\")\n            .replacingOccurrences(of: \":curry:\", with: \"🍛\")\n            .replacingOccurrences(of: \":rice_ball:\", with: \"🍙\")\n            .replacingOccurrences(of: \":rice:\", with: \"🍚\")\n            .replacingOccurrences(of: \":rice_cracker:\", with: \"🍘\")\n            .replacingOccurrences(of: \":oden:\", with: \"🍢\")\n            .replacingOccurrences(of: \":dango:\", with: \"🍡\")\n            .replacingOccurrences(of: \":shaved_ice:\", with: \"🍧\")\n            .replacingOccurrences(of: \":ice_cream:\", with: \"🍨\")\n            .replacingOccurrences(of: \":icecream:\", with: \"🍦\")\n            .replacingOccurrences(of: \":cake:\", with: \"🍰\")\n            .replacingOccurrences(of: \":birthday:\", with: \"🎂\")\n            .replacingOccurrences(of: \":custard:\", with: \"🍮\")\n            .replacingOccurrences(of: \":candy:\", with: \"🍬\")\n            .replacingOccurrences(of: \":lollipop:\", with: \"🍭\")\n            .replacingOccurrences(of: \":chocolate_bar:\", with: \"🍫\")\n            .replacingOccurrences(of: \":popcorn:\", with: \"🍿\")\n            .replacingOccurrences(of: \":doughnut:\", with: \"🍩\")\n            .replacingOccurrences(of: \":cookie:\", with: \"🍪\")\n            .replacingOccurrences(of: \":beer:\", with: \"🍺\")\n            .replacingOccurrences(of: \":beers:\", with: \"🍻\")\n            .replacingOccurrences(of: \":wine_glass:\", with: \"🍷\")\n            .replacingOccurrences(of: \":cocktail:\", with: \"🍸\")\n            .replacingOccurrences(of: \":tropical_drink:\", with: \"🍹\")\n            .replacingOccurrences(of: \":bottle:\", with: \"🍾\")\n            .replacingOccurrences(of: \":sake:\", with: \"🍶\")\n            .replacingOccurrences(of: \":tea:\", with: \"🍵\")\n            .replacingOccurrences(of: \":coffee:\", with: \"☕\")\n            .replacingOccurrences(of: \":baby_bottle:\", with: \"🍼\")\n            .replacingOccurrences(of: \":fork_and_knife:\", with: \"🍴\")\n            .replacingOccurrences(of: \":fork_and_knife_with_plate:\", with: \"🍽\")\n            .replacingOccurrences(of: \":soccer:\", with: \"⚽\")\n            .replacingOccurrences(of: \":basketball:\", with: \"🏀\")\n            .replacingOccurrences(of: \":football:\", with: \"🏈\")\n            .replacingOccurrences(of: \":baseball:\", with: \"⚾\")\n            .replacingOccurrences(of: \":tennis:\", with: \"🎾\")\n            .replacingOccurrences(of: \":volleyball:\", with: \"🏐\")\n            .replacingOccurrences(of: \":rugby_football:\", with: \"🏉\")\n            .replacingOccurrences(of: \":8ball:\", with: \"🎱\")\n            .replacingOccurrences(of: \":golf:\", with: \"⛳\")\n            .replacingOccurrences(of: \":golfer:\", with: \"🏌\")\n            .replacingOccurrences(of: \":table_tennis:\", with: \"🏓\")\n            .replacingOccurrences(of: \":badminton:\", with: \"🏸\")\n            .replacingOccurrences(of: \":ice_hockey:\", with: \"🏒\")\n            .replacingOccurrences(of: \":field_hockey:\", with: \"🏑\")\n            .replacingOccurrences(of: \":cricket:\", with: \"🏏\")\n            .replacingOccurrences(of: \":ski:\", with: \"🎿\")\n            .replacingOccurrences(of: \":skier:\", with: \"⛷\")\n            .replacingOccurrences(of: \":snowboarder:\", with: \"🏂\")\n            .replacingOccurrences(of: \":ice_skate:\", with: \"⛸\")\n            .replacingOccurrences(of: \":bow_and_arrow:\", with: \"🏹\")\n            .replacingOccurrences(of: \":fishing_pole_and_fish:\", with: \"🎣\")\n            .replacingOccurrences(of: \":rowboat:\", with: \"🚣\")\n            .replacingOccurrences(of: \":swimmer:\", with: \"🏊\")\n            .replacingOccurrences(of: \":surfer:\", with: \"🏄\")\n            .replacingOccurrences(of: \":bath:\", with: \"🛀\")\n            .replacingOccurrences(of: \":person_with_ball:\", with: \"⛹\")\n            .replacingOccurrences(of: \":weight_lifter:\", with: \"🏋\")\n            .replacingOccurrences(of: \":bicyclist:\", with: \"🚴\")\n            .replacingOccurrences(of: \":mountain_bicyclist:\", with: \"🚵\")\n            .replacingOccurrences(of: \":horse_racing:\", with: \"🏇\")\n            .replacingOccurrences(of: \":man_levitating:\", with: \"🕴\")\n            .replacingOccurrences(of: \":trophy:\", with: \"🏆\")\n            .replacingOccurrences(of: \":running_shirt_with_sash:\", with: \"🎽\")\n            .replacingOccurrences(of: \":sports_medal:\", with: \"🏅\")\n            .replacingOccurrences(of: \":military_medal:\", with: \"🎖\")\n            .replacingOccurrences(of: \":reminder_ribbon:\", with: \"🎗\")\n            .replacingOccurrences(of: \":rosette:\", with: \"🏵\")\n            .replacingOccurrences(of: \":ticket:\", with: \"🎫\")\n            .replacingOccurrences(of: \":admission_ticket:\", with: \"🎟\")\n            .replacingOccurrences(of: \":performing_arts:\", with: \"🎭\")\n            .replacingOccurrences(of: \":art:\", with: \"🎨\")\n            .replacingOccurrences(of: \":circus_tent:\", with: \"🎪\")\n            .replacingOccurrences(of: \":microphone:\", with: \"🎤\")\n            .replacingOccurrences(of: \":headphones:\", with: \"🎧\")\n            .replacingOccurrences(of: \":musical_score:\", with: \"🎼\")\n            .replacingOccurrences(of: \":musical_keyboard:\", with: \"🎹\")\n            .replacingOccurrences(of: \":saxophone:\", with: \"🎷\")\n            .replacingOccurrences(of: \":trumpet:\", with: \"🎺\")\n            .replacingOccurrences(of: \":guitar:\", with: \"🎸\")\n            .replacingOccurrences(of: \":violin:\", with: \"🎻\")\n            .replacingOccurrences(of: \":clapper:\", with: \"🎬\")\n            .replacingOccurrences(of: \":video_game:\", with: \"🎮\")\n            .replacingOccurrences(of: \":space_invader:\", with: \"👾\")\n            .replacingOccurrences(of: \":dart:\", with: \"🎯\")\n            .replacingOccurrences(of: \":game_die:\", with: \"🎲\")\n            .replacingOccurrences(of: \":slot_machine:\", with: \"🎰\")\n            .replacingOccurrences(of: \":bowling:\", with: \"🎳\")\n            .replacingOccurrences(of: \":car:\", with: \"🚗\")\n            .replacingOccurrences(of: \":taxi:\", with: \"🚕\")\n            .replacingOccurrences(of: \":blue_car:\", with: \"🚙\")\n            .replacingOccurrences(of: \":bus:\", with: \"🚌\")\n            .replacingOccurrences(of: \":trolleybus:\", with: \"🚎\")\n            .replacingOccurrences(of: \":racing_car:\", with: \"🏎\")\n            .replacingOccurrences(of: \":police_car:\", with: \"🚓\")\n            .replacingOccurrences(of: \":ambulance:\", with: \"🚑\")\n            .replacingOccurrences(of: \":fire_engine:\", with: \"🚒\")\n            .replacingOccurrences(of: \":minibus:\", with: \"🚐\")\n            .replacingOccurrences(of: \":truck:\", with: \"🚚\")\n            .replacingOccurrences(of: \":articulated_lorry:\", with: \"🚛\")\n            .replacingOccurrences(of: \":tractor:\", with: \"🚜\")\n            .replacingOccurrences(of: \":racing_motorcycle:\", with: \"🏍\")\n            .replacingOccurrences(of: \":bike:\", with: \"🚲\")\n            .replacingOccurrences(of: \":rotating_light:\", with: \"🚨\")\n            .replacingOccurrences(of: \":oncoming_police_car:\", with: \"🚔\")\n            .replacingOccurrences(of: \":oncoming_bus:\", with: \"🚍\")\n            .replacingOccurrences(of: \":oncoming_automobile:\", with: \"🚘\")\n            .replacingOccurrences(of: \":oncoming_taxi:\", with: \"🚖\")\n            .replacingOccurrences(of: \":aerial_tramway:\", with: \"🚡\")\n            .replacingOccurrences(of: \":mountain_cableway:\", with: \"🚠\")\n            .replacingOccurrences(of: \":suspension_railway:\", with: \"🚟\")\n            .replacingOccurrences(of: \":railway_car:\", with: \"🚃\")\n            .replacingOccurrences(of: \":train:\", with: \"🚋\")\n            .replacingOccurrences(of: \":monorail:\", with: \"🚝\")\n            .replacingOccurrences(of: \":bullettrain_side:\", with: \"🚄\")\n            .replacingOccurrences(of: \":bullettrain_front:\", with: \"🚅\")\n            .replacingOccurrences(of: \":light_rail:\", with: \"🚈\")\n            .replacingOccurrences(of: \":mountain_railway:\", with: \"🚞\")\n            .replacingOccurrences(of: \":steam_locomotive:\", with: \"🚂\")\n            .replacingOccurrences(of: \":train2:\", with: \"🚆\")\n            .replacingOccurrences(of: \":metro:\", with: \"🚇\")\n            .replacingOccurrences(of: \":tram:\", with: \"🚊\")\n            .replacingOccurrences(of: \":station:\", with: \"🚉\")\n            .replacingOccurrences(of: \":helicopter:\", with: \"🚁\")\n            .replacingOccurrences(of: \":small_airplane:\", with: \"🛩\")\n            .replacingOccurrences(of: \":airplane:\", with: \"✈️\")\n            .replacingOccurrences(of: \":airplane_departure:\", with: \"🛫\")\n            .replacingOccurrences(of: \":airplane_arrival:\", with: \"🛬\")\n            .replacingOccurrences(of: \":boat:\", with: \"⛵\")\n            .replacingOccurrences(of: \":motor_boat:\", with: \"🛥\")\n            .replacingOccurrences(of: \":speedboat:\", with: \"🚤\")\n            .replacingOccurrences(of: \":ferry:\", with: \"⛴\")\n            .replacingOccurrences(of: \":passenger_ship:\", with: \"🛳\")\n            .replacingOccurrences(of: \":rocket:\", with: \"🚀\")\n            .replacingOccurrences(of: \":artificial_satellite:\", with: \"🛰\")\n            .replacingOccurrences(of: \":seat:\", with: \"💺\")\n            .replacingOccurrences(of: \":anchor:\", with: \"⚓\")\n            .replacingOccurrences(of: \":construction:\", with: \"🚧\")\n            .replacingOccurrences(of: \":fuelpump:\", with: \"⛽\")\n            .replacingOccurrences(of: \":busstop:\", with: \"🚏\")\n            .replacingOccurrences(of: \":vertical_traffic_light:\", with: \"🚦\")\n            .replacingOccurrences(of: \":traffic_light:\", with: \"🚥\")\n            .replacingOccurrences(of: \":checkered_flag:\", with: \"🏁\")\n            .replacingOccurrences(of: \":ship:\", with: \"🚢\")\n            .replacingOccurrences(of: \":ferris_wheel:\", with: \"🎡\")\n            .replacingOccurrences(of: \":roller_coaster:\", with: \"🎢\")\n            .replacingOccurrences(of: \":carousel_horse:\", with: \"🎠\")\n            .replacingOccurrences(of: \":building_construction:\", with: \"🏗\")\n            .replacingOccurrences(of: \":foggy:\", with: \"🌁\")\n            .replacingOccurrences(of: \":tokyo_tower:\", with: \"🗼\")\n            .replacingOccurrences(of: \":factory:\", with: \"🏭\")\n            .replacingOccurrences(of: \":fountain:\", with: \"⛲\")\n            .replacingOccurrences(of: \":rice_scene:\", with: \"🎑\")\n            .replacingOccurrences(of: \":mountain:\", with: \"⛰\")\n            .replacingOccurrences(of: \":snow_capped_mountain:\", with: \"🏔\")\n            .replacingOccurrences(of: \":mount_fuji:\", with: \"🗻\")\n            .replacingOccurrences(of: \":volcano:\", with: \"🌋\")\n            .replacingOccurrences(of: \":japan:\", with: \"🗾\")\n            .replacingOccurrences(of: \":camping:\", with: \"🏕\")\n            .replacingOccurrences(of: \":tent:\", with: \"⛺\")\n            .replacingOccurrences(of: \":national_park:\", with: \"🏞\")\n            .replacingOccurrences(of: \":motorway:\", with: \"🛣\")\n            .replacingOccurrences(of: \":railway_track:\", with: \"🛤\")\n            .replacingOccurrences(of: \":sunrise:\", with: \"🌅\")\n            .replacingOccurrences(of: \":sunrise_over_mountains:\", with: \"🌄\")\n            .replacingOccurrences(of: \":desert:\", with: \"🏜\")\n            .replacingOccurrences(of: \":beach_with_umbrella:\", with: \"🏖\")\n            .replacingOccurrences(of: \":desert_island:\", with: \"🏝\")\n            .replacingOccurrences(of: \":city_sunrise:\", with: \"🌇\")\n            .replacingOccurrences(of: \":city_sunset:\", with: \"🌆\")\n            .replacingOccurrences(of: \":cityscape:\", with: \"🏙\")\n            .replacingOccurrences(of: \":night_with_stars:\", with: \"🌃\")\n            .replacingOccurrences(of: \":bridge_at_night:\", with: \"🌉\")\n            .replacingOccurrences(of: \":milky_way:\", with: \"🌌\")\n            .replacingOccurrences(of: \":stars:\", with: \"🌠\")\n            .replacingOccurrences(of: \":sparkler:\", with: \"🎇\")\n            .replacingOccurrences(of: \":fireworks:\", with: \"🎆\")\n            .replacingOccurrences(of: \":rainbow:\", with: \"🌈\")\n            .replacingOccurrences(of: \":buildings:\", with: \"🏘\")\n            .replacingOccurrences(of: \":european_castle:\", with: \"🏰\")\n            .replacingOccurrences(of: \":japanese_castle:\", with: \"🏯\")\n            .replacingOccurrences(of: \":stadium:\", with: \"🏟\")\n            .replacingOccurrences(of: \":statue_of_liberty:\", with: \"🗽\")\n            .replacingOccurrences(of: \":house:\", with: \"🏠\")\n            .replacingOccurrences(of: \":house_with_garden:\", with: \"🏡\")\n            .replacingOccurrences(of: \":derelict_house:\", with: \"🏚\")\n            .replacingOccurrences(of: \":office:\", with: \"🏢\")\n            .replacingOccurrences(of: \":department_store:\", with: \"🏬\")\n            .replacingOccurrences(of: \":post_office:\", with: \"🏣\")\n            .replacingOccurrences(of: \":european_post_office:\", with: \"🏤\")\n            .replacingOccurrences(of: \":hospital:\", with: \"🏥\")\n            .replacingOccurrences(of: \":bank:\", with: \"🏦\")\n            .replacingOccurrences(of: \":hotel:\", with: \"🏨\")\n            .replacingOccurrences(of: \":convenience_store:\", with: \"🏪\")\n            .replacingOccurrences(of: \":school:\", with: \"🏫\")\n            .replacingOccurrences(of: \":love_hotel:\", with: \"🏩\")\n            .replacingOccurrences(of: \":wedding:\", with: \"💒\")\n            .replacingOccurrences(of: \":museum:\", with: \"🏛\")\n            .replacingOccurrences(of: \":church:\", with: \"⛪\")\n            .replacingOccurrences(of: \":mosque:\", with: \"🕌\")\n            .replacingOccurrences(of: \":synagogue:\", with: \"🕍\")\n            .replacingOccurrences(of: \":kaaba:\", with: \"🕋\")\n            .replacingOccurrences(of: \":shinto_shrine:\", with: \"⛩\")\n            .replacingOccurrences(of: \":watch:\", with: \"⌚\")\n            .replacingOccurrences(of: \":iphone:\", with: \"📱\")\n            .replacingOccurrences(of: \":calling:\", with: \"📲\")\n            .replacingOccurrences(of: \":computer:\", with: \"💻\")\n            .replacingOccurrences(of: \":keyboard:\", with: \"⌨\")\n            .replacingOccurrences(of: \":desktop_computer:\", with: \"🖥\")\n            .replacingOccurrences(of: \":printer:\", with: \"🖨\")\n            .replacingOccurrences(of: \":three_button_mouse:\", with: \"🖱\")\n            .replacingOccurrences(of: \":trackball:\", with: \"🖲\")\n            .replacingOccurrences(of: \":joystick:\", with: \"🕹\")\n            .replacingOccurrences(of: \":compression:\", with: \"🗜\")\n            .replacingOccurrences(of: \":minidisc:\", with: \"💽\")\n            .replacingOccurrences(of: \":floppy_disk:\", with: \"💾\")\n            .replacingOccurrences(of: \":cd:\", with: \"💿\")\n            .replacingOccurrences(of: \":dvd:\", with: \"📀\")\n            .replacingOccurrences(of: \":vhs:\", with: \"📼\")\n            .replacingOccurrences(of: \":camera:\", with: \"📷\")\n            .replacingOccurrences(of: \":camera_with_flash:\", with: \"📸\")\n            .replacingOccurrences(of: \":video_camera:\", with: \"📹\")\n            .replacingOccurrences(of: \":movie_camera:\", with: \"🎥\")\n            .replacingOccurrences(of: \":film_projector:\", with: \"📽\")\n            .replacingOccurrences(of: \":film_frames:\", with: \"🎞\")\n            .replacingOccurrences(of: \":telephone_receiver:\", with: \"📞\")\n            .replacingOccurrences(of: \":phone:\", with: \"☎️\")\n            .replacingOccurrences(of: \":pager:\", with: \"📟\")\n            .replacingOccurrences(of: \":fax:\", with: \"📠\")\n            .replacingOccurrences(of: \":tv:\", with: \"📺\")\n            .replacingOccurrences(of: \":radio:\", with: \"📻\")\n            .replacingOccurrences(of: \":studio_microphone:\", with: \"🎙\")\n            .replacingOccurrences(of: \":level_slider:\", with: \"🎚\")\n            .replacingOccurrences(of: \":control_knobs:\", with: \"🎛\")\n            .replacingOccurrences(of: \":stopwatch:\", with: \"⏱\")\n            .replacingOccurrences(of: \":timer_clock:\", with: \"⏲\")\n            .replacingOccurrences(of: \":alarm_clock:\", with: \"⏰\")\n            .replacingOccurrences(of: \":mantelpiece_clock:\", with: \"🕰\")\n            .replacingOccurrences(of: \":hourglass_flowing_sand:\", with: \"⏳\")\n            .replacingOccurrences(of: \":hourglass:\", with: \"⌛\")\n            .replacingOccurrences(of: \":satellite:\", with: \"📡\")\n            .replacingOccurrences(of: \":battery:\", with: \"🔋\")\n            .replacingOccurrences(of: \":electric_plug:\", with: \"🔌\")\n            .replacingOccurrences(of: \":bulb:\", with: \"💡\")\n            .replacingOccurrences(of: \":flashlight:\", with: \"🔦\")\n            .replacingOccurrences(of: \":candle:\", with: \"🕯\")\n            .replacingOccurrences(of: \":wastebasket:\", with: \"🗑\")\n            .replacingOccurrences(of: \":oil_drum:\", with: \"🛢\")\n            .replacingOccurrences(of: \":money_with_wings:\", with: \"💸\")\n            .replacingOccurrences(of: \":dollar:\", with: \"💵\")\n            .replacingOccurrences(of: \":yen:\", with: \"💴\")\n            .replacingOccurrences(of: \":euro:\", with: \"💶\")\n            .replacingOccurrences(of: \":pound:\", with: \"💷\")\n            .replacingOccurrences(of: \":moneybag:\", with: \"💰\")\n            .replacingOccurrences(of: \":credit_card:\", with: \"💳\")\n            .replacingOccurrences(of: \":gem:\", with: \"💎\")\n            .replacingOccurrences(of: \":scales:\", with: \"⚖\")\n            .replacingOccurrences(of: \":wrench:\", with: \"🔧\")\n            .replacingOccurrences(of: \":hammer:\", with: \"🔨\")\n            .replacingOccurrences(of: \":hammer_and_pick:\", with: \"⚒\")\n            .replacingOccurrences(of: \":hammer_and_wrench:\", with: \"🛠\")\n            .replacingOccurrences(of: \":pick:\", with: \"⛏\")\n            .replacingOccurrences(of: \":nut_and_bolt:\", with: \"🔩\")\n            .replacingOccurrences(of: \":gear:\", with: \"⚙\")\n            .replacingOccurrences(of: \":chains:\", with: \"⛓\")\n            .replacingOccurrences(of: \":gun:\", with: \"🔫\")\n            .replacingOccurrences(of: \":bomb:\", with: \"💣\")\n            .replacingOccurrences(of: \":hocho:\", with: \"🔪\")\n            .replacingOccurrences(of: \":dagger_knife:\", with: \"🗡\")\n            .replacingOccurrences(of: \":crossed_swords:\", with: \"⚔\")\n            .replacingOccurrences(of: \":shield:\", with: \"🛡\")\n            .replacingOccurrences(of: \":smoking:\", with: \"🚬\")\n            .replacingOccurrences(of: \":skull_and_crossbones:\", with: \"☠\")\n            .replacingOccurrences(of: \":coffin:\", with: \"⚰\")\n            .replacingOccurrences(of: \":funeral_urn:\", with: \"⚱\")\n            .replacingOccurrences(of: \":amphora:\", with: \"🏺\")\n            .replacingOccurrences(of: \":crystal_ball:\", with: \"🔮\")\n            .replacingOccurrences(of: \":prayer_beads:\", with: \"📿\")\n            .replacingOccurrences(of: \":barber:\", with: \"💈\")\n            .replacingOccurrences(of: \":alembic:\", with: \"⚗\")\n            .replacingOccurrences(of: \":telescope:\", with: \"🔭\")\n            .replacingOccurrences(of: \":microscope:\", with: \"🔬\")\n            .replacingOccurrences(of: \":hole:\", with: \"🕳\")\n            .replacingOccurrences(of: \":pill:\", with: \"💊\")\n            .replacingOccurrences(of: \":syringe:\", with: \"💉\")\n            .replacingOccurrences(of: \":thermometer:\", with: \"🌡\")\n            .replacingOccurrences(of: \":label:\", with: \"🏷\")\n            .replacingOccurrences(of: \":bookmark:\", with: \"🔖\")\n            .replacingOccurrences(of: \":toilet:\", with: \"🚽\")\n            .replacingOccurrences(of: \":shower:\", with: \"🚿\")\n            .replacingOccurrences(of: \":bathtub:\", with: \"🛁\")\n            .replacingOccurrences(of: \":key:\", with: \"🔑\")\n            .replacingOccurrences(of: \":old_key:\", with: \"🗝\")\n            .replacingOccurrences(of: \":couch_and_lamp:\", with: \"🛋\")\n            .replacingOccurrences(of: \":sleeping_accommodation:\", with: \"🛌\")\n            .replacingOccurrences(of: \":bed:\", with: \"🛏\")\n            .replacingOccurrences(of: \":door:\", with: \"🚪\")\n            .replacingOccurrences(of: \":bellhop_bell:\", with: \"🛎\")\n            .replacingOccurrences(of: \":frame_with_picture:\", with: \"🖼\")\n            .replacingOccurrences(of: \":world_map:\", with: \"🗺\")\n            .replacingOccurrences(of: \":umbrella_on_ground:\", with: \"⛱\")\n            .replacingOccurrences(of: \":moyai:\", with: \"🗿\")\n            .replacingOccurrences(of: \":shopping_bags:\", with: \"🛍\")\n            .replacingOccurrences(of: \":balloon:\", with: \"🎈\")\n            .replacingOccurrences(of: \":flags:\", with: \"🎏\")\n            .replacingOccurrences(of: \":ribbon:\", with: \"🎀\")\n            .replacingOccurrences(of: \":gift:\", with: \"🎁\")\n            .replacingOccurrences(of: \":confetti_ball:\", with: \"🎊\")\n            .replacingOccurrences(of: \":tada:\", with: \"🎉\")\n            .replacingOccurrences(of: \":dolls:\", with: \"🎎\")\n            .replacingOccurrences(of: \":wind_chime:\", with: \"🎐\")\n            .replacingOccurrences(of: \":crossed_flags:\", with: \"🎌\")\n            .replacingOccurrences(of: \":izakaya_lantern:\", with: \"🏮\")\n            .replacingOccurrences(of: \":envelope:\", with: \"✉️\")\n            .replacingOccurrences(of: \":envelope_with_arrow:\", with: \"📩\")\n            .replacingOccurrences(of: \":incoming_envelope:\", with: \"📨\")\n            .replacingOccurrences(of: \":email:\", with: \"📧\")\n            .replacingOccurrences(of: \":love_letter:\", with: \"💌\")\n            .replacingOccurrences(of: \":postbox:\", with: \"📮\")\n            .replacingOccurrences(of: \":mailbox_closed:\", with: \"📪\")\n            .replacingOccurrences(of: \":mailbox:\", with: \"📫\")\n            .replacingOccurrences(of: \":mailbox_with_mail:\", with: \"📬\")\n            .replacingOccurrences(of: \":mailbox_with_no_mail:\", with: \"📭\")\n            .replacingOccurrences(of: \":package:\", with: \"📦\")\n            .replacingOccurrences(of: \":postal_horn:\", with: \"📯\")\n            .replacingOccurrences(of: \":inbox_tray:\", with: \"📥\")\n            .replacingOccurrences(of: \":outbox_tray:\", with: \"📤\")\n            .replacingOccurrences(of: \":scroll:\", with: \"📜\")\n            .replacingOccurrences(of: \":page_with_curl:\", with: \"📃\")\n            .replacingOccurrences(of: \":bookmark_tabs:\", with: \"📑\")\n            .replacingOccurrences(of: \":bar_chart:\", with: \"📊\")\n            .replacingOccurrences(of: \":chart_with_upwards_trend:\", with: \"📈\")\n            .replacingOccurrences(of: \":chart_with_downwards_trend:\", with: \"📉\")\n            .replacingOccurrences(of: \":page_facing_up:\", with: \"📄\")\n            .replacingOccurrences(of: \":date:\", with: \"📅\")\n            .replacingOccurrences(of: \":calendar:\", with: \"📆\")\n            .replacingOccurrences(of: \":spiral_calendar_pad:\", with: \"🗓\")\n            .replacingOccurrences(of: \":card_index:\", with: \"📇\")\n            .replacingOccurrences(of: \":card_file_box:\", with: \"🗃\")\n            .replacingOccurrences(of: \":ballot_box_with_ballot:\", with: \"🗳\")\n            .replacingOccurrences(of: \":file_cabinet:\", with: \"🗄\")\n            .replacingOccurrences(of: \":clipboard:\", with: \"📋\")\n            .replacingOccurrences(of: \":spiral_note_pad:\", with: \"🗒\")\n            .replacingOccurrences(of: \":file_folder:\", with: \"📁\")\n            .replacingOccurrences(of: \":open_file_folder:\", with: \"📂\")\n            .replacingOccurrences(of: \":card_index_dividers:\", with: \"🗂\")\n            .replacingOccurrences(of: \":rolled_up_newspaper:\", with: \"🗞\")\n            .replacingOccurrences(of: \":newspaper:\", with: \"📰\")\n            .replacingOccurrences(of: \":notebook:\", with: \"📓\")\n            .replacingOccurrences(of: \":closed_book:\", with: \"📕\")\n            .replacingOccurrences(of: \":green_book:\", with: \"📗\")\n            .replacingOccurrences(of: \":blue_book:\", with: \"📘\")\n            .replacingOccurrences(of: \":orange_book:\", with: \"📙\")\n            .replacingOccurrences(of: \":notebook_with_decorative_cover:\", with: \"📔\")\n            .replacingOccurrences(of: \":ledger:\", with: \"📒\")\n            .replacingOccurrences(of: \":books:\", with: \"📚\")\n            .replacingOccurrences(of: \":book:\", with: \"📖\")\n            .replacingOccurrences(of: \":link:\", with: \"🔗\")\n            .replacingOccurrences(of: \":paperclip:\", with: \"📎\")\n            .replacingOccurrences(of: \":linked_paperclips:\", with: \"🖇\")\n            .replacingOccurrences(of: \":scissors:\", with: \"✂️\")\n            .replacingOccurrences(of: \":triangular_ruler:\", with: \"📐\")\n            .replacingOccurrences(of: \":straight_ruler:\", with: \"📏\")\n            .replacingOccurrences(of: \":pushpin:\", with: \"📌\")\n            .replacingOccurrences(of: \":round_pushpin:\", with: \"📍\")\n            .replacingOccurrences(of: \":triangular_flag_on_post:\", with: \"🚩\")\n            .replacingOccurrences(of: \":waving_white_flag:\", with: \"🏳\")\n            .replacingOccurrences(of: \":waving_black_flag:\", with: \"🏴\")\n            .replacingOccurrences(of: \":closed_lock_with_key:\", with: \"🔐\")\n            .replacingOccurrences(of: \":lock:\", with: \"🔒\")\n            .replacingOccurrences(of: \":unlock:\", with: \"🔓\")\n            .replacingOccurrences(of: \":lock_with_ink_pen:\", with: \"🔏\")\n            .replacingOccurrences(of: \":lower_left_ballpoint_pen:\", with: \"🖊\")\n            .replacingOccurrences(of: \":lower_left_fountain_pen:\", with: \"🖋\")\n            .replacingOccurrences(of: \":black_nib:\", with: \"✒️\")\n            .replacingOccurrences(of: \":memo:\", with: \"📝\")\n            .replacingOccurrences(of: \":pencil2:\", with: \"✏️\")\n            .replacingOccurrences(of: \":lower_left_crayon:\", with: \"🖍\")\n            .replacingOccurrences(of: \":lower_left_paintbrush:\", with: \"🖌\")\n            .replacingOccurrences(of: \":mag:\", with: \"🔍\")\n            .replacingOccurrences(of: \":mag_right:\", with: \"🔎\")\n            .replacingOccurrences(of: \":heart:\", with: \"❤️\")\n            .replacingOccurrences(of: \":yellow_heart:\", with: \"💛\")\n            .replacingOccurrences(of: \":green_heart:\", with: \"💚\")\n            .replacingOccurrences(of: \":blue_heart:\", with: \"💙\")\n            .replacingOccurrences(of: \":purple_heart:\", with: \"💜\")\n            .replacingOccurrences(of: \":broken_heart:\", with: \"💔\")\n            .replacingOccurrences(of: \":heavy_heart_exclamation_mark_ornament:\", with: \"❣\")\n            .replacingOccurrences(of: \":two_hearts:\", with: \"💕\")\n            .replacingOccurrences(of: \":revolving_hearts:\", with: \"💞\")\n            .replacingOccurrences(of: \":heartbeat:\", with: \"💓\")\n            .replacingOccurrences(of: \":heartpulse:\", with: \"💗\")\n            .replacingOccurrences(of: \":sparkling_heart:\", with: \"💖\")\n            .replacingOccurrences(of: \":cupid:\", with: \"💘\")\n            .replacingOccurrences(of: \":gift_heart:\", with: \"💝\")\n            .replacingOccurrences(of: \":heart_decoration:\", with: \"💟\")\n            .replacingOccurrences(of: \":peace_symbol:\", with: \"☮\")\n            .replacingOccurrences(of: \":latin_cross:\", with: \"✝\")\n            .replacingOccurrences(of: \":star_and_crescent:\", with: \"☪\")\n            .replacingOccurrences(of: \":om_symbol:\", with: \"🕉\")\n            .replacingOccurrences(of: \":wheel_of_dharma:\", with: \"☸\")\n            .replacingOccurrences(of: \":star_of_david:\", with: \"✡\")\n            .replacingOccurrences(of: \":six_pointed_star:\", with: \"🔯\")\n            .replacingOccurrences(of: \":menorah_with_nine_branches:\", with: \"🕎\")\n            .replacingOccurrences(of: \":yin_yang:\", with: \"☯\")\n            .replacingOccurrences(of: \":orthodox_cross:\", with: \"☦\")\n            .replacingOccurrences(of: \":place_of_worship:\", with: \"🛐\")\n            .replacingOccurrences(of: \":ophiuchus:\", with: \"⛎\")\n            .replacingOccurrences(of: \":aries:\", with: \"♈\")\n            .replacingOccurrences(of: \":taurus:\", with: \"♉\")\n            .replacingOccurrences(of: \":gemini:\", with: \"♊\")\n            .replacingOccurrences(of: \":cancer:\", with: \"♋\")\n            .replacingOccurrences(of: \":leo:\", with: \"♌\")\n            .replacingOccurrences(of: \":virgo:\", with: \"♍\")\n            .replacingOccurrences(of: \":libra:\", with: \"♎\")\n            .replacingOccurrences(of: \":scorpius:\", with: \"♏\")\n            .replacingOccurrences(of: \":sagittarius:\", with: \"♐\")\n            .replacingOccurrences(of: \":capricorn:\", with: \"♑\")\n            .replacingOccurrences(of: \":aquarius:\", with: \"♒\")\n            .replacingOccurrences(of: \":pisces:\", with: \"♓\")\n            .replacingOccurrences(of: \":id:\", with: \"🆔\")\n            .replacingOccurrences(of: \":atom_symbol:\", with: \"⚛\")\n            .replacingOccurrences(of: \":u7a7a:\", with: \"🈳\")\n            .replacingOccurrences(of: \":u5272:\", with: \"🈹\")\n            .replacingOccurrences(of: \":radioactive_sign:\", with: \"☢\")\n            .replacingOccurrences(of: \":biohazard_sign:\", with: \"☣\")\n            .replacingOccurrences(of: \":mobile_phone_off:\", with: \"📴\")\n            .replacingOccurrences(of: \":vibration_mode:\", with: \"📳\")\n            .replacingOccurrences(of: \":u6709:\", with: \"🈶\")\n            .replacingOccurrences(of: \":u7121:\", with: \"🈚\")\n            .replacingOccurrences(of: \":u7533:\", with: \"🈸\")\n            .replacingOccurrences(of: \":u55b6:\", with: \"🈺\")\n            .replacingOccurrences(of: \":u6708:\", with: \"🈷️\")\n            .replacingOccurrences(of: \":eight_pointed_black_star:\", with: \"✴️\")\n            .replacingOccurrences(of: \":vs:\", with: \"🆚\")\n            .replacingOccurrences(of: \":accept:\", with: \"🉑\")\n            .replacingOccurrences(of: \":white_flower:\", with: \"💮\")\n            .replacingOccurrences(of: \":ideograph_advantage:\", with: \"🉐\")\n            .replacingOccurrences(of: \":secret:\", with: \"㊙️\")\n            .replacingOccurrences(of: \":congratulations:\", with: \"㊗️\")\n            .replacingOccurrences(of: \":u5408:\", with: \"🈴\")\n            .replacingOccurrences(of: \":u6e80:\", with: \"🈵\")\n            .replacingOccurrences(of: \":u7981:\", with: \"🈲\")\n            .replacingOccurrences(of: \":a:\", with: \"🅰️\")\n            .replacingOccurrences(of: \":b:\", with: \"🅱️\")\n            .replacingOccurrences(of: \":ab:\", with: \"🆎\")\n            .replacingOccurrences(of: \":cl:\", with: \"🆑\")\n            .replacingOccurrences(of: \":o2:\", with: \"🅾️\")\n            .replacingOccurrences(of: \":sos:\", with: \"🆘\")\n            .replacingOccurrences(of: \":no_entry:\", with: \"⛔\")\n            .replacingOccurrences(of: \":name_badge:\", with: \"📛\")\n            .replacingOccurrences(of: \":no_entry_sign:\", with: \"🚫\")\n            .replacingOccurrences(of: \":x:\", with: \"❌\")\n            .replacingOccurrences(of: \":o:\", with: \"⭕\")\n            .replacingOccurrences(of: \":anger:\", with: \"💢\")\n            .replacingOccurrences(of: \":hotsprings:\", with: \"♨️\")\n            .replacingOccurrences(of: \":no_pedestrians:\", with: \"🚷\")\n            .replacingOccurrences(of: \":do_not_litter:\", with: \"🚯\")\n            .replacingOccurrences(of: \":no_bicycles:\", with: \"🚳\")\n            .replacingOccurrences(of: \":non-potable_water:\", with: \"🚱\")\n            .replacingOccurrences(of: \":underage:\", with: \"🔞\")\n            .replacingOccurrences(of: \":no_mobile_phones:\", with: \"📵\")\n            .replacingOccurrences(of: \":exclamation:\", with: \"❗\")\n            .replacingOccurrences(of: \":grey_exclamation:\", with: \"❕\")\n            .replacingOccurrences(of: \":question:\", with: \"❓\")\n            .replacingOccurrences(of: \":grey_question:\", with: \"❔\")\n            .replacingOccurrences(of: \":bangbang:\", with: \"‼️\")\n            .replacingOccurrences(of: \":interrobang:\", with: \"⁉️\")\n            .replacingOccurrences(of: \":low_brightness:\", with: \"🔅\")\n            .replacingOccurrences(of: \":high_brightness:\", with: \"🔆\")\n            .replacingOccurrences(of: \":trident:\", with: \"🔱\")\n            .replacingOccurrences(of: \":fleur_de_lis:\", with: \"⚜\")\n            .replacingOccurrences(of: \":part_alternation_mark:\", with: \"〽️\")\n            .replacingOccurrences(of: \":warning:\", with: \"⚠️\")\n            .replacingOccurrences(of: \":children_crossing:\", with: \"🚸\")\n            .replacingOccurrences(of: \":beginner:\", with: \"🔰\")\n            .replacingOccurrences(of: \":recycle:\", with: \"♻️\")\n            .replacingOccurrences(of: \":u6307:\", with: \"🈯\")\n            .replacingOccurrences(of: \":chart:\", with: \"💹\")\n            .replacingOccurrences(of: \":sparkle:\", with: \"❇️\")\n            .replacingOccurrences(of: \":eight_spoked_asterisk:\", with: \"✳️\")\n            .replacingOccurrences(of: \":negative_squared_cross_mark:\", with: \"❎\")\n            .replacingOccurrences(of: \":white_check_mark:\", with: \"✅\")\n            .replacingOccurrences(of: \":diamond_shape_with_a_dot_inside:\", with: \"💠\")\n            .replacingOccurrences(of: \":cyclone:\", with: \"🌀\")\n            .replacingOccurrences(of: \":loop:\", with: \"➿\")\n            .replacingOccurrences(of: \":globe_with_meridians:\", with: \"🌐\")\n            .replacingOccurrences(of: \":m:\", with: \"Ⓜ️\")\n            .replacingOccurrences(of: \":atm:\", with: \"🏧\")\n            .replacingOccurrences(of: \":sa:\", with: \"🈂️\")\n            .replacingOccurrences(of: \":passport_control:\", with: \"🛂\")\n            .replacingOccurrences(of: \":customs:\", with: \"🛃\")\n            .replacingOccurrences(of: \":baggage_claim:\", with: \"🛄\")\n            .replacingOccurrences(of: \":left_luggage:\", with: \"🛅\")\n            .replacingOccurrences(of: \":wheelchair:\", with: \"♿\")\n            .replacingOccurrences(of: \":no_smoking:\", with: \"🚭\")\n            .replacingOccurrences(of: \":wc:\", with: \"🚾\")\n            .replacingOccurrences(of: \":parking:\", with: \"🅿️\")\n            .replacingOccurrences(of: \":potable_water:\", with: \"🚰\")\n            .replacingOccurrences(of: \":mens:\", with: \"🚹\")\n            .replacingOccurrences(of: \":womens:\", with: \"🚺\")\n            .replacingOccurrences(of: \":baby_symbol:\", with: \"🚼\")\n            .replacingOccurrences(of: \":restroom:\", with: \"🚻\")\n            .replacingOccurrences(of: \":put_litter_in_its_place:\", with: \"🚮\")\n            .replacingOccurrences(of: \":cinema:\", with: \"🎦\")\n            .replacingOccurrences(of: \":signal_strength:\", with: \"📶\")\n            .replacingOccurrences(of: \":koko:\", with: \"🈁\")\n            .replacingOccurrences(of: \":ng:\", with: \"🆖\")\n            .replacingOccurrences(of: \":ok:\", with: \"🆗\")\n            .replacingOccurrences(of: \":up:\", with: \"🆙\")\n            .replacingOccurrences(of: \":cool:\", with: \"🆒\")\n            .replacingOccurrences(of: \":new:\", with: \"🆕\")\n            .replacingOccurrences(of: \":free:\", with: \"🆓\")\n            .replacingOccurrences(of: \":zero:\", with: \"0️⃣\")\n            .replacingOccurrences(of: \":one:\", with: \"1️⃣\")\n            .replacingOccurrences(of: \":two:\", with: \"2️⃣\")\n            .replacingOccurrences(of: \":three:\", with: \"3️⃣\")\n            .replacingOccurrences(of: \":four:\", with: \"4️⃣\")\n            .replacingOccurrences(of: \":five:\", with: \"5️⃣\")\n            .replacingOccurrences(of: \":six:\", with: \"6️⃣\")\n            .replacingOccurrences(of: \":seven:\", with: \"7️⃣\")\n            .replacingOccurrences(of: \":eight:\", with: \"8️⃣\")\n            .replacingOccurrences(of: \":nine:\", with: \"9️⃣\")\n            .replacingOccurrences(of: \":keycap_ten:\", with: \"🔟\")\n            .replacingOccurrences(of: \":keycap_star:\", with: \"*⃣\")\n            .replacingOccurrences(of: \":arrow_forward:\", with: \"▶️\")\n            .replacingOccurrences(of: \":double_vertical_bar:\", with: \"⏸\")\n            .replacingOccurrences(of: \":black_right_pointing_triangle_with_double_vertical_bar:\", with: \"⏭\")\n            .replacingOccurrences(of: \":black_square_for_stop:\", with: \"⏹\")\n            .replacingOccurrences(of: \":black_circle_for_record:\", with: \"⏺\")\n            .replacingOccurrences(of: \":black_right_pointing_double_triangle_with_vertical_bar:\", with: \"⏯\")\n            .replacingOccurrences(of: \":black_left_pointing_double_triangle_with_vertical_bar:\", with: \"⏮\")\n            .replacingOccurrences(of: \":fast_forward:\", with: \"⏩\")\n            .replacingOccurrences(of: \":rewind:\", with: \"⏪\")\n            .replacingOccurrences(of: \":twisted_rightwards_arrows:\", with: \"🔀\")\n            .replacingOccurrences(of: \":repeat:\", with: \"🔁\")\n            .replacingOccurrences(of: \":repeat_one:\", with: \"🔂\")\n            .replacingOccurrences(of: \":arrow_backward:\", with: \"◀️\")\n            .replacingOccurrences(of: \":arrow_up_small:\", with: \"🔼\")\n            .replacingOccurrences(of: \":arrow_down_small:\", with: \"🔽\")\n            .replacingOccurrences(of: \":arrow_double_up:\", with: \"⏫\")\n            .replacingOccurrences(of: \":arrow_double_down:\", with: \"⏬\")\n            .replacingOccurrences(of: \":arrow_right:\", with: \"➡️\")\n            .replacingOccurrences(of: \":arrow_left:\", with: \"⬅️\")\n            .replacingOccurrences(of: \":arrow_up:\", with: \"⬆️\")\n            .replacingOccurrences(of: \":arrow_down:\", with: \"⬇️\")\n            .replacingOccurrences(of: \":arrow_upper_right:\", with: \"↗️\")\n            .replacingOccurrences(of: \":arrow_lower_right:\", with: \"↘️\")\n            .replacingOccurrences(of: \":arrow_lower_left:\", with: \"↙️\")\n            .replacingOccurrences(of: \":arrow_upper_left:\", with: \"↖️\")\n            .replacingOccurrences(of: \":arrow_up_down:\", with: \"↕️\")\n            .replacingOccurrences(of: \":left_right_arrow:\", with: \"↔️\")\n            .replacingOccurrences(of: \":arrows_counterclockwise:\", with: \"🔄\")\n            .replacingOccurrences(of: \":arrow_right_hook:\", with: \"↪️\")\n            .replacingOccurrences(of: \":leftwards_arrow_with_hook:\", with: \"↩️\")\n            .replacingOccurrences(of: \":arrow_heading_up:\", with: \"⤴️\")\n            .replacingOccurrences(of: \":arrow_heading_down:\", with: \"⤵️\")\n            .replacingOccurrences(of: \":hash:\", with: \"#️⃣\")\n            .replacingOccurrences(of: \":information_source:\", with: \"ℹ️\")\n            .replacingOccurrences(of: \":abc:\", with: \"🔤\")\n            .replacingOccurrences(of: \":abcd:\", with: \"🔡\")\n            .replacingOccurrences(of: \":capital_abcd:\", with: \"🔠\")\n            .replacingOccurrences(of: \":symbols:\", with: \"🔣\")\n            .replacingOccurrences(of: \":musical_note:\", with: \"🎵\")\n            .replacingOccurrences(of: \":notes:\", with: \"🎶\")\n            .replacingOccurrences(of: \":wavy_dash:\", with: \"〰️\")\n            .replacingOccurrences(of: \":curly_loop:\", with: \"➰\")\n            .replacingOccurrences(of: \":heavy_check_mark:\", with: \"✔️\")\n            .replacingOccurrences(of: \":arrows_clockwise:\", with: \"🔃\")\n            .replacingOccurrences(of: \":heavy_plus_sign:\", with: \"➕\")\n            .replacingOccurrences(of: \":heavy_minus_sign:\", with: \"➖\")\n            .replacingOccurrences(of: \":heavy_division_sign:\", with: \"➗\")\n            .replacingOccurrences(of: \":heavy_multiplication_x:\", with: \"✖️\")\n            .replacingOccurrences(of: \":heavy_dollar_sign:\", with: \"💲\")\n            .replacingOccurrences(of: \":currency_exchange:\", with: \"💱\")\n            .replacingOccurrences(of: \":copyright:\", with: \"©️\")\n            .replacingOccurrences(of: \":registered:\", with: \"®️\")\n            .replacingOccurrences(of: \":tm:\", with: \"™️\")\n            .replacingOccurrences(of: \":end:\", with: \"🔚\")\n            .replacingOccurrences(of: \":back:\", with: \"🔙\")\n            .replacingOccurrences(of: \":on:\", with: \"🔛\")\n            .replacingOccurrences(of: \":top:\", with: \"🔝\")\n            .replacingOccurrences(of: \":soon:\", with: \"🔜\")\n            .replacingOccurrences(of: \":ballot_box_with_check:\", with: \"☑️\")\n            .replacingOccurrences(of: \":radio_button:\", with: \"🔘\")\n            .replacingOccurrences(of: \":white_circle:\", with: \"⚪\")\n            .replacingOccurrences(of: \":black_circle:\", with: \"⚫\")\n            .replacingOccurrences(of: \":red_circle:\", with: \"🔴\")\n            .replacingOccurrences(of: \":large_blue_circle:\", with: \"🔵\")\n            .replacingOccurrences(of: \":small_orange_diamond:\", with: \"🔸\")\n            .replacingOccurrences(of: \":small_blue_diamond:\", with: \"🔹\")\n            .replacingOccurrences(of: \":large_orange_diamond:\", with: \"🔶\")\n            .replacingOccurrences(of: \":large_blue_diamond:\", with: \"🔷\")\n            .replacingOccurrences(of: \":small_red_triangle:\", with: \"🔺\")\n            .replacingOccurrences(of: \":black_small_square:\", with: \"▪️\")\n            .replacingOccurrences(of: \":white_small_square:\", with: \"▫️\")\n            .replacingOccurrences(of: \":black_large_square:\", with: \"⬛\")\n            .replacingOccurrences(of: \":white_large_square:\", with: \"⬜\")\n            .replacingOccurrences(of: \":small_red_triangle_down:\", with: \"🔻\")\n            .replacingOccurrences(of: \":black_medium_square:\", with: \"◼️\")\n            .replacingOccurrences(of: \":white_medium_square:\", with: \"◻️\")\n            .replacingOccurrences(of: \":black_medium_small_square:\", with: \"◾\")\n            .replacingOccurrences(of: \":white_medium_small_square:\", with: \"◽\")\n            .replacingOccurrences(of: \":black_square_button:\", with: \"🔲\")\n            .replacingOccurrences(of: \":white_square_button:\", with: \"🔳\")\n            .replacingOccurrences(of: \":speaker:\", with: \"🔈\")\n            .replacingOccurrences(of: \":sound:\", with: \"🔉\")\n            .replacingOccurrences(of: \":loud_sound:\", with: \"🔊\")\n            .replacingOccurrences(of: \":mute:\", with: \"🔇\")\n            .replacingOccurrences(of: \":mega:\", with: \"📣\")\n            .replacingOccurrences(of: \":loudspeaker:\", with: \"📢\")\n            .replacingOccurrences(of: \":bell:\", with: \"🔔\")\n            .replacingOccurrences(of: \":no_bell:\", with: \"🔕\")\n            .replacingOccurrences(of: \":black_joker:\", with: \"🃏\")\n            .replacingOccurrences(of: \":mahjong:\", with: \"🀄\")\n            .replacingOccurrences(of: \":spades:\", with: \"♠️\")\n            .replacingOccurrences(of: \":clubs:\", with: \"♣️\")\n            .replacingOccurrences(of: \":hearts:\", with: \"♥️\")\n            .replacingOccurrences(of: \":diamonds:\", with: \"♦️\")\n            .replacingOccurrences(of: \":flower_playing_cards:\", with: \"🎴\")\n            .replacingOccurrences(of: \":thought_balloon:\", with: \"💭\")\n            .replacingOccurrences(of: \":right_anger_bubble:\", with: \"🗯\")\n            .replacingOccurrences(of: \":speech_balloon:\", with: \"💬\")\n            .replacingOccurrences(of: \":left_speech_bubble:\", with: \"🗨\")\n            .replacingOccurrences(of: \":clock1:\", with: \"🕐\")\n            .replacingOccurrences(of: \":clock2:\", with: \"🕑\")\n            .replacingOccurrences(of: \":clock3:\", with: \"🕒\")\n            .replacingOccurrences(of: \":clock4:\", with: \"🕓\")\n            .replacingOccurrences(of: \":clock5:\", with: \"🕔\")\n            .replacingOccurrences(of: \":clock6:\", with: \"🕕\")\n            .replacingOccurrences(of: \":clock7:\", with: \"🕖\")\n            .replacingOccurrences(of: \":clock8:\", with: \"🕗\")\n            .replacingOccurrences(of: \":clock9:\", with: \"🕘\")\n            .replacingOccurrences(of: \":clock10:\", with: \"🕙\")\n            .replacingOccurrences(of: \":clock11:\", with: \"🕚\")\n            .replacingOccurrences(of: \":clock12:\", with: \"🕛\")\n            .replacingOccurrences(of: \":clock130:\", with: \"🕜\")\n            .replacingOccurrences(of: \":clock230:\", with: \"🕝\")\n            .replacingOccurrences(of: \":clock330:\", with: \"🕞\")\n            .replacingOccurrences(of: \":clock430:\", with: \"🕟\")\n            .replacingOccurrences(of: \":clock530:\", with: \"🕠\")\n            .replacingOccurrences(of: \":clock630:\", with: \"🕡\")\n            .replacingOccurrences(of: \":clock730:\", with: \"🕢\")\n            .replacingOccurrences(of: \":clock830:\", with: \"🕣\")\n            .replacingOccurrences(of: \":clock930:\", with: \"🕤\")\n            .replacingOccurrences(of: \":clock1030:\", with: \"🕥\")\n            .replacingOccurrences(of: \":clock1130:\", with: \"🕦\")\n            .replacingOccurrences(of: \":clock1230:\", with: \"🕧\")\n    }\n}\n"
  },
  {
    "path": "Sources/SlackEvent.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nenum SlackEvent {\n    \n    case message(SlackMessage)\n    case messageChanged(SlackMessage)\n    case messageDeleted(String, String)\n    case messageReactionAdded(String, String, String)\n    case messageReactionRemoved(String, String, String)\n    case hello\n    case reconnectUrl\n    case userTyping(String, String)\n    case channelMarked\n    case presenceChange(String, SlackUser.Presence)\n    case unknown(String)\n    case fileCreated\n    case filePublic\n    case fileShared\n    case fileChange\n    case prefChange\n    case groupMarked\n    case mpimMarked\n    case imMarked\n    case userChange\n    case reply(Int, String)\n    case teamRename(String)\n    case desktopNotification(String, String)\n}\n"
  },
  {
    "path": "Sources/SlackGroup.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nstruct SlackGroup {\n    \n    let id: String\n    let name: String\n    let members: [String]\n    let topic: String\n}\n"
  },
  {
    "path": "Sources/SlackIM.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nstruct SlackIM {\n    \n    let id: String\n    let user: String\n}\n"
  },
  {
    "path": "Sources/SlackMessage.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nstruct SlackMessage {\n    \n    let ts: String\n    let channel: String\n    let user: String\n    let text: String\n    \n    let reactions: [SlackMessageReaction]\n}\n\n"
  },
  {
    "path": "Sources/SlackMessageReaction.swift",
    "content": "//\n//  SlackMessageReaction.swift\n//  slash\n//\n//  Created by damian on 08.02.2019.\n//  Copyright © 2019 kolakowski. All rights reserved.\n//\n\nimport Foundation\n\nstruct SlackMessageReaction {\n    \n    let name: String\n    let count: Int\n    let users: [String]\n}\n"
  },
  {
    "path": "Sources/SlackOAuth2.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nenum SlackOAuth2Error: Error {\n    case error(String)\n}\n\nclass SlackOAuth2 {\n    \n    static let port = 7777\n    static let address = \"http://localhost:\\(SlackOAuth2.port)\"\n    \n    private let clientId : String\n    private let clientSecret : String\n    private let permissions : [String]\n    \n    private var accessToken : String?\n    \n    init(clientId: String, clientSecret: String, permissions: [String]) {\n        self.clientId = clientId\n        self.clientSecret = clientSecret\n        self.permissions = permissions\n    }\n    \n    func authenticate() throws -> String? {\n        \n        let permissionsStr = self.permissions.joined(separator: \" \")\n        \n        Utils.shell(\"open\", \"https://slack.com/oauth/authorize?client_id=\\(self.clientId)&scope=\\(permissionsStr)&redirect_uri=\\(SlackOAuth2.address)\")\n        \n        let server = try Server(in_port_t(SlackOAuth2.port))\n        \n        var processIncomingRequests = true\n\n        while processIncomingRequests {\n            \n            try server.serve { (request, responder) in\n                \n                guard request.path == \"/\" else {\n                    responder(TextResponse(200, \"Invalid request.\"))\n                    return\n                }\n                \n                guard let code = request.query.first?.1 else {\n                    responder(TextResponse(200, \"Could not get the code.\"))\n                    return\n                }\n                \n                guard let url = URL(string: \"https://slack.com/api/oauth.access?client_id=\\(self.clientId)&client_secret=\\(self.clientSecret)&code=\\(code)&redirect_uri=\\(SlackOAuth2.address)\") else {\n                    responder(TextResponse(200, \"Could not create URL object.\"))\n                    return\n                }\n                \n                do {\n                    \n                    let (theData, _) = try URLSession.shared.synchronousDataTask(with: URLRequest(url: url))\n                    guard let data = theData else {\n                        responder(TextResponse(200, \"No response from Slack.\"))\n                        return\n                    }\n                    let object = try JSONSerialization.jsonObject(with:data)\n                    \n                    guard let dict = object as? Dictionary<String, Any> else {\n                        responder(TextResponse(200, \"Slack's response is not a dictionary \\(object).\"))\n                        return\n                    }\n                    \n                    guard let accessToken = dict[\"access_token\"] as? String else {\n                        responder(TextResponse(200, \"Could not find access token in the response \\(dict).\"))\n                        return\n                    }\n                    \n                    self.accessToken = accessToken\n                    processIncomingRequests = false\n                    \n                    responder(HtmlResponse(200, R.string.authConfirmation))\n                } catch {\n                    responder(TextResponse(200, \"Error occured for token request \\(error).\"))\n                }\n            }\n        }\n        \n\n        return self.accessToken\n    }\n}\n"
  },
  {
    "path": "Sources/SlackRealTimeClient.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nclass SlackRealTimeClient {\n    \n    enum Err: Error {\n        case error(String)\n    }\n    \n    private let websocketClient: WebSocketClient\n    \n    init(_ url: String) throws {\n        \n        guard let wssUrl = URL(string: url) else {\n            throw Err.error(\"Failed to create URL object from: \\(url).\")\n        }\n        \n        guard let wssHost = wssUrl.host else {\n            throw Err.error(\"Could not find host for: \\(wssUrl).\")\n        }\n\n        self.websocketClient = try WebSocketClient(wssHost, path: wssUrl.path)\n    }\n \n    func send(_ channel: String, message: String, replyId: Int) throws {\n        let jsonData = try JSONSerialization.data(withJSONObject:\n            [\"id\": replyId, \"type\": \"message\", \"channel\": channel, \"text\": message],\n             options: .prettyPrinted)\n        try self.websocketClient.writeFrame(opcode: .text, payload: [UInt8](jsonData))\n    }\n    \n    func waitForEvent() throws -> SlackEvent? {\n        \n        guard let frame = try self.websocketClient.waitForFrame() else {\n            return nil\n        }\n        switch frame.opcode {\n        case .text:\n            let object = try JSONSerialization.jsonObject(with: Data(frame.payload), options: .init(rawValue: 0))\n            guard let dictionary = object as? Dictionary<String, Any> else {\n                return nil\n            }\n            if let replyToId = dictionary[\"reply_to\"] as? Int {\n                let ts = (dictionary[\"ts\"] as? String) ?? \"\"\n                return .reply(replyToId, ts)\n            }\n            guard let type = dictionary[\"type\"] as? String else {\n                return nil\n            }\n            switch type {\n                case \"hello\":\n                    return .hello\n                case \"message\":\n                    return self.handleMessageEvent(dictionary)\n                case \"reconnect_url\":\n                    return .reconnectUrl\n                case \"user_typing\":\n                    let channel = (dictionary[\"channel\"] as? String) ?? \"\"\n                    let user = (dictionary[\"user\"] as? String) ?? \"\"\n                    return .userTyping(channel, user)\n                case \"channel_marked\":\n                    return .channelMarked\n                case \"presence_change\":\n                    let user = (dictionary[\"user\"] as? String) ?? \"\"\n                    let presenceValue: String = (dictionary[\"presence\"] as? String) ?? \"\"\n                    return .presenceChange(user, presenceValue == \"active\" ? .active : .away)\n                case \"file_created\":\n                    return .fileCreated\n                case \"file_public\":\n                    return .filePublic\n                case \"file_shared\":\n                    return .fileShared\n                case \"file_change\":\n                    return .fileChange\n                case \"pref_change\":\n                    return .prefChange\n                case \"group_marked\":\n                    return .groupMarked\n                case \"mpim_marked\":\n                    return .mpimMarked\n                case \"im_marked\":\n                    return .imMarked\n                case \"reaction_added\":\n                    if let item = dictionary[\"item\"] as? [String: Any] {\n                        if (item[\"type\"] as? String) == \"message\" {\n                            let reaction = (dictionary[\"reaction\"] as? String) ?? \"\"\n                            let channel = item[\"channel\"] as? String ?? \"\"\n                            let ts = item[\"ts\"] as? String ?? \"\"\n                            return .messageReactionAdded(reaction, channel, ts)\n                        }\n                    }\n                    return nil\n                case \"user_change\":\n                    return .userChange\n                case \"team_rename\":\n                    let name = (dictionary[\"name\"] as? String) ?? \"\"\n                    return .teamRename(name)\n                case \"desktop_notification\":\n                    let title = ((dictionary[\"title\"] as? String) ?? \"\") + \" \" + ((dictionary[\"subtitle\"] as? String) ?? \"\")\n                    let message = ((dictionary[\"content\"] as? String) ?? \"\")\n                    return .desktopNotification(title, message)\n                default:\n                    return .unknown(\"\\(type) - \\(dictionary)\")\n            }\n        case .ping:\n            try self.websocketClient.writeFrame(opcode: .pong)\n        default:\n            return nil\n        }\n        return nil\n    }\n    \n    private func handleMessageEvent(_ dictionary: Dictionary<String, Any>) -> SlackEvent {\n        \n        let channel = (dictionary[\"channel\"] as? String) ?? \"\"\n        let user    = (dictionary[\"user\"] as? String) ?? \"unknown\"\n        let message = (dictionary[\"text\"] as? String) ?? \"\"\n        let ts      = (dictionary[\"ts\"] as? String) ?? \"\"\n        let subType = (dictionary[\"subtype\"] as? String) ?? \"\"\n        \n        switch subType {\n            case \"message_changed\":\n                if let updatedMessage = (dictionary[\"message\"] as? Dictionary<String, Any>) {\n                    let user = (updatedMessage[\"user\"] as? String) ?? \"unknown\"\n                    let ts = (updatedMessage[\"ts\"] as? String) ?? \"\"\n                    let text = (updatedMessage[\"text\"] as? String) ?? \"\"\n                    return .messageChanged(SlackMessage(ts: ts, channel: channel, user: user, text: text, reactions: []))\n                }\n            case \"message_deleted\":\n                let ts = (dictionary[\"deleted_ts\"] as? String) ?? \"\"\n                return .messageDeleted(ts, channel)\n            default:break\n        }\n        \n        return .message(SlackMessage(ts: ts, channel: channel, user: user, text: message, reactions: []))\n    }\n}\n"
  },
  {
    "path": "Sources/SlackTeam.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\n\nimport Foundation\n\nstruct SlackTeam {\n    \n    let selfId: String\n    let name: String\n    let users: [SlackUser]\n    let channels: [SlackChannel]\n    let groups: [SlackGroup]\n    let ims: [SlackIM]\n    let wssUrl: String\n}\n"
  },
  {
    "path": "Sources/SlackUser.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nstruct SlackUser {\n    \n    enum Presence {\n        case active, away\n    }\n    \n    let id: String\n    let name: String\n    let color: String\n    let presence: Presence\n}\n"
  },
  {
    "path": "Sources/SlackWebClient.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\n\nimport Foundation\n\nenum SlackWebClientError: Error {\n    case error(String)\n}\n\nclass SlackWebClient {\n    \n    private let token: String\n    \n    init(authenticatedBy token: String) {\n        self.token = token\n    }\n    \n    func rtm() throws -> SlackTeam {\n        return processStartRTMresponse(try self.rpc(forMethod: \"rtm.start\"))\n    }\n    \n    func history(for channel: String) throws -> [SlackMessage] {\n        \n        var method = \"channels.history\"\n        \n        if let firstCharacter = channel.first {\n            switch firstCharacter {\n                //TODO - This mapping is rather naive. There should be separated methods for: groups and ims.\n                case \"C\": method = \"channels.history\"\n                case \"G\": method = \"groups.history\"\n                case \"D\": method = \"im.history\"\n                default: break\n            }\n        }\n        \n        let response = try self.rpc(forMethod: method, withParams: [\"channel\": channel])\n        \n        guard let messages = response[\"messages\"] as? Array<Any> else {\n            throw SlackWebClientError.error(\"No messages array in the response \\(response).\")\n        }\n        \n        return messages.map { item in\n            guard let dictionary = item as? Dictionary<String, Any> else {\n                return SlackMessage(ts: \"\", channel: \"\", user: \"\", text: \"\", reactions: [])\n            }\n            return SlackMessage(ts: (dictionary[\"ts\"] as? String) ?? \"\",\n                channel: channel,\n                user: (dictionary[\"user\"] as? String) ?? \"\",\n                text: (dictionary[\"text\"] as? String) ?? \"\",\n                reactions: (dictionary[\"reactions\"] as? [[String: Any]])?.map({ item in\n                    return SlackMessageReaction(\n                        name: item[\"name\"] as? String ?? \"\",\n                        count: item[\"count\"] as? Int ?? 0,\n                        users: item[\"users\"] as? [String] ?? []\n                    )\n                }) ?? []\n            )\n        }\n    }\n    \n    private func rpc(forMethod rpcMethod: String, withParams params: [String: String] = [:]) throws -> Dictionary<String, Any> {\n        \n        var queryParams = [String: String]()\n        \n        queryParams[\"token\"] = token\n        params.forEach { queryParams[$0.key] = $0.value }\n        \n        let urlString = (\"https://slack.com/api/\\(rpcMethod)?\") + queryParams.map({ $0 + \"=\" + $1}).joined(separator: \"&\")\n    \n        guard let url = URL(string: urlString) else {\n            throw SlackWebClientError.error(\"Could not create URL object.\")\n        }\n        \n        let (theData, _) = try URLSession.shared.synchronousDataTask(with: URLRequest(url: url))\n        guard let data = theData else {\n            throw SlackWebClientError.error(\"Error receiving data.\")\n        }\n        let object = try JSONSerialization.jsonObject(with:data)\n        \n        guard let dict = object as? Dictionary<String, Any> else {\n            throw SlackWebClientError.error(\"\\(rpcMethod)'s response is not a dictionary.\")\n        }\n        \n        guard (dict[\"ok\"] as? Bool) == true else {\n            throw SlackWebClientError.error(\"result not ok \\(dict).\")\n        }\n        \n        return dict\n    }\n    \n    private func processStartRTMresponse(_ object: Any) -> SlackTeam {\n        \n        return SlackTeam(\n            selfId : object ← \"self\" ← \"id\",\n            name : object ← \"team\" ← \"name\",\n            users: (object ←← \"users\").map(\n                { SlackUser(id: $0 ← \"id\", name: $0 ← \"name\", color: $0 ← \"color\", presence: ($0 ← \"presence\") == \"active\" ? .active : .away) }\n            ),\n            channels: (object ←← \"channels\").map({\n                SlackChannel(\n                    id: $0 ← \"id\",\n                    name: $0 ← \"name\",\n                    members: ($0 ←← \"members\").map({ ($0 as? String) ?? \"\" }),\n                    topic: $0 ← \"topic\",\n                    general: $0 ← \"is_general\",\n                    isMember: $0 ← \"is_member\"\n                )}\n            ),\n            groups: (object ←← \"groups\").map(\n                { SlackGroup(id: $0 ← \"id\", name: $0 ← \"name\",\n                    members: ($0 ←← \"members\").map({ ($0 as? String) ?? \"\" }),\n                    topic: $0 ← \"topic\")}\n            ),\n            ims: (object ←← \"ims\").map({ SlackIM(id: $0 ← \"id\", user: $0 ← \"user\") }),\n            wssUrl: object ← \"url\"\n        )\n    }\n}\n\nprecedencegroup LookupSeparatorPrecedence { associativity: left }\n\ninfix operator ← : LookupSeparatorPrecedence\ninfix operator ←← : LookupSeparatorPrecedence\n\nfunc ← (left: Any, right: String) -> [String: Any] {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? [String: Any]) ?? [String: Any]()\n    }\n    return [String: Any]()\n}\n\nfunc ←← (left: Any, right: String) -> [Any] {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? [Any]) ?? [Any]()\n    }\n    return [Any]()\n}\n\nfunc ← (left: Any, right: String) -> String? {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? String)\n    }\n    return nil\n}\n\nfunc ← (left: Any, right: String) -> String {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? String) ?? \"\"\n    }\n    return \"\"\n}\n\nfunc ← (left: Any, right: String) -> Bool? {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? Bool)\n    }\n    return nil\n}\n\nfunc ← (left: Any, right: String) -> Bool {\n    if let dict = left as? [String: Any] {\n        return (dict[right] as? Bool) ?? false\n    }\n    return false\n}\n\nfunc ← (left: [String: Any], right: String) -> [String: Any] {\n    return (left[right] as? [String: Any]) ?? [String: Any]()\n}\n\nfunc ← (left: [String: Any], right: String) -> Int? {\n    return (left[right] as? Int) ?? nil\n}\n\nfunc ← (left: [String: Any], right: String) -> Int {\n    return (left[right] as? Int) ?? 0\n}\n\nfunc ← (left: [String: Any], right: String) -> String? {\n    return (left[right] as? String) ?? nil\n}\n\nfunc ← (left: [String: Any], right: String) -> String {\n    return (left[right] as? String) ?? \"\"\n}\n\nfunc ← (left: [String: Any], right: String) -> Bool? {\n    return (left[right] as? Bool)\n}\n\nfunc ← (left: [String: Any], right: String) -> Bool {\n    return (left[right] as? Bool) ?? false\n}\n"
  },
  {
    "path": "Sources/Socket.swift",
    "content": "#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)\n\timport Darwin\n#elseif os(Linux)\n\timport Glibc\n#endif\n\nstruct Socket {\n  static func read(_ socket:Int32, _ buffer: UnsafeMutableRawPointer, _ size:Int) -> Int {\n    #if os(macOS) \n      return Darwin.read(socket, buffer, size) \n    #elseif os(Linux)\n      return Glibc.read(socket, buffer, size) \n    #endif\n  }\n  \n  static func write(_ socket:Int32, _ buffer: Array<UInt8>, _ size:Int) -> Int {\n    #if os(macOS) \n      return Darwin.write(socket, buffer, size) \n    #elseif os(Linux)\n      return Glibc.write(socket, buffer, size) \n    #endif\n  }\n  \n  static func close(_ socket:Int32) -> Int32 {\n    #if os(macOS) \n      return Darwin.close(socket) \n    #elseif os(Linux)\n      return Glibc.close(socket)\n    #endif\n  }\n}\n"
  },
  {
    "path": "Sources/TLSSocket.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n#if os(OSX) || os(iOS)\n\nenum TLSSocketError: Error {\n    case error(String)\n}\n\nclass TLSSocket {\n    \n    private var socket: Int32\n    private let sslContext: SSLContext\n    \n    init(_ address: String, port: Int = 443) throws {\n        \n        guard let context = SSLCreateContext(nil, .clientSide, .streamType) else {\n            throw TLSSocketError.error(\"SSLCreateContext returned null.\")\n        }\n        \n        self.sslContext = context\n        \n        let socket = Darwin.socket(AF_INET, SOCK_STREAM, 0)\n        \n        guard socket != -1 else {\n            throw TLSSocketError.error(\"Darwin.socket failed: \\(errno)\")\n        }\n        \n        self.socket = socket\n        \n        var addr = sockaddr_in()\n        addr.sin_len = __uint8_t(MemoryLayout<sockaddr_in>.size)\n        addr.sin_family = sa_family_t(AF_INET)\n        addr.sin_port = UInt16(port).bigEndian\n        \n        guard inet_pton(AF_INET, address, &(addr.sin_addr)) == 1 else {\n            let _ = Darwin.close(self.socket)\n            throw TLSSocketError.error(\"inet_pton failed.\")\n        }\n        \n        if withUnsafePointer(to: &addr, {\n            Darwin.connect(socket, UnsafePointer<sockaddr>(OpaquePointer($0)), socklen_t(MemoryLayout<sockaddr_in>.size))\n        }) == -1 {\n            let _ = Darwin.close(self.socket)\n            throw TLSSocketError.error(\"Darwin.connect failed: \\(errno)\")\n        }\n        \n        SSLSetIOFuncs(context, sslRead, sslWrite)\n        \n        guard SSLSetConnection(context, &self.socket) == noErr else {\n            let _ = Darwin.close(self.socket)\n            throw TLSSocketError.error(\"SSLSetConnection failed.\")\n        }\n        \n        let handshakeResult = SSLHandshake(context)\n        \n        guard handshakeResult == noErr else {\n            let _ = Darwin.close(self.socket)\n            throw TLSSocketError.error(\"SSLHandshake failed: \\(handshakeResult)\")\n        }\n    }\n    \n    func close() {\n        SSLClose(self.sslContext)\n        let _ = Darwin.close(self.socket)\n    }\n\n    func writeData(_ data: [UInt8]) throws {\n        var processed = 0\n        let result = SSLWrite(self.sslContext, data, data.count, &processed)\n        guard result == noErr else {\n            throw TLSSocketError.error(\"SSLWrite failed: \\(result)\")\n        }\n    }\n    \n    func readData() throws -> [UInt8] {\n        var processed = 0\n        var data = [UInt8](repeating: 0, count: 1024)\n        let result = SSLRead(self.sslContext, &data, data.count, &processed)\n        guard result == noErr else {\n            throw TLSSocketError.error(\"SSLRead failed: \\(result)\")\n        }\n        data.removeLast(data.count - processed)\n        return data\n    }\n}\n\nfunc sslRead(_ socketRef: SSLConnectionRef, _ data: UnsafeMutableRawPointer, _ length: UnsafeMutablePointer<Int>) -> OSStatus {\n    let socket = socketRef.load(as: Int32.self)\n    var n = 0\n    while n < length.pointee {\n        let result = read(socket, data + n, length.pointee - n)\n        if result <= 0 {\n            if result == Int(ENOENT) {\n                return errSSLClosedGraceful\n            }\n            if result == Int(ECONNRESET) {\n                return errSSLClosedAbort\n            }\n            return OSStatus(ioErr)\n        }\n        n += result\n    }\n    length.pointee = n\n    return noErr\n}\n\nfunc sslWrite(_ socketRef: SSLConnectionRef, _ data: UnsafeRawPointer, _ length: UnsafeMutablePointer<Int>) -> OSStatus {\n    let socket = socketRef.load(as: Int32.self)\n    var n = 0\n    while n < length.pointee {\n        let result = write(socket, data + n, length.pointee - n)\n        if result <= 0 {\n            if result == Int(EPIPE) {\n                return errSSLClosedAbort\n            }\n            if result == Int(ECONNRESET) {\n                return errSSLClosedAbort\n            }\n            return OSStatus(ioErr)\n        }\n        n += result\n    }\n    length.pointee = n\n    return noErr\n}\n\n#endif\n"
  },
  {
    "path": "Sources/TerminalCanvas.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass TerminalCanvas {\n    \n    var buffer = [UInt8]()\n    \n    init() {\n        self.buffer.reserveCapacity(4_000)\n    }\n    \n    @discardableResult func clear() -> TerminalCanvas {\n        self.buffer.removeAll(keepingCapacity: true)\n        return self\n    }\n    \n    @discardableResult func cursor(_ x: Int, _ y: Int) -> TerminalCanvas {\n        self.buffer.append(contentsOf: \"\\u{001B}[\\(y);\\(x)H\".utf8)\n        return self\n    }\n    \n    @discardableResult func hideCursor() -> TerminalCanvas {\n        self.buffer.append(contentsOf: \"\\u{001B}[?25l\".utf8)\n        return self\n    }\n    \n    @discardableResult func showCursor() -> TerminalCanvas {\n        self.buffer.append(contentsOf: \"\\u{001B}[?25h\".utf8)\n        return self\n    }\n    \n    @discardableResult func clean() -> TerminalCanvas {\n        buffer.append(contentsOf: \"\\u{001B}[0m\\u{001B}[2J\".utf8)\n        return self\n    }\n    \n    @discardableResult func color(_ color: Int) -> TerminalCanvas {\n        if color < 0 {\n            buffer.append(contentsOf: \"\\u{001B}[39m\".utf8)\n        } else {\n            buffer.append(contentsOf: \"\\u{001B}[38;5;\\(color)m\".utf8)\n        }\n        return self\n    }\n\n    @discardableResult func background(_ color: Int) -> TerminalCanvas {\n        if color < 0 {\n            buffer.append(contentsOf: \"\\u{001B}[49m\".utf8)\n        } else {\n            buffer.append(contentsOf: \"\\u{001B}[48;5;\\(color)m\".utf8)\n        }\n        return self\n    }\n    \n    @discardableResult func blink(_ flag: Bool) -> TerminalCanvas {\n        self.buffer.append(contentsOf: \"\\u{001B}[\\(flag ? \"5\" : \"25\")m\".utf8)\n        return self\n    }\n    \n    @discardableResult func text(_ text: String) -> TerminalCanvas {\n        buffer.append(contentsOf: text.utf8)\n        return self\n    }\n    \n    @discardableResult func reset() -> TerminalCanvas {\n        buffer.append(contentsOf: \"\\u{001B}[0m\".utf8)\n        return self\n    }\n}\n"
  },
  {
    "path": "Sources/TerminalDevice.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nenum ControlKey {\n    \n    case null\n    case ctrlC\n    case ctrlD\n    case ctrlF\n    case ctrlH\n    case tab(Bool)\n    case cr\n    case ctrlL\n    case enter\n    case ctrlQ\n    case ctrlS\n    case ctrlU\n    case esc\n    case backspace\n    case arrowUp\n    case arrowDown\n    case arrowLeft\n    case arrowRight\n    \n    case other(Character)\n}\n\nclass TerminalDevice {\n    \n    enum TerminalError: Error {\n        case error(String)\n    }\n    \n    private var originalTermios = termios()\n    \n    init() throws {\n        guard tcgetattr(fileno(stdin), &self.originalTermios) == 0 else {\n            throw TerminalError.error(\"Could not load current terminal config: \\(errno)\")\n        }\n        try self.terminalEnableRawMode()\n        \n        self.flush(TerminalCanvas().clean().buffer)\n    }\n\n    var size: (width: Int, height: Int) {\n        var w = winsize()\n        guard ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 else {\n            exit(1)\n        }\n        return (Int(w.ws_col), Int(w.ws_row))\n    }\n    \n    func key() -> ControlKey {\n\n        let c = getwchar()\n\n        switch c {\n            \n            case 0: return .null\n            case 3: return .ctrlC\n            case 4: return .ctrlD\n            case 6: return .ctrlF\n            case 8: return .ctrlH\n            case 9: return .tab(false)\n            case 10: return .cr\n            case 12: return .ctrlL\n            case 13: return .enter\n            case 17: return .ctrlQ\n            case 19: return .ctrlS\n            case 21: return .ctrlU\n            \n            case 27:\n         \n                let c1 = getwchar()\n                let c2 = getwchar()\n                \n                if c1 == 91 {\n                    switch c2 {\n                        case 65: return .arrowUp\n                        case 66: return .arrowDown\n                        case 68: return .arrowLeft\n                        case 67: return .arrowRight\n                        case 90: return .tab(true)\n                        default: break\n                    }\n                }\n                \n                return .esc\n                \n            case 127: return .backspace\n                \n            default: return .other(Character(UnicodeScalar(Int(c))!))\n        }\n    }\n    \n    func flush(_ buffer: [UInt8]) {\n        write(fileno(stdout), buffer, buffer.count)\n    }\n    \n    func reset() throws {\n        guard tcsetattr(fileno(stdin), TCSAFLUSH, &self.originalTermios) == 0 else {\n            throw TerminalError.error(\"Could not revert the original mode: \\(errno)\")\n        }\n        self.flush(TerminalCanvas().clean().cursor(1, 1).showCursor().buffer)\n    }\n    \n    private func terminalEnableRawMode() throws {\n        \n        var rawModeTermios = termios()\n        \n        memcpy(&rawModeTermios, &self.originalTermios, MemoryLayout<termios>.size)\n        \n        rawModeTermios.c_lflag = UInt(Int32(rawModeTermios.c_lflag)\n            \n            & (~(ECHO | ECHONL | ICANON | IEXTEN | ISIG)))\n        \n        rawModeTermios.c_iflag = UInt(Int32(rawModeTermios.c_iflag)\n            \n            & (~(IGNBRK | BRKINT | INLCR | ICRNL | INPCK | PARMRK | ISTRIP | IXON | IUTF8)))\n        \n        rawModeTermios.c_cflag = UInt(Int32(rawModeTermios.c_cflag) & CS8)\n        rawModeTermios.c_oflag = 0\n        \n        rawModeTermios.c_cc.17 /*[VTIME]*/ = 0\n        rawModeTermios.c_cc.16 /*[VMIN] */ = 1\n        \n        guard tcsetattr(fileno(stdin), TCSAFLUSH, &rawModeTermios) == 0 else {\n            throw TerminalError.error(\"Could not enable raw mode: \\(errno)\")\n        }\n    }\n}\n"
  },
  {
    "path": "Sources/TextLayout.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nstruct TextSpan: ExpressibleByStringLiteral {\n    \n    let text: String\n    \n    let textColor: Int\n    \n    let backgroundColor: Int\n    \n    init(stringLiteral value: String) {\n        self.text = value\n        self.textColor = R.color.defaulTextColor\n        self.backgroundColor = R.color.defaultBgColor\n    }\n    \n    init(extendedGraphemeClusterLiteral value: String) {\n        self.text = value\n        self.textColor = R.color.defaulTextColor\n        self.backgroundColor = R.color.defaultBgColor\n    }\n    \n    init(unicodeScalarLiteral value: String) {\n        self.text = value\n        self.textColor = R.color.defaulTextColor\n        self.backgroundColor = R.color.defaultBgColor\n    }\n    \n    init(_ text: String, withColor: Int = R.color.defaulTextColor, withBackground: Int = R.color.defaultBgColor) {\n        self.text = text\n        self.textColor = withColor\n        self.backgroundColor = withBackground\n    }\n}\n\nclass TextLayout {\n    \n    let canvas = TerminalCanvas()\n    \n    func layout(_ spans: [TextSpan], alignToWidth width: Int, highlightColor: Int? = nil) -> [[UInt8]] {\n        \n        canvas.clear()\n        \n        var counter = 0\n        var lines = [[UInt8]]()\n        \n        for span in spans {\n            \n            canvas.background(highlightColor ?? span.backgroundColor)\n            canvas.color(span.textColor)\n            \n            for character in span.text {\n                if character == \"\\n\" {\n                    canvas.text(String(repeating: \" \", count: width - counter))\n                    counter = 0\n                    lines.append(canvas.buffer)\n                    canvas.clear()\n                    canvas.background(highlightColor ?? span.backgroundColor)\n                    canvas.color(span.textColor)\n                } else {\n                    canvas.text(String(character))\n                    counter = counter + 1\n                    if counter == width {\n                        counter = 0\n                        lines.append(canvas.buffer)\n                        canvas.clear()\n                        canvas.background(highlightColor ?? span.backgroundColor)\n                        canvas.color(span.textColor)\n                    }\n                }\n            \n            }\n        }\n        \n        if counter < width {\n            canvas.text(String(repeating: \" \", count: width - counter))\n            lines.append(canvas.buffer)\n        }\n        \n        return lines\n    }\n    \n}\n"
  },
  {
    "path": "Sources/URLSession.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nextension URLSession {\n\n    /// Synchonized version of dataTask(with URLRequest)\n    func synchronousDataTask(with request: URLRequest) throws -> (data: Data?, response: HTTPURLResponse?) {\n        \n        let semaphore = DispatchSemaphore(value: 0)\n        \n        var data: Data?\n        var response: URLResponse?\n        var error: Error?\n        \n        URLSession.shared.dataTask(with: request) { (theData, theResponse, theError) -> Void in\n            // extract information from callback\n            data = theData\n            response = theResponse\n            error = theError\n            \n            // wake semaphore\n            semaphore.signal()\n            \n            }.resume()\n        \n        // wait until signaled\n        _ = semaphore.wait(timeout: .distantFuture)\n        \n        // do we have an error?\n        if let error = error {\n            throw error\n        }\n        \n        return (data: data, response: response as! HTTPURLResponse?)\n    }\n}\n"
  },
  {
    "path": "Sources/UserInputView.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nclass UserInputView {\n    \n    private let renderer = TerminalCanvas()\n    \n    private let terminalDevice: TerminalDevice\n    \n    init(_ device: TerminalDevice) {\n        self.terminalDevice = device\n    }\n    \n    var placeholder = R.string.inputPlaceholder\n    \n    var input = \"\"\n    \n    var cursor = 0\n    \n    func draw() {\n        \n        let size = self.terminalDevice.size\n        \n        guard size.width > 0 && size.height > 0 else {\n            return\n        }\n        \n        self.renderer\n            .clear()\n            .hideCursor()\n            .cursor(R.dimen.channelsListWidth + 1, size.height - 1)\n            .background(R.color.defaultBgColor)\n            .color(R.color.channelListBgColor)\n            .text(String(repeating: \"─\", count: size.width-R.dimen.channelsListWidth))\n            .cursor(R.dimen.channelsListWidth + 1, size.height)\n        \n        if self.input.isEmpty {\n            self.renderer\n                .color(R.color.userInputPlaceholderTextColor)\n                .background(R.color.userInputBackgorundColor)\n                .text((\" \" + placeholder).padding(toLength: size.width - R.dimen.channelsListWidth, withPad: \" \", startingAt: 0))\n                .cursor(R.dimen.channelsListWidth + 2, size.height)\n        } else {\n            self.renderer\n                .color(R.color.userInputTextColor)\n                .background(R.color.userInputBackgorundColor)\n                .text((\" \" + input).padding(toLength: size.width - R.dimen.channelsListWidth, withPad: \" \", startingAt: 0))\n                .cursor(R.dimen.channelsListWidth + 2 + cursor, size.height)\n        }\n        \n        self.renderer.showCursor()\n        \n        self.terminalDevice.flush(renderer.buffer)\n    }\n}\n"
  },
  {
    "path": "Sources/Utils.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\n\nclass Utils {\n    \n    class func shell(_ args: String...) {\n        let task = Process()\n        task.launchPath = \"/usr/bin/env\"\n        task.arguments = args\n        task.launch()\n    }\n    \n    class func xterm256Color(forUser user: SlackUser) -> Int {\n        // Slack API provides a True-Color value for every user (example: 4b3a5a). Terminal supports only 256 colors.\n        // Instead of using complex alghoritm for finding the closet color from 256 palette, just get modulo 255 value.\n        return (Int(user.color, radix: 16) ?? R.color.messageAuthorTextColor) % 255\n    }\n}"
  },
  {
    "path": "Sources/WebSocketClient.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nclass WebSocketClient {\n    \n    enum Err: Error {\n        \n        case unknownOpCode(String)\n        case unMaskedFrame\n        case notImplemented(String)\n        case invalidFrameLength(String)\n        case io(String)\n    }\n    \n    enum OpCode: UInt8 {\n        \n        case `continue` = 0x00\n        case close = 0x08\n        case ping = 0x09\n        case pong = 0x0A\n        case text = 0x01\n        case binary = 0x02\n    }\n    \n    struct Frame {\n        \n        let opcode: OpCode\n        let payload: [UInt8]\n    }\n    \n    private let mask: [UInt8]\n    private let socket: TLSSocket\n    \n    private var inputBuffer = [UInt8]()\n    \n    init(_ host: String, path: String) throws {\n        \n        self.mask = WebSocketClient.provideRandomValues(4)\n        \n        self.socket = try TLSSocket(try WebSocketClient.addressForHost(host))\n        \n        let secWebSocketKey = Data(WebSocketClient.provideRandomValues(16)).base64EncodedString()\n        \n        let handshakeRequest = [UInt8]((\n            \"GET \\(path)?encoding=text HTTP/1.1\\r\\n\" +\n            \"Host: \\(host)\\r\\n\" +\n            \"Pragma:no-cache\\r\\n\" +\n            \"Upgrade: websocket\\r\\n\" +\n            \"Connection: Upgrade\\r\\n\" +\n            \"Cache-Control: no-cache\\r\\n\" +\n            \"Sec-WebSocket-Version: 13\\r\\n\" +\n            \"Sec-WebSocket-Key: \\(secWebSocketKey)\\r\\n\\r\\n\").utf8)\n        \n        try self.socket.writeData(handshakeRequest)\n        \n        //TODO: parse http response in a better way to validate returned Sec-WebSocket-Accept.\n        \n        skipHeaders: while true {\n            let chunk = try self.socket.readData()\n            var iteratpr = chunk.makeIterator()\n            while let b = iteratpr.next() {\n                if b != 13 { inputBuffer.append(b) }\n                if inputBuffer.count >= 2 && inputBuffer.last == 10 && inputBuffer[inputBuffer.endIndex - 2] == 10 {\n                    inputBuffer.removeAll(keepingCapacity: true)\n                    inputBuffer.append(contentsOf: iteratpr)\n                    break skipHeaders\n                }\n            }\n        }\n    }\n    \n    func writeFrame(fin: Bool = true, opcode: OpCode, payload: [UInt8] = []) throws  {\n        var data = [UInt8]()\n        data.append(UInt8(fin ? 0x80 : 0x00) | opcode.rawValue)\n        data.append(contentsOf: encodeLengthAndMaskFlag(UInt64(payload.count), mask: self.mask))\n        data.append(contentsOf: payload.enumerated().map { item in\n            item.element ^ self.mask[item.offset % self.mask.count]\n        })\n        try self.socket.writeData(data)\n    }\n    \n    private class func provideRandomValues(_ count: Int) -> [UInt8] {\n        var result = [UInt8]()\n        for _ in 0..<count {\n            result.append(UInt8(arc4random() % UInt32(UInt8.max)))\n        }\n        return result\n    }\n\n    private func encodeLengthAndMaskFlag(_ len: UInt64, mask: [UInt8]? = nil) -> [UInt8] {\n        let encodedLngth = UInt8(mask != nil ? 0x80 : 0x00)\n        var encodedBytes = [UInt8]()\n        switch len {\n        case 0...125:\n            encodedBytes.append(encodedLngth | UInt8(len));\n        case 126...UInt64(UINT16_MAX):\n            encodedBytes.append(encodedLngth | 0x7E);\n            encodedBytes.append(UInt8(len >> 8 & 0xFF));\n            encodedBytes.append(UInt8(len >> 0 & 0xFF));\n        default:\n            encodedBytes.append(encodedLngth | 0x7F);\n            encodedBytes.append(UInt8(len >> 56 & 0xFF));\n            encodedBytes.append(UInt8(len >> 48 & 0xFF));\n            encodedBytes.append(UInt8(len >> 40 & 0xFF));\n            encodedBytes.append(UInt8(len >> 32 & 0xFF));\n            encodedBytes.append(UInt8(len >> 24 & 0xFF));\n            encodedBytes.append(UInt8(len >> 16 & 0xFF));\n            encodedBytes.append(UInt8(len >> 08 & 0xFF));\n            encodedBytes.append(UInt8(len >> 00 & 0xFF));\n        }\n        if let mask = mask {\n            encodedBytes.append(contentsOf: mask)\n        }\n        return encodedBytes\n    }\n    \n    func waitForFrame() throws -> Frame? {\n    \n        // Handle remaining frames after the handshake.\n        \n        if let frame = try self.lookfForFrame() {\n            return frame\n        }\n        \n        inputBuffer.append(contentsOf: try self.socket.readData())\n        \n        if let frame = try self.lookfForFrame() {\n            return frame\n        }\n        \n        return nil\n    }\n    \n    private func lookfForFrame() throws -> Frame? {\n        \n        guard inputBuffer.count > 1 else { return nil }\n        \n        let _ /* fin flag */ = inputBuffer[0] & 0x80 != 0\n        let opc = inputBuffer[0] & 0x0F\n        \n        guard let opcode = OpCode(rawValue: opc) else {\n            // \"If an unknown opcode is received, the receiving endpoint MUST _Fail the WebSocket Connection_.\"\n            // http://tools.ietf.org/html/rfc6455#section-5.2 ( Page 29 )\n            throw Err.unknownOpCode(\"\\(opc)\")\n        }\n        \n        var offset = 2\n        var len = UInt64(0)\n        \n        switch UInt64(inputBuffer[1] & 0x7F) {\n        case let short where short < 0x7E:\n            len = short\n        case 0x7E:\n            guard inputBuffer.count > 3 else { return nil }\n            len = UInt64(littleEndian: UInt64(inputBuffer[2]) << 8 | UInt64(inputBuffer[3]))\n            offset = 4\n        case 0x7F:\n            guard inputBuffer.count > 9 else { return nil }\n            let byte2 = UInt64(inputBuffer[2]) << 54\n            let byte3 = UInt64(inputBuffer[3]) << 48\n            let byte4 = UInt64(inputBuffer[4]) << 40\n            let byte5 = UInt64(inputBuffer[5]) << 32\n            let byte6 = UInt64(inputBuffer[6]) << 24\n            let byte7 = UInt64(inputBuffer[7]) << 16\n            let byte8 = UInt64(inputBuffer[8]) << 8\n            let byte9 = UInt64(inputBuffer[9])\n            len = UInt64(littleEndian: byte2 | byte3 | byte4 | byte5 | byte6 | byte7 | byte8 | byte9)\n            offset = 10\n        default:\n            throw Err.invalidFrameLength(\"Not allowed frame length: \\(len)\")\n        }\n        \n        let masked = (inputBuffer[1] & 0x80) != 0\n        \n        guard (len + UInt64(offset) + (masked ? 4 : 0)) <= UInt64(inputBuffer.count) else {\n            return nil\n        }\n        \n        if masked {\n        \n            let mask = [inputBuffer[offset], inputBuffer[offset+1], inputBuffer[offset+2], inputBuffer[offset+3]]\n            \n            offset = offset + mask.count\n            \n            let payload = inputBuffer[offset..<(offset + Int(len /* //TODO fix Int64/Int conversion */))]\n                .enumerated()\n                .map {\n                    $0.element ^ mask[Int($0.offset % 4)]\n                }\n            \n            inputBuffer.removeFirst(offset+Int(len))\n            \n            return Frame(opcode: opcode, payload: payload)\n            \n        } else {\n            \n            let payload = [UInt8](inputBuffer[offset..<(offset + Int(len /* //TODO fix Int64/Int conversion */))])\n            \n            inputBuffer.removeFirst(offset+Int(len))\n            \n            return Frame(opcode: opcode, payload: payload)\n        }\n    }\n    \n    private static func addressForHost(_ host: String) throws -> String {\n        guard let info = host.withCString({ gethostbyname($0) }) else {\n            throw Err.io(\"Could not find address for \\(host): gethostbyname failed.\")\n        }\n        guard let first = info.pointee.h_addr_list[0] else {\n            throw Err.io(\"Could not find address for \\(host): empty list.\")\n        }\n        var buffer = [Int8](repeating: 0, count: 256)\n        guard inet_ntop(AF_INET, first, &buffer, socklen_t(buffer.count)) != nil else {\n            throw Err.io(\"Could not find address for \\(host): inet_ntop failed \\(errno).\")\n        }\n        return String(cString: buffer)\n    }\n}\n"
  },
  {
    "path": "Sources/main.swift",
    "content": "//\n//  slash\n//\n//  Copyright © 2016 slash Corp. All rights reserved.\n//\n\nimport Foundation\n\nsetlocale(LC_CTYPE,\"UTF-8\")\n\nlet device = try TerminalDevice()\n\nCrashReporter.watch(usingDevice: device)\n\nvar token: String!\n\nif CommandLine.arguments.count > 1 {\n    \n    token = CommandLine.arguments[1]\n    \n} else {\n    \n    device.flush(TerminalCanvas()\n        .clean()\n        .cursor(1, 1)\n        .text(String(format: R.string.authHelpMessage, SlackOAuth2.address)).buffer)\n    \n    let slackAuthenticator = SlackOAuth2(clientId: \"2296647491.109731100693\", clientSecret: \"db81eea6c974916693ab746775dbc096\", permissions: [\"client\"])\n    \n    token = try slackAuthenticator.authenticate()\n    \n    device.flush(TerminalCanvas().clean().buffer)\n}\n\nlet application = try Application(usingDevice: device, authenticatedBy: token)\n\nsignal(SIGWINCH) { _ in\n    application.notifyTerminalSizeHasChanged()\n}\n\napplication.run()\n\n"
  },
  {
    "path": "slash.rb",
    "content": "class Slash < Formula\n  desc \"Slack terminal client written in Swift.\"\n  homepage \"https://github.com/slash-hq/slash\"\n  url \"https://github.com/slash-hq/slash/archive/0.1.0.tar.gz\"\n  sha256 \"8a709579ffba7c47b1e1975bb418d72ecbd542539d4cd6f7a72d876808bfbdb2\"\n\n  depends_on :xcode\n  def install\n    xcodebuild \"-workspace\", \"slash.xcodeproj/project.xcworkspace\", \"-derivedDataPath\", \"prefix.to_s\", \"-configuration\", \"Release\", \"-scheme\", \"slash\", \"SYMROOT=#{prefix}/Build\"\n    bin.install(prefix + \"Build/Release/slash\")\n  end\n\n  test do\n    system \"false\"\n  end\nend\n"
  },
  {
    "path": "slash.sublime-project",
    "content": "{\n  \"build_systems\": [\n    {\n      \"shell_cmd\": \"swift build -v\",\n      \"name\": \"Sublime SPM Build for Swift.\"\n    }\n  ],\n  \"folders\": [\n    {\n      \"path\": \".\",\n      \"follow_symlinks\": true\n    }\n  ]\n}"
  },
  {
    "path": "slash.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t2DB32B79220D933300D23E57 /* SlackMessageReaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DB32B78220D933300D23E57 /* SlackMessageReaction.swift */; };\n\t\t7C92EB571E03F3C900F92267 /* TerminalCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB541E03F3C900F92267 /* TerminalCanvas.swift */; };\n\t\t7C92EB581E03F3C900F92267 /* TerminalDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB551E03F3C900F92267 /* TerminalDevice.swift */; };\n\t\t7C92EB591E03F3C900F92267 /* TextLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB561E03F3C900F92267 /* TextLayout.swift */; };\n\t\t7C92EB651E03F3ED00F92267 /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5A1E03F3ED00F92267 /* Application.swift */; };\n\t\t7C92EB661E03F3ED00F92267 /* ChannelsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5B1E03F3ED00F92267 /* ChannelsListView.swift */; };\n\t\t7C92EB671E03F3ED00F92267 /* CrashReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5C1E03F3ED00F92267 /* CrashReporter.swift */; };\n\t\t7C92EB681E03F3ED00F92267 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5D1E03F3ED00F92267 /* main.swift */; };\n\t\t7C92EB691E03F3ED00F92267 /* MessagesListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5E1E03F3ED00F92267 /* MessagesListView.swift */; };\n\t\t7C92EB6A1E03F3ED00F92267 /* R.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB5F1E03F3ED00F92267 /* R.swift */; };\n\t\t7C92EB6B1E03F3ED00F92267 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB601E03F3ED00F92267 /* Server.swift */; };\n\t\t7C92EB6C1E03F3ED00F92267 /* SlackAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB611E03F3ED00F92267 /* SlackAdapter.swift */; };\n\t\t7C92EB6D1E03F3ED00F92267 /* SlackContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB621E03F3ED00F92267 /* SlackContext.swift */; };\n\t\t7C92EB6E1E03F3ED00F92267 /* UserInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB631E03F3ED00F92267 /* UserInputView.swift */; };\n\t\t7C92EB6F1E03F3ED00F92267 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB641E03F3ED00F92267 /* Utils.swift */; };\n\t\t7C92EB7D1E03F3FC00F92267 /* SlackChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB701E03F3FC00F92267 /* SlackChannel.swift */; };\n\t\t7C92EB7E1E03F3FC00F92267 /* SlackEmojiDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB711E03F3FC00F92267 /* SlackEmojiDecoder.swift */; };\n\t\t7C92EB7F1E03F3FC00F92267 /* SlackEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB721E03F3FC00F92267 /* SlackEvent.swift */; };\n\t\t7C92EB801E03F3FC00F92267 /* SlackGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB731E03F3FC00F92267 /* SlackGroup.swift */; };\n\t\t7C92EB811E03F3FC00F92267 /* SlackIM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB741E03F3FC00F92267 /* SlackIM.swift */; };\n\t\t7C92EB821E03F3FC00F92267 /* SlackMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB751E03F3FC00F92267 /* SlackMessage.swift */; };\n\t\t7C92EB831E03F3FC00F92267 /* SlackOAuth2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB761E03F3FC00F92267 /* SlackOAuth2.swift */; };\n\t\t7C92EB841E03F3FC00F92267 /* SlackRealTimeClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB771E03F3FC00F92267 /* SlackRealTimeClient.swift */; };\n\t\t7C92EB851E03F3FC00F92267 /* SlackTeam.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB781E03F3FC00F92267 /* SlackTeam.swift */; };\n\t\t7C92EB861E03F3FC00F92267 /* SlackUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB791E03F3FC00F92267 /* SlackUser.swift */; };\n\t\t7C92EB871E03F3FC00F92267 /* SlackWebClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB7A1E03F3FC00F92267 /* SlackWebClient.swift */; };\n\t\t7C92EB881E03F3FC00F92267 /* TLSSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB7B1E03F3FC00F92267 /* TLSSocket.swift */; };\n\t\t7C92EB891E03F3FC00F92267 /* WebSocketClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C92EB7C1E03F3FC00F92267 /* WebSocketClient.swift */; };\n\t\t7C9FE5F11E18F9B900FB8166 /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C9FE5F01E18F9B900FB8166 /* Socket.swift */; };\n\t\tD42C5DF71E156BEE008CDA3C /* URLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = D42C5DF61E156BEE008CDA3C /* URLSession.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t7CBB81F01DC12E8B00DC0334 /* CopyFiles */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = /usr/share/man/man1/;\n\t\t\tdstSubfolderSpec = 0;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 1;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t2DB32B78220D933300D23E57 /* SlackMessageReaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackMessageReaction.swift; path = Sources/SlackMessageReaction.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB541E03F3C900F92267 /* TerminalCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TerminalCanvas.swift; path = Sources/TerminalCanvas.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB551E03F3C900F92267 /* TerminalDevice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TerminalDevice.swift; path = Sources/TerminalDevice.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB561E03F3C900F92267 /* TextLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TextLayout.swift; path = Sources/TextLayout.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5A1E03F3ED00F92267 /* Application.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Application.swift; path = Sources/Application.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5B1E03F3ED00F92267 /* ChannelsListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChannelsListView.swift; path = Sources/ChannelsListView.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5C1E03F3ED00F92267 /* CrashReporter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CrashReporter.swift; path = Sources/CrashReporter.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5D1E03F3ED00F92267 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = Sources/main.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5E1E03F3ED00F92267 /* MessagesListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessagesListView.swift; path = Sources/MessagesListView.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB5F1E03F3ED00F92267 /* R.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = R.swift; path = Sources/R.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB601E03F3ED00F92267 /* Server.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Server.swift; path = Sources/Server.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB611E03F3ED00F92267 /* SlackAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackAdapter.swift; path = Sources/SlackAdapter.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB621E03F3ED00F92267 /* SlackContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackContext.swift; path = Sources/SlackContext.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB631E03F3ED00F92267 /* UserInputView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserInputView.swift; path = Sources/UserInputView.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB641E03F3ED00F92267 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Utils.swift; path = Sources/Utils.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB701E03F3FC00F92267 /* SlackChannel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackChannel.swift; path = Sources/SlackChannel.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB711E03F3FC00F92267 /* SlackEmojiDecoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackEmojiDecoder.swift; path = Sources/SlackEmojiDecoder.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB721E03F3FC00F92267 /* SlackEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackEvent.swift; path = Sources/SlackEvent.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB731E03F3FC00F92267 /* SlackGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackGroup.swift; path = Sources/SlackGroup.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB741E03F3FC00F92267 /* SlackIM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackIM.swift; path = Sources/SlackIM.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB751E03F3FC00F92267 /* SlackMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackMessage.swift; path = Sources/SlackMessage.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB761E03F3FC00F92267 /* SlackOAuth2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackOAuth2.swift; path = Sources/SlackOAuth2.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB771E03F3FC00F92267 /* SlackRealTimeClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackRealTimeClient.swift; path = Sources/SlackRealTimeClient.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB781E03F3FC00F92267 /* SlackTeam.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackTeam.swift; path = Sources/SlackTeam.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB791E03F3FC00F92267 /* SlackUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackUser.swift; path = Sources/SlackUser.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB7A1E03F3FC00F92267 /* SlackWebClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackWebClient.swift; path = Sources/SlackWebClient.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB7B1E03F3FC00F92267 /* TLSSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TLSSocket.swift; path = Sources/TLSSocket.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C92EB7C1E03F3FC00F92267 /* WebSocketClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocketClient.swift; path = Sources/WebSocketClient.swift; sourceTree = SOURCE_ROOT; };\n\t\t7C9FE5F01E18F9B900FB8166 /* Socket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Socket.swift; path = Sources/Socket.swift; sourceTree = SOURCE_ROOT; };\n\t\t7CBB81F21DC12E8B00DC0334 /* slash */ = {isa = PBXFileReference; explicitFileType = \"compiled.mach-o.executable\"; includeInIndex = 0; path = slash; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tD42C5DF61E156BEE008CDA3C /* URLSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = URLSession.swift; path = Sources/URLSession.swift; sourceTree = SOURCE_ROOT; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t7CBB81EF1DC12E8B00DC0334 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t7C4A722A1DE5CC91005A72EF /* Sources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD42C5DF51E156A2A008CDA3C /* Extensions */,\n\t\t\t\t7C4A725F1DE5CCD4005A72EF /* App */,\n\t\t\t\t7C4A725E1DE5CCB6005A72EF /* Slack */,\n\t\t\t\t7C4A725D1DE5CCA3005A72EF /* Terminal */,\n\t\t\t);\n\t\t\tname = Sources;\n\t\t\tpath = ../Sources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7C4A725D1DE5CCA3005A72EF /* Terminal */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7C92EB541E03F3C900F92267 /* TerminalCanvas.swift */,\n\t\t\t\t7C92EB551E03F3C900F92267 /* TerminalDevice.swift */,\n\t\t\t\t7C92EB561E03F3C900F92267 /* TextLayout.swift */,\n\t\t\t);\n\t\t\tname = Terminal;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7C4A725E1DE5CCB6005A72EF /* Slack */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7C9FE5F01E18F9B900FB8166 /* Socket.swift */,\n\t\t\t\t7C92EB701E03F3FC00F92267 /* SlackChannel.swift */,\n\t\t\t\t7C92EB711E03F3FC00F92267 /* SlackEmojiDecoder.swift */,\n\t\t\t\t7C92EB721E03F3FC00F92267 /* SlackEvent.swift */,\n\t\t\t\t7C92EB731E03F3FC00F92267 /* SlackGroup.swift */,\n\t\t\t\t7C92EB741E03F3FC00F92267 /* SlackIM.swift */,\n\t\t\t\t7C92EB751E03F3FC00F92267 /* SlackMessage.swift */,\n\t\t\t\t2DB32B78220D933300D23E57 /* SlackMessageReaction.swift */,\n\t\t\t\t7C92EB761E03F3FC00F92267 /* SlackOAuth2.swift */,\n\t\t\t\t7C92EB771E03F3FC00F92267 /* SlackRealTimeClient.swift */,\n\t\t\t\t7C92EB781E03F3FC00F92267 /* SlackTeam.swift */,\n\t\t\t\t7C92EB791E03F3FC00F92267 /* SlackUser.swift */,\n\t\t\t\t7C92EB7A1E03F3FC00F92267 /* SlackWebClient.swift */,\n\t\t\t\t7C92EB7B1E03F3FC00F92267 /* TLSSocket.swift */,\n\t\t\t\t7C92EB7C1E03F3FC00F92267 /* WebSocketClient.swift */,\n\t\t\t);\n\t\t\tname = Slack;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7C4A725F1DE5CCD4005A72EF /* App */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7C92EB5A1E03F3ED00F92267 /* Application.swift */,\n\t\t\t\t7C92EB5B1E03F3ED00F92267 /* ChannelsListView.swift */,\n\t\t\t\t7C92EB5C1E03F3ED00F92267 /* CrashReporter.swift */,\n\t\t\t\t7C92EB5D1E03F3ED00F92267 /* main.swift */,\n\t\t\t\t7C92EB5E1E03F3ED00F92267 /* MessagesListView.swift */,\n\t\t\t\t7C92EB5F1E03F3ED00F92267 /* R.swift */,\n\t\t\t\t7C92EB601E03F3ED00F92267 /* Server.swift */,\n\t\t\t\t7C92EB611E03F3ED00F92267 /* SlackAdapter.swift */,\n\t\t\t\t7C92EB621E03F3ED00F92267 /* SlackContext.swift */,\n\t\t\t\t7C92EB631E03F3ED00F92267 /* UserInputView.swift */,\n\t\t\t\t7C92EB641E03F3ED00F92267 /* Utils.swift */,\n\t\t\t);\n\t\t\tname = App;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7CBB81E91DC12E8B00DC0334 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7C4A722A1DE5CC91005A72EF /* Sources */,\n\t\t\t\t7CBB81F31DC12E8B00DC0334 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7CBB81F31DC12E8B00DC0334 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7CBB81F21DC12E8B00DC0334 /* slash */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD42C5DF51E156A2A008CDA3C /* Extensions */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD42C5DF61E156BEE008CDA3C /* URLSession.swift */,\n\t\t\t);\n\t\t\tname = Extensions;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t7CBB81F11DC12E8B00DC0334 /* slash */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 7CBB81F91DC12E8B00DC0334 /* Build configuration list for PBXNativeTarget \"slash\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t7CBB81EE1DC12E8B00DC0334 /* Sources */,\n\t\t\t\t7CBB81EF1DC12E8B00DC0334 /* Frameworks */,\n\t\t\t\t7CBB81F01DC12E8B00DC0334 /* CopyFiles */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = slash;\n\t\t\tproductName = swiftslack;\n\t\t\tproductReference = 7CBB81F21DC12E8B00DC0334 /* slash */;\n\t\t\tproductType = \"com.apple.product-type.tool\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t7CBB81EA1DC12E8B00DC0334 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0800;\n\t\t\t\tLastUpgradeCheck = 1000;\n\t\t\t\tORGANIZATIONNAME = kolakowski;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t7CBB81F11DC12E8B00DC0334 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 8.0;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 7CBB81ED1DC12E8B00DC0334 /* Build configuration list for PBXProject \"slash\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 7CBB81E91DC12E8B00DC0334;\n\t\t\tproductRefGroup = 7CBB81F31DC12E8B00DC0334 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t7CBB81F11DC12E8B00DC0334 /* slash */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t7CBB81EE1DC12E8B00DC0334 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t7C92EB801E03F3FC00F92267 /* SlackGroup.swift in Sources */,\n\t\t\t\t7C92EB6B1E03F3ED00F92267 /* Server.swift in Sources */,\n\t\t\t\t7C92EB6E1E03F3ED00F92267 /* UserInputView.swift in Sources */,\n\t\t\t\t2DB32B79220D933300D23E57 /* SlackMessageReaction.swift in Sources */,\n\t\t\t\t7C92EB691E03F3ED00F92267 /* MessagesListView.swift in Sources */,\n\t\t\t\t7C92EB881E03F3FC00F92267 /* TLSSocket.swift in Sources */,\n\t\t\t\t7C92EB6F1E03F3ED00F92267 /* Utils.swift in Sources */,\n\t\t\t\t7C92EB871E03F3FC00F92267 /* SlackWebClient.swift in Sources */,\n\t\t\t\t7C92EB811E03F3FC00F92267 /* SlackIM.swift in Sources */,\n\t\t\t\t7C92EB7D1E03F3FC00F92267 /* SlackChannel.swift in Sources */,\n\t\t\t\t7C92EB861E03F3FC00F92267 /* SlackUser.swift in Sources */,\n\t\t\t\t7C92EB671E03F3ED00F92267 /* CrashReporter.swift in Sources */,\n\t\t\t\t7C92EB821E03F3FC00F92267 /* SlackMessage.swift in Sources */,\n\t\t\t\t7C92EB681E03F3ED00F92267 /* main.swift in Sources */,\n\t\t\t\t7C92EB7F1E03F3FC00F92267 /* SlackEvent.swift in Sources */,\n\t\t\t\t7C92EB891E03F3FC00F92267 /* WebSocketClient.swift in Sources */,\n\t\t\t\t7C92EB6C1E03F3ED00F92267 /* SlackAdapter.swift in Sources */,\n\t\t\t\t7C92EB6A1E03F3ED00F92267 /* R.swift in Sources */,\n\t\t\t\t7C92EB661E03F3ED00F92267 /* ChannelsListView.swift in Sources */,\n\t\t\t\t7C92EB7E1E03F3FC00F92267 /* SlackEmojiDecoder.swift in Sources */,\n\t\t\t\t7C92EB651E03F3ED00F92267 /* Application.swift in Sources */,\n\t\t\t\t7C92EB831E03F3FC00F92267 /* SlackOAuth2.swift in Sources */,\n\t\t\t\t7C92EB6D1E03F3ED00F92267 /* SlackContext.swift in Sources */,\n\t\t\t\tD42C5DF71E156BEE008CDA3C /* URLSession.swift in Sources */,\n\t\t\t\t7C92EB841E03F3FC00F92267 /* SlackRealTimeClient.swift in Sources */,\n\t\t\t\t7C92EB851E03F3FC00F92267 /* SlackTeam.swift in Sources */,\n\t\t\t\t7C9FE5F11E18F9B900FB8166 /* Socket.swift in Sources */,\n\t\t\t\t7C92EB581E03F3C900F92267 /* TerminalDevice.swift in Sources */,\n\t\t\t\t7C92EB571E03F3C900F92267 /* TerminalCanvas.swift in Sources */,\n\t\t\t\t7C92EB591E03F3C900F92267 /* TextLayout.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t7CBB81F71DC12E8B00DC0334 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.12;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSWIFT_INCLUDE_PATHS = \"\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t7CBB81F81DC12E8B00DC0334 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.12;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSWIFT_INCLUDE_PATHS = \"\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7CBB81FA1DC12E8B00DC0334 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t7CBB81FB1DC12E8B00DC0334 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@executable_path\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t7CBB81ED1DC12E8B00DC0334 /* Build configuration list for PBXProject \"slash\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7CBB81F71DC12E8B00DC0334 /* Debug */,\n\t\t\t\t7CBB81F81DC12E8B00DC0334 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t7CBB81F91DC12E8B00DC0334 /* Build configuration list for PBXNativeTarget \"slash\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7CBB81FA1DC12E8B00DC0334 /* Debug */,\n\t\t\t\t7CBB81FB1DC12E8B00DC0334 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 7CBB81EA1DC12E8B00DC0334 /* Project object */;\n}\n"
  },
  {
    "path": "slash.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "slash.xcodeproj/xcshareddata/xcschemes/slash.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1000\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"7CBB81F11DC12E8B00DC0334\"\n               BuildableName = \"slash\"\n               BlueprintName = \"slash\"\n               ReferencedContainer = \"container:slash.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"7CBB81F11DC12E8B00DC0334\"\n            BuildableName = \"slash\"\n            BlueprintName = \"slash\"\n            ReferencedContainer = \"container:slash.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"1\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"7CBB81F11DC12E8B00DC0334\"\n            BuildableName = \"slash\"\n            BlueprintName = \"slash\"\n            ReferencedContainer = \"container:slash.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"7CBB81F11DC12E8B00DC0334\"\n            BuildableName = \"slash\"\n            BlueprintName = \"slash\"\n            ReferencedContainer = \"container:slash.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  }
]