Просмотр исходного кода

Add OAuth 2 client (#1422)

* Initialize OAuth app

* First pass on OAUTH

* Change settings names

* Rename urls and views

* Add tests for OAuth2 admin

* Add tests for oauth2 login view

* Fix tests, replace login button with oauth2 url

* Disable features when OAUTH2 is enabled

* Return 404 in oauth2 complete if its disabled

* Check if user ip is banned in oauth2 views

* Replace exceptions with final ones, test code retrieval

* Add tests for code for token exchange

* WIP tests for user data retrieval

* Cleanup tests, finish tests for user retrieval

* WIP data validation and user creation

* Happy path flow for oauth user creation/update

* Add tests for default name filter

* More iteration on user account pairing with oauth2 providder

* Add tests for user data filtering

* Add validation for user data

* Create user from oauth2 data, download avatar

* Set account as requiring admin activation, fix tests

* Repack DB integrity errors for validation errors

* Update user with oauth2 data

* Pull user ban cache with user during OAuth2 flow

* Check for bans and account inactive during OAuth2 complete

* WIP tests for oauth2 complete flow

* OAuth 2 client tests
Rafał Pitoń 2 лет назад
Родитель
Сommit
5cb0cb4eab
79 измененных файлов с 5091 добавлено и 58 удалено
  1. 1 0
      devproject/settings.py
  2. 10 6
      frontend/src/components/options/root.js
  3. 45 14
      frontend/src/components/user-menu/guest-nav.js
  4. 13 0
      misago/conf/admin/__init__.py
  5. 1 0
      misago/conf/admin/forms/__init__.py
  6. 270 0
      misago/conf/admin/forms/oauth2.py
  7. 474 0
      misago/conf/admin/tests/test_change_oauth2_settings.py
  8. 5 0
      misago/conf/admin/tests/test_change_settings_views.py
  9. 6 0
      misago/conf/admin/views.py
  10. 12 2
      misago/conf/context_processors.py
  11. 0 1
      misago/conf/migrations/0005_add_sso_settings.py
  12. 69 0
      misago/conf/migrations/0007_add_oauth2_settings.py
  13. 24 0
      misago/conf/migrations/0008_delete_sso_settings.py
  14. 2 0
      misago/hooks.py
  15. 0 1
      misago/markup/api.py
  16. 0 0
      misago/oauth2/__init__.py
  17. 7 0
      misago/oauth2/apps.py
  18. 181 0
      misago/oauth2/client.py
  19. 98 0
      misago/oauth2/exceptions.py
  20. 39 0
      misago/oauth2/migrations/0001_initial.py
  21. 43 0
      misago/oauth2/migrations/0002_copy_sso_subjects.py
  22. 0 0
      misago/oauth2/migrations/__init__.py
  23. 11 0
      misago/oauth2/models.py
  24. 0 0
      misago/oauth2/tests/__init__.py
  25. 41 0
      misago/oauth2/tests/test_default_user_name_filter.py
  26. 305 0
      misago/oauth2/tests/test_get_access_token.py
  27. 144 0
      misago/oauth2/tests/test_get_code_grant.py
  28. 504 0
      misago/oauth2/tests/test_get_user_data.py
  29. 31 0
      misago/oauth2/tests/test_getting_json_values.py
  30. 31 0
      misago/oauth2/tests/test_headers_dict_creation.py
  31. 36 0
      misago/oauth2/tests/test_login_url_creation.py
  32. 1027 0
      misago/oauth2/tests/test_oauth2_complete_view.py
  33. 62 0
      misago/oauth2/tests/test_oauth2_login_view.py
  34. 131 0
      misago/oauth2/tests/test_user_creation_from_data.py
  35. 146 0
      misago/oauth2/tests/test_user_data_filter.py
  36. 151 0
      misago/oauth2/tests/test_user_data_validation.py
  37. 117 0
      misago/oauth2/tests/test_user_update_with_data.py
  38. 8 0
      misago/oauth2/urls.py
  39. 102 0
      misago/oauth2/user.py
  40. 92 0
      misago/oauth2/validation.py
  41. 98 0
      misago/oauth2/views.py
  42. 11 0
      misago/socialauth/tests/test_begin_auth.py
  43. 9 0
      misago/socialauth/views.py
  44. 1 1
      misago/static/misago/js/misago.js
  45. 0 0
      misago/static/misago/js/misago.js.map
  46. 100 0
      misago/templates/misago/admin/conf/oauth2_settings.html
  47. 7 0
      misago/templates/misago/admin/conf/users_settings.html
  48. 8 0
      misago/templates/misago/admin/socialauth/list.html
  49. 56 0
      misago/templates/misago/errorpages/oauth2.html
  50. 32 0
      misago/templates/misago/errorpages/oauth2_profile.html
  51. 1 0
      misago/urls.py
  52. 23 0
      misago/users/api/auth.py
  53. 45 0
      misago/users/api/users.py
  54. 8 0
      misago/users/apps.py
  55. 15 19
      misago/users/avatars/__init__.py
  56. 24 0
      misago/users/avatars/default.py
  57. 33 0
      misago/users/avatars/downloaded.py
  58. 1 1
      misago/users/bans.py
  59. 5 0
      misago/users/decorators.py
  60. 2 1
      misago/users/migrations/0023_remove_user_sso_id.py
  61. 8 5
      misago/users/setupnewuser.py
  62. 26 0
      misago/users/tests/test_activation_views.py
  63. 60 0
      misago/users/tests/test_auth_api.py
  64. 11 0
      misago/users/tests/test_auth_views.py
  65. 41 2
      misago/users/tests/test_avatars.py
  66. 16 0
      misago/users/tests/test_forgottenpassword_views.py
  67. 6 0
      misago/users/tests/test_new_user_setup.py
  68. 16 0
      misago/users/tests/test_options_views.py
  69. 43 0
      misago/users/tests/test_user_changeemail_api.py
  70. 47 0
      misago/users/tests/test_user_changepassword_api.py
  71. 22 2
      misago/users/tests/test_user_create_api.py
  72. 16 0
      misago/users/tests/test_user_username_api.py
  73. 17 0
      misago/users/tests/test_users_api.py
  74. 3 0
      misago/users/tests/test_validators.py
  75. 2 3
      misago/users/validators.py
  76. 6 0
      misago/users/views/activation.py
  77. 8 0
      misago/users/views/auth.py
  78. 13 0
      misago/users/views/forgottenpassword.py
  79. 12 0
      misago/users/views/options.py

+ 1 - 0
devproject/settings.py

@@ -196,6 +196,7 @@ INSTALLED_APPS = INSTALLED_PLUGINS + [
     "misago.threads",
     "misago.readtracker",
     "misago.search",
+    "misago.oauth2",
     "misago.socialauth",
     "misago.graphql",
     "misago.faker",

+ 10 - 6
frontend/src/components/options/root.js

@@ -113,15 +113,19 @@ export function paths() {
       path: misago.get("USERCP_URL") + "edit-details/",
       component: connect(select)(EditDetails),
     },
-    {
+  ]
+
+  const delegateAuth = misago.get("SETTINGS").DELEGATE_AUTH
+  if (!delegateAuth)  {
+    paths.push({
       path: misago.get("USERCP_URL") + "change-username/",
       component: connect(select)(ChangeUsername),
-    },
-    {
+    })
+    paths.push({
       path: misago.get("USERCP_URL") + "sign-in-credentials/",
       component: connect(select)(ChangeSignInCredentials),
-    },
-  ]
+    })
+  }
 
   if (misago.get("ENABLE_DOWNLOAD_OWN_DATA")) {
     paths.push({
@@ -130,7 +134,7 @@ export function paths() {
     })
   }
 
-  if (misago.get("ENABLE_DELETE_OWN_ACCOUNT")) {
+  if (!delegateAuth && misago.get("ENABLE_DELETE_OWN_ACCOUNT")) {
     paths.push({
       path: misago.get("USERCP_URL") + "delete-account/",
       component: connect(select)(DeleteAccount),

+ 45 - 14
frontend/src/components/user-menu/guest-nav.js

@@ -13,6 +13,8 @@ export class GuestMenu extends React.Component {
   }
 
   render() {
+    const delegateAuth = misago.get("SETTINGS").DELEGATE_AUTH
+  
     return (
       <ul
         className="dropdown-menu user-dropdown dropdown-menu-right"
@@ -25,22 +27,35 @@ export class GuestMenu extends React.Component {
               "Sign in or register to start and participate in discussions."
             )}
           </p>
-          <div className="row">
-            <div className="col-xs-6">
-              <button
-                className="btn btn-default btn-sign-in btn-block"
-                onClick={this.showSignInModal}
-                type="button"
-              >
-                {gettext("Sign in")}
-              </button>
+          {delegateAuth ? (
+            <div className="row">
+              <div className="col-xs-12">
+                <a
+                  className="btn btn-default btn-sign-in btn-block"
+                  href={misago.get("SETTINGS").LOGIN_URL}
+                >
+                  {gettext("Sign in")}
+                </a>
+              </div>
             </div>
-            <div className="col-xs-6">
-              <RegisterButton className="btn-primary btn-register btn-block">
-                {gettext("Register")}
-              </RegisterButton>
+          ) : (
+            <div className="row">
+              <div className="col-xs-6">
+                <button
+                  className="btn btn-default btn-sign-in btn-block"
+                  onClick={this.showSignInModal}
+                  type="button"
+                >
+                  {gettext("Sign in")}
+                </button>
+              </div>
+              <div className="col-xs-6">
+                <RegisterButton className="btn-primary btn-register btn-block">
+                  {gettext("Register")}
+                </RegisterButton>
+              </div>
             </div>
-          </div>
+          )}
         </li>
       </ul>
     )
@@ -49,6 +64,22 @@ export class GuestMenu extends React.Component {
 
 export class GuestNav extends GuestMenu {
   render() {
+    if (misago.get("SETTINGS").DELEGATE_AUTH)  {
+      return (
+        <div className="nav nav-guest">
+          <a
+            className="btn navbar-btn btn-default btn-sign-in"
+            href={misago.get("SETTINGS").LOGIN_URL}
+          >
+            {gettext("Sign in")}
+          </a>
+          <div className="navbar-left">
+            <NavbarSearch />
+          </div>
+        </div>
+      )
+    }
+
     return (
       <div className="nav nav-guest">
         <button

+ 13 - 0
misago/conf/admin/__init__.py

@@ -6,6 +6,7 @@ from .views import (
     ChangeAnalyticsSettingsView,
     ChangeCaptchaSettingsView,
     ChangeGeneralSettingsView,
+    ChangeOAuth2SettingsView,
     ChangeThreadsSettingsView,
     ChangeUsersSettingsView,
 )
@@ -30,6 +31,9 @@ class MisagoAdminExtension:
             "general/", "general", "settings", ChangeGeneralSettingsView.as_view()
         )
         urlpatterns.single_pattern(
+            "oauth2/", "oauth2", "settings", ChangeOAuth2SettingsView.as_view()
+        )
+        urlpatterns.single_pattern(
             "threads/", "threads", "settings", ChangeThreadsSettingsView.as_view()
         )
         urlpatterns.single_pattern(
@@ -82,3 +86,12 @@ class MisagoAdminExtension:
             namespace="threads",
             after="analytics:index",
         )
+        site.add_node(
+            name=_("OAuth2"),
+            description=_(
+                "Enable OAuth2 client and connect your site to existing auth provider."
+            ),
+            parent="settings",
+            namespace="oauth2",
+            after="threads:index",
+        )

+ 1 - 0
misago/conf/admin/forms/__init__.py

@@ -2,5 +2,6 @@ from .analytics import ChangeAnalyticsSettingsForm
 from .base import ChangeSettingsForm
 from .captcha import ChangeCaptchaSettingsForm
 from .general import ChangeGeneralSettingsForm
+from .oauth2 import ChangeOAuth2SettingsForm
 from .threads import ChangeThreadsSettingsForm
 from .users import ChangeUsersSettingsForm

+ 270 - 0
misago/conf/admin/forms/oauth2.py

@@ -0,0 +1,270 @@
+from django import forms
+from django.contrib import messages
+from django.utils.translation import gettext, gettext_lazy as _
+
+from ....admin.forms import YesNoSwitch
+from .base import ChangeSettingsForm
+
+OAUTH2_OPTIONAL_FIELDS = (
+    "oauth2_token_extra_headers",
+    "oauth2_user_extra_headers",
+    "oauth2_send_welcome_email",
+    "oauth2_json_avatar_path",
+)
+
+
+class ChangeOAuth2SettingsForm(ChangeSettingsForm):
+    settings = [
+        "enable_oauth2_client",
+        "oauth2_provider",
+        "oauth2_client_id",
+        "oauth2_client_secret",
+        "oauth2_scopes",
+        "oauth2_login_url",
+        "oauth2_token_url",
+        "oauth2_token_method",
+        "oauth2_token_extra_headers",
+        "oauth2_json_token_path",
+        "oauth2_user_url",
+        "oauth2_user_method",
+        "oauth2_user_token_location",
+        "oauth2_user_token_name",
+        "oauth2_user_extra_headers",
+        "oauth2_send_welcome_email",
+        "oauth2_json_id_path",
+        "oauth2_json_name_path",
+        "oauth2_json_email_path",
+        "oauth2_json_avatar_path",
+    ]
+
+    enable_oauth2_client = YesNoSwitch(
+        label=_("Enable OAuth2 client"),
+        help_text=_(
+            "Enabling OAuth2 will make login option redirect users to the OAuth provider "
+            "configured below. It will also disable option to register on forum, "
+            "change username, email or password, as those features will be delegated "
+            "to the 3rd party site."
+        ),
+    )
+    oauth2_provider = forms.CharField(
+        label=_("Provider name"),
+        help_text=_("Name of the OAuth 2 provider to be displayed by interface."),
+        max_length=255,
+        required=False,
+    )
+    oauth2_client_id = forms.CharField(
+        label=_("Client ID"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_client_secret = forms.CharField(
+        label=_("Client Secret"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_scopes = forms.CharField(
+        label=_("Scopes"),
+        help_text=_("List of scopes to request from provider, separated with spaces."),
+        max_length=500,
+        required=False,
+    )
+
+    oauth2_login_url = forms.URLField(
+        label=_("Login form URL"),
+        help_text=_(
+            "Address to login form on provider's server that users will be "
+            "redirected to."
+        ),
+        max_length=500,
+        required=False,
+    )
+
+    oauth2_token_url = forms.URLField(
+        label=_("Access token retrieval URL"),
+        help_text=_(
+            "URL that will be called after user completes the login process "
+            "and authorization code is sent back to your site. This URL "
+            "is expected to take this code and return the access token that "
+            "will be next used to retrieve user data."
+        ),
+        max_length=500,
+        required=False,
+    )
+    oauth2_token_method = forms.ChoiceField(
+        label=_("Request method"),
+        choices=[
+            ("POST", "POST"),
+            ("GET", "GET"),
+        ],
+        widget=forms.RadioSelect(),
+    )
+    oauth2_token_extra_headers = forms.CharField(
+        label=_("Extra HTTP headers in token request"),
+        help_text=_(
+            "List of extra headers to include in a HTTP request made to retrieve "
+            'the access token. Example header is "Header-name: value". Specify each '
+            "header on separate line."
+        ),
+        widget=forms.Textarea(attrs={"rows": 4}),
+        max_length=500,
+        required=False,
+    )
+    oauth2_json_token_path = forms.CharField(
+        label=_("JSON path to access token"),
+        help_text=_(
+            "Name of key containing the access token in JSON returned by the provider "
+            'If token is nested, use period (".") for path, eg: "result.token" '
+            'will retrieve the token from "token" key nested in "result".'
+        ),
+        max_length=500,
+        required=False,
+    )
+
+    oauth2_user_url = forms.URLField(
+        label=_("User data URL"),
+        max_length=500,
+        required=False,
+    )
+    oauth2_user_method = forms.ChoiceField(
+        label=_("Request method"),
+        choices=[
+            ("POST", "POST"),
+            ("GET", "GET"),
+        ],
+        widget=forms.RadioSelect(),
+    )
+    oauth2_user_token_location = forms.ChoiceField(
+        label=_("Access token location"),
+        choices=[
+            ("QUERY", _("Query string")),
+            ("HEADER", _("HTTP header")),
+            ("HEADER_BEARER", _("HTTP header (Bearer)")),
+        ],
+        widget=forms.RadioSelect(),
+    )
+    oauth2_user_token_name = forms.CharField(
+        label=_("Access token name"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_user_extra_headers = forms.CharField(
+        label=_("Extra HTTP headers in user request"),
+        help_text=_(
+            "List of extra headers to include in a HTTP request made to retrieve "
+            'the user profile. Example header is "Header-name: value". Specify each '
+            "header on separate line."
+        ),
+        widget=forms.Textarea(attrs={"rows": 4}),
+        max_length=500,
+        required=False,
+    )
+
+    oauth2_send_welcome_email = YesNoSwitch(
+        label=_("Send a welcoming e-mail to users on their first sign-ons"),
+        required=False,
+    )
+
+    oauth2_json_id_path = forms.CharField(
+        label=_("User ID path"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_json_name_path = forms.CharField(
+        label=_("User name path"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_json_email_path = forms.CharField(
+        label=_("User e-mail path"),
+        max_length=200,
+        required=False,
+    )
+    oauth2_json_avatar_path = forms.CharField(
+        label=_("User avatar URL path"),
+        help_text=_("Optional, leave empty to don't download avatar from provider."),
+        max_length=200,
+        required=False,
+    )
+
+    def clean_oauth2_scopes(self):
+        # Remove duplicates and extra spaces, keep order of scopes
+        clean_scopes = []
+        for scope in self.cleaned_data["oauth2_scopes"].split():
+            scope = scope.strip()
+            if scope and scope not in clean_scopes:
+                clean_scopes.append(scope)
+
+        return " ".join(clean_scopes) or None
+
+    def clean_oauth2_token_extra_headers(self):
+        return clean_headers(self.cleaned_data["oauth2_token_extra_headers"])
+
+    def clean_oauth2_user_extra_headers(self):
+        return clean_headers(self.cleaned_data["oauth2_user_extra_headers"])
+
+    def clean(self):
+        data = super().clean()
+
+        if not data.get("enable_oauth2_client"):
+            return data
+
+        required_data = [data[key] for key in data if key not in OAUTH2_OPTIONAL_FIELDS]
+
+        if not all(required_data):
+            data["enable_oauth2_client"] = False
+
+            messages.error(
+                self.request,
+                gettext(
+                    "You need to complete the configuration before you will be able to "
+                    "enable OAuth 2 on your site."
+                ),
+            )
+
+        return data
+
+
+def clean_headers(headers_value):
+    clean_headers = {}
+    for header in headers_value.splitlines():
+        header = header.strip()
+        if not header:
+            continue
+        if ":" not in header:
+            raise forms.ValidationError(
+                gettext(
+                    '"%(header)s" is not a valid header. '
+                    'It\'s missing a colon (":").'
+                )
+                % {"header": header},
+            )
+
+        name, value = [part.strip() for part in header.split(":", 1)]
+
+        if not name:
+            raise forms.ValidationError(
+                gettext(
+                    '"%(header)s" is not a valid header. '
+                    'It\'s missing a header name before the colon (":").'
+                )
+                % {"header": header},
+            )
+
+        if name in clean_headers:
+            raise forms.ValidationError(
+                gettext('"%(header)s" header is entered more than once.')
+                % {"header": name},
+            )
+
+        if not value:
+            raise forms.ValidationError(
+                gettext(
+                    '"%(header)s" is not a valid header. '
+                    'It\'s missing a header value after the colon (":").'
+                )
+                % {"header": header},
+            )
+
+        clean_headers[name] = value
+
+    return "\n".join([f"{key}: {value}" for key, value in clean_headers.items()])

+ 474 - 0
misago/conf/admin/tests/test_change_oauth2_settings.py

@@ -0,0 +1,474 @@
+from django.urls import reverse
+from ...models import Setting
+from ....test import ERROR, assert_has_message, assert_contains
+
+
+def test_oauth2_can_be_enabled(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "1",
+            "oauth2_provider": "Lorem",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": "",
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "avatar",
+        },
+    )
+
+    assert response.status_code == 302
+
+    settings = {row.setting: row.value for row in Setting.objects.all()}
+
+    assert settings["enable_oauth2_client"] is True
+    assert settings["oauth2_provider"] == "Lorem"
+    assert settings["oauth2_client_id"] == "id"
+    assert settings["oauth2_client_secret"] == "secret"
+    assert settings["oauth2_scopes"] == "some scope"
+    assert settings["oauth2_login_url"] == "https://example.com/login/"
+    assert settings["oauth2_token_url"] == "https://example.com/token/"
+    assert settings["oauth2_token_method"] == "POST"
+    assert settings["oauth2_token_extra_headers"] == ""
+    assert settings["oauth2_json_token_path"] == "access_token"
+    assert settings["oauth2_user_url"] == "https://example.com/user/"
+    assert settings["oauth2_user_method"] == "GET"
+    assert settings["oauth2_user_token_location"] == "HEADER"
+    assert settings["oauth2_user_token_name"] == "access_token"
+    assert settings["oauth2_user_extra_headers"] == ""
+    assert settings["oauth2_send_welcome_email"] is False
+    assert settings["oauth2_json_id_path"] == "id"
+    assert settings["oauth2_json_name_path"] == "name"
+    assert settings["oauth2_json_email_path"] == "email"
+    assert settings["oauth2_json_avatar_path"] == "avatar"
+
+
+def test_oauth2_can_be_enabled_without_avatar(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "1",
+            "oauth2_provider": "Lorem",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": "",
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert response.status_code == 302
+
+    settings = {row.setting: row.value for row in Setting.objects.all()}
+
+    assert settings["enable_oauth2_client"] is True
+    assert settings["oauth2_provider"] == "Lorem"
+    assert settings["oauth2_client_id"] == "id"
+    assert settings["oauth2_client_secret"] == "secret"
+    assert settings["oauth2_scopes"] == "some scope"
+    assert settings["oauth2_login_url"] == "https://example.com/login/"
+    assert settings["oauth2_token_url"] == "https://example.com/token/"
+    assert settings["oauth2_token_method"] == "POST"
+    assert settings["oauth2_token_extra_headers"] == ""
+    assert settings["oauth2_json_token_path"] == "access_token"
+    assert settings["oauth2_user_url"] == "https://example.com/user/"
+    assert settings["oauth2_user_method"] == "GET"
+    assert settings["oauth2_user_token_location"] == "HEADER"
+    assert settings["oauth2_user_token_name"] == "access_token"
+    assert settings["oauth2_user_extra_headers"] == ""
+    assert settings["oauth2_send_welcome_email"] == False
+    assert settings["oauth2_json_id_path"] == "id"
+    assert settings["oauth2_json_name_path"] == "name"
+    assert settings["oauth2_json_email_path"] == "email"
+    assert settings["oauth2_json_avatar_path"] == ""
+
+
+def test_oauth2_cant_be_enabled_with_some_value_missing(admin_client):
+    data = {
+        "enable_oauth2_client": "1",
+        "oauth2_provider": "Lorem",
+        "oauth2_client_id": "id",
+        "oauth2_client_secret": "secret",
+        "oauth2_scopes": "some scope",
+        "oauth2_login_url": "https://example.com/login/",
+        "oauth2_token_url": "https://example.com/token/",
+        "oauth2_token_method": "POST",
+        "oauth2_token_extra_headers": "",
+        "oauth2_json_token_path": "access_token",
+        "oauth2_user_url": "https://example.com/user/",
+        "oauth2_user_method": "GET",
+        "oauth2_user_token_location": "HEADER",
+        "oauth2_user_token_name": "access_token",
+        "oauth2_user_extra_headers": "",
+        "oauth2_send_welcome_email": "",
+        "oauth2_json_id_path": "id",
+        "oauth2_json_name_path": "name",
+        "oauth2_json_email_path": "email",
+        "oauth2_json_avatar_path": "",
+    }
+
+    skip_settings = (
+        "enable_oauth2_client",
+        "oauth2_json_avatar_path",
+        "oauth2_token_method",
+        "oauth2_token_extra_headers",
+        "oauth2_user_method",
+        "oauth2_user_token_location",
+        "oauth2_user_extra_headers",
+        "oauth2_send_welcome_email",
+    )
+
+    for setting in data:
+        if setting in skip_settings:
+            continue
+
+        new_data = data.copy()
+        new_data[setting] = ""
+
+        response = admin_client.post(
+            reverse("misago:admin:settings:oauth2:index"),
+            new_data,
+        )
+
+        assert response.status_code == 302
+        assert_has_message(response, "You need to complete the configuration", ERROR)
+
+        settings = {row.setting: row.value for row in Setting.objects.all()}
+
+        assert settings["enable_oauth2_client"] is False
+
+        if setting != "oauth2_client_id":
+            assert settings["oauth2_client_id"] == "id"
+
+        if setting != "oauth2_client_secret":
+            assert settings["oauth2_client_secret"] == "secret"
+
+        if setting != "oauth2_scopes":
+            assert settings["oauth2_scopes"] == "some scope"
+
+        if setting != "oauth2_login_url":
+            assert settings["oauth2_login_url"] == "https://example.com/login/"
+
+        if setting != "oauth2_token_url":
+            assert settings["oauth2_token_url"] == "https://example.com/token/"
+
+        if setting != "oauth2_json_token_path":
+            assert settings["oauth2_json_token_path"] == "access_token"
+
+        if setting != "oauth2_user_url":
+            assert settings["oauth2_user_url"] == "https://example.com/user/"
+
+        if setting != "oauth2_user_token_name":
+            assert settings["oauth2_user_token_name"] == "access_token"
+
+        if setting != "oauth2_json_id_path":
+            assert settings["oauth2_json_id_path"] == "id"
+
+        if setting != "oauth2_json_name_path":
+            assert settings["oauth2_json_name_path"] == "name"
+
+        if setting != "oauth2_json_email_path":
+            assert settings["oauth2_json_email_path"] == "email"
+
+
+def test_oauth2_scopes_are_normalized(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert response.status_code == 302
+
+    setting = Setting.objects.get(setting="oauth2_scopes")
+    assert setting.value == "some scope"
+
+
+def test_oauth2_extra_token_headers_are_normalized(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": ("Lorem:   ipsum\n   Dolor: Met-elit"),
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": "",
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert response.status_code == 302
+
+    setting = Setting.objects.get(setting="oauth2_token_extra_headers")
+    assert setting.value == "Lorem: ipsum\nDolor: Met-elit"
+
+
+def test_oauth2_extra_token_headers_are_validated(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": (
+                "Lorem:   ipsum\n   Dolor-amet\n Dolor: Met-elit"
+            ),
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": "",
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(response, "is not a valid header")
+
+
+def test_oauth2_extra_user_headers_are_normalized(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Lorem:   ipsum\n   Dolor: Met-amet"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert response.status_code == 302
+
+    setting = Setting.objects.get(setting="oauth2_user_extra_headers")
+    assert setting.value == "Lorem: ipsum\nDolor: Met-amet"
+
+
+def test_oauth2_extra_user_headers_are_validated(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Lorem:   ipsum\n   Dolor-met"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(response, "is not a valid header")
+
+
+def test_oauth2_extra_headers_are_validated_to_have_colons(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Lorem:   ipsum\n   Dolor-met"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(response, "is not a valid header. It&#x27;s missing a colon")
+
+
+def test_oauth2_extra_headers_are_validated_to_have_names(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Lorem:   ipsum\n   :Dolor-met"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(
+        response,
+        "is not a valid header. It&#x27;s missing a header name before the colon",
+    )
+
+
+def test_oauth2_extra_headers_are_validated_to_have_values(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Lorem:   ipsum\n   Dolor-met:"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(
+        response,
+        "is not a valid header. It&#x27;s missing a header value after the colon",
+    )
+
+
+def test_oauth2_extra_headers_are_validated_to_be_unique(admin_client):
+    response = admin_client.post(
+        reverse("misago:admin:settings:oauth2:index"),
+        {
+            "enable_oauth2_client": "0",
+            "oauth2_client_id": "id",
+            "oauth2_client_secret": "secret",
+            "oauth2_scopes": "some some    scope",
+            "oauth2_login_url": "https://example.com/login/",
+            "oauth2_token_url": "https://example.com/token/",
+            "oauth2_token_method": "POST",
+            "oauth2_token_extra_headers": "",
+            "oauth2_json_token_path": "access_token",
+            "oauth2_user_url": "https://example.com/user/",
+            "oauth2_user_method": "GET",
+            "oauth2_user_token_location": "HEADER",
+            "oauth2_user_token_name": "access_token",
+            "oauth2_user_extra_headers": ("Accept:b\nLorem:   ipsum\n   Accept: a"),
+            "oauth2_send_welcome_email": "",
+            "oauth2_json_id_path": "id",
+            "oauth2_json_name_path": "name",
+            "oauth2_json_email_path": "email",
+            "oauth2_json_avatar_path": "",
+        },
+    )
+
+    assert_contains(response, "&quot;Accept&quot; header is entered more than once.")

+ 5 - 0
misago/conf/admin/tests/test_change_settings_views.py

@@ -90,6 +90,11 @@ def test_general_settings_form_renders(admin_client):
     assert response.status_code == 200
 
 
+def test_oauth2_settings_form_renders(admin_client):
+    response = admin_client.get(reverse("misago:admin:settings:oauth2:index"))
+    assert response.status_code == 200
+
+
 def test_threads_settings_form_renders(admin_client):
     response = admin_client.get(reverse("misago:admin:settings:threads:index"))
     assert response.status_code == 200

+ 6 - 0
misago/conf/admin/views.py

@@ -9,6 +9,7 @@ from .forms import (
     ChangeAnalyticsSettingsForm,
     ChangeCaptchaSettingsForm,
     ChangeGeneralSettingsForm,
+    ChangeOAuth2SettingsForm,
     ChangeThreadsSettingsForm,
     ChangeUsersSettingsForm,
 )
@@ -75,6 +76,11 @@ class ChangeGeneralSettingsView(ChangeSettingsView):
     template_name = "misago/admin/conf/general_settings.html"
 
 
+class ChangeOAuth2SettingsView(ChangeSettingsView):
+    form_class = ChangeOAuth2SettingsForm
+    template_name = "misago/admin/conf/oauth2_settings.html"
+
+
 class ChangeThreadsSettingsView(ChangeSettingsView):
     form_class = ChangeThreadsSettingsForm
     template_name = "misago/admin/conf/threads_settings.html"

+ 12 - 2
misago/conf/context_processors.py

@@ -37,11 +37,19 @@ def og_image(request):
 def preload_settings_json(request):
     preloaded_settings = request.settings.get_public_settings()
 
+    delegate_auth = request.settings.enable_oauth2_client
+
+    if request.settings.enable_oauth2_client:
+        login_url = reverse("misago:oauth2-login")
+    else:
+        login_url = reverse(settings.LOGIN_URL)
+
     preloaded_settings.update(
         {
+            "DELEGATE_AUTH": delegate_auth,
             "LOGIN_API_URL": settings.MISAGO_LOGIN_API_URL,
             "LOGIN_REDIRECT_URL": reverse(settings.LOGIN_REDIRECT_URL),
-            "LOGIN_URL": reverse(settings.LOGIN_URL),
+            "LOGIN_URL": login_url,
             "LOGOUT_URL": reverse(settings.LOGOUT_URL),
         }
     )
@@ -52,7 +60,9 @@ def preload_settings_json(request):
                 request.settings.blank_avatar or static(settings.MISAGO_BLANK_AVATAR)
             ),
             "CSRF_COOKIE_NAME": settings.CSRF_COOKIE_NAME,
-            "ENABLE_DELETE_OWN_ACCOUNT": request.settings.allow_delete_own_account,
+            "ENABLE_DELETE_OWN_ACCOUNT": (
+                not delegate_auth and request.settings.allow_delete_own_account
+            ),
             "ENABLE_DOWNLOAD_OWN_DATA": request.settings.allow_data_downloads,
             "MISAGO_PATH": reverse("misago:index"),
             "SETTINGS": preloaded_settings,

+ 0 - 1
misago/conf/migrations/0005_add_sso_settings.py

@@ -1,6 +1,5 @@
 # Generated by Django 2.2.1 on 2019-05-19 00:16
 
-from django.conf import settings
 from django.db import migrations
 
 from ..hydrators import dehydrate_value

+ 69 - 0
misago/conf/migrations/0007_add_oauth2_settings.py

@@ -0,0 +1,69 @@
+# Generated by Django 3.2.15 on 2023-01-04 12:36
+
+from django.db import migrations
+
+from ..hydrators import dehydrate_value
+
+settings = [
+    {
+        "setting": "enable_oauth2_client",
+        "python_type": "bool",
+        "dry_value": False,
+        "is_public": True,
+    },
+    {"setting": "oauth2_provider", "is_public": True},
+    {"setting": "oauth2_client_id", "is_public": False},
+    {"setting": "oauth2_client_secret", "is_public": False},
+    {"setting": "oauth2_scopes", "is_public": False},
+    {"setting": "oauth2_login_url", "is_public": False},
+    {"setting": "oauth2_token_url", "is_public": False},
+    {"setting": "oauth2_token_method", "dry_value": "POST", "is_public": False},
+    {"setting": "oauth2_token_extra_headers", "is_public": False},
+    {
+        "setting": "oauth2_json_token_path",
+        "dry_value": "access_token",
+        "is_public": False,
+    },
+    {"setting": "oauth2_user_url", "is_public": False},
+    {"setting": "oauth2_user_method", "dry_value": "GET", "is_public": False},
+    {
+        "setting": "oauth2_user_token_location",
+        "dry_value": "QUERY",
+        "is_public": False,
+    },
+    {
+        "setting": "oauth2_user_token_name",
+        "dry_value": "access_token",
+        "is_public": False,
+    },
+    {"setting": "oauth2_user_extra_headers", "is_public": False},
+    {
+        "setting": "oauth2_send_welcome_email",
+        "python_type": "bool",
+        "dry_value": False,
+        "is_public": False,
+    },
+    {"setting": "oauth2_json_id_path", "dry_value": "id", "is_public": False},
+    {"setting": "oauth2_json_name_path", "dry_value": "name", "is_public": False},
+    {"setting": "oauth2_json_email_path", "dry_value": "email", "is_public": False},
+    {"setting": "oauth2_json_avatar_path", "is_public": False},
+]
+
+
+def create_settings(apps, _):
+    Setting = apps.get_model("misago_conf", "Setting")
+    for setting in settings:
+        data = setting.copy()
+        if "python_type" in data and "dry_value" in data:
+            data["dry_value"] = dehydrate_value(data["python_type"], data["dry_value"])
+
+        Setting.objects.create(**setting)
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("misago_conf", "0006_add_index_message"),
+    ]
+
+    operations = [migrations.RunPython(create_settings)]

+ 24 - 0
misago/conf/migrations/0008_delete_sso_settings.py

@@ -0,0 +1,24 @@
+# Generated by Django 3.2.15 on 2023-01-04 12:37
+
+from django.db import migrations
+
+settings = (
+    "enable_sso",
+    "sso_public_key",
+    "sso_private_key",
+    "sso_url",
+)
+
+
+def delete_sso_settings(apps, _):
+    Setting = apps.get_model("misago_conf", "Setting")
+    Setting.objects.filter(setting__in=settings).delete()
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("misago_conf", "0007_add_oauth2_settings"),
+    ]
+
+    operations = [migrations.RunPython(delete_sso_settings)]

+ 2 - 0
misago/hooks.py

@@ -3,6 +3,8 @@ urlpatterns = []
 context_processors = []
 
 new_registrations_validators = []
+oauth2_user_data_filters = []
+
 post_search_filters = []
 post_validators = []
 

+ 0 - 1
misago/markup/api.py

@@ -8,7 +8,6 @@ from .serializers import MarkupSerializer
 
 @api_view(["POST"])
 def parse_markup(request):
-    print(request.data)
     serializer = MarkupSerializer(
         data=request.data, context={"settings": request.settings}
     )

+ 0 - 0
misago/oauth2/__init__.py


+ 7 - 0
misago/oauth2/apps.py

@@ -0,0 +1,7 @@
+from django.apps import AppConfig
+
+
+class MisagoOAuthConfig(AppConfig):
+    name = "misago.oauth2"
+    label = "misago_oauth2"
+    verbose_name = "Misago OAuth2"

+ 181 - 0
misago/oauth2/client.py

@@ -0,0 +1,181 @@
+from urllib.parse import urlencode
+
+import requests
+from django.urls import reverse
+from django.utils.crypto import get_random_string
+from requests.exceptions import RequestException
+
+from . import exceptions
+
+SESSION_STATE = "oauth2_state"
+STATE_LENGTH = 40
+REQUESTS_TIMEOUT = 30
+
+
+def create_login_url(request):
+    state = get_random_string(STATE_LENGTH)
+    request.session[SESSION_STATE] = state
+
+    quote = {
+        "response_type": "code",
+        "client_id": request.settings.oauth2_client_id,
+        "redirect_uri": get_redirect_uri(request),
+        "scope": request.settings.oauth2_scopes,
+        "state": state,
+    }
+
+    return "%s?%s" % (request.settings.oauth2_login_url, urlencode(quote))
+
+
+def get_code_grant(request):
+    session_state = request.session.pop(SESSION_STATE, None)
+
+    if request.GET.get("error") == "access_denied":
+        raise exceptions.OAuth2AccessDeniedError()
+
+    if not session_state:
+        raise exceptions.OAuth2StateNotSetError()
+
+    provider_state = request.GET.get("state")
+    if not provider_state:
+        raise exceptions.OAuth2StateNotProvidedError()
+    if provider_state != session_state:
+        raise exceptions.OAuth2StateMismatchError()
+
+    code_grant = request.GET.get("code")
+    if not code_grant:
+        raise exceptions.OAuth2CodeNotProvidedError()
+
+    return code_grant
+
+
+def get_access_token(request, code_grant):
+    token_url = request.settings.oauth2_token_url
+    data = {
+        "grant_type": "authorization_code",
+        "client_id": request.settings.oauth2_client_id,
+        "client_secret": request.settings.oauth2_client_secret,
+        "redirect_uri": get_redirect_uri(request),
+        "code": code_grant,
+    }
+    headers = get_headers_dict(request.settings.oauth2_token_extra_headers)
+
+    try:
+        if request.settings.oauth2_token_method == "GET":
+            token_url += "&" if "?" in token_url else "?"
+            token_url += urlencode(data)
+            r = requests.get(
+                token_url,
+                headers=headers,
+                timeout=REQUESTS_TIMEOUT,
+            )
+        else:
+            r = requests.post(
+                token_url,
+                data=data,
+                headers=headers,
+                timeout=REQUESTS_TIMEOUT,
+            )
+    except RequestException:
+        raise exceptions.OAuth2AccessTokenRequestError()
+
+    if r.status_code != 200:
+        raise exceptions.OAuth2AccessTokenResponseError()
+
+    try:
+        response_json = r.json()
+        if not isinstance(response_json, dict):
+            raise TypeError()
+    except (ValueError, TypeError):
+        raise exceptions.OAuth2AccessTokenJSONError()
+
+    access_token = get_value_from_json(
+        request.settings.oauth2_json_token_path,
+        response_json,
+    )
+
+    if not access_token:
+        raise exceptions.OAuth2AccessTokenNotProvidedError()
+
+    return access_token
+
+
+JSON_MAPPING = {
+    "id": "oauth2_json_id_path",
+    "name": "oauth2_json_name_path",
+    "email": "oauth2_json_email_path",
+    "avatar": "oauth2_json_avatar_path",
+}
+
+
+def get_user_data(request, access_token):
+    headers = get_headers_dict(request.settings.oauth2_user_extra_headers)
+    user_url = request.settings.oauth2_user_url
+
+    if request.settings.oauth2_user_token_location == "QUERY":
+        user_url += "&" if "?" in user_url else "?"
+        user_url += urlencode({request.settings.oauth2_user_token_name: access_token})
+    elif request.settings.oauth2_user_token_location == "HEADER_BEARER":
+        headers[request.settings.oauth2_user_token_name] = f"Bearer {access_token}"
+    else:
+        headers[request.settings.oauth2_user_token_name] = access_token
+
+    try:
+        if request.settings.oauth2_user_method == "GET":
+            r = requests.get(user_url, headers=headers, timeout=REQUESTS_TIMEOUT)
+        else:
+            r = requests.post(user_url, headers=headers, timeout=REQUESTS_TIMEOUT)
+    except RequestException:
+        raise exceptions.OAuth2UserDataRequestError()
+
+    if r.status_code != 200:
+        raise exceptions.OAuth2UserDataResponseError()
+
+    try:
+        response_json = r.json()
+        if not isinstance(response_json, dict):
+            raise TypeError()
+    except (ValueError, TypeError):
+        raise exceptions.OAuth2UserDataJSONError()
+
+    return {
+        key: get_value_from_json(getattr(request.settings, setting), response_json)
+        for key, setting in JSON_MAPPING.items()
+    }
+
+
+def get_redirect_uri(request):
+    return request.build_absolute_uri(reverse("misago:oauth2-complete"))
+
+
+def get_headers_dict(headers_str):
+    headers = {}
+    if not headers_str:
+        return headers
+
+    for header in headers_str.splitlines():
+        header = header.strip()
+        if ":" not in header:
+            continue
+
+        header_name, header_value = [part.strip() for part in header.split(":", 1)]
+        if header_name and header_value:
+            headers[header_name] = header_value
+
+    return headers
+
+
+def get_value_from_json(path, json):
+    if not path:
+        return None
+
+    if "." not in path:
+        return str(json.get(path, "")).strip() or None
+
+    data = json
+    for path_part in path.split("."):
+        data = data.get(path_part)
+        if not data:
+            return None
+
+    return data

+ 98 - 0
misago/oauth2/exceptions.py

@@ -0,0 +1,98 @@
+from django.utils.translation import gettext_lazy as _
+
+
+class OAuth2Error(Exception):
+    pass
+
+
+class OAuth2ProviderError(OAuth2Error):
+    pass
+
+
+class OAuth2AccessDeniedError(OAuth2ProviderError):
+    message = _("The OAuth2 process was canceled by the provider.")
+
+
+class OAuth2StateError(OAuth2Error):
+    recoverable = True
+
+
+class OAuth2StateNotSetError(OAuth2StateError):
+    message = _("The OAuth2 session is missing state.")
+
+
+class OAuth2StateNotProvidedError(OAuth2StateError):
+    message = _("The OAuth2 state was not sent by the provider.")
+
+
+class OAuth2StateMismatchError(OAuth2StateError):
+    message = _(
+        "The OAuth2 state sent by the provider did not match one in the session."
+    )
+
+
+class OAuth2CodeError(OAuth2Error):
+    recoverable = True
+
+
+class OAuth2CodeNotProvidedError(OAuth2CodeError):
+    message = _("The OAuth2 authorization code was not sent by the provider.")
+
+
+class OAuth2ProviderError(OAuth2Error):
+    recoverable = True
+
+
+class OAuth2AccessTokenRequestError(OAuth2ProviderError):
+    message = _("Failed to connect to the OAuth2 provider to retrieve an access token.")
+
+
+class OAuth2AccessTokenResponseError(OAuth2ProviderError):
+    message = _("The OAuth2 provider responded with error for an access token request.")
+
+
+class OAuth2AccessTokenJSONError(OAuth2ProviderError):
+    message = _(
+        "The OAuth2 provider did not respond with a valid JSON "
+        "for an access token request."
+    )
+
+
+class OAuth2AccessTokenNotProvidedError(OAuth2ProviderError):
+    message = _("JSON sent by the OAuth2 provider did not contain an access token.")
+
+
+class OAuth2UserDataRequestError(OAuth2ProviderError):
+    message = _("Failed to connect to the OAuth2 provider to retrieve user profile.")
+
+
+class OAuth2UserDataResponseError(OAuth2ProviderError):
+    message = _("The OAuth2 provider responded with error for user profile request.")
+
+
+class OAuth2UserDataJSONError(OAuth2ProviderError):
+    message = _(
+        "The OAuth2 provider did not respond with a valid JSON "
+        "for user profile request."
+    )
+
+
+class OAuth2UserIdNotProvidedError(OAuth2Error):
+    message = _("JSON sent by the OAuth2 provider did not contain a user id.")
+
+
+class OAuth2UserAccountDeactivatedError(OAuth2Error):
+    recoverable = False
+    message = _(
+        "User account associated with the profile from the OAuth2 provider was "
+        "deactivated by the site administrator."
+    )
+
+
+class OAuth2UserDataValidationError(OAuth2ProviderError):
+    recoverable = False
+    error_list: list[str]
+    message = _("User profile retrieved from the OAuth2 provider did not validate.")
+
+    def __init__(self, error_list: list[str]):
+        self.error_list = error_list

+ 39 - 0
misago/oauth2/migrations/0001_initial.py

@@ -0,0 +1,39 @@
+# Generated by Django 3.2.15 on 2023-01-04 12:15
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name="Subject",
+            fields=[
+                (
+                    "sub",
+                    models.CharField(max_length=36, primary_key=True, serialize=False),
+                ),
+                ("created_on", models.DateTimeField(default=django.utils.timezone.now)),
+                (
+                    "last_used_on",
+                    models.DateTimeField(default=django.utils.timezone.now),
+                ),
+                (
+                    "user",
+                    models.ForeignKey(
+                        on_delete=django.db.models.deletion.CASCADE,
+                        to=settings.AUTH_USER_MODEL,
+                    ),
+                ),
+            ],
+        ),
+    ]

+ 43 - 0
misago/oauth2/migrations/0002_copy_sso_subjects.py

@@ -0,0 +1,43 @@
+# Generated by Django 3.2.15 on 2023-01-04 12:36
+
+from django.db import migrations
+from django.utils import timezone
+
+CHUNK_SIZE = 50
+
+
+def create_settings(apps, _):
+    Subject = apps.get_model("misago_oauth2", "Subject")
+    User = apps.get_model("misago_users", "User")
+
+    tz_now = timezone.now()
+    sso_users = User.objects.filter(sso_id__isnull=False)
+
+    batch = []
+
+    for user in sso_users.iterator(chunk_size=CHUNK_SIZE):
+        batch.append(
+            Subject(
+                sub=str(user.sso_id),
+                user=user,
+                created_on=tz_now,
+                last_used_on=tz_now,
+            )
+        )
+
+        if len(batch) >= CHUNK_SIZE:
+            Subject.objects.bulk_create(batch)
+            batch = []
+
+    if batch:
+        Subject.objects.bulk_create(batch)
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("misago_oauth2", "0001_initial"),
+        ("misago_users", "0022_deleteduser"),
+    ]
+
+    operations = [migrations.RunPython(create_settings)]

+ 0 - 0
misago/oauth2/migrations/__init__.py


+ 11 - 0
misago/oauth2/models.py

@@ -0,0 +1,11 @@
+from django.db import models
+from django.utils import timezone
+
+from ..conf import settings
+
+
+class Subject(models.Model):
+    sub = models.CharField(max_length=36, primary_key=True)  # UUID4 str length
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
+    created_on = models.DateTimeField(default=timezone.now)
+    last_used_on = models.DateTimeField(default=timezone.now)

+ 0 - 0
misago/oauth2/tests/__init__.py


+ 41 - 0
misago/oauth2/tests/test_default_user_name_filter.py

@@ -0,0 +1,41 @@
+from ..validation import filter_name
+
+
+def test_filter_replaces_spaces_with_underscores(db):
+    assert filter_name(None, "John Doe") == "John_Doe"
+
+
+def test_filter_strips_special_characters(db):
+    assert filter_name(None, "John Doe!") == "John_Doe"
+
+
+def test_filter_strips_unicode_strings(db):
+    assert filter_name(None, "Łóżąć Bęś") == "Lozac_Bes"
+
+
+def test_filter_generates_random_name_to_avoid_empty_result(db):
+    user_name = filter_name(None, "__!!!")
+    assert user_name
+    assert len(user_name) > 5
+    assert user_name.startswith("User_")
+
+
+def test_filter_generates_unique_name_to_avoid_same_names(user):
+    user_name = filter_name(None, user.username)
+
+    assert user_name
+    assert user_name != user.username
+    assert user_name.startswith(user.username)
+
+
+def test_filter_keeps_user_name_if_its_same_as_current_one(user):
+    user_name = filter_name(user, user.username)
+    assert user_name == user.username
+
+
+def test_filter_keeps_cleaned_user_name_if_its_same_as_current_one(user):
+    user.set_username("Lozac_Bes")
+    user.save()
+
+    user_name = filter_name(user, "Łóżąć Bęś")
+    assert user_name == user.username

+ 305 - 0
misago/oauth2/tests/test_get_access_token.py

@@ -0,0 +1,305 @@
+from unittest.mock import Mock, patch
+
+import pytest
+from requests.exceptions import Timeout
+
+from ...conf.test import override_dynamic_settings
+from .. import exceptions
+from ..client import REQUESTS_TIMEOUT, get_access_token
+
+ACCESS_TOKEN = "acc3ss-t0k3n"
+CODE_GRANT = "valid-code"
+
+
+@pytest.fixture
+def mock_request(dynamic_settings):
+    return Mock(
+        settings=dynamic_settings,
+        build_absolute_uri=lambda url: f"http://mysite.com{url or ''}",
+    )
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="GET",
+)
+def test_access_token_is_retrieved_using_get_request(mock_request):
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "access_token": ACCESS_TOKEN,
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_access_token(mock_request, CODE_GRANT) == ACCESS_TOKEN
+
+        get_mock.assert_called_once_with(
+            (
+                "https://example.com/oauth2/token"
+                "?grant_type=authorization_code"
+                "&client_id=clientid123"
+                "&client_secret=secr3t"
+                "&redirect_uri=http%3A%2F%2Fmysite.com%2Foauth2%2Fcomplete%2F"
+                "&code=valid-code"
+            ),
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token?exchange=1",
+    oauth2_token_method="GET",
+)
+def test_access_token_get_request_url_respects_existing_querystring(
+    mock_request,
+):
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "access_token": ACCESS_TOKEN,
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_access_token(mock_request, CODE_GRANT) == ACCESS_TOKEN
+
+        get_mock.assert_called_once_with(
+            (
+                "https://example.com/oauth2/token?exchange=1"
+                "&grant_type=authorization_code"
+                "&client_id=clientid123"
+                "&client_secret=secr3t"
+                "&redirect_uri=http%3A%2F%2Fmysite.com%2Foauth2%2Fcomplete%2F"
+                "&code=valid-code"
+            ),
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_access_token_is_retrieved_using_post_request(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "access_token": ACCESS_TOKEN,
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_access_token(mock_request, CODE_GRANT) == ACCESS_TOKEN
+
+        post_mock.assert_called_once_with(
+            "https://example.com/oauth2/token",
+            data={
+                "grant_type": "authorization_code",
+                "client_id": "clientid123",
+                "client_secret": "secr3t",
+                "redirect_uri": "http://mysite.com/oauth2/complete/",
+                "code": CODE_GRANT,
+            },
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+    oauth2_token_extra_headers="Accept: application/json\nApi-Ver:1234",
+)
+def test_access_token_is_retrieved_using_extra_headers(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "access_token": ACCESS_TOKEN,
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_access_token(mock_request, CODE_GRANT) == ACCESS_TOKEN
+
+        post_mock.assert_called_once_with(
+            "https://example.com/oauth2/token",
+            data={
+                "grant_type": "authorization_code",
+                "client_id": "clientid123",
+                "client_secret": "secr3t",
+                "redirect_uri": "http://mysite.com/oauth2/complete/",
+                "code": CODE_GRANT,
+            },
+            headers={
+                "Accept": "application/json",
+                "Api-Ver": "1234",
+            },
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+    oauth2_json_token_path="data.auth.token",
+)
+def test_access_token_is_extracted_from_json(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "data": {
+                        "auth": {
+                            "token": ACCESS_TOKEN,
+                        },
+                    },
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_access_token(mock_request, CODE_GRANT) == ACCESS_TOKEN
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_exception_is_raised_if_access_token_request_times_out(mock_request):
+    post_mock = Mock(side_effect=Timeout())
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2AccessTokenRequestError):
+            get_access_token(mock_request, CODE_GRANT)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_exception_is_raised_if_access_token_request_response_is_not_200(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=400,
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2AccessTokenResponseError):
+            get_access_token(mock_request, CODE_GRANT)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_exception_is_raised_if_access_token_request_response_is_not_json(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                side_effect=ValueError(),
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2AccessTokenJSONError):
+            get_access_token(mock_request, CODE_GRANT)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_exception_is_raised_if_access_token_request_response_json_is_not_object(
+    mock_request,
+):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=["json", "list"],
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2AccessTokenJSONError):
+            get_access_token(mock_request, CODE_GRANT)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_client_id="clientid123",
+    oauth2_client_secret="secr3t",
+    oauth2_token_url="https://example.com/oauth2/token",
+    oauth2_token_method="POST",
+)
+def test_exception_is_raised_if_access_token_request_response_json_misses_token(
+    mock_request,
+):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "no_token": "nope",
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2AccessTokenNotProvidedError):
+            get_access_token(mock_request, CODE_GRANT)
+
+        post_mock.assert_called_once()

+ 144 - 0
misago/oauth2/tests/test_get_code_grant.py

@@ -0,0 +1,144 @@
+from unittest.mock import Mock
+
+import pytest
+
+from .. import exceptions
+from ..client import SESSION_STATE, get_code_grant
+
+
+def test_code_grant_is_returned_from_request():
+    state = "l0r3m1p5um"
+    code_grant = "valid-code"
+
+    request = Mock(
+        GET={
+            "state": state,
+            "code": code_grant,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    assert get_code_grant(request) == code_grant
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_provider_returned_error():
+    request = Mock(
+        GET={"error": "access_denied"},
+        session={},
+    )
+
+    with pytest.raises(exceptions.OAuth2AccessDeniedError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_session_is_missing_state():
+    state = "l0r3m1p5um"
+    code_grant = "valid-code"
+
+    request = Mock(
+        GET={
+            "state": state,
+            "code": code_grant,
+        },
+        session={},
+    )
+
+    with pytest.raises(exceptions.OAuth2StateNotSetError):
+        get_code_grant(request)
+
+
+def test_exception_is_raised_if_request_is_missing_state():
+    state = "l0r3m1p5um"
+    code_grant = "valid-code"
+
+    request = Mock(
+        GET={
+            "code": code_grant,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    with pytest.raises(exceptions.OAuth2StateNotProvidedError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_request_state_is_empty():
+    state = "l0r3m1p5um"
+    code_grant = "valid-code"
+
+    request = Mock(
+        GET={
+            "state": "",
+            "code": code_grant,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    with pytest.raises(exceptions.OAuth2StateNotProvidedError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_session_state_doesnt_match_with_request():
+    state = "l0r3m1p5um"
+    code_grant = "valid-code"
+
+    request = Mock(
+        GET={
+            "state": "invalid",
+            "code": code_grant,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    with pytest.raises(exceptions.OAuth2StateMismatchError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_request_is_missing_code_grant():
+    state = "l0r3m1p5um"
+
+    request = Mock(
+        GET={
+            "state": state,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    with pytest.raises(exceptions.OAuth2CodeNotProvidedError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session
+
+
+def test_exception_is_raised_if_request_code_grant_is_empty():
+    state = "l0r3m1p5um"
+
+    request = Mock(
+        GET={
+            "code": "",
+            "state": state,
+        },
+        session={SESSION_STATE: state},
+    )
+
+    with pytest.raises(exceptions.OAuth2CodeNotProvidedError):
+        get_code_grant(request)
+
+    # State was removed from session
+    assert SESSION_STATE not in request.session

+ 504 - 0
misago/oauth2/tests/test_get_user_data.py

@@ -0,0 +1,504 @@
+from unittest.mock import Mock, patch
+
+import pytest
+from requests.exceptions import Timeout
+
+from ...conf.test import override_dynamic_settings
+from .. import exceptions
+from ..client import REQUESTS_TIMEOUT, get_user_data
+
+ACCESS_TOKEN = "acc3ss-t0k3n"
+
+
+@pytest.fixture
+def mock_request(dynamic_settings):
+    return Mock(settings=dynamic_settings)
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_get_request_with_token_in_query_string(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user?atoken={ACCESS_TOKEN}",
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="Authentication",
+    oauth2_user_token_location="HEADER",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_get_request_with_token_in_header(mock_request):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user",
+            headers={"Authentication": ACCESS_TOKEN},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="Authentication",
+    oauth2_user_token_location="HEADER_BEARER",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_get_request_with_bearer_token_in_header(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user",
+            headers={"Authentication": f"Bearer {ACCESS_TOKEN}"},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_post_request_with_token_in_query_string(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        post_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user?atoken={ACCESS_TOKEN}",
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="Authentication",
+    oauth2_user_token_location="HEADER",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_post_request_with_token_in_header(mock_request):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        post_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user",
+            headers={"Authentication": ACCESS_TOKEN},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="Authentication",
+    oauth2_user_token_location="HEADER_BEARER",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_post_request_with_bearer_token_in_header(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        post_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user",
+            headers={"Authentication": f"Bearer {ACCESS_TOKEN}"},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/user",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="Authentication",
+    oauth2_user_token_location="HEADER_BEARER",
+    oauth2_user_extra_headers="Accept: application/json\nApi-Ver:1234",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_is_returned_using_post_request_with_extra_headers(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        post_mock.assert_called_once_with(
+            f"https://example.com/oauth2/user",
+            headers={
+                "Authentication": f"Bearer {ACCESS_TOKEN}",
+                "Accept": "application/json",
+                "Api-Ver": "1234",
+            },
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data?type=user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="name",
+    oauth2_json_email_path="email",
+    oauth2_json_avatar_path="avatar",
+)
+def test_user_data_request_with_token_in_url_respects_existing_querystring(
+    mock_request,
+):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=user_data,
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/data?type=user&atoken={ACCESS_TOKEN}",
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data?type=user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="user.profile.name",
+    oauth2_json_email_path="user.profile.email",
+    oauth2_json_avatar_path="user.profile.avatar",
+)
+def test_user_data_json_values_are_mapped_to_result(mock_request):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": "https://example.com/avatar.png",
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "id": user_data["id"],
+                    "user": {
+                        "profile": {
+                            "name": user_data["name"],
+                            "email": user_data["email"],
+                            "avatar": user_data["avatar"],
+                        }
+                    },
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/data?type=user&atoken={ACCESS_TOKEN}",
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data?type=user",
+    oauth2_user_method="GET",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+    oauth2_json_id_path="id",
+    oauth2_json_name_path="user.profile.name",
+    oauth2_json_email_path="user.profile.email",
+    oauth2_json_avatar_path="",
+)
+def test_user_data_skips_avatar_if_path_is_not_set(mock_request):
+    user_data = {
+        "id": "7dds8a7dd89sa",
+        "name": "Aerith",
+        "email": "aerith@example.com",
+        "avatar": None,
+    }
+
+    get_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value={
+                    "id": user_data["id"],
+                    "user": {
+                        "profile": {
+                            "name": user_data["name"],
+                            "email": user_data["email"],
+                            "avatar": "https://example.com/avatar.png",
+                        }
+                    },
+                },
+            ),
+        ),
+    )
+
+    with patch("requests.get", get_mock):
+        assert get_user_data(mock_request, ACCESS_TOKEN) == user_data
+
+        get_mock.assert_called_once_with(
+            f"https://example.com/oauth2/data?type=user&atoken={ACCESS_TOKEN}",
+            headers={},
+            timeout=REQUESTS_TIMEOUT,
+        )
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+)
+def test_exception_is_raised_if_user_data_request_times_out(mock_request):
+    post_mock = Mock(side_effect=Timeout())
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2UserDataRequestError):
+            get_user_data(mock_request, ACCESS_TOKEN)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+)
+def test_exception_is_raised_if_user_data_request_response_is_not_200(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=400,
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2UserDataResponseError):
+            get_user_data(mock_request, ACCESS_TOKEN)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+)
+def test_exception_is_raised_if_user_data_request_response_is_not_json(mock_request):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                side_effect=ValueError(),
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2UserDataJSONError):
+            get_user_data(mock_request, ACCESS_TOKEN)
+
+        post_mock.assert_called_once()
+
+
+@override_dynamic_settings(
+    oauth2_user_url="https://example.com/oauth2/data",
+    oauth2_user_method="POST",
+    oauth2_user_token_name="atoken",
+    oauth2_user_token_location="QUERY",
+)
+def test_exception_is_raised_if_user_data_request_response_json_is_not_object(
+    mock_request,
+):
+    post_mock = Mock(
+        return_value=Mock(
+            status_code=200,
+            json=Mock(
+                return_value=["json", "list"],
+            ),
+        ),
+    )
+
+    with patch("requests.post", post_mock):
+        with pytest.raises(exceptions.OAuth2UserDataJSONError):
+            get_user_data(mock_request, ACCESS_TOKEN)
+
+        post_mock.assert_called_once()

+ 31 - 0
misago/oauth2/tests/test_getting_json_values.py

@@ -0,0 +1,31 @@
+from ..client import get_value_from_json
+
+
+def test_json_value_is_returned():
+    assert get_value_from_json("val", {"val": "ok", "val2": "nope"}) == "ok"
+
+
+def test_json_value_is_cast_to_str():
+    assert get_value_from_json("val", {"val": 21, "val2": "nope"}) == "21"
+
+
+def test_none_is_returned_if_val_is_not_found():
+    assert get_value_from_json("val", {"val3": 21, "val2": "nope"}) is None
+
+
+def test_json_value_is_returned_from_nested_objects():
+    assert (
+        get_value_from_json(
+            "val.child.val",
+            {
+                "val2": "nope",
+                "val": {
+                    "child": {
+                        "val2": "nope",
+                        "val": "ok",
+                    },
+                },
+            },
+        )
+        == "ok"
+    )

+ 31 - 0
misago/oauth2/tests/test_headers_dict_creation.py

@@ -0,0 +1,31 @@
+from ..client import get_headers_dict
+
+
+def test_empty_headers_dict_is_returned_for_none():
+    headers = get_headers_dict(None)
+    assert headers == {}
+
+
+def test_empty_headers_dict_is_returned_for_empty_str():
+    headers = get_headers_dict("")
+    assert headers == {}
+
+
+def test_empty_headers_dict_is_returned_for_empty_multiline_str():
+    headers = get_headers_dict("  \n   \n  ")
+    assert headers == {}
+
+
+def test_header_is_returned_from_str():
+    headers = get_headers_dict("Lorem: ipsum")
+    assert headers == {"Lorem": "ipsum"}
+
+
+def test_headers_str_content_is_cleaned():
+    headers = get_headers_dict("  Lorem:   ips:um\n\n")
+    assert headers == {"Lorem": "ips:um"}
+
+
+def test_multiple_headers_are_returned_from_multiline_str():
+    headers = get_headers_dict("Lorem: ipsum\nDolor: met")
+    assert headers == {"Lorem": "ipsum", "Dolor": "met"}

+ 36 - 0
misago/oauth2/tests/test_login_url_creation.py

@@ -0,0 +1,36 @@
+from unittest.mock import Mock
+from urllib.parse import parse_qsl, urlparse
+
+from ...conf.test import override_dynamic_settings
+from ..client import SESSION_STATE, create_login_url
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="some scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_login_url_is_created(dynamic_settings):
+    request = Mock(
+        session={},
+        settings=dynamic_settings,
+        build_absolute_uri=lambda url: f"http://mysite.com{url or ''}",
+    )
+
+    login_url = create_login_url(request)
+
+    # State set in session?
+    assert request.session.get(SESSION_STATE)
+
+    # Redirect url is valid?
+    redirect_to = urlparse(login_url)
+    assert redirect_to.netloc == "example.com"
+    assert redirect_to.path == "/oauth2/login"
+    assert parse_qsl(redirect_to.query) == [
+        ("response_type", "code"),
+        ("client_id", "clientid123"),
+        ("redirect_uri", "http://mysite.com/oauth2/complete/"),
+        ("scope", "some scopes"),
+        ("state", request.session[SESSION_STATE]),
+    ]

+ 1027 - 0
misago/oauth2/tests/test_oauth2_complete_view.py

@@ -0,0 +1,1027 @@
+import responses
+from django.contrib.auth import get_user_model
+from django.urls import reverse
+from responses.matchers import header_matcher, urlencoded_params_matcher
+
+from ...conf.test import override_dynamic_settings
+from ...test import assert_contains
+from ...users.bans import ban_ip, ban_user
+from ..client import SESSION_STATE
+from ..models import Subject
+
+User = get_user_model()
+
+
+def test_oauth2_complete_view_returns_404_if_oauth_is_disabled(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is False
+
+    response = client.get(reverse("misago:oauth2-complete"))
+    assert response.status_code == 404
+
+
+def test_oauth2_complete_view_returns_error_404_if_user_ip_is_banned_and_oauth_is_disabled(
+    client, dynamic_settings
+):
+    ban_ip("127.*", "Ya got banned!")
+
+    assert dynamic_settings.enable_oauth2_client is False
+
+    response = client.get(reverse("misago:oauth2-complete"))
+    assert response.status_code == 404
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_complete_view_returns_error_403_if_user_ip_is_banned(
+    client, dynamic_settings
+):
+    ban_ip("127.*", "Ya got banned!")
+
+    assert dynamic_settings.enable_oauth2_client is True
+
+    response = client.get(reverse("misago:oauth2-complete"))
+    assert_contains(response, "Ya got banned", 403)
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_complete_view_returns_error_400_if_user_canceled_sign_in(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    response = client.get("%s?error=access_denied" % reverse("misago:oauth2-complete"))
+    assert_contains(response, "The OAuth2 process was canceled by the provider.", 400)
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_complete_view_returns_error_400_if_state_is_not_set(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    response = client.get(reverse("misago:oauth2-complete"))
+    assert_contains(response, "OAuth2 session is missing state.", 400)
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_complete_view_returns_error_400_if_state_is_invalid(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    session = client.session
+    session[SESSION_STATE] = "state123"
+    session.save()
+
+    response = client.get(
+        "%s?state=invalid&code=1234" % reverse("misago:oauth2-complete")
+    )
+    assert_contains(
+        response,
+        "OAuth2 state sent by the provider did not match one in the session.",
+        400,
+    )
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_complete_view_returns_error_400_if_code_is_missing(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    session = client.session
+    session[SESSION_STATE] = "state123"
+    session.save()
+
+    response = client.get("%s?state=state123&code=" % reverse("misago:oauth2-complete"))
+    assert_contains(
+        response,
+        "OAuth2 authorization code was not sent by the provider.",
+        400,
+    )
+
+
+TEST_SETTINGS = {
+    "enable_oauth2_client": True,
+    "oauth2_client_id": "oauth2_client_id",
+    "oauth2_client_secret": "oauth2_client_secret",
+    "oauth2_login_url": "https://example.com/oauth2/login",
+    "oauth2_token_url": "https://example.com/oauth2/token",
+    "oauth2_token_method": "POST",
+    "oauth2_json_token_path": "token.bearer",
+    "oauth2_user_url": "https://example.com/oauth2/user",
+    "oauth2_user_method": "POST",
+    "oauth2_user_token_name": "Authorization",
+    "oauth2_user_token_location": "HEADER_BEARER",
+    "oauth2_send_welcome_email": True,
+    "oauth2_json_id_path": "id",
+    "oauth2_json_name_path": "profile.name",
+    "oauth2_json_email_path": "profile.email",
+}
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_creates_new_user(client, dynamic_settings, mailoutbox):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert response.status_code == 302
+
+    # User and subject are created
+    subject = Subject.objects.get(sub="1234")
+    user = User.objects.get_by_email("john@example.com")
+    assert subject.user_id == user.id
+
+    assert user.username == "John_Doe"
+    assert user.slug == "john-doe"
+    assert user.email == "john@example.com"
+    assert user.requires_activation == User.ACTIVATION_NONE
+
+    # User is authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] == user.id
+
+    # User welcome e-mail is sent
+    assert len(mailoutbox) == 1
+    assert mailoutbox[0].subject == "Welcome on Misago forums!"
+
+
+TEST_SETTINGS_EMAIL_DISABLED = TEST_SETTINGS.copy()
+TEST_SETTINGS_EMAIL_DISABLED["oauth2_send_welcome_email"] = False
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS_EMAIL_DISABLED)
+def test_oauth2_complete_view_doesnt_send_welcome_mail_if_option_is_disabled(
+    client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert response.status_code == 302
+
+    # User and subject are created
+    subject = Subject.objects.get(sub="1234")
+    user = User.objects.get_by_email("john@example.com")
+    assert subject.user_id == user.id
+
+    # User is authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] == user.id
+
+    # User welcome e-mail is not sent
+    assert len(mailoutbox) == 0
+
+
+TEST_SETTINGS_EXTRA_TOKEN_HEADERS = TEST_SETTINGS.copy()
+TEST_SETTINGS_EXTRA_TOKEN_HEADERS[
+    "oauth2_token_extra_headers"
+] = """
+Accept: application/json
+API-Version: 2.1.3.7
+""".strip()
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS_EXTRA_TOKEN_HEADERS)
+def test_oauth2_complete_view_includes_extra_headers_in_token_request(
+    client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+            header_matcher(
+                {
+                    "Accept": "application/json",
+                    "API-Version": "2.1.3.7",
+                }
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert response.status_code == 302
+
+    # User and subject are created
+    subject = Subject.objects.get(sub="1234")
+    user = User.objects.get_by_email("john@example.com")
+    assert subject.user_id == user.id
+
+    # User is authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] == user.id
+
+
+TEST_SETTINGS_EXTRA_USER_HEADERS = TEST_SETTINGS.copy()
+TEST_SETTINGS_EXTRA_USER_HEADERS[
+    "oauth2_user_extra_headers"
+] = """
+X-Header: its-a-test
+API-Version: 2.1.3.7
+""".strip()
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS_EXTRA_USER_HEADERS)
+def test_oauth2_complete_view_includes_extra_headers_in_user_request(
+    client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher(
+                {
+                    "Authorization": f"Bearer {access_token}",
+                    "X-Header": "its-a-test",
+                    "API-Version": "2.1.3.7",
+                }
+            ),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert response.status_code == 302
+
+    # User and subject are created
+    subject = Subject.objects.get(sub="1234")
+    user = User.objects.get_by_email("john@example.com")
+    assert subject.user_id == user.id
+
+    # User is authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] == user.id
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_updates_existing_user(
+    user, client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    Subject.objects.create(sub="1234", user=user)
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert response.status_code == 302
+
+    # User is updated
+    user.refresh_from_db()
+    assert user.username == "John_Doe"
+    assert user.slug == "john-doe"
+    assert user.email == "john@example.com"
+
+    # User is authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] == user.id
+
+    # User welcome e-mail is not sent
+    assert len(mailoutbox) == 0
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_returns_error_400_if_code_grant_is_rejected(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "error": "Permission denied",
+        },
+        status=403,
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(
+        response,
+        "The OAuth2 provider responded with error for an access token request.",
+        400,
+    )
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_returns_error_400_if_access_token_is_rejected(
+    user, client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    Subject.objects.create(sub="1234", user=user)
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "error": "Permission denied",
+        },
+        status=403,
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(
+        response,
+        "The OAuth2 provider responded with error for user profile request.",
+        400,
+    )
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_returns_error_400_if_user_data_didnt_validate(
+    user, client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    Subject.objects.create(sub="1234", user=user)
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(response, "Enter a valid email address.", 400)
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_returns_error_400_if_user_data_causes_integrity_error(
+    user, client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": user.email,
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(response, "This e-mail address is not available.", 400)
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_updates_deactivated_user_but_returns_error_400(
+    user, client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    Subject.objects.create(sub="1234", user=user)
+
+    user.is_active = False
+    user.save()
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(
+        response,
+        (
+            "User account associated with the profile from the OAuth2 provider "
+            "was deactivated by the site administrator."
+        ),
+        400,
+    )
+
+    # User is updated but still deactivated
+    user.refresh_from_db()
+    assert user.username == "John_Doe"
+    assert user.slug == "john-doe"
+    assert user.email == "john@example.com"
+    assert user.is_active is False
+
+    # User is not authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] is None
+
+    # User welcome e-mail is not sent
+    assert len(mailoutbox) == 0
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_creates_banned_user_but_returns_error_403(
+    user, client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    user.username = "John_Doe"
+    ban_user(user, "Banned for a test.")
+    user.refresh_from_db()
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(response, "Banned for a test.", 403)
+
+    # User is created
+    new_user = User.objects.get_by_email("john@example.com")
+    assert new_user
+    assert new_user.id != user.id
+    assert new_user.username == "John_Doe"
+    assert new_user.slug == "john-doe"
+    assert new_user.email == "john@example.com"
+
+    # User is not authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] is None
+
+    # User welcome e-mail is not sent
+    assert len(mailoutbox) == 0
+
+
+@responses.activate
+@override_dynamic_settings(**TEST_SETTINGS)
+def test_oauth2_complete_view_updates_banned_user_but_returns_error_403(
+    user, client, dynamic_settings, mailoutbox
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    Subject.objects.create(sub="1234", user=user)
+
+    user.username = "John_Doe"
+    ban_user(user, "Banned for a test.")
+    user.refresh_from_db()
+
+    code_grant = "12345grant"
+    session_state = "12345state"
+    access_token = "12345token"
+
+    session = client.session
+    session[SESSION_STATE] = session_state
+    session.save()
+
+    responses.post(
+        "https://example.com/oauth2/token",
+        json={
+            "token": {
+                "bearer": access_token,
+            },
+        },
+        match=[
+            urlencoded_params_matcher(
+                {
+                    "grant_type": "authorization_code",
+                    "client_id": "oauth2_client_id",
+                    "client_secret": "oauth2_client_secret",
+                    "redirect_uri": "http://testserver/oauth2/complete/",
+                    "code": code_grant,
+                },
+            ),
+        ],
+    )
+
+    responses.post(
+        "https://example.com/oauth2/user",
+        json={
+            "id": 1234,
+            "profile": {
+                "name": "John Doe",
+                "email": "john@example.com",
+            },
+        },
+        match=[
+            header_matcher({"Authorization": f"Bearer {access_token}"}),
+        ],
+    )
+
+    response = client.get(
+        "%s?state=%s&code=%s"
+        % (
+            reverse("misago:oauth2-complete"),
+            session_state,
+            code_grant,
+        )
+    )
+
+    assert_contains(response, "Banned for a test.", 403)
+
+    # User is updated
+    user.refresh_from_db()
+    assert user.username == "John_Doe"
+    assert user.slug == "john-doe"
+    assert user.email == "john@example.com"
+
+    # User is not authenticated
+    auth_api = client.get(reverse("misago:api:auth")).json()
+    assert auth_api["id"] is None
+
+    # User welcome e-mail is not sent
+    assert len(mailoutbox) == 0

+ 62 - 0
misago/oauth2/tests/test_oauth2_login_view.py

@@ -0,0 +1,62 @@
+from urllib.parse import urlparse
+
+from django.urls import reverse
+
+from ...conf.test import override_dynamic_settings
+from ...test import assert_contains
+from ...users.bans import ban_ip
+
+
+def test_oauth2_login_view_returns_404_if_oauth_is_disabled(client, dynamic_settings):
+    assert dynamic_settings.enable_oauth2_client is False
+
+    response = client.get(reverse("misago:oauth2-login"))
+    assert response.status_code == 404
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_login_view_returns_redirect_302_if_oauth_is_enabled(
+    client, dynamic_settings
+):
+    assert dynamic_settings.enable_oauth2_client is True
+
+    response = client.get(reverse("misago:oauth2-login"))
+    assert response.status_code == 302
+
+    redirect_to = urlparse(response["Location"])
+    assert redirect_to.netloc == "example.com"
+    assert redirect_to.path == "/oauth2/login"
+    assert "clientid123" in redirect_to.query
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_client_id="clientid123",
+    oauth2_scopes="scopes",
+    oauth2_login_url="https://example.com/oauth2/login",
+)
+def test_oauth2_login_view_returns_error_403_if_user_ip_is_banned(
+    client, dynamic_settings
+):
+    ban_ip("127.*", "Ya got banned!")
+
+    assert dynamic_settings.enable_oauth2_client is True
+
+    response = client.get(reverse("misago:oauth2-login"))
+    assert_contains(response, "Ya got banned", 403)
+
+
+def test_oauth2_login_view_returns_error_404_if_user_ip_is_banned_and_oauth_is_disabled(
+    client, dynamic_settings
+):
+    ban_ip("127.*", "Ya got banned!")
+
+    assert dynamic_settings.enable_oauth2_client is False
+
+    response = client.get(reverse("misago:oauth2-login"))
+    assert response.status_code == 404

+ 131 - 0
misago/oauth2/tests/test_user_creation_from_data.py

@@ -0,0 +1,131 @@
+from unittest.mock import Mock, patch
+
+import pytest
+from django.contrib.auth import get_user_model
+
+from ...conf.test import override_dynamic_settings
+from ..exceptions import OAuth2UserDataValidationError
+from ..models import Subject
+from ..user import get_user_from_data
+
+User = get_user_model()
+
+
+def test_activated_user_is_created_from_valid_data(db, dynamic_settings):
+    user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": "NewUser",
+            "email": "user@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert created
+    assert user.id
+    assert user.username == "NewUser"
+    assert user.slug == "newuser"
+    assert user.email == "user@example.com"
+    assert user.requires_activation == User.ACTIVATION_NONE
+
+    user_by_name = User.objects.get_by_username("NewUser")
+    assert user_by_name.id == user.id
+
+    user_by_email = User.objects.get_by_email("user@example.com")
+    assert user_by_email.id == user.id
+
+
+def test_user_subject_is_created_from_valid_data(db, dynamic_settings):
+    user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": "NewUser",
+            "email": "user@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert created
+    assert user
+
+    user_subject = Subject.objects.get(sub="1234")
+    assert user_subject.user_id == user.id
+
+
+def test_user_is_created_with_avatar_from_valid_data(db, dynamic_settings):
+    user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": "NewUser",
+            "email": "user@example.com",
+            "avatar": "https://placekitten.com/600/500",
+        },
+    )
+
+    assert created
+    assert user
+    assert user.avatars
+    assert user.avatar_set.exists()
+
+
+@override_dynamic_settings(account_activation="admin")
+def test_user_is_created_with_admin_activation_from_valid_data(db, dynamic_settings):
+    user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": "NewUser",
+            "email": "user@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert created
+    assert user
+    assert user.requires_activation == User.ACTIVATION_ADMIN
+
+
+def user_noop_filter(*args):
+    pass
+
+
+def test_user_name_conflict_during_creation_from_valid_data_is_handled(
+    user, dynamic_settings
+):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        # Custom filters disable build in filters
+        with patch(
+            "misago.oauth2.validation.oauth2_user_data_filters",
+            [user_noop_filter],
+        ):
+            get_user_from_data(
+                Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+                {
+                    "id": "1234",
+                    "name": user.username,
+                    "email": "test@example.com",
+                    "avatar": None,
+                },
+            )
+
+    assert excinfo.value.error_list == ["This username is not available."]
+
+
+def test_user_email_conflict_during_creation_from_valid_data_is_handled(
+    user, dynamic_settings
+):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        get_user_from_data(
+            Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+            {
+                "id": "1234",
+                "name": "NewUser",
+                "email": user.email,
+                "avatar": None,
+            },
+        )
+
+    assert excinfo.value.error_list == ["This e-mail address is not available."]

+ 146 - 0
misago/oauth2/tests/test_user_data_filter.py

@@ -0,0 +1,146 @@
+from unittest.mock import patch
+
+from ..validation import filter_user_data
+
+
+def test_new_user_data_is_filtered_using_default_filters(db, request):
+    filtered_data = filter_user_data(
+        request,
+        None,
+        {
+            "id": "242132",
+            "name": "New User",
+            "email": "oauth2@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert filtered_data == {
+        "id": "242132",
+        "name": "New_User",
+        "email": "oauth2@example.com",
+        "avatar": None,
+    }
+
+
+def test_existing_user_data_is_filtered_using_default_filters(user, request):
+    filtered_data = filter_user_data(
+        request,
+        user,
+        {
+            "id": "242132",
+            "name": user.username,
+            "email": user.email,
+            "avatar": None,
+        },
+    )
+
+    assert filtered_data == {
+        "id": "242132",
+        "name": user.username,
+        "email": user.email,
+        "avatar": None,
+    }
+
+
+def user_request_filter(request, user, user_data):
+    assert request
+
+
+def user_id_filter(request, user, user_data):
+    return {
+        "id": "".join(reversed(user_data["id"])),
+        "name": user_data["name"],
+        "email": user_data["email"],
+        "avatar": user_data["avatar"],
+    }
+
+
+def user_name_filter(request, user, user_data):
+    return {
+        "id": user_data["id"],
+        "name": "".join(reversed(user_data["name"])),
+        "email": user_data["email"],
+        "avatar": user_data["avatar"],
+    }
+
+
+def user_email_filter(request, user, user_data):
+    return {
+        "id": user_data["id"],
+        "name": user_data["name"],
+        "email": "filtered_%s" % user_data["email"],
+        "avatar": user_data["avatar"],
+    }
+
+
+def test_new_user_data_is_filtered_using_custom_filters(db, request):
+    def user_is_none_filter(request, user, user_data):
+        assert user is None
+
+    with patch(
+        "misago.oauth2.validation.oauth2_user_data_filters",
+        [
+            user_request_filter,
+            user_is_none_filter,
+            user_id_filter,
+            user_name_filter,
+            user_email_filter,
+        ],
+    ):
+        filtered_data = filter_user_data(
+            request,
+            None,
+            {
+                "id": "1234",
+                "name": "New User",
+                "email": "oauth2@example.com",
+                "avatar": None,
+            },
+        )
+
+        assert filtered_data == {
+            "id": "4321",
+            "name": "resU weN",
+            "email": "filtered_oauth2@example.com",
+            "avatar": None,
+        }
+
+
+def test_existing_user_data_is_filtered_using_custom_filters(user, request):
+    def user_is_set_filter(request, user_obj, user_data):
+        assert user_obj == user
+        return {
+            "id": str(user_obj.id),
+            "name": user_data["name"],
+            "email": user_data["email"],
+            "avatar": user_data["avatar"],
+        }
+
+    with patch(
+        "misago.oauth2.validation.oauth2_user_data_filters",
+        [
+            user_request_filter,
+            user_is_set_filter,
+            user_id_filter,
+            user_name_filter,
+            user_email_filter,
+        ],
+    ):
+        filtered_data = filter_user_data(
+            request,
+            user,
+            {
+                "id": "1234",
+                "name": "New User",
+                "email": "oauth2@example.com",
+                "avatar": None,
+            },
+        )
+
+        assert filtered_data == {
+            "id": "".join(reversed(str(user.id))),
+            "name": "resU weN",
+            "email": "filtered_oauth2@example.com",
+            "avatar": None,
+        }

+ 151 - 0
misago/oauth2/tests/test_user_data_validation.py

@@ -0,0 +1,151 @@
+from unittest.mock import Mock, patch
+
+import pytest
+
+from ..exceptions import OAuth2UserDataValidationError
+from ..validation import validate_user_data
+
+
+def test_new_user_valid_data_is_validated(db, dynamic_settings):
+    valid_data = validate_user_data(
+        Mock(settings=dynamic_settings),
+        None,
+        {
+            "id": "1234",
+            "name": "Test User",
+            "email": "user@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert valid_data == {
+        "id": "1234",
+        "name": "Test_User",
+        "email": "user@example.com",
+        "avatar": None,
+    }
+
+
+def test_existing_user_valid_data_is_validated(user, dynamic_settings):
+    valid_data = validate_user_data(
+        Mock(settings=dynamic_settings),
+        user,
+        {
+            "id": "1234",
+            "name": user.username,
+            "email": user.email,
+            "avatar": None,
+        },
+    )
+
+    assert valid_data == {
+        "id": "1234",
+        "name": user.username,
+        "email": user.email,
+        "avatar": None,
+    }
+
+
+def user_noop_filter(*args):
+    return None
+
+
+def test_error_was_raised_for_user_data_with_without_name(db, dynamic_settings):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        # Custom filters disable build in filters
+        with patch(
+            "misago.oauth2.validation.oauth2_user_data_filters",
+            [user_noop_filter],
+        ):
+            validate_user_data(
+                Mock(settings=dynamic_settings),
+                None,
+                {
+                    "id": "1234",
+                    "name": "",
+                    "email": "user@example.com",
+                    "avatar": None,
+                },
+            )
+
+    assert excinfo.value.error_list == [
+        "Username can only contain latin alphabet letters and digits."
+    ]
+
+
+def test_error_was_raised_for_user_data_with_invalid_name(db, dynamic_settings):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        # Custom filters disable build in filters
+        with patch(
+            "misago.oauth2.validation.oauth2_user_data_filters",
+            [user_noop_filter],
+        ):
+            validate_user_data(
+                Mock(settings=dynamic_settings),
+                None,
+                {
+                    "id": "1234",
+                    "name": "Invalid!",
+                    "email": "user@example.com",
+                    "avatar": None,
+                },
+            )
+
+    assert excinfo.value.error_list == [
+        "Username can only contain latin alphabet letters and digits."
+    ]
+
+
+def test_error_was_raised_for_user_data_with_too_long_name(db, dynamic_settings):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        # Custom filters disable build in filters
+        with patch(
+            "misago.oauth2.validation.oauth2_user_data_filters",
+            [user_noop_filter],
+        ):
+            validate_user_data(
+                Mock(settings=dynamic_settings),
+                None,
+                {
+                    "id": "1234",
+                    "name": "UserName" * 100,
+                    "email": "user@example.com",
+                    "avatar": None,
+                },
+            )
+
+    assert excinfo.value.error_list == [
+        "Username cannot be longer than 200 characters."
+    ]
+
+
+def test_error_was_raised_for_user_data_without_email(db, dynamic_settings):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        validate_user_data(
+            Mock(settings=dynamic_settings),
+            None,
+            {
+                "id": "1234",
+                "name": "Test User",
+                "email": "",
+                "avatar": None,
+            },
+        )
+
+    assert excinfo.value.error_list == ["Enter a valid email address."]
+
+
+def test_error_was_raised_for_user_data_with_invalid_email(db, dynamic_settings):
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        validate_user_data(
+            Mock(settings=dynamic_settings),
+            None,
+            {
+                "id": "1234",
+                "name": "Test User",
+                "email": "userexample.com",
+                "avatar": None,
+            },
+        )
+
+    assert excinfo.value.error_list == ["Enter a valid email address."]

+ 117 - 0
misago/oauth2/tests/test_user_update_with_data.py

@@ -0,0 +1,117 @@
+from unittest.mock import Mock, patch
+
+import pytest
+from django.contrib.auth import get_user_model
+
+from ..exceptions import OAuth2UserDataValidationError
+from ..models import Subject
+from ..user import get_user_from_data
+
+User = get_user_model()
+
+
+def test_user_is_updated_with_valid_data(user, dynamic_settings):
+    Subject.objects.create(sub="1234", user=user)
+
+    updated_user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": "UpdatedName",
+            "email": "updated@example.com",
+            "avatar": None,
+        },
+    )
+
+    assert created is False
+    assert updated_user.id
+    assert updated_user.id == user.id
+    assert updated_user.username == "UpdatedName"
+    assert updated_user.username != user.username
+    assert updated_user.slug == "updatedname"
+    assert updated_user.slug != user.slug
+    assert updated_user.email == "updated@example.com"
+    assert updated_user.email != user.email
+
+    user_by_name = User.objects.get_by_username("UpdatedName")
+    assert user_by_name.id == user.id
+
+    user_by_email = User.objects.get_by_email("updated@example.com")
+    assert user_by_email.id == user.id
+
+
+def test_user_is_not_updated_with_unchanged_valid_data(user, dynamic_settings):
+    Subject.objects.create(sub="1234", user=user)
+
+    updated_user, created = get_user_from_data(
+        Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+        {
+            "id": "1234",
+            "name": user.username,
+            "email": user.email,
+            "avatar": None,
+        },
+    )
+
+    assert created is False
+    assert updated_user.id
+    assert updated_user.id == user.id
+    assert updated_user.username == "User"
+    assert updated_user.username == user.username
+    assert updated_user.slug == "user"
+    assert updated_user.slug == user.slug
+    assert updated_user.email == "user@example.com"
+    assert updated_user.email == user.email
+
+    user_by_name = User.objects.get_by_username("User")
+    assert user_by_name.id == user.id
+
+    user_by_email = User.objects.get_by_email("user@example.com")
+    assert user_by_email.id == user.id
+
+
+def user_noop_filter(*args):
+    pass
+
+
+def test_user_name_conflict_during_update_with_valid_data_is_handled(
+    user, other_user, dynamic_settings
+):
+    Subject.objects.create(sub="1234", user=user)
+
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        # Custom filters disable build in filters
+        with patch(
+            "misago.oauth2.validation.oauth2_user_data_filters",
+            [user_noop_filter],
+        ):
+            get_user_from_data(
+                Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+                {
+                    "id": "1234",
+                    "name": other_user.username,
+                    "email": "test@example.com",
+                    "avatar": None,
+                },
+            )
+
+    assert excinfo.value.error_list == ["This username is not available."]
+
+
+def test_user_email_conflict_during_update_with_valid_data_is_handled(
+    user, other_user, dynamic_settings
+):
+    Subject.objects.create(sub="1234", user=user)
+
+    with pytest.raises(OAuth2UserDataValidationError) as excinfo:
+        get_user_from_data(
+            Mock(settings=dynamic_settings, user_ip="83.0.0.1"),
+            {
+                "id": "1234",
+                "name": "NewUser",
+                "email": other_user.email,
+                "avatar": None,
+            },
+        )
+
+    assert excinfo.value.error_list == ["This e-mail address is not available."]

+ 8 - 0
misago/oauth2/urls.py

@@ -0,0 +1,8 @@
+from django.urls import path
+
+from .views import oauth2_login, oauth2_complete
+
+urlpatterns = [
+    path("oauth2/login/", oauth2_login, name="oauth2-login"),
+    path("oauth2/complete/", oauth2_complete, name="oauth2-complete"),
+]

+ 102 - 0
misago/oauth2/user.py

@@ -0,0 +1,102 @@
+from django.contrib.auth import get_user_model
+from django.db import IntegrityError, transaction
+from django.utils import timezone
+from django.utils.translation import gettext_lazy as _
+
+from ..users.setupnewuser import setup_new_user
+from .exceptions import OAuth2UserDataValidationError, OAuth2UserIdNotProvidedError
+from .models import Subject
+from .validation import validate_user_data
+
+User = get_user_model()
+
+
+def get_user_from_data(request, user_data):
+    if not user_data["id"]:
+        raise OAuth2UserIdNotProvidedError()
+
+    user = get_user_by_subject(user_data["id"])
+    if not user and user_data["email"]:
+        user = get_user_by_email(user_data["id"], user_data["email"])
+
+    created = not bool(user)
+
+    cleaned_data = validate_user_data(request, user, user_data)
+
+    try:
+        with transaction.atomic():
+            if not user:
+                user = create_new_user(request, cleaned_data)
+            else:
+                update_existing_user(user, cleaned_data)
+    except IntegrityError as error:
+        raise_validation_error_from_integrity_error(error)
+
+    return user, created
+
+
+def get_user_by_subject(user_id):
+    try:
+        subject = Subject.objects.select_related("user", "user__ban_cache").get(
+            sub=user_id
+        )
+        subject.last_used_on = timezone.now()
+        subject.save(update_fields=["last_used_on"])
+        return subject.user
+    except Subject.DoesNotExist:
+        return None
+
+
+def get_user_by_email(user_id, user_email):
+    try:
+        user = User.objects.get_by_email(user_email)
+        Subject.objects.create(sub=user_id, user=user)
+    except User.DoesNotExist:
+        return None
+
+
+def create_new_user(request, user_data):
+    activation_kwargs = {}
+    if request.settings.account_activation == "admin":
+        activation_kwargs = {"requires_activation": User.ACTIVATION_ADMIN}
+
+    user = User.objects.create_user(
+        user_data["name"],
+        user_data["email"],
+        joined_from_ip=request.user_ip,
+        **activation_kwargs,
+    )
+
+    setup_new_user(request.settings, user, avatar_url=user_data["avatar"])
+    Subject.objects.create(sub=user_data["id"], user=user)
+
+    return user
+
+
+def update_existing_user(user, user_data):
+    save_changes = False
+
+    if user.username != user_data["name"]:
+        user.set_username(user_data["name"])
+        save_changes = True
+
+    if user.email != user_data["email"]:
+        user.set_email(user_data["email"])
+        save_changes = True
+
+    if save_changes:
+        user.save()
+
+
+def raise_validation_error_from_integrity_error(error):
+    error_str = str(error)
+
+    if "misago_users_user_email_hash_key" in error_str:
+        raise OAuth2UserDataValidationError(
+            error_list=[_("This e-mail address is not available.")]
+        )
+
+    if "misago_users_user_slug_key" in error_str:
+        raise OAuth2UserDataValidationError(
+            error_list=[_("This username is not available.")]
+        )

+ 92 - 0
misago/oauth2/validation.py

@@ -0,0 +1,92 @@
+from dataclasses import dataclass
+
+from django.contrib.auth import get_user_model
+from django.core.validators import validate_email
+from django.forms import ValidationError
+from django.utils.crypto import get_random_string
+from unidecode import unidecode
+
+from ..hooks import oauth2_user_data_filters
+from ..users.validators import (
+    validate_new_registration,
+    validate_username_content,
+    validate_username_length,
+)
+from .exceptions import OAuth2UserDataValidationError
+
+User = get_user_model()
+
+
+class UsernameSettings:
+    username_length_max: int = 200
+    username_length_min: int = 1
+
+
+def validate_user_data(request, user, user_data):
+    filtered_data = filter_user_data(request, user, user_data)
+
+    try:
+        errors_list = []
+
+        def add_error(_field_unused: str | None, error: str | ValidationError):
+            if isinstance(error, ValidationError):
+                error = error.message
+
+            errors_list.append(str(error))
+
+        validate_username_content(user_data["name"])
+        validate_username_length(UsernameSettings, user_data["name"])
+        validate_email(user_data["email"])
+
+        validate_new_registration(request, filtered_data, add_error)
+    except ValidationError as exc:
+        raise OAuth2UserDataValidationError(error_list=[str(exc.message)])
+
+    if errors_list:
+        raise OAuth2UserDataValidationError(error_list=errors_list)
+
+    return filtered_data
+
+
+def filter_user_data(request, user, user_data):
+    if oauth2_user_data_filters:
+        return filter_user_data_with_filters(
+            request, user, user_data, oauth2_user_data_filters
+        )
+    else:
+        user_data["name"] = filter_name(user, user_data["name"])
+
+    return user_data
+
+
+def filter_user_data_with_filters(request, user, user_data, filters):
+    for filter_user_data in filters:
+        user_data = filter_user_data(request, user, user_data) or user_data
+    return user_data
+
+
+def filter_name(user, name):
+    if user and user.username == name:
+        return name
+
+    clean_name = "".join(
+        [c for c in unidecode(name.replace(" ", "_")) if c.isalnum() or c == "_"]
+    )
+
+    if user and user.username == clean_name:
+        return clean_name  # No change in name
+
+    if not clean_name.replace("_", ""):
+        clean_name = "User_%s" % get_random_string(4)
+
+    clean_name_root = clean_name
+    while True:
+        try:
+            db_user = User.objects.get_by_username(clean_name)
+        except User.DoesNotExist:
+            return clean_name
+
+        if not user or user.pk != db_user.pk:
+            clean_name = f"{clean_name_root}_{get_random_string(4)}"
+        else:
+            return clean_name

+ 98 - 0
misago/oauth2/views.py

@@ -0,0 +1,98 @@
+from functools import wraps
+from logging import getLogger
+
+from django.contrib.auth import get_user_model, login
+from django.http import Http404
+from django.shortcuts import redirect, render
+from django.urls import reverse
+from django.views.decorators.cache import never_cache
+
+from ..core.exceptions import Banned
+from ..users.bans import get_user_ban
+from ..users.decorators import deny_banned_ips
+from ..users.registration import send_welcome_email
+from .client import (
+    create_login_url,
+    get_access_token,
+    get_code_grant,
+    get_user_data,
+)
+from .exceptions import (
+    OAuth2Error,
+    OAuth2UserAccountDeactivatedError,
+    OAuth2UserDataValidationError,
+)
+from .user import get_user_from_data
+
+logger = getLogger("misago.oauth2")
+
+User = get_user_model()
+
+
+def oauth2_view(f):
+    f = deny_banned_ips(f)
+
+    @wraps(f)
+    @never_cache
+    def wrapped_oauth2_view(request):
+        if not request.settings.enable_oauth2_client:
+            raise Http404()
+
+        return f(request)
+
+    return wrapped_oauth2_view
+
+
+@oauth2_view
+def oauth2_login(request):
+    redirect_to = create_login_url(request)
+    return redirect(redirect_to)
+
+
+@oauth2_view
+def oauth2_complete(request):
+    try:
+        code_grant = get_code_grant(request)
+        token = get_access_token(request, code_grant)
+        user_data = get_user_data(request, token)
+        user, created = get_user_from_data(request, user_data)
+
+        if not user.is_active:
+            raise OAuth2UserAccountDeactivatedError()
+
+        if not user.is_staff:
+            if user_ban := get_user_ban(user, request.cache_versions):
+                raise Banned(user_ban)
+    except OAuth2UserDataValidationError as error:
+        logger.exception(
+            "OAuth2 Profile Error",
+            extra={
+                f"error[{error_index}]": str(error_msg)
+                for error_index, error_msg in enumerate(error.error_list)
+            },
+        )
+        return render(
+            request,
+            "misago/errorpages/oauth2_profile.html",
+            {
+                "error": error,
+                "error_list": error.error_list,
+            },
+            status=400,
+        )
+    except OAuth2Error as error:
+        logger.exception("OAuth2 Error")
+        return render(
+            request,
+            "misago/errorpages/oauth2.html",
+            {"error": error},
+            status=400,
+        )
+
+    if created and request.settings.oauth2_send_welcome_email:
+        send_welcome_email(request, user)
+
+    if not user.requires_activation:
+        login(request, user)
+
+    return redirect(reverse("misago:index"))

+ 11 - 0
misago/socialauth/tests/test_begin_auth.py

@@ -10,6 +10,17 @@ def test_view_begins_social_auth_for_provider(client, provider):
     assert response.status_code == 302
 
 
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_view_returns_403_when_oauth2_is_enabled(client, provider):
+    response = client.get(
+        reverse("misago:social-begin", kwargs={"backend": provider.pk})
+    )
+    assert response.status_code == 403
+
+
 def test_view_returns_404_for_disabled_provider(client, disabled_provider):
     response = client.get(
         reverse("misago:social-begin", kwargs={"backend": disabled_provider.pk})

+ 9 - 0
misago/socialauth/views.py

@@ -19,6 +19,15 @@ def get_provider_from_request(request, backend):
 
 def social_auth_view(f):
     def social_auth_view_wrapper(request, backend, *args, **kwargs):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to sign in."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         provider = get_provider_from_request(request, backend)
         request.strategy = load_strategy(request)
 

+ 1 - 1
misago/static/misago/js/misago.js

@@ -1,3 +1,3 @@
 /*! For license information please see misago.js.LICENSE.txt */
-!function(){var e,t={54116:function(e,t){var n,a;(a="object"==typeof window&&window||"object"==typeof self&&self)&&(a.hljs=function(e){function t(e){return e.replace(/[&<>]/gm,(function(e){return x[e]}))}function n(e){return e.nodeName.toLowerCase()}function a(e,t){var n=e&&e.exec(t);return n&&0===n.index}function s(e){return b.test(e)}function i(e,t){var n,a={};for(n in e)a[n]=e[n];if(t)for(n in t)a[n]=t[n];return a}function o(e){var t=[];return function e(a,s){for(var i=a.firstChild;i;i=i.nextSibling)3===i.nodeType?s+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:s,node:i}),s=e(i,s),n(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:s,node:i}));return s}(e,0),t}function r(e,a,s){function i(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset<a[0].offset?e:a:"start"===a[0].event?e:a:e.length?e:a}function o(e){u+="<"+n(e)+v.map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+t(e.value)+'"'})).join("")+">"}function r(e){u+="</"+n(e)+">"}function l(e){("start"===e.event?o:r)(e.node)}for(var c=0,u="",d=[];e.length||a.length;){var p=i();if(u+=t(s.substring(c,p[0].offset)),c=p[0].offset,p===e){d.reverse().forEach(r);do{l(p.splice(0,1)[0]),p=i()}while(p===e&&p.length&&p[0].offset===c);d.reverse().forEach(o)}else"start"===p[0].event?d.push(p[0].node):d.pop(),l(p.splice(0,1)[0])}return u+t(s.substr(c))}function l(e){function t(e){return e&&e.source||e}function n(n,a){return new RegExp(t(n),"m"+(e.cI?"i":"")+(a?"g":""))}!function a(s,o){if(!s.compiled){if(s.compiled=!0,s.k=s.k||s.bK,s.k){var r={},l=function(t,n){e.cI&&(n=n.toLowerCase()),n.split(" ").forEach((function(e){var n=e.split("|");r[n[0]]=[t,n[1]?Number(n[1]):1]}))};"string"==typeof s.k?l("keyword",s.k):m(s.k).forEach((function(e){l(e,s.k[e])})),s.k=r}s.lR=n(s.l||/\w+/,!0),o&&(s.bK&&(s.b="\\b("+s.bK.split(" ").join("|")+")\\b"),s.b||(s.b=/\B|\b/),s.bR=n(s.b),s.e||s.eW||(s.e=/\B|\b/),s.e&&(s.eR=n(s.e)),s.tE=t(s.e)||"",s.eW&&o.tE&&(s.tE+=(s.e?"|":"")+o.tE)),s.i&&(s.iR=n(s.i)),null==s.r&&(s.r=1),s.c||(s.c=[]);var c=[];s.c.forEach((function(e){e.v?e.v.forEach((function(t){c.push(i(e,t))})):c.push("self"===e?s:e)})),s.c=c,s.c.forEach((function(e){a(e,s)})),s.starts&&a(s.starts,o);var u=s.c.map((function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b})).concat([s.tE,s.i]).map(t).filter(Boolean);s.t=u.length?n(u.join("|"),!0):{exec:function(){return null}}}}(e)}function c(e,n,s,i){function o(e,t){var n,s;for(n=0,s=t.c.length;s>n;n++)if(a(t.c[n].bR,e))return t.c[n]}function r(e,t){if(a(e.eR,t)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?r(e.parent,t):void 0}function d(e,t){return!s&&a(t.iR,e)}function p(e,t){var n=b.cI?t[0].toLowerCase():t[0];return e.k.hasOwnProperty(n)&&e.k[n]}function h(e,t,n,a){var s='<span class="'+(a?"":k.classPrefix);return(s+=e+'">')+t+(n?"":N)}function v(){w+=null!=_.sL?function(){var e="string"==typeof _.sL;if(e&&!Z[_.sL])return t(R);var n=e?c(_.sL,R,!0,x[_.sL]):u(R,_.sL.length?_.sL:void 0);return _.r>0&&(C+=n.r),e&&(x[_.sL]=n.top),h(n.language,n.value,!1,!0)}():function(){var e,n,a,s;if(!_.k)return t(R);for(s="",n=0,_.lR.lastIndex=0,a=_.lR.exec(R);a;)s+=t(R.substring(n,a.index)),(e=p(_,a))?(C+=e[1],s+=h(e[0],t(a[0]))):s+=t(a[0]),n=_.lR.lastIndex,a=_.lR.exec(R);return s+t(R.substr(n))}(),R=""}function m(e){w+=e.cN?h(e.cN,"",!0):"",_=Object.create(e,{parent:{value:_}})}function g(e,t){if(R+=e,null==t)return v(),0;var n=o(t,_);if(n)return n.skip?R+=t:(n.eB&&(R+=t),v(),n.rB||n.eB||(R=t)),m(n),n.rB?0:t.length;var a=r(_,t);if(a){var s=_;s.skip?R+=t:(s.rE||s.eE||(R+=t),v(),s.eE&&(R=t));do{_.cN&&(w+=N),_.skip||(C+=_.r),_=_.parent}while(_!==a.parent);return a.starts&&m(a.starts),s.rE?0:t.length}if(d(t,_))throw new Error('Illegal lexeme "'+t+'" for mode "'+(_.cN||"<unnamed>")+'"');return R+=t,t.length||1}var b=f(e);if(!b)throw new Error('Unknown language: "'+e+'"');l(b);var y,_=i||b,x={},w="";for(y=_;y!==b;y=y.parent)y.cN&&(w=h(y.cN,"",!0)+w);var R="",C=0;try{for(var S,E,L=0;_.t.lastIndex=L,S=_.t.exec(n);)E=g(n.substring(L,S.index),S[0]),L=S.index+E;for(g(n.substr(L)),y=_;y.parent;y=y.parent)y.cN&&(w+=N);return{r:C,value:w,language:e,top:_}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:t(n)};throw e}}function u(e,n){n=n||k.languages||m(Z);var a={r:0,value:t(e)},s=a;return n.filter(f).forEach((function(t){var n=c(t,e,!1);n.language=t,n.r>s.r&&(s=n),n.r>a.r&&(s=a,a=n)})),s.language&&(a.second_best=s),a}function d(e){return k.tabReplace||k.useBR?e.replace(_,(function(e,t){return k.useBR&&"\n"===e?"<br>":k.tabReplace?t.replace(/\t/g,k.tabReplace):void 0})):e}function p(e){var t,n,a,i,l,p=function(e){var t,n,a,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",n=y.exec(o))return f(n[1])?n[1]:"no-highlight";for(t=0,a=(o=o.split(/\s+/)).length;a>t;t++)if(s(i=o[t])||f(i))return i}(e);s(p)||(k.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n"):t=e,l=t.textContent,a=p?c(p,l,!0):u(l),(n=o(t)).length&&((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=a.value,a.value=r(n,o(i),l)),a.value=d(a.value),e.innerHTML=a.value,e.className=function(e,t,n){var a=t?g[t]:n,s=[e.trim()];return e.match(/\bhljs\b/)||s.push("hljs"),-1===e.indexOf(a)&&s.push(a),s.join(" ").trim()}(e.className,p,a.language),e.result={language:a.language,re:a.r},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.r}))}function h(){if(!h.called){h.called=!0;var e=document.querySelectorAll("pre code");v.forEach.call(e,p)}}function f(e){return e=(e||"").toLowerCase(),Z[e]||Z[g[e]]}var v=[],m=Object.keys,Z={},g={},b=/^(no-?highlight|plain|text)$/i,y=/\blang(?:uage)?-([\w-]+)\b/i,_=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,N="</span>",k={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},x={"&":"&amp;","<":"&lt;",">":"&gt;"};return e.highlight=c,e.highlightAuto=u,e.fixMarkup=d,e.highlightBlock=p,e.configure=function(e){k=i(k,e)},e.initHighlighting=h,e.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",h,!1),addEventListener("load",h,!1)},e.registerLanguage=function(t,n){var a=Z[t]=n(e);a.aliases&&a.aliases.forEach((function(e){g[e]=t}))},e.listLanguages=function(){return m(Z)},e.getLanguage=f,e.inherit=i,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(t,n,a){var s=e.inherit({cN:"comment",b:t,e:n,c:[]},a||{});return s.c.push(e.PWM),s.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),s},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e}({}),void 0===(n=function(){return a.hljs}.apply(t,[]))||(e.exports=n)),hljs.registerLanguage("xml",(function(e){var t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:"[A-Za-z0-9\\._:-]+",r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("\x3c!--","--\x3e",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"<\/script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}})),hljs.registerLanguage("markdown",(function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}})),hljs.registerLanguage("ini",(function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}})),hljs.registerLanguage("python",(function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},n={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},s={cN:"params",b:/\(/,e:/\)/,c:["self",t,a,n]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,a,n,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,s,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}})),hljs.registerLanguage("css",(function(e){var t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:"[a-zA-Z-][a-zA-Z0-9_-]*",r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}})),hljs.registerLanguage("less",(function(e){var t="[\\w-]+",n="("+t+"|@{"+t+"})",a=[],s=[],i=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},o=function(e,t,n){return{cN:e,b:t,r:n}},r={b:"\\(",e:"\\)",c:s,r:0};s.push(e.CLCM,e.CBCM,i("'"),i('"'),e.CSSNM,{b:"(url|data-uri)\\(",starts:{cN:"string",e:"[\\)\\n]",eE:!0}},o("number","#[0-9A-Fa-f]+\\b"),r,o("variable","@@?"+t,10),o("variable","@{"+t+"}"),o("built_in","~?`[^`]*?`"),{cN:"attribute",b:t+"\\s*:",e:":",rB:!0,eE:!0},{cN:"meta",b:"!important"});var l=s.concat({b:"{",e:"}",c:a}),c={bK:"when",eW:!0,c:[{bK:"and not"}].concat(s)},u={b:n+"\\s*:",rB:!0,e:"[;}]",r:0,c:[{cN:"attribute",b:n,e:":",eE:!0,starts:{eW:!0,i:"[<=$]",r:0,c:s}}]},d={cN:"keyword",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:s,r:0}},p={cN:"variable",v:[{b:"@"+t+"\\s*:",r:15},{b:"@"+t}],starts:{e:"[;}]",rE:!0,c:l}},h={v:[{b:"[\\.#:&\\[>]",e:"[;{}]"},{b:n,e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",r:0,c:[e.CLCM,e.CBCM,c,o("keyword","all\\b"),o("variable","@{"+t+"}"),o("selector-tag",n+"%?",0),o("selector-id","#"+n),o("selector-class","\\."+n,0),o("selector-tag","&",0),{cN:"selector-attr",b:"\\[",e:"\\]"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"\\(",e:"\\)",c:l},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,d,p,u,h),{cI:!0,i:"[=>'/<($\"]",c:a}})),hljs.registerLanguage("scss",(function(e){var t={cN:"variable",b:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b"},n={cN:"number",b:"#[0-9A-Fa-f]+"};return e.CSSNM,e.QSM,e.ASM,e.CBCM,{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},t,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[t,n,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[t,e.QSM,e.ASM,n,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}})),hljs.registerLanguage("json",(function(e){var t={literal:"true false null"},n=[e.QSM,e.CNM],a={e:",",eW:!0,eE:!0,c:n,k:t},s={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(a,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(a)],i:"\\S"};return n.splice(n.length,0,s,i),{c:n,k:t,i:"\\S"}})),hljs.registerLanguage("javascript",(function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",n={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},s={cN:"subst",b:"\\$\\{",e:"\\}",k:n,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,s]};s.c=[e.ASM,e.QSM,i,a,e.RM];var o=s.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:n,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:n,c:o}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:o}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}})),hljs.registerLanguage("bash",(function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},n={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,n,{cN:"string",b:/'/,e:/'/},t]}}))},98936:function(e,t,n){"use strict";n.d(t,{gq:function(){return o},Z6:function(){return r},kw:function(){return l}});var a=n(22928),s=n(94184),i=n.n(s),o=(n(57588),function(e){var t=e.children,n=e.className;return(0,a.Z)("div",{className:i()("flex-row",n)},void 0,t)}),r=function(e){var t=e.children,n=e.className,s=e.shrink;return(0,a.Z)("div",{className:i()("flex-row-col",n,{"flex-row-col-shrink":s})},void 0,t)},l=function(e){var t=e.auto,n=e.children,s=e.className;return(0,a.Z)("div",{className:i()("flex-row-section",{"flex-row-section-auto":t},s)},void 0,n)}},59131:function(e,t,n){"use strict";var a=n(22928);n(57588),t.Z=function(e){var t=e.children;return(0,a.Z)("div",{className:"container page-container"},void 0,t)}},99755:function(e,t,n){"use strict";n.d(t,{mr:function(){return r},gC:function(){return l},sP:function(){return c},eA:function(){return u},Ql:function(){return d},bM:function(){return p},Iv:function(){return h}});var a,s=n(22928),i=n(94184),o=n.n(i),r=(n(57588),function(e){var t=e.children,n=e.className,i=e.styleName;return(0,s.Z)("div",{className:o()("page-header",n,i&&"page-header-"+i)},void 0,(0,s.Z)("div",{className:"page-header-bg-image"},void 0,(0,s.Z)("div",{className:"page-header-bg-overlay"},void 0,a||(a=(0,s.Z)("div",{className:"page-header-image"})),t)))}),l=function(e){var t=e.children,n=e.className,a=e.styleName;return(0,s.Z)("div",{className:o()("page-header-banner",n,a&&"page-header-banner-"+a)},void 0,(0,s.Z)("div",{className:"page-header-banner-bg-image"},void 0,(0,s.Z)("div",{className:"page-header-banner-bg-overlay"},void 0,t)))},c=function(e){var t=e.children;return(0,s.Z)("div",{className:"container page-header-container"},void 0,t)},u=function(e){var t=e.children,n=e.className;return(0,s.Z)("div",{className:o()("page-header-details",n)},void 0,t)},d=function(e){var t=e.className,n=e.message;return(0,s.Z)("div",{className:o()("page-header-message",t),dangerouslySetInnerHTML:{__html:n}})},p=function(e){var t=e.children,n=e.className;return(0,s.Z)("div",{className:o()("page-header-message",n)},void 0,t)},h=function(e){var t=e.styleName,n=e.header,a=e.message;return(0,s.Z)(c,{},void 0,(0,s.Z)(r,{styleName:t},void 0,(0,s.Z)(l,{styleName:t},void 0,(0,s.Z)("h1",{},void 0,n)),a&&(0,s.Z)(u,{styleName:t},void 0,a)))}},26106:function(e,t,n){"use strict";var a=n(22928),s=(n(57588),n(32233)),i=n(89627),o=function(e){var t=e.agreement,n=e.checked,s=e.errors,o=e.url,r=e.value,l=e.onChange;if(!o)return null;var c=interpolate('<a href="%(url)s" target="_blank">%(agreement)s</a>',{agreement:(0,i.Z)(t),url:(0,i.Z)(o)},!0),u=interpolate(gettext("I have read and accept %(agreement)s."),{agreement:c},!0);return(0,a.Z)("div",{className:"checkbox legal-footnote"},void 0,(0,a.Z)("label",{},void 0,(0,a.Z)("input",{checked:n,type:"checkbox",value:r,onChange:l}),(0,a.Z)("span",{dangerouslySetInnerHTML:{__html:u}})),s&&s.map((function(e,t){return(0,a.Z)("div",{className:"help-block errors"},t,e)})))};t.Z=function(e){var t=e.errors,n=e.privacyPolicy,i=e.termsOfService,r=e.onPrivacyPolicyChange,l=e.onTermsOfServiceChange,c=s.Z.get("TERMS_OF_SERVICE_ID"),u=s.Z.get("TERMS_OF_SERVICE_URL"),d=s.Z.get("PRIVACY_POLICY_ID"),p=s.Z.get("PRIVACY_POLICY_URL");return c||d?(0,a.Z)("div",{},void 0,(0,a.Z)(o,{agreement:gettext("the terms of service"),checked:null!==i,errors:t.termsOfService,url:u,value:c,onChange:l}),(0,a.Z)(o,{agreement:gettext("the privacy policy"),checked:null!==n,errors:t.privacyPolicy,url:p,value:d,onChange:r})):null}},47235:function(e,t,n){"use strict";var a,s=n(22928),i=(n(57588),n(32233)),o=function(e){var t=e.className,n=e.text;return n?(0,s.Z)("h5",{className:t||""},void 0,n):null};t.Z=function(e){var t=e.buttonClassName,n=e.buttonLabel,r=e.formLabel,l=e.header,c=e.labelClassName,u=i.Z.get("SOCIAL_AUTH");return 0===u.length?null:(0,s.Z)("div",{className:"form-group form-social-auth"},void 0,(0,s.Z)(o,{className:c,text:l}),(0,s.Z)("div",{className:"row"},void 0,u.map((function(e){var a=e.id,i=e.name,o=e.button_text,r=e.button_color,l=e.url,c="btn btn-block btn-default btn-social-"+a,u=r?{color:r}:null,d=o||interpolate(n,{site:i},!0);return(0,s.Z)("div",{className:t||"col-xs-12"},a,(0,s.Z)("a",{className:c,style:u,href:l},void 0,d))}))),a||(a=(0,s.Z)("hr",{})),(0,s.Z)(o,{className:c,text:r}))}},50366:function(e,t,n){"use strict";var a,s,i,o,r,l,c,u=n(22928);n(57588),t.Z=function(e){var t=e.thread;return(0,u.Z)("ul",{className:"thread-flags"},void 0,2==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-globally",title:gettext("Pinned globally")},void 0,a||(a=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark"))),1==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-locally",title:gettext("Pinned in category")},void 0,s||(s=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark_outline"))),t.best_answer&&(0,u.Z)("li",{className:"thread-flag-answered",title:gettext("Answered")},void 0,i||(i=(0,u.Z)("span",{className:"material-icon"},void 0,"check_circle"))),t.has_poll&&(0,u.Z)("li",{className:"thread-flag-poll",title:gettext("Poll")},void 0,o||(o=(0,u.Z)("span",{className:"material-icon"},void 0,"poll"))),(t.is_unapproved||t.has_unapproved_posts)&&(0,u.Z)("li",{className:"thread-flag-unapproved",title:t.is_unapproved?gettext("Awaiting approval"):gettext("Has unapproved posts")},void 0,r||(r=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility"))),t.is_closed&&(0,u.Z)("li",{className:"thread-flag-closed",title:gettext("Closed")},void 0,l||(l=(0,u.Z)("span",{className:"material-icon"},void 0,"lock"))),t.is_hidden&&(0,u.Z)("li",{className:"thread-flag-hidden",title:gettext("Hidden")},void 0,c||(c=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility_off"))))}},16768:function(e,t,n){"use strict";var a,s=n(22928);n(57588),t.Z=function(e){var t=e.thread;return(0,s.Z)("span",{className:"threads-replies",title:interpolate(ngettext("%(replies)s reply","%(replies)s replies",t.replies),{replies:t.replies},!0)},void 0,a||(a=(0,s.Z)("span",{className:"material-icon"},void 0,"chat_bubble_outline")),t.replies>980?Math.round(t.replies/1e3)+"K":t.replies)}},92490:function(e,t,n){"use strict";n.d(t,{o8:function(){return s},Eg:function(){return r},Z2:function(){return l},tw:function(){return c}});var a=n(22928),s=(n(57588),function(e){var t=e.children;return(0,a.Z)("nav",{className:"toolbar"},void 0,t)}),i=n(94184),o=n.n(i),r=function(e){var t=e.children,n=e.className,s=e.shrink;return(0,a.Z)("div",{className:o()("toolbar-item",n,{"toolbar-item-shrink":s})},void 0,t)},l=function(e){var t=e.auto,n=e.children,s=e.className;return(0,a.Z)("div",{className:o()("toolbar-section",{"toolbar-section-auto":t},s)},void 0,n)},c=function(e){var t=e.className;return(0,a.Z)("div",{className:o()("toolbar-spacer",t)})}},19605:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i}});var a=n(22928),s=(n(57588),n(32233));function i(e){var t=e.size||100,n=e.size2x||t;return(0,a.Z)("img",{alt:"",className:e.className||"user-avatar",src:o(e.user,t),srcSet:o(e.user,n),width:t,height:t})}function o(e,t){return e&&e.id?function(e,t){var n=e[0];return e.forEach((function(e){e.size>=t&&(n=e)})),n}(e.avatars,t).url:s.Z.get("BLANK_AVATAR_URL")}},82211:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){var e="btn "+this.props.className,t=this.props.disabled;return this.props.loading&&(e+=" btn-loading",t=!0),(0,s.Z)("button",{className:e,disabled:t,onClick:this.props.onClick,type:this.props.onClick?"button":"submit"},void 0,this.props.children,this.props.loading?a||(a=(0,s.Z)(p.Z,{})):null)}}]),d}(d().Component);h.defaultProps={className:"btn-default",type:"submit",loading:!1,disabled:!1,onClick:null}},57026:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(22928);function s(e){return(0,a.Z)("select",{className:e.className||"form-control",disabled:e.disabled||!1,id:e.id||null,onChange:e.onChange,value:e.value},void 0,e.choices.map((function(e){return(0,a.Z)("option",{disabled:e.disabled||!1,value:e.value},e.value,"- - ".repeat(e.level)+e.label)})))}n(57588)},21688:function(e,t,n){"use strict";n.d(t,{Z:function(){return S}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c),d=n(33556);function p(e){return e.display?(0,a.Z)(d.Z,{helpText:gettext("No profile details are editable at this time."),message:gettext("This option is currently unavailable.")}):null}var h,f=n(37848);function v(e){return e.display?h||(h=(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(f.Z,{}))):null}var m=n(97326),Z=n(4942),g=n(60471);var b=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){var e;(0,s.Z)(this,u);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=c.call.apply(c,[this].concat(n)),(0,Z.Z)((0,m.Z)(e),"onChange",(function(t){var n=e.props,a=n.field;(0,n.onChange)(a.fieldname,t.target.value)})),e}return(0,i.Z)(u,[{key:"render",value:function(){var e=this.props,t=e.disabled,n=e.field,s=e.value,i=n.input;return"select"===i.type?(0,a.Z)(g.Z,{choices:i.choices,disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,value:s}):"textarea"===i.type?(0,a.Z)("textarea",{className:"form-control",disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,rows:"4",type:"text",value:s}):"text"===i.type?(0,a.Z)("input",{className:"form-control",disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,type:"text",value:s}):null}}]),u}(u().Component),y=n(96359);function _(e){var t=e.disabled,n=e.errors,s=e.fields,i=e.name,o=e.onChange,r=e.value;return(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,i),s.map((function(e){return(0,a.Z)(y.Z,{for:"id_"+e.fieldname,helpText:e.help_text,label:e.label,validation:n[e.fieldname]},e.fieldname,(0,a.Z)(b,{disabled:t,field:e,onChange:o,value:r[e.fieldname]}))})))}var N=n(82211),k=n(43345),x=n(78657),w=n(53904);var R=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;(0,s.Z)(this,u),t=c.call(this,e),(0,Z.Z)((0,m.Z)(t),"onChange",(function(e,n){t.setState((0,Z.Z)({},e,n))})),t.state={isLoading:!1,errors:{}};for(var n=e.groups.length,a=0;a<n;a++)for(var i=e.groups[a],o=i.fields.length,r=0;r<o;r++){var l=i.fields[r].fieldname,d=i.fields[r].initial;t.state[l]=d}return t}return(0,i.Z)(u,[{key:"send",value:function(){var e=Object.assign({},this.state,{errors:null,isLoading:null});return x.Z.post(this.props.api,e)}},{key:"handleSuccess",value:function(e){this.props.onSuccess(e)}},{key:"handleError",value:function(e){400===e.status?(w.Z.error(gettext("Form contains errors.")),this.setState({errors:e})):w.Z.apiError(e)}},{key:"render",value:function(){var e=this;return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,this.props.groups.map((function(t,n){return(0,a.Z)(_,{disabled:e.state.isLoading,errors:e.state.errors,fields:t.fields,name:t.name,onChange:e.onChange,value:e.state},n)}))),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(C,{disabled:this.state.isLoading,onCancel:this.props.onCancel})," ",(0,a.Z)(N.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes"))))}}]),u}(k.Z);function C(e){var t=e.onCancel,n=e.disabled;return t?(0,a.Z)("button",{className:"btn btn-default",disabled:n,onClick:t,type:"button"},void 0,gettext("Cancel")):null}var S=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={loading:!0,groups:null},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){var e=this;x.Z.get(this.props.api).then((function(t){e.setState({loading:!1,groups:t})}),(function(t){w.Z.apiError(t),e.props.cancel&&e.props.cancel()}))}},{key:"render",value:function(){var e=this.state,t=e.groups,n=e.loading;return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Edit details"))),(0,a.Z)(v,{display:n}),(0,a.Z)(p,{display:!n&&!t.length}),(0,a.Z)(E,{api:this.props.api,display:!n&&t.length,groups:t,onCancel:this.props.onCancel,onSuccess:this.props.onSuccess}))}}]),u}(u().Component);function E(e){var t=e.api,n=e.display,s=e.groups,i=e.onCancel,o=e.onSuccess;return n?(0,a.Z)(R,{api:t,groups:s,onCancel:i,onSuccess:o}):null}},96359:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"isValidated",value:function(){return void 0!==this.props.validation}},{key:"getClassName",value:function(){var e="form-group";return this.isValidated()&&(e+=" has-feedback",null===this.props.validation?e+=" has-success":e+=" has-error"),e}},{key:"getFeedback",value:function(){var e=this;return this.props.validation?(0,a.Z)("div",{className:"help-block errors"},void 0,this.props.validation.map((function(t,n){return(0,a.Z)("p",{},e.props.for+"FeedbackItem"+n,t)}))):null}},{key:"getFeedbackDescription",value:function(){return this.isValidated()?(0,a.Z)("span",{id:this.props.for+"_status",className:"sr-only"},void 0,this.props.validation?gettext("(error)"):gettext("(success)")):null}},{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:this.getClassName()},void 0,(0,a.Z)("label",{className:"control-label "+(this.props.labelClass||""),htmlFor:this.props.for||""},void 0,this.props.label+":"),(0,a.Z)("div",{className:this.props.controlClass||""},void 0,this.props.children,this.getFeedbackDescription(),this.getFeedback(),this.getHelpText(),this.props.extra||null))}}]),u}(n.n(c)().Component)},43345:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var a=n(15671),s=n(43144),i=n(97326),o=n(79340),r=n(6215),l=n(61120),c=n(4942),u=n(57588),d=n.n(u),p=n(55210),h=n(53904);var f=(0,p.C1)(),v=function(e){(0,o.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function d(){var e;(0,a.Z)(this,d);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=u.call.apply(u,[this].concat(n)),(0,c.Z)((0,i.Z)(e),"bindInput",(function(t){return function(n){e.changeValue(t,n.target.value)}})),(0,c.Z)((0,i.Z)(e),"changeValue",(function(t,n){var a=(0,c.Z)({},t,n),s=e.state.errors||{};s[t]=e.validateField(t,a[t]),a.errors=s,e.setState(a)})),(0,c.Z)((0,i.Z)(e),"handleSubmit",(function(t){if(t&&t.preventDefault(),!e.state.isLoading&&e.clean()){e.setState({isLoading:!0});var n=e.send();n?n.then((function(t){e.setState({isLoading:!1}),e.handleSuccess(t)}),(function(t){e.setState({isLoading:!1}),e.handleError(t)})):e.setState({isLoading:!1})}})),e}return(0,s.Z)(d,[{key:"validate",value:function(){var e={};if(!this.state.validators)return e;var t={required:this.state.validators.required||this.state.validators,optional:this.state.validators.optional||{}},n=[];for(var a in t.required)t.required.hasOwnProperty(a)&&t.required[a]&&n.push(a);for(var s in t.optional)t.optional.hasOwnProperty(s)&&t.optional[s]&&n.push(s);for(var i in n){var o=n[i],r=this.validateField(o,this.state[o]);null===r?e[o]=null:r&&(e[o]=r)}return e}},{key:"isValid",value:function(){var e=this.validate();for(var t in e)if(e.hasOwnProperty(t)&&null!==e[t])return!1;return!0}},{key:"validateField",value:function(e,t){var n=[];if(!this.state.validators)return n;var a={required:(this.state.validators.required||this.state.validators)[e],optional:(this.state.validators.optional||{})[e]},s=f(t)||!1;if(a.required){if(s)n=[s];else for(var i in a.required){var o=a.required[i](t);o&&n.push(o)}return n.length?n:null}if(!1===s&&a.optional){for(var r in a.optional){var l=a.optional[r](t);l&&n.push(l)}return n.length?n:null}return!1}},{key:"clean",value:function(){return!0}},{key:"send",value:function(){return null}},{key:"handleSuccess",value:function(e){}},{key:"handleError",value:function(e){h.Z.apiError(e)}}]),d}(d().Component)},94417:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"isActive",value:function(){return this.props.isControlled?this.props.isActive:!!this.props.path&&0===document.location.pathname.indexOf(this.props.path)}},{key:"getClassName",value:function(){return this.isActive()?(this.props.className||"")+" "+(this.props.activeClassName||"active"):this.props.className||""}},{key:"render",value:function(){return(0,a.Z)("li",{className:this.getClassName()},void 0,this.props.children)}}]),u}(n.n(c)().Component)},37848:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a,s=n(22928);function i(e){return(0,s.Z)("div",{className:e.className||"loader"},void 0,a||(a=(0,s.Z)("div",{className:"loader-spinning-wheel"})))}n(57588)},52753:function(e,t,n){"use strict";n.d(t,{ZP:function(){return Z}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=(n(57588),n(82211)),h=n(43345),f=n(96359),v=n(78657),m=n(59801);var Z=function(e){(0,l.Z)(f,e);var t,n,h=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function f(e){var t;return(0,i.Z)(this,f),t=h.call(this,e),(0,d.Z)((0,r.Z)(t),"handleSuccess",(function(e){t.props.onSuccess(e),m.Z.hide()})),(0,d.Z)((0,r.Z)(t),"handleError",(function(e){t.props.onError(e)})),(0,d.Z)((0,r.Z)(t),"onBestAnswerChange",(function(e){t.changeValue("bestAnswer",e.target.value)})),(0,d.Z)((0,r.Z)(t),"onPollChange",(function(e){t.changeValue("poll",e.target.value)})),t.state={isLoading:!1,bestAnswer:"0",poll:"0"},t}return(0,o.Z)(f,[{key:"clean",value:function(){return!this.props.polls||"0"!==this.state.poll||window.confirm(gettext("Are you sure you want to delete all polls?"))}},{key:"send",value:function(){var e=Object.assign({},this.props.data,{best_answer:this.state.bestAnswer,poll:this.state.poll});return v.Z.post(this.props.api,e)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Merge threads"))),(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(g,{choices:this.props.bestAnswers,onChange:this.onBestAnswerChange,value:this.state.bestAnswer}),(0,s.Z)(b,{choices:this.props.polls,onChange:this.onPollChange,value:this.state.poll})),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)(p.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Merge threads"))))))}}]),f}(h.Z);function g(e){var t=e.choices,n=e.onChange,a=e.value;return t?(0,s.Z)(f.Z,{label:gettext("Best answer"),helpText:gettext("Please select the best answer for your newly merged thread. No posts will be deleted during the merge."),for:"id_best_answer"},void 0,(0,s.Z)("select",{className:"form-control",id:"id_best_answer",onChange:n,value:a},void 0,t.map((function(e){return(0,s.Z)("option",{value:e[0]},e[0],e[1])})))):null}function b(e){var t=e.choices,n=e.onChange,a=e.value;return t?(0,s.Z)(f.Z,{label:gettext("Poll"),helpText:gettext("Please select the poll for your newly merged thread. Rejected polls will be permanently deleted and cannot be recovered."),for:"id_poll"},void 0,(0,s.Z)("select",{className:"form-control",id:"id_poll",onChange:n,value:a},void 0,t.map((function(e){return(0,s.Z)("option",{value:e[0]},e[0],e[1])})))):null}},69092:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var a=n(15671),s=n(43144),i=n(79340),o=n(6215),r=n(61120),l=n(57588),c=n.n(l),u=n(4942),d=n(19755),p=new RegExp("^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*"),h=new(function(){function e(){var t=this;(0,a.Z)(this,e),(0,u.Z)(this,"render",(function(e){e&&(t.highlightCode(e),t.embedYoutubePlayers(e))})),this._youtube={}}return(0,s.Z)(e,[{key:"highlightCode",value:function(e){for(var t=e.querySelectorAll("pre>code"),n=0;n<t.length;n++){var a=t[n];hljs.highlightBlock(a)}}},{key:"embedYoutubePlayers",value:function(e){for(var t=e.querySelectorAll("p>a"),n=0;n<t.length;n++){var a=t[n],s=1===a.parentNode.childNodes.length;this._youtube[a.href]||(this._youtube[a.href]=f(a.href));var i=this._youtube[a.href];s&&i&&!1!==i.data&&this.swapYoutubePlayer(a,i)}}},{key:"swapYoutubePlayer",value:function(e,t){var n="https://www.youtube.com/embed/";n+=t.video,n+="?rel=0",t.start&&(n+="&start="+t.start);var a=d('<iframe class="embed-responsive-item" src="'+n+'" allowfullscreen></iframe>');d(e).replaceWith(a),a.wrap('<div class="embed-responsive embed-responsive-16by9"></div>')}}]),e}());function f(e){var t=function(e){var t=e;return"https://"===e.substr(0,8)?t=t.substr(8):"http://"===e.substr(0,7)&&(t=t.substr(7)),"www."===t.substr(0,4)&&(t=t.substr(4)),t}(e),n=function(e){if(-1===e.indexOf("youtu"))return null;var t=e.match(p);return t?t[1]:null}(t);if(!n)return null;var a=0;if(t.indexOf("?")>0){var s=t.substr(t.indexOf("?")+1).split("&").filter((function(e){return"t="===e.substr(0,2)}))[0];if(s){var i=s.substr(2).split("m");"s"===i[0].substr(-1)?a+=parseInt(i[0].substr(0,i[0].length-1)):(a+=60*parseInt(i[0]),i[1]&&"s"===i[1].substr(-1)&&(a+=parseInt(i[1].substr(0,i[1].length-1))))}}return{start:a,video:n}}var v=n(19755);var m=function(e){(0,i.Z)(u,e);var t,n,l=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,r.Z)(t);if(n){var s=(0,r.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function u(){return(0,a.Z)(this,u),l.apply(this,arguments)}return(0,s.Z)(u,[{key:"componentDidMount",value:function(){h.render(this.documentNode),v(this.documentNode).find(".spoiler-reveal").click(Z)}},{key:"componentDidUpdate",value:function(e,t){h.render(this.documentNode),v(this.documentNode).find(".spoiler-reveal").click(Z)}},{key:"shouldComponentUpdate",value:function(e,t){return e.markup!==this.props.markup}},{key:"render",value:function(){var e=this;return c().createElement("article",{className:"misago-markup",dangerouslySetInnerHTML:{__html:this.props.markup},ref:function(t){e.documentNode=t}})}}]),u}(c().Component);function Z(e){var t=e.target;v(t).parent().parent().addClass("revealed")}},3784:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){return a||(a=(0,s.Z)("div",{className:"modal-body modal-loader"},void 0,(0,s.Z)(p.Z,{})))}}]),d}(d().Component)},30337:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120);n(57588);var c=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:"modal-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText(),(0,a.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}}]),u}(n(33556).Z)},95187:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){return a||(a=(0,s.Z)("div",{className:"panel-body panel-body-loading"},void 0,(0,s.Z)(p.Z,{className:"loader loader-spaced"})))}}]),d}(d().Component)},33556:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText()))}}]),u}(n.n(c)().Component)},91876:function(e,t,n){"use strict";n.d(t,{n:function(){return me},y:function(){return ke}});var a,s=n(87462),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(57588),h=n.n(p),f=n(30381),v=n.n(f),m=n(22928);function Z(e){return(0,m.Z)("div",{className:"poll-choices-bars"},void 0,e.poll.choices.map((function(t){return(0,m.Z)(g,{choice:t,poll:e.poll},t.hash)})))}function g(e){var t=0;return e.choice.votes&&e.poll.votes&&(t=Math.ceil(100*e.choice.votes/e.poll.votes)),(0,m.Z)("dl",{className:"dl-horizontal"},void 0,(0,m.Z)("dt",{},void 0,e.choice.label),(0,m.Z)("dd",{},void 0,(0,m.Z)("div",{className:"progress"},void 0,(0,m.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100",style:{width:t+"%"}},void 0,(0,m.Z)("span",{className:"sr-only"},void 0,y(e.votes,e.proc)))),(0,m.Z)("ul",{className:"list-unstyled list-inline poll-chart"},void 0,(0,m.Z)(b,{proc:t,votes:e.choice.votes}),(0,m.Z)(_,{selected:e.choice.selected}))))}function b(e){return(0,m.Z)("li",{className:"poll-chart-votes"},void 0,y(e.votes,e.proc))}function y(e,t){var n=ngettext("%(votes)s vote, %(proc)s% of total.","%(votes)s votes, %(proc)s% of total.",e);return interpolate(n,{votes:e,proc:t},!0)}function _(e){return e.selected?(0,m.Z)("li",{className:"poll-chart-selected"},void 0,a||(a=(0,m.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Your choice.")):null}var N,k,x,w=n(30337),R=n(3784),C=n(78657);var S=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,i.Z)(this,s),(t=a.call(this,e)).state={isLoading:!0,error:null,data:[]},t}return(0,o.Z)(s,[{key:"componentDidMount",value:function(){var e=this;C.Z.get(this.props.poll.api.votes).then((function(t){var n=t.map((function(e){return Object.assign({},e,{voters:e.voters.map((function(e){return Object.assign({},e,{voted_on:v()(e.voted_on)})}))})}));e.setState({isLoading:!1,data:n})}),(function(t){e.setState({isLoading:!1,error:t.detail})}))}},{key:"render",value:function(){return(0,m.Z)("div",{className:"modal-dialog"+(this.state.error?" modal-message":" modal-sm"),role:"document"},void 0,(0,m.Z)("div",{className:"modal-content"},void 0,(0,m.Z)("div",{className:"modal-header"},void 0,(0,m.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,N||(N=(0,m.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,m.Z)("h4",{className:"modal-title"},void 0,gettext("Poll votes"))),(0,m.Z)(E,{data:this.state.data,error:this.state.error,isLoading:this.state.isLoading})))}}]),s}(h().Component);function E(e){return e.isLoading?k||(k=(0,m.Z)(R.Z,{})):e.error?(0,m.Z)(w.Z,{icon:"error_outline",message:e.error}):(0,m.Z)(L,{data:e.data})}function L(e){return(0,m.Z)("div",{className:"modal-body modal-poll-votes"},void 0,(0,m.Z)("ul",{className:"list-unstyled votes-details"},void 0,e.data.map((function(e){return h().createElement(P,(0,s.Z)({key:e.hash},e))}))))}function P(e){return(0,m.Z)("li",{},void 0,(0,m.Z)("h4",{},void 0,e.label),(0,m.Z)(O,{votes:e.votes}),(0,m.Z)(T,{voters:e.voters}),x||(x=(0,m.Z)("hr",{})))}function O(e){var t=ngettext("%(votes)s user has voted for this choice.","%(votes)s users have voted for this choice.",e.votes),n=interpolate(t,{votes:e.votes},!0);return(0,m.Z)("p",{},void 0,n)}function T(e){return e.voters.length?(0,m.Z)("ul",{className:"list-unstyled"},void 0,e.voters.map((function(e){return h().createElement(A,(0,s.Z)({key:e.username},e))}))):null}function A(e){return e.url?(0,m.Z)("li",{},void 0,(0,m.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,m.Z)(B,{voted_on:e.voted_on})):(0,m.Z)("li",{},void 0,(0,m.Z)("strong",{},void 0,e.username)," ",(0,m.Z)(B,{voted_on:e.voted_on}))}function B(e){return(0,m.Z)("abbr",{className:"text-muted",title:e.voted_on.format("LLL")},void 0,e.voted_on.fromNow())}var I=n(59752),j=n(7738),D=n(59801),M=n(27950),U=n(53904),z=n(90287);function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}function F(e){var t=e.isPollOver,n=e.poll,a=e.showVoting,s=e.thread;if(!function(e,t,n){return n.is_public||t.can_delete||t.can_edit||t.can_see_votes||t.can_vote&&!e&&(!n.hasSelectedChoices||n.allow_revotes)}(t,n.acl,n))return null;var i=[],o=n.acl.can_vote,r=!n.hasSelectedChoices||n.allow_revotes;return o&&r&&i.push(0),(n.is_public||n.acl.can_see_votes)&&i.push(1),n.acl.can_edit&&i.push(2),n.acl.can_delete&&i.push(3),(0,m.Z)("div",{className:"row poll-options"},void 0,(0,m.Z)(Y,{controls:i,isPollOver:t,poll:n,showVoting:a}),(0,m.Z)(V,{controls:i,poll:n}),(0,m.Z)($,{controls:i,poll:n,thread:s}),(0,m.Z)(G,{controls:i,poll:n}))}function q(e,t){var n="col-xs-6";return 1===e.length&&(n="col-xs-12"),3===e.length&&e[0]===t&&(n="col-xs-12"),n+" col-sm-3 col-md-2"}function Y(e){var t=e.poll.acl.can_vote,n=!e.poll.hasSelectedChoices||e.poll.allow_revotes;return t&&n?(0,m.Z)("div",{className:q(e.controls,0)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:e.poll.isBusy,onClick:e.showVoting,type:"button"},void 0,gettext("Vote"))):null}var V=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){D.Z.show((0,m.Z)(S,{poll:e.props.poll}))})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.is_public||this.props.poll.acl.can_see_votes?(0,m.Z)("div",{className:q(this.props.controls,1)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("See votes"))):null}}]),n}(h().Component),$=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){M.Z.open({submit:e.props.poll.api.index,thread:e.props.thread,poll:e.props.poll,mode:"POLL"})})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.acl.can_edit?(0,m.Z)("div",{className:q(this.props.controls,2)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("Edit"))):null}}]),n}(h().Component),G=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){if(!window.confirm(gettext("Are you sure you want to delete this poll? This action is not reversible.")))return!1;z.Z.dispatch(I.n6()),C.Z.delete(e.props.poll.api.index).then(e.handleSuccess,e.handleError)})),(0,d.Z)((0,r.Z)(e),"handleSuccess",(function(e){U.Z.success("Poll has been deleted"),z.Z.dispatch(I.Od()),z.Z.dispatch(j.y8(e))})),(0,d.Z)((0,r.Z)(e),"handleError",(function(e){U.Z.apiError(e),z.Z.dispatch(I.Ar())})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.acl.can_delete?(0,m.Z)("div",{className:q(this.props.controls,3)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("Delete"))):null}}]),n}(h().Component),W=n(89627),K='<abbr title="%(absolute)s">%(relative)s</abbr>';function J(e){return(0,m.Z)("ul",{className:"list-unstyled list-inline poll-details"},void 0,(0,m.Z)(ae,{votes:e.poll.votes}),(0,m.Z)(te,{poll:e.poll}),(0,m.Z)(se,{poll:e.poll}),(0,m.Z)(Q,{poll:e.poll}))}function Q(e){var t=interpolate((0,W.Z)(gettext("Posted by %(poster)s %(posted_on)s.")),{poster:X(e.poll),posted_on:ee(e.poll)},!0);return(0,m.Z)("li",{className:"poll-info-creation",dangerouslySetInnerHTML:{__html:t}})}function X(e){return e.url.poster?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,W.Z)(e.url.poster),user:(0,W.Z)(e.poster_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,W.Z)(e.poster_name)},!0)}function ee(e){return interpolate(K,{absolute:(0,W.Z)(e.posted_on.format("LLL")),relative:(0,W.Z)(e.posted_on.fromNow())},!0)}function te(e){if(!e.poll.length)return null;var t=interpolate((0,W.Z)(gettext("Voting ends %(ends_on)s.")),{ends_on:ne(e.poll)},!0);return(0,m.Z)("li",{className:"poll-info-ends-on",dangerouslySetInnerHTML:{__html:t}})}function ne(e){return interpolate(K,{absolute:(0,W.Z)(e.endsOn.format("LLL")),relative:(0,W.Z)(e.endsOn.fromNow())},!0)}function ae(e){var t=ngettext("%(votes)s vote.","%(votes)s votes.",e.votes),n=interpolate(t,{votes:e.votes},!0);return(0,m.Z)("li",{className:"poll-info-votes"},void 0,n)}function se(e){return e.poll.is_public?(0,m.Z)("li",{className:"poll-info-public"},void 0,gettext("Votes are public.")):null}function ie(e){return(0,m.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("h2",{},void 0,e.poll.question),(0,m.Z)(J,{poll:e.poll}),(0,m.Z)(Z,{poll:e.poll}),(0,m.Z)(F,{isPollOver:e.isPollOver,poll:e.poll,showVoting:e.showVoting,thread:e.thread})))}function oe(e){return(0,m.Z)("ul",{className:"list-unstyled list-inline poll-help"},void 0,(0,m.Z)(re,{choicesLeft:e.choicesLeft}),(0,m.Z)(le,{poll:e.poll}))}function re(e){var t=e.choicesLeft;if(0===t)return(0,m.Z)("li",{className:"poll-help-choices-left"},void 0,gettext("You can't select any more choices."));var n=ngettext("You can select %(choices)s more choice.","You can select %(choices)s more choices.",t),a=interpolate(n,{choices:t},!0);return(0,m.Z)("li",{className:"poll-help-choices-left"},void 0,a)}function le(e){return e.poll.allow_revotes?(0,m.Z)("li",{className:"poll-help-allow-revotes"},void 0,gettext("You can change your vote later.")):(0,m.Z)("li",{className:"poll-help-no-revotes"},void 0,gettext("Votes are final."))}function ce(e){return(0,m.Z)("ul",{className:"list-unstyled poll-select-choices"},void 0,e.choices.map((function(t){return(0,m.Z)(ue,{choice:t,toggleChoice:e.toggleChoice},t.hash)})))}var ue=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){var e;(0,i.Z)(this,s);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){e.props.toggleChoice(e.props.choice.hash)})),e}return(0,o.Z)(s,[{key:"render",value:function(){return(0,m.Z)("li",{className:"poll-select-choice"},void 0,(0,m.Z)("button",{className:this.props.choice.selected?"btn btn-selected":"btn",onClick:this.onClick,type:"button"},void 0,(0,m.Z)("span",{className:"material-icon"},void 0,this.props.choice.selected?"check_box":"check_box_outline_blank"),(0,m.Z)("strong",{},void 0,this.props.choice.label)))}}]),s}(h().Component);function de(e,t){var n=[];for(var a in t){var s=t[a];s.selected&&n.push(s)}return e.allowed_choices-n.length}var pe=n(82211),he=n(43345);var fe=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,i.Z)(this,s),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"toggleChoice",(function(e){var n,a=function(e,t){for(var n in e){var a=e[n];if(a.hash===t)return a}return null}(t.state.choices,e);n=a.selected?t.deselectChoice(a,e):t.selectChoice(a,e),t.setState({choices:n,choicesLeft:de(t.props.poll,n)})})),(0,d.Z)((0,r.Z)(t),"selectChoice",(function(e,n){if(!de(t.props.poll,t.state.choices))for(var a in t.state.choices.slice()){var s=t.state.choices[a];if(s.selected&&s.hash!=n){s.selected=!1;break}}return t.state.choices.map((function(e){return Object.assign({},e,{selected:e.hash==n||e.selected})}))})),(0,d.Z)((0,r.Z)(t),"deselectChoice",(function(e,n){return t.state.choices.map((function(e){return Object.assign({},e,{selected:e.hash!=n&&e.selected})}))})),t.state={isLoading:!1,choices:e.poll.choices,choicesLeft:de(e.poll,e.poll.choices)},t}return(0,o.Z)(s,[{key:"clean",value:function(){return this.state.choicesLeft!==this.props.poll.allowed_choices||(U.Z.error(gettext("You need to select at least one choice")),!1)}},{key:"send",value:function(){var e=[];for(var t in this.state.choices.slice()){var n=this.state.choices[t];n.selected&&e.push(n.hash)}return C.Z.post(this.props.poll.api.votes,e)}},{key:"handleSuccess",value:function(e){z.Z.dispatch(I.gx(e)),U.Z.success(gettext("Your vote has been saved.")),this.props.showResults()}},{key:"handleError",value:function(e){400===e.status?U.Z.error(e.detail):U.Z.apiError(e)}},{key:"render",value:function(){var e=[];return this.props.poll.acl.can_vote&&e.push(0),(this.props.poll.is_public||this.props.poll.acl.can_see_votes)&&e.push(1),this.props.poll.acl.can_edit&&e.push(2),this.props.poll.acl.can_delete&&e.push(3),(0,m.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,m.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("h2",{},void 0,this.props.poll.question),(0,m.Z)(J,{poll:this.props.poll}),(0,m.Z)(ce,{choices:this.state.choices,toggleChoice:this.toggleChoice}),(0,m.Z)(oe,{choicesLeft:this.state.choicesLeft,poll:this.props.poll})),(0,m.Z)("div",{className:"panel-footer"},void 0,(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)("div",{className:q(e,0)},void 0,(0,m.Z)(pe.Z,{className:"btn-primary btn-block btn-sm",loading:this.state.isLoading},void 0,gettext("Save your vote"))),(0,m.Z)("div",{className:q(e,1)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.state.isLoading,onClick:this.props.showResults,type:"button"},void 0,gettext("See results"))),(0,m.Z)($,{controls:e,poll:this.props.poll,thread:this.props.thread}),(0,m.Z)(G,{controls:e,poll:this.props.poll})))))}}]),s}(he.Z);var ve,me=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"showResults",(function(){t.setState({showResults:!0})})),(0,d.Z)((0,r.Z)(t),"showVoting",(function(){t.setState({showResults:!1})}));var n=!0;return e.user.id&&!e.poll.hasSelectedChoices&&(n=!1),t.state={showResults:n},t}return(0,o.Z)(p,[{key:"render",value:function(){if(!this.props.thread.poll)return null;var e=function(e){return!!e.length&&v()().isAfter(e.endsOn)}(this.props.poll);return e||!this.props.poll.acl.can_vote||this.state.showResults?h().createElement(ie,(0,s.Z)({isPollOver:e,showVoting:this.showVoting},this.props)):h().createElement(fe,(0,s.Z)({showResults:this.showResults},this.props))}}]),p}(h().Component);function Ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ge=function(e){(0,l.Z)(n,e);var t=Ze(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onAdd",(function(){var t=e.props.choices.slice();t.push({hash:ye(),label:""}),e.props.setChoices(t)})),(0,d.Z)((0,r.Z)(e),"onChange",(function(t,n){var a=e.props.choices.map((function(e){return e.hash===t&&(e.label=n),e}));e.props.setChoices(a)})),(0,d.Z)((0,r.Z)(e),"onDelete",(function(t){var n=e.props.choices.filter((function(e){return e.hash!==t}));e.props.setChoices(n)})),e}return(0,o.Z)(n,[{key:"render",value:function(){var e=this;return(0,m.Z)("div",{className:"poll-choices-control"},void 0,(0,m.Z)("ul",{className:"list-group"},void 0,this.props.choices.map((function(t){return(0,m.Z)(be,{canDelete:e.props.choices.length>2,choice:t,disabled:e.props.disabled,onChange:e.onChange,onDelete:e.onDelete},t.hash)}))),(0,m.Z)("button",{className:"btn btn-default btn-sm",disabled:this.props.disabled,onClick:this.onAdd,type:"button"},void 0,gettext("Add choice")))}}]),n}(h().Component),be=function(e){(0,l.Z)(n,e);var t=Ze(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onChange",(function(t){e.props.onChange(e.props.choice.hash,t.target.value)})),(0,d.Z)((0,r.Z)(e),"onDelete",(function(){window.confirm(gettext("Are you sure you want to delete this choice?"))&&e.props.onDelete(e.props.choice.hash)})),e}return(0,o.Z)(n,[{key:"render",value:function(){return(0,m.Z)("li",{className:"list-group-item"},void 0,(0,m.Z)("button",{className:"btn",disabled:!this.props.canDelete||this.props.disabled,onClick:this.onDelete,title:gettext("Delete this choice"),type:"button"},void 0,ve||(ve=(0,m.Z)("span",{className:"material-icon"},void 0,"close"))),(0,m.Z)("input",{disabled:this.props.disabled,maxLength:"255",placeholder:gettext("choice label"),type:"text",onChange:this.onChange,value:this.props.choice.label}))}}]),n}(h().Component);function ye(){for(var e="";12!=e.length;)e=Math.random().toString(36).replace(/[^a-zA-Z0-9]+/g,"").substr(1,12);return e}var _e=n(96359),Ne=n(7227);var ke=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;(0,i.Z)(this,s),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"setChoices",(function(e){var n=Object.assign({},n,{choices:null});t.setState({choices:e,errors:n})})),(0,d.Z)((0,r.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard poll?"))&&M.Z.close()}));var n=e.poll||{question:"",choices:[{hash:"choice-10000",label:""},{hash:"choice-20000",label:""}],length:0,allowed_choices:1,allow_revotes:0,is_public:0};return t.state={isLoading:!1,isEdit:!!n.question,question:n.question,choices:n.choices,length:n.length,allowed_choices:n.allowed_choices,allow_revotes:n.allow_revotes,is_public:n.is_public,validators:{question:[],choices:[],length:[],allowed_choices:[]},errors:{}},t}return(0,o.Z)(s,[{key:"send",value:function(){var e={question:this.state.question,choices:this.state.choices,length:this.state.length,allowed_choices:this.state.allowed_choices,allow_revotes:this.state.allow_revotes,is_public:this.state.is_public};return this.state.isEdit?C.Z.put(this.props.poll.api.index,e):C.Z.post(this.props.thread.api.poll,e)}},{key:"handleSuccess",value:function(e){z.Z.dispatch(I.gx(e)),this.state.isEdit?U.Z.success(gettext("Poll has been edited.")):U.Z.success(gettext("Poll has been posted.")),M.Z.close()}},{key:"handleError",value:function(e){400===e.status?(e.non_field_errors&&(e.allowed_choices=e.non_field_errors),this.setState({errors:Object.assign({},e)}),U.Z.error(gettext("Form contains errors."))):U.Z.apiError(e)}},{key:"render",value:function(){return(0,m.Z)("div",{className:"poll-form"},void 0,(0,m.Z)("div",{className:"container"},void 0,(0,m.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,m.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("fieldset",{},void 0,(0,m.Z)("legend",{},void 0,gettext("Question and choices")),(0,m.Z)(_e.Z,{label:gettext("Poll question"),for:"id_questions",validation:this.state.errors.question},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_questions",onChange:this.bindInput("question"),type:"text",maxLength:"255",value:this.state.question})),(0,m.Z)(_e.Z,{label:gettext("Available choices"),validation:this.state.errors.choices},void 0,(0,m.Z)(ge,{choices:this.state.choices,disabled:this.state.isLoading,setChoices:this.setChoices}))),(0,m.Z)("fieldset",{},void 0,(0,m.Z)("legend",{},void 0,gettext("Voting")),(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Poll length"),helpText:gettext("Enter number of days for which voting in this poll should be possible or zero to run this poll indefinitely."),for:"id_length",validation:this.state.errors.length},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_length",onChange:this.bindInput("length"),type:"text",value:this.state.length}))),(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Allowed choices"),for:"id_allowed_choices",validation:this.state.errors.allowed_choices},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_allowed_choices",onChange:this.bindInput("allowed_choices"),type:"text",maxLength:"255",value:this.state.allowed_choices})))),(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)(xe,{bindInput:this.bindInput,disabled:this.state.isLoading,isEdit:this.state.isEdit,value:this.state.is_public}),(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Allow vote changes"),for:"id_allow_revotes"},void 0,(0,m.Z)(Ne.Z,{id:"id_allow_revotes",disabled:this.state.isLoading,iconOn:"check",iconOff:"close",labelOn:gettext("Allow participants to change their vote"),labelOff:gettext("Don't allow participants to change their vote"),onChange:this.bindInput("allow_revotes"),value:this.state.allow_revotes})))))),(0,m.Z)("div",{className:"panel-footer text-right"},void 0,(0,m.Z)("button",{className:"btn btn-default",disabled:this.state.isLoading,onClick:this.onCancel,type:"button"},void 0,gettext("Cancel"))," ",(0,m.Z)(pe.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,this.state.isEdit?gettext("Save changes"):gettext("Post poll")))))))}}]),s}(he.Z);function xe(e){return e.isEdit?null:(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Make voting public"),helpText:gettext("Making voting public will allow everyone to access detailed list of votes, showing which users voted for which choices and at which times. This option can't be changed after poll's creation. Moderators may see voting details for all polls."),for:"id_is_public"},void 0,(0,m.Z)(Ne.Z,{id:"id_is_public",disabled:e.disabled,iconOn:"visibility",iconOff:"visibility_off",labelOn:gettext("Votes are public"),labelOff:gettext("Votes are hidden"),onChange:e.bindInput("is_public"),value:e.value})))}},11005:function(e,t,n){"use strict";n.d(t,{Z:function(){return x}});var a=n(22928),s=n(57588),i=n.n(s),o=n(69092);function r(e){return e.post.content?i().createElement(l,e):i().createElement(c,e)}function l(e){return(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)(o.Z,{markup:e.post.content}))}function c(e){return(0,a.Z)("div",{className:"post-body post-body-invalid"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("This post's contents cannot be displayed.")),(0,a.Z)("p",{className:"text-muted"},void 0,gettext("This error is caused by invalid post content manipulation.")))}function u(e){var t=e.post,n=t.category,s=t.thread,i=interpolate(gettext("posted %(posted_on)s"),{posted_on:t.posted_on.format("LL, LT")},!0);return(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("a",{className:"btn btn-link item-title",href:s.url},void 0,s.title),(0,a.Z)("a",{className:"btn btn-link post-category",href:n.url.index},void 0,n.name),(0,a.Z)("a",{href:t.url.index,className:"btn btn-link posted-on",title:i},void 0,t.posted_on.fromNow()))}n(89627);var d,p,h=n(19605);function f(e){var t=e.post;return(0,a.Z)("a",{className:"btn btn-default btn-icon pull-right",href:t.url.index},void 0,(0,a.Z)("span",{className:"btn-text-left hidden-xs"},void 0,gettext("See post")),d||(d=(0,a.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function v(e){var t=e.post;return(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)(f,{post:t}),(0,a.Z)("div",{className:"media"},void 0,p||(p=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,t.poster_name)),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,gettext("Removed user")))))}function m(e){var t=e.rank,n=e.title||t.title||t.name,s="user-title";return t.css_class&&(s+=" user-title-"+t.css_class),t.is_tab?(0,a.Z)("a",{className:s,href:t.url},void 0,n):(0,a.Z)("span",{className:s},void 0,n)}function Z(e){var t=e.post,n=e.poster;return(0,a.Z)("div",{className:"post-side post-side-registered"},void 0,(0,a.Z)(f,{post:t}),(0,a.Z)("div",{className:"media"},void 0,(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("a",{href:n.url},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50,user:n}))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("a",{className:"item-title",href:n.url},void 0,n.username)),(0,a.Z)(m,{title:n.title,rank:n.rank}))))}function g(e){var t=e.post,n=e.poster;return n&&n.id?(0,a.Z)(Z,{post:t,poster:n}):(0,a.Z)(v,{post:t})}function b(e){var t=e.post,n=e.poster||t.poster,s="post";return n&&n.rank.css_class&&(s+=" post-"+n.rank.css_class),(0,a.Z)("li",{className:s,id:"post-"+t.id},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(g,{post:t,poster:n}),(0,a.Z)(u,{post:t}),(0,a.Z)(r,{post:t}))))}var y,_,N=n(44039);function k(){return(0,a.Z)("ul",{className:"posts-list post-feed ui-preview"},void 0,(0,a.Z)("li",{className:"post"},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)("div",{className:"media"},void 0,y||(y=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))))),(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")),(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)("article",{className:"misago-markup"},void 0,(0,a.Z)("p",{},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))))))))}function x(e){var t=e.isReady,n=e.posts,s=e.poster;return t?(0,a.Z)("ul",{className:"posts-list post-feed ui-ready"},void 0,n.map((function(e){return(0,a.Z)(b,{post:e,poster:s},e.id)}))):_||(_=(0,a.Z)(k,{}))}},12891:function(e,t,n){"use strict";n.d(t,{Jh:function(){return o},jn:function(){return i}});var a=n(55210),s=n(32233);function i(){return[(0,a.Ei)(s.Z.get("SETTINGS").thread_title_length_min,(function(e,t){var n=ngettext("Thread title should be at least %(limit_value)s character long (it has %(show_value)s).","Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)})),(0,a.BS)(s.Z.get("SETTINGS").thread_title_length_max,(function(e,t){var n=ngettext("Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).","Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))]}function o(){return s.Z.get("SETTINGS").post_length_max?[r(),(0,a.BS)(s.Z.get("SETTINGS").post_length_max||1e6,(function(e,t){var n=ngettext("Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).","Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))]:[r()]}function r(){return(0,a.Ei)(s.Z.get("SETTINGS").post_length_min,(function(e,t){var n=ngettext("Posted message should be at least %(limit_value)s character long (it has %(show_value)s).","Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))}},60471:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a=n(22928),s=n(15671),i=n(43144),o=n(97326),r=n(79340),l=n(6215),c=n(61120),u=n(4942),d=n(57588);var p=function(e){(0,r.Z)(p,e);var t,n,d=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,s.Z)(this,p);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=d.call.apply(d,[this].concat(n)),(0,u.Z)((0,o.Z)(e),"change",(function(t){return function(){e.props.onChange({target:{value:t}})}})),e}return(0,i.Z)(p,[{key:"getChoice",value:function(){var e=this,t=null;return this.props.choices.map((function(n){n.value===e.props.value&&(t=n)})),t}},{key:"getIcon",value:function(){return this.getChoice().icon}},{key:"getLabel",value:function(){return this.getChoice().label}},{key:"render",value:function(){var e=this;return(0,a.Z)("div",{className:"btn-group btn-select-group"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-select dropdown-toggle",id:this.props.id||null,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)(h,{icon:this.getIcon()}),this.getLabel()),(0,a.Z)("ul",{className:"dropdown-menu"},void 0,this.props.choices.map((function(t,n){return(0,a.Z)("li",{},n,(0,a.Z)("button",{type:"button",className:"btn-link",onClick:e.change(t.value)},void 0,(0,a.Z)(h,{icon:t.icon}),t.label))}))))}}]),p}(n.n(d)().Component);function h(e){var t=e.icon;return t?(0,a.Z)("span",{className:"material-icon"},void 0,t):null}},14467:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=(n(57588),n(32233)),d=n(82211),p=n(43345),h=n(47235),f=n(78657),v=n(59801),m=n(53904),Z=n(93051),g=n(19755);var b=function(e){(0,r.Z)(b,e);var t,n,p=(t=b,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function b(e){var t;return(0,i.Z)(this,b),(t=p.call(this,e)).state={isLoading:!1,showActivation:!1,username:"",password:"",validators:{username:[],password:[]}},t}return(0,o.Z)(b,[{key:"clean",value:function(){return!!this.isValid()||(m.Z.error(gettext("Fill out both fields.")),!1)}},{key:"send",value:function(){return f.Z.post(u.Z.get("AUTH_API"),{username:this.state.username,password:this.state.password})}},{key:"handleSuccess",value:function(){var e=g("#hidden-login-form");e.append('<input type="text" name="username" />'),e.append('<input type="password" name="password" />'),e.find('input[type="hidden"]').val(f.Z.getCsrfToken()),e.find('input[name="redirect_to"]').val(window.location.pathname),e.find('input[name="username"]').val(this.state.username),e.find('input[name="password"]').val(this.state.password),e.submit(),this.setState({isLoading:!0})}},{key:"handleError",value:function(e){400===e.status?"inactive_admin"===e.code?m.Z.info(e.detail):"inactive_user"===e.code?(m.Z.info(e.detail),this.setState({showActivation:!0})):"banned"===e.code?((0,Z.Z)(e.detail),v.Z.hide()):m.Z.error(e.detail):403===e.status&&e.ban?((0,Z.Z)(e.ban),v.Z.hide()):m.Z.apiError(e)}},{key:"getActivationButton",value:function(){return this.state.showActivation?(0,s.Z)("a",{className:"btn btn-success btn-block",href:u.Z.get("REQUEST_ACTIVATION_URL")},void 0,gettext("Activate account")):null}},{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog modal-sm modal-sign-in",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Sign in"))),(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(h.Z,{buttonLabel:gettext("Sign in with %(site)s"),formLabel:gettext("Or use your forum account:"),labelClassName:"text-center"}),(0,s.Z)("div",{className:"form-group"},void 0,(0,s.Z)("div",{className:"control-input"},void 0,(0,s.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_username",onChange:this.bindInput("username"),placeholder:gettext("Username or e-mail"),type:"text",value:this.state.username}))),(0,s.Z)("div",{className:"form-group"},void 0,(0,s.Z)("div",{className:"control-input"},void 0,(0,s.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_password",onChange:this.bindInput("password"),placeholder:gettext("Password"),type:"password",value:this.state.password})))),(0,s.Z)("div",{className:"modal-footer"},void 0,this.getActivationButton(),(0,s.Z)(d.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Sign in")),(0,s.Z)("a",{className:"btn btn-default btn-block",href:u.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Forgot password?"))))))}}]),b}(p.Z)},24678:function(e,t,n){"use strict";n.d(t,{Jj:function(){return h},ZP:function(){return p},pg:function(){return f}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,l.Z)(e);if(t){var s=(0,l.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,r.Z)(this,n)}}var p=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getClass",value:function(){return e=this.props.status,t="",e.is_banned?t="banned":e.is_hidden?t="offline":e.is_online_hidden?t="online":e.is_offline_hidden?t="offline":e.is_online?t="online":e.is_offline&&(t="offline"),"user-status user-"+t;var e,t}},{key:"render",value:function(){return(0,a.Z)("span",{className:this.getClass()},void 0,this.props.children)}}]),n}(u().Component),h=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getIcon",value:function(){return this.props.status.is_banned?"remove_circle_outline":this.props.status.is_hidden?"help_outline":this.props.status.is_online_hidden?"label":this.props.status.is_offline_hidden?"label_outline":this.props.status.is_online?"lens":this.props.status.is_offline?"panorama_fish_eye":void 0}},{key:"render",value:function(){return(0,a.Z)("span",{className:"material-icon status-icon"},void 0,this.getIcon())}}]),n}(u().Component),f=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getHelp",value:function(){return e=this.props.user,(t=this.props.status).is_banned?t.banned_until?interpolate(gettext("%(username)s is banned until %(ban_expires)s"),{username:e.username,ban_expires:t.banned_until.format("LL, LT")},!0):interpolate(gettext("%(username)s is banned"),{username:e.username},!0):t.is_hidden?interpolate(gettext("%(username)s is hiding presence"),{username:e.username},!0):t.is_online_hidden?interpolate(gettext("%(username)s is online (hidden)"),{username:e.username},!0):t.is_offline_hidden?interpolate(gettext("%(username)s was last seen %(last_click)s (hidden)"),{username:e.username,last_click:t.last_click.fromNow()},!0):t.is_online?interpolate(gettext("%(username)s is online"),{username:e.username},!0):t.is_offline?interpolate(gettext("%(username)s was last seen %(last_click)s"),{username:e.username,last_click:t.last_click.fromNow()},!0):void 0;var e,t}},{key:"getLabel",value:function(){return this.props.status.is_banned?gettext("Banned"):this.props.status.is_hidden?gettext("Hidden"):this.props.status.is_online_hidden?gettext("Online (hidden)"):this.props.status.is_offline_hidden?gettext("Offline (hidden)"):this.props.status.is_online?gettext("Online"):this.props.status.is_offline?gettext("Offline"):void 0}},{key:"render",value:function(){return(0,a.Z)("span",{className:this.props.className||"status-label",title:this.getHelp()},void 0,this.getLabel())}}]),n}(u().Component)},7850:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c);var d,p,h=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getEmptyMessage",value:function(){return this.props.emptyMessage?this.props.emptyMessage:gettext("No name changes have been recorded for your account.")}},{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-ready"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,(0,a.Z)("li",{className:"list-group-item empty-message"},void 0,this.getEmptyMessage())))}}]),u}(u().Component),f=n(19605);var v=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"renderUserAvatar",value:function(){return this.props.change.changed_by?(0,a.Z)("a",{href:this.props.change.changed_by.url,className:"user-avatar-wrapper"},void 0,(0,a.Z)(f.ZP,{user:this.props.change.changed_by,size:"100"})):d||(d=(0,a.Z)("span",{className:"user-avatar-wrapper"},void 0,(0,a.Z)(f.ZP,{size:"100"})))}},{key:"renderUsername",value:function(){return this.props.change.changed_by?(0,a.Z)("a",{href:this.props.change.changed_by.url,className:"item-title"},void 0,this.props.change.changed_by.username):(0,a.Z)("span",{className:"item-title"},void 0,this.props.change.changed_by_username)}},{key:"render",value:function(){return(0,a.Z)("li",{className:"list-group-item"},this.props.change.id,(0,a.Z)("div",{className:"change-avatar"},void 0,this.renderUserAvatar()),(0,a.Z)("div",{className:"change-author"},void 0,this.renderUsername()),(0,a.Z)("div",{className:"change"},void 0,(0,a.Z)("span",{className:"old-username"},void 0,this.props.change.old_username),p||(p=(0,a.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,a.Z)("span",{className:"new-username"},void 0,this.props.change.new_username)),(0,a.Z)("div",{className:"change-date"},void 0,(0,a.Z)("abbr",{title:this.props.change.changed_on.format("LLL")},void 0,this.props.change.changed_on.fromNow())))}}]),u}(u().Component);var m,Z,g=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-ready"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,this.props.changes.map((function(e){return(0,a.Z)(v,{change:e},e.id)}))))}}]),u}(u().Component),b=n(44039);var y=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getClassName",value:function(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}},{key:"render",value:function(){return(0,a.Z)("li",{className:this.getClassName()},void 0,m||(m=(0,a.Z)("div",{className:"change-avatar"},void 0,(0,a.Z)("span",{className:"user-avatar"},void 0,(0,a.Z)(f.ZP,{size:"100"})))),(0,a.Z)("div",{className:"change-author"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,100)+"px"}},void 0," ")),(0,a.Z)("div",{className:"change"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,70)+"px"}},void 0," "),Z||(Z=(0,a.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,70)+"px"}},void 0," ")),(0,a.Z)("div",{className:"change-date"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(80,140)+"px"}},void 0," ")))}}]),u}(u().Component);var _,N=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-preview"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((function(e){return(0,a.Z)(y,{hiddenOnMobile:e>0},e)}))))}}]),u}(u().Component);var k=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){return this.props.isLoaded?this.props.changes.length?(0,a.Z)(g,{changes:this.props.changes}):(0,a.Z)(h,{emptyMessage:this.props.emptyMessage}):_||(_=(0,a.Z)(N,{}))}}]),u}(u().Component)},40429:function(e,t,n){"use strict";n.d(t,{Z:function(){return L}});var a,s=n(22928),i=n(57588),o=n.n(i),r=n(19605),l=n(24678);function c(e){var t=e.showStatus,n=e.user;return(0,s.Z)("ul",{className:"list-unstyled"},void 0,(0,s.Z)(u,{showStatus:t,user:n}),(0,s.Z)(d,{user:n}),a||(a=(0,s.Z)("li",{className:"user-stat-divider"})),(0,s.Z)(p,{user:n}),(0,s.Z)(h,{user:n}),(0,s.Z)(f,{user:n}))}function u(e){var t=e.showStatus,n=e.user;return t?(0,s.Z)("li",{className:"user-stat-status"},void 0,(0,s.Z)(l.ZP,{status:n.status},void 0,(0,s.Z)(l.pg,{status:n.status,user:n}))):null}function d(e){var t=e.user.joined_on,n=interpolate(gettext("Joined on %(joined_on)s"),{joined_on:t.format("LL, LT")},!0),a=interpolate(gettext("Joined %(joined_on)s"),{joined_on:t.fromNow()},!0);return(0,s.Z)("li",{className:"user-stat-join-date"},void 0,(0,s.Z)("abbr",{title:n},void 0,a))}function p(e){var t=e.user,n=v("user-stat-posts",t.posts),a=ngettext("%(posts)s post","%(posts)s posts",t.posts);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{posts:t.posts},!0))}function h(e){var t=e.user,n=v("user-stat-threads",t.threads),a=ngettext("%(threads)s thread","%(threads)s threads",t.threads);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{threads:t.threads},!0))}function f(e){var t=e.user,n=v("user-stat-followers",t.followers),a=ngettext("%(followers)s follower","%(followers)s followers",t.followers);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{followers:t.followers},!0))}function v(e,t){return 0===t?e+" user-stat-empty":e}function m(e){var t=e.rank,n=e.title||t.title||t.name,a="user-title";return t.css_class&&(a+=" user-title-"+t.css_class),t.is_tab?(0,s.Z)("a",{className:a,href:t.url},void 0,n):(0,s.Z)("span",{className:a},void 0,n)}function Z(e){var t=e.showStatus,n=e.user,a=n.rank,i="panel user-card";return a.css_class&&(i+=" user-card-"+a.css_class),(0,s.Z)("div",{className:i},void 0,(0,s.Z)("div",{className:"panel-body"},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,s.Z)("div",{className:"user-card-small-avatar"},void 0,(0,s.Z)("a",{href:n.url},void 0,(0,s.Z)(r.ZP,{size:"50",size2x:"80",user:n})))),(0,s.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,(0,s.Z)("div",{className:"user-card-avatar"},void 0,(0,s.Z)("a",{href:n.url},void 0,(0,s.Z)(r.ZP,{size:"150",size2x:"200",user:n}))),(0,s.Z)("div",{className:"user-card-username"},void 0,(0,s.Z)("a",{href:n.url},void 0,n.username)),(0,s.Z)("div",{className:"user-card-title"},void 0,(0,s.Z)(m,{rank:a,title:n.title})),(0,s.Z)("div",{className:"user-card-stats"},void 0,(0,s.Z)(c,{showStatus:t,user:n}))))))}var g,b,y,_=n(15671),N=n(43144),k=n(79340),x=n(6215),w=n(61120),R=n(44039);var C,S=function(e){(0,k.Z)(i,e);var t,n,a=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,w.Z)(t);if(n){var s=(0,w.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,x.Z)(this,e)});function i(){return(0,_.Z)(this,i),a.apply(this,arguments)}return(0,N.Z)(i,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,s.Z)("div",{className:"panel user-card user-card-preview"},void 0,(0,s.Z)("div",{className:"panel-body"},void 0,(0,s.Z)("div",{className:"row"},void 0,g||(g=(0,s.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,s.Z)("div",{className:"user-card-small-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(r.ZP,{size:"50",size2x:"80"}))))),(0,s.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,b||(b=(0,s.Z)("div",{className:"user-card-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(r.ZP,{size:"150",size2x:"200"})))),(0,s.Z)("div",{className:"user-card-username"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(60,150)+"px"}},void 0," ")),(0,s.Z)("div",{className:"user-card-title"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(60,150)+"px"}},void 0," ")),(0,s.Z)("div",{className:"user-card-stats"},void 0,(0,s.Z)("ul",{className:"list-unstyled"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),y||(y=(0,s.Z)("li",{className:"user-stat-divider"})),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," "))))))))}}]),i}(o().Component);function E(e){var t=e.colClassName,n=e.cols,a=Array.apply(null,{length:n}).map(Number.call,Number);return(0,s.Z)("div",{className:"users-cards-list ui-preview"},void 0,(0,s.Z)("div",{className:"row"},void 0,a.map((function(e){var n=t;return 0!==e&&(n+=" hidden-xs"),3===e&&(n+=" hidden-sm"),(0,s.Z)("div",{className:n},e,C||(C=(0,s.Z)(S,{})))}))))}function L(e){var t=e.cols,n=e.isReady,a=e.showStatus,i=e.users,o="col-xs-12 col-sm-4";return 4===t&&(o+=" col-md-3"),n?(0,s.Z)("div",{className:"users-cards-list ui-ready"},void 0,(0,s.Z)("div",{className:"row"},void 0,i.map((function(e){return(0,s.Z)("div",{className:o},e.id,(0,s.Z)(Z,{showStatus:a,user:e}))})))):(0,s.Z)(E,{colClassName:o,cols:t})}},82125:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var a=n(15671),s=n(43144),i=n(97326),o=n(79340),r=n(6215),l=n(61120),c=n(4942),u=n(57588);var d=function(e){(0,o.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function d(e){var t;return(0,a.Z)(this,d),t=u.call(this,e),(0,c.Z)((0,i.Z)(t),"toggleNav",(function(){t.setState({dropdown:!t.state.dropdown})})),(0,c.Z)((0,i.Z)(t),"hideNav",(function(){t.setState({dropdown:!1})})),t.state={dropdown:!1},t}return(0,s.Z)(d,[{key:"getCompactNavClassName",value:function(){return this.state.dropdown?"compact-nav open":"compact-nav"}}]),d}(n.n(u)().Component)},7227:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a=n(22928),s=n(15671),i=n(43144),o=n(97326),r=n(79340),l=n(6215),c=n(61120),u=n(4942),d=n(57588);var p=function(e){(0,r.Z)(p,e);var t,n,d=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,s.Z)(this,p);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=d.call.apply(d,[this].concat(n)),(0,u.Z)((0,o.Z)(e),"toggle",(function(){e.props.onChange({target:{value:!e.props.value}})})),e}return(0,i.Z)(p,[{key:"getClassName",value:function(){return this.props.value?"btn btn-yes-no btn-yes-no-on":"btn btn-yes-no btn-yes-no-off"}},{key:"getIcon",value:function(){return this.props.value?this.props.iconOn||"check_box":this.props.iconOff||"check_box_outline_blank"}},{key:"getLabel",value:function(){return this.props.value?this.props.labelOn||gettext("yes"):this.props.labelOff||gettext("no")}},{key:"render",value:function(){return(0,a.Z)("button",{type:"button",onClick:this.toggle,className:this.getClassName(),id:this.props.id||null,"aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.getIcon()),(0,a.Z)("span",{className:"btn-text"},void 0,this.getLabel()))}}]),p}(n.n(d)().Component)},32233:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var a=n(15671),s=n(43144),i=(n(58294),n(95377),n(68852),n(39737),n(14316),n(43204),n(43511),n(7023),n(54116),function(){function e(t){(0,a.Z)(this,e),this.isOrdered=!1,this._items=t||[]}return(0,s.Z)(e,[{key:"add",value:function(e,t,n){this._items.push({key:e,item:t,after:n&&n.after||null,before:n&&n.before||null})}},{key:"get",value:function(e,t){for(var n=0;n<this._items.length;n++)if(this._items[n].key===e)return this._items[n].item;return t}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"values",value:function(){for(var e=[],t=0;t<this._items.length;t++)e.push(this._items[t].item);return e}},{key:"order",value:function(e){return this.isOrdered||(this._items=this._order(this._items),this.isOrdered=!0),e||void 0===e?this.values():this._items}},{key:"orderedValues",value:function(){return this.order(!0)}},{key:"_order",value:function(e){var t=[];e.forEach((function(e){t.push(e.key)}));var n=[],a=[];function s(e){var t=-1;-1===a.indexOf(e.key)&&(e.after?-1!==(t=a.indexOf(e.after))&&(t+=1):e.before&&(t=a.indexOf(e.before)),-1!==t&&(n.splice(t,0,e),a.splice(t,0,e.key)))}e.forEach((function(e){e.after||e.before||(n.push(e),a.push(e.key))})),e.forEach((function(e){"_end"===e.before&&(n.push(e),a.push(e.key))}));for(var i=200;i>0&&t.length!==a.length;)i-=1,e.forEach(s);return n}}]),e}()),o=new(function(){function e(){(0,a.Z)(this,e),this._initializers=[],this._context={}}return(0,s.Z)(e,[{key:"addInitializer",value:function(e){this._initializers.push({key:e.name,item:e.initializer,after:e.after,before:e.before})}},{key:"init",value:function(e){var t=this;this._context=e,new i(this._initializers).orderedValues().forEach((function(e){e(t)}))}},{key:"has",value:function(e){return!!this._context[e]}},{key:"get",value:function(e,t){return this.has(e)?this._context[e]:t||void 0}},{key:"pop",value:function(e){if(this.has(e)){var t=this._context[e];return this._context[e]=null,t}}}]),e}());window.misago=o;var r=o},58339:function(e,t,n){"use strict";var a=n(32233),s=n(78657);a.Z.addInitializer({name:"ajax",initializer:function(){s.Z.init(a.Z.get("CSRF_COOKIE_NAME"))}})},64109:function(e,t,n){"use strict";var a=n(32233),s=n(35486),i=n(78657),o=n(53904),r=n(90287);a.Z.addInitializer({name:"auth-sync",initializer:function(e){e.get("isAuthenticated")&&window.setInterval((function(){i.Z.get(e.get("AUTH_API")).then((function(e){r.Z.dispatch((0,s.r$)(e))}),(function(e){o.Z.apiError(e)}))}),45e3)},after:"auth"})},46226:function(e,t,n){"use strict";var a=n(32233),s=n(98274),i=n(59801),o=n(90287),r=n(62833);a.Z.addInitializer({name:"auth",initializer:function(){s.Z.init(o.Z,r.Z,i.Z)},after:"store"})},93240:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(93825),o=n(96142),r=n(53904);a.Z.addInitializer({name:"captcha",initializer:function(e){i.ZP.init(e,s.Z,o.Z,r.Z)}})},75147:function(e,t,n){"use strict";var a=n(22928),s=n(57588),i=n.n(s),o=n(32233),r=n(15671),l=n(43144),c=n(97326),u=n(79340),d=n(6215),p=n(61120),h=n(4942),f=n(78657);var v=function(e){(0,u.Z)(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=s.call(this,e),(0,h.Z)((0,c.Z)(t),"handleDecline",(function(){t.state.submiting||window.confirm(gettext("Declining will result in immediate deactivation and deletion of your account. This action is not reversible."))&&(t.setState({submiting:!0}),f.Z.post(t.props.api,{accept:!1}).then((function(){window.location.reload(!0)})))})),(0,h.Z)((0,c.Z)(t),"handleAccept",(function(){t.state.submiting||(t.setState({submiting:!0}),f.Z.post(t.props.api,{accept:!0}).then((function(){window.location.reload(!0)})))})),t.state={submiting:!1},t}return(0,l.Z)(i,[{key:"render",value:function(){return(0,a.Z)("div",{},void 0,(0,a.Z)("button",{className:"btn btn-default",disabled:this.state.submiting,type:"buton",onClick:this.handleDecline},void 0,gettext("Decline")),(0,a.Z)("button",{className:"btn btn-primary",disabled:this.state.submiting,type:"buton",onClick:this.handleAccept},void 0,gettext("Accept and continue")))}}]),i}(i().Component),m=n(4869);o.Z.addInitializer({name:"component:accept-agreement",initializer:function(e){document.getElementById("required-agreement-mount")&&(0,m.Z)((0,a.Z)(v,{api:e.get("REQUIRED_AGREEMENT_API")}),"required-agreement-mount",!1)},after:"store"})},4894:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588);var p=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"refresh",value:function(){window.location.reload()}},{key:"getMessage",value:function(){return this.props.signedIn?interpolate(gettext("You have signed in as %(username)s. Please refresh the page before continuing."),{username:this.props.signedIn.username},!0):this.props.signedOut?interpolate(gettext("%(username)s, you have been signed out. Please refresh the page before continuing."),{username:this.props.user.username},!0):void 0}},{key:"render",value:function(){var e="auth-message";return(this.props.signedIn||this.props.signedOut)&&(e+=" show"),(0,i.Z)("div",{className:e},void 0,(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,i.Z)("p",{},void 0,(0,i.Z)("button",{className:"btn btn-default",type:"button",onClick:this.refresh},void 0,gettext("Reload page")),(0,i.Z)("span",{className:"hidden-xs hidden-sm"},void 0," "+gettext("or press F5 key.")))))}}]),s}(n.n(d)().Component);function h(e){return{user:e.auth.user,signedIn:e.auth.signedIn,signedOut:e.auth.signedOut}}var f=n(4869);s.Z.addInitializer({name:"component:auth-message",initializer:function(){(0,f.Z)((0,a.$j)(h)(p),"auth-message-mount")},after:"store"})},29223:function(e,t,n){"use strict";var a=n(32233),s=n(93051);a.Z.addInitializer({name:"component:banmed-page",initializer:function(e){e.has("BAN_MESSAGE")&&(0,s.Z)(e.get("BAN_MESSAGE"),!1)},after:"store"})},3026:function(e,t,n){"use strict";var a=n(37424),s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(30381),h=n.n(p),f=n(57588),v=n.n(f);function m(e){return(0,s.Z)("div",{className:"categories-list"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("No categories exist or you don't have permission to see them.")))))}function Z(e){var t=e.category;return t.description?(0,s.Z)("div",{className:"category-description",dangerouslySetInnerHTML:{__html:t.description.html}}):null}function g(e){var t=e.category;return(0,s.Z)("div",{className:b(t),title:y(t)},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)))}function b(e){return e.is_read?"read-status item-read":"read-status item-new"}function y(e){return e.is_closed?e.is_read?gettext("This category has no new posts. (closed)"):gettext("This category has new posts. (closed)"):e.is_read?gettext("This category has no new posts."):gettext("This category has new posts.")}function _(e){var t=e.category;return(0,s.Z)("div",{className:"col-xs-12 col-sm-6 col-md-6 category-main"},void 0,(0,s.Z)("div",{className:"media"},void 0,(0,s.Z)("div",{className:"media-left"},void 0,(0,s.Z)(g,{category:t})),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("h4",{className:"media-heading"},void 0,(0,s.Z)("a",{href:t.url.index},void 0,t.name)),(0,s.Z)(Z,{category:t}))))}var N,k,x,w=n(19605);function R(e){var t=e.category;return(0,s.Z)("div",{className:"col-xs-12 col-sm-6 col-md-4 category-last-thread"},void 0,(0,s.Z)(C,{category:t}),(0,s.Z)(L,{category:t}),(0,s.Z)(P,{category:t}),(0,s.Z)(O,{category:t}))}function C(e){var t=e.category;return t.acl.can_browse&&t.acl.can_see_all_threads&&t.last_thread_title?(0,s.Z)("div",{className:"media"},void 0,(0,s.Z)("div",{className:"media-left hidden-xs"},void 0,(0,s.Z)(S,{category:t})),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("div",{className:"media-heading"},void 0,(0,s.Z)("a",{className:"item-title thread-title",href:t.url.last_thread_new,title:t.last_thread_title},void 0,t.last_thread_title)),(0,s.Z)("ul",{className:"list-inline"},void 0,(0,s.Z)("li",{className:"category-last-thread-poster"},void 0,(0,s.Z)(E,{category:t})),N||(N=(0,s.Z)("li",{className:"divider"},void 0,"—")),(0,s.Z)("li",{className:"category-last-thread-date"},void 0,(0,s.Z)("a",{href:t.url.last_post},void 0,t.last_post_on.fromNow()))))):null}function S(e){var t=e.category;return t.last_poster?(0,s.Z)("a",{className:"last-poster-avatar",href:t.last_poster.url,title:t.last_poster_name},void 0,(0,s.Z)(w.ZP,{className:"media-object",size:40,user:t.last_poster})):(0,s.Z)("span",{className:"last-poster-avatar",title:t.last_poster_name},void 0,k||(k=(0,s.Z)(w.ZP,{className:"media-object",size:40})))}function E(e){var t=e.category;return t.last_poster?(0,s.Z)("a",{className:"item-title",href:t.last_poster.url},void 0,t.last_poster_name):(0,s.Z)("span",{className:"item-title"},void 0,t.last_poster_name)}function L(e){var t=e.category;return t.acl.can_browse&&t.acl.can_see_all_threads?t.last_thread_title?null:(0,s.Z)(T,{message:gettext("This category is empty. No threads were posted within it so far.")}):null}function P(e){var t=e.category;return t.acl.can_browse?t.acl.can_see_all_threads?null:(0,s.Z)(T,{message:gettext("This category is private. You can see only your own threads within it.")}):null}function O(e){return e.category.acl.can_browse?null:(0,s.Z)(T,{message:gettext("This category is protected. You can't browse its contents.")})}function T(e){var t=e.message;return(0,s.Z)("div",{className:"media category-thread-message"},void 0,x||(x=(0,s.Z)("div",{className:"media-left"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("p",{},void 0,t)))}function A(e){var t=e.category;return(0,s.Z)("div",{className:"col-md-2 hidden-xs hidden-sm"},void 0,(0,s.Z)("ul",{className:"list-unstyled category-stats"},void 0,(0,s.Z)(B,{threads:t.threads}),(0,s.Z)(I,{posts:t.posts})))}function B(e){var t=e.threads,n=ngettext("%(threads)s thread","%(threads)s threads",t);return(0,s.Z)("li",{className:"category-stat-threads"},void 0,interpolate(n,{threads:t},!0))}function I(e){var t=e.posts,n=ngettext("%(posts)s post","%(posts)s posts",t);return(0,s.Z)("li",{className:"category-stat-posts"},void 0,interpolate(n,{posts:t},!0))}function j(e){var t=e.category,n="btn btn-default btn-block btn-sm btn-subcategory";return t.is_read||(n+=" btn-subcategory-new"),(0,s.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3"},void 0,(0,s.Z)("a",{className:n,href:t.url.index},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)),(0,s.Z)("span",{className:"icon-text"},void 0,t.name)))}function D(e){var t=e.category;return e.isFirst||0===t.subcategories.length?null:(0,s.Z)("div",{className:"row subcategories-list"},void 0,t.subcategories.map((function(e){return(0,s.Z)(j,{category:e},e.id)})))}function M(e){var t=e.category,n=e.isFirst,a="list-group-item";return t.description?a+=" list-group-category-has-description":a+=" list-group-category-no-description",n&&(a+=" list-group-item-first"),t.css_class&&(a+=" list-group-category-has-flavor",a+=" list-group-item-category-"+t.css_class),(0,s.Z)("li",{className:a},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)(_,{category:t}),(0,s.Z)(A,{category:t}),(0,s.Z)(R,{category:t})),(0,s.Z)(D,{category:t,isFirst:n}))}function U(e){var t=e.category,n="list-group list-group-category";return t.css_class&&(n+=" list-group-category-has-flavor",n+=" list-group-category-"+t.css_class),(0,s.Z)("ul",{className:n},void 0,(0,s.Z)(M,{category:t,isFirst:!0}),t.subcategories.map((function(e){return(0,s.Z)(M,{category:e,isFirst:!1},e.id)})))}function z(e){var t=e.categories;return(0,s.Z)("div",{className:"categories-list"},void 0,t.map((function(e){return(0,s.Z)(U,{category:e},e.id)})))}var H,F=n(32233),q=n(55547);var Y=function e(t){return Object.assign({},t,{last_post_on:t.last_post_on?h()(t.last_post_on):null,subcategories:t.subcategories.map(e)})},V=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;return(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"update",(function(e){t.setState({categories:e.map(Y)})})),t.state={categories:F.Z.get("CATEGORIES").map(Y)},t.startPolling(F.Z.get("CATEGORIES_API")),t}return(0,o.Z)(p,[{key:"startPolling",value:function(e){q.Z.start({poll:"categories",url:e,frequency:18e4,update:this.update})}},{key:"render",value:function(){var e=this.state.categories;return 0===e.length?H||(H=(0,s.Z)(m,{})):(0,s.Z)(z,{categories:e})}}]),p}(v().Component);function $(e){return{tick:e.tick.tick}}var G=n(4869);F.Z.addInitializer({name:"component:categories",initializer:function(){document.getElementById("categories-mount")&&(0,G.Z)((0,a.$j)($)(V),"categories-mount")},after:"store"})},94795:function(e,t,n){"use strict";var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c),d=n(37424),p=n(69987),h=n(94417);function f(e){return(0,a.Z)("div",{className:"list-group nav-side"},void 0,e.options.map((function(t){return(0,a.Z)(p.rU,{to:e.baseUrl+t.component+"/",className:"list-group-item",activeClassName:"active"},t.component,(0,a.Z)("span",{className:"material-icon"},void 0,t.icon),t.name)})))}function v(e){return(0,a.Z)("ul",{className:e.className||"dropdown-menu",role:"menu"},void 0,e.options.map((function(t){return(0,a.Z)(h.Z,{path:e.baseUrl+t.component+"/"},t.component,(0,a.Z)(p.rU,{to:e.baseUrl+t.component+"/",onClick:e.hideNav},void 0,(0,a.Z)("span",{className:"material-icon hidden-sm"},void 0,t.icon),t.name))})))}var m,Z=n(97326),g=n(4942),b=n(82211),y=n(78657),_=n(53328),N=n(53904),k=n(90287),x=n(32233);var w=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"onPasswordChange",(function(e){t.setState({password:e.target.value})})),(0,g.Z)((0,Z.Z)(t),"handleSubmit",(function(e){e.preventDefault();var n=t.state,a=n.isLoading,s=n.password,i=t.props.user;return 0==s.length?(N.Z.error(gettext("Enter your password to confirm account deletion.")),!1):!a&&(t.setState({isLoading:!0}),void y.Z.post(i.api.delete,{password:s}).then((function(e){window.location.href=x.Z.get("MISAGO_PATH")}),(function(e){t.setState({isLoading:!1}),e.password?N.Z.error(e.password[0]):N.Z.apiError(e)})))})),t.state={isLoading:!1,password:""},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Delete account"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-danger panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Delete account"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("You are going to delete your account. This action is nonreversible, and will result in following data being deleted:")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Stored IP addresses associated with content that you have posted will be deleted.")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Your username will become available for other user to rename to or for new user to register their account with.")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Your e-mail will become available for use in new account registration.")),m||(m=(0,a.Z)("hr",{})),(0,a.Z)("p",{},void 0,gettext("All your posted content will NOT be deleted, but username associated with it will be changed to one shared by all deleted accounts."))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)("div",{className:"input-group"},void 0,(0,a.Z)("input",{className:"form-control",disabled:this.state.isLoading,name:"password-confirmation",type:"password",placeholder:gettext("Enter your password to confirm account deletion."),value:this.state.password,onChange:this.onPasswordChange}),(0,a.Z)("span",{className:"input-group-btn"},void 0,(0,a.Z)(b.Z,{className:"btn-danger",loading:this.state.isLoading},void 0,gettext("Delete my account")))))))}}]),u}(u().Component),R=n(21688);var C=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){var e;(0,s.Z)(this,u);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=c.call.apply(c,[this].concat(n)),(0,g.Z)((0,Z.Z)(e),"onSuccess",(function(){N.Z.info(gettext("Your details have been updated."))})),e}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Edit details"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)(R.Z,{api:this.props.user.api.edit_details,onSuccess:this.onSuccess})}}]),u}(u().Component),S=n(30381),E=n.n(S);var L=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"handleLoadDownloads",(function(){y.Z.get(t.props.user.api.data_downloads).then((function(e){t.setState({isLoading:!1,downloads:e})}),(function(e){N.Z.apiError(e)}))})),(0,g.Z)((0,Z.Z)(t),"handleRequestDataDownload",(function(){t.setState({isSubmiting:!0}),y.Z.post(t.props.user.api.request_data_download).then((function(){t.handleLoadDownloads(),N.Z.success(gettext("Your request for data download has been registered.")),t.setState({isSubmiting:!1})}),(function(e){N.Z.apiError(e),t.setState({isSubmiting:!1})}))})),t.state={isLoading:!1,isSubmiting:!1,downloads:[]},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Download your data"),parent:gettext("Change your options")}),this.handleLoadDownloads()}},{key:"render",value:function(){return(0,a.Z)("div",{},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Download your data"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{},void 0,gettext('To download your data from the site, click the "Request data download" button. Depending on amount of data to be archived and number of users wanting to download their data at same time it may take up to few days for your download to be prepared. An e-mail with notification will be sent to you when your data is ready to be downloaded.')),(0,a.Z)("p",{},void 0,gettext("The download will only be available for limited amount of time, after which it will be deleted from the site and marked as expired."))),(0,a.Z)("table",{className:"table"},void 0,(0,a.Z)("thead",{},void 0,(0,a.Z)("tr",{},void 0,(0,a.Z)("th",{},void 0,gettext("Requested on")),(0,a.Z)("th",{className:"col-md-4"},void 0,gettext("Download")))),(0,a.Z)("tbody",{},void 0,this.state.downloads.map((function(e){return(0,a.Z)("tr",{},e.id,(0,a.Z)("td",{style:P},void 0,E()(e.requested_on).fromNow()),(0,a.Z)("td",{},void 0,(0,a.Z)(O,{exportFile:e.file,status:e.status})))})),0==this.state.downloads.length?(0,a.Z)("tr",{},void 0,(0,a.Z)("td",{colSpan:"2"},void 0,gettext("You have no data downloads."))):null)),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isSubmiting,type:"button",onClick:this.handleRequestDataDownload},void 0,gettext("Request data download")))))}}]),u}(u().Component),P={verticalAlign:"middle"},O=function(e){var t=e.exportFile,n=e.status;return 0===n||1===n?(0,a.Z)(b.Z,{className:"btn-info btn-sm btn-block",disabled:!0,type:"button"},void 0,gettext("Download is being prepared")):t?(0,a.Z)("a",{className:"btn btn-success btn-sm btn-block",href:t},void 0,gettext("Download your data")):(0,a.Z)(b.Z,{className:"btn-default btn-sm btn-block",disabled:!0,type:"button"},void 0,gettext("Download is expired"))},T=n(43345),A=n(96359),B=n(60471),I=n(7227),j=n(35486);var D,M=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={isLoading:!1,is_hiding_presence:e.user.is_hiding_presence,limits_private_thread_invites_to:e.user.limits_private_thread_invites_to,subscribe_to_started_threads:e.user.subscribe_to_started_threads,subscribe_to_replied_threads:e.user.subscribe_to_replied_threads,errors:{}},t.privateThreadInvitesChoices=[{value:0,icon:"help_outline",label:gettext("Everybody")},{value:1,icon:"done_all",label:gettext("Users I follow")},{value:2,icon:"highlight_off",label:gettext("Nobody")}],t.subscribeToChoices=[{value:0,icon:"star_border",label:gettext("No")},{value:1,icon:"star_half",label:gettext("Notify")},{value:2,icon:"star",label:gettext("Notify with e-mail")}],t}return(0,i.Z)(u,[{key:"send",value:function(){return y.Z.post(this.props.user.api.options,{is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,subscribe_to_started_threads:this.state.subscribe_to_started_threads,subscribe_to_replied_threads:this.state.subscribe_to_replied_threads})}},{key:"handleSuccess",value:function(){k.Z.dispatch((0,j.r$)({is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,subscribe_to_started_threads:this.state.subscribe_to_started_threads,subscribe_to_replied_threads:this.state.subscribe_to_replied_threads})),N.Z.success(gettext("Your forum options have been changed."))}},{key:"handleError",value:function(e){400===e.status?N.Z.error(gettext("Please reload page and try again.")):N.Z.apiError(e)}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Forum options"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change forum options"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,gettext("Privacy settings")),(0,a.Z)(A.Z,{label:gettext("Hide my presence"),helpText:gettext("If you hide your presence, only members with permission to see hidden users will see when you are online."),for:"id_is_hiding_presence"},void 0,(0,a.Z)(I.Z,{id:"id_is_hiding_presence",disabled:this.state.isLoading,iconOn:"visibility_off",iconOff:"visibility",labelOn:gettext("Hide my presence from other users"),labelOff:gettext("Show my presence to other users"),onChange:this.bindInput("is_hiding_presence"),value:this.state.is_hiding_presence})),(0,a.Z)(A.Z,{label:gettext("Private thread invitations"),for:"id_limits_private_thread_invites_to"},void 0,(0,a.Z)(B.Z,{id:"id_limits_private_thread_invites_to",disabled:this.state.isLoading,onChange:this.bindInput("limits_private_thread_invites_to"),value:this.state.limits_private_thread_invites_to,choices:this.privateThreadInvitesChoices}))),(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,gettext("Automatic subscriptions")),(0,a.Z)(A.Z,{label:gettext("Threads I start"),for:"id_subscribe_to_started_threads"},void 0,(0,a.Z)(B.Z,{id:"id_subscribe_to_started_threads",disabled:this.state.isLoading,onChange:this.bindInput("subscribe_to_started_threads"),value:this.state.subscribe_to_started_threads,choices:this.subscribeToChoices})),(0,a.Z)(A.Z,{label:gettext("Threads I reply to"),for:"id_subscribe_to_replied_threads"},void 0,(0,a.Z)(B.Z,{id:"id_subscribe_to_replied_threads",disabled:this.state.isLoading,onChange:this.bindInput("subscribe_to_replied_threads"),value:this.state.subscribe_to_replied_threads,choices:this.subscribeToChoices})))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes")))))}}]),u}(T.Z),U=n(95187);function z(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),D||(D=(0,a.Z)(U.Z,{})))}var H=n(33556);var F=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.options.next_on?interpolate(gettext("You will be able to change your username %(next_change)s."),{next_change:this.props.options.next_on.fromNow()},!0):gettext("You have used up available name changes.")}},{key:"render",value:function(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),(0,a.Z)(H.Z,{helpText:this.getHelpText(),message:gettext("You can't change your username at the moment.")}))}}]),u}(u().Component),q=n(55210);var Y,V=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={username:"",validators:{username:[q.lG(),q.HR(e.options.length_min),q.gS(e.options.length_max)]},isLoading:!1},t}return(0,i.Z)(u,[{key:"getHelpText",value:function(){var e=[];if(this.props.options.changes_left>0){var t=ngettext("You can change your username %(changes_left)s more time.","You can change your username %(changes_left)s more times.",this.props.options.changes_left);e.push(interpolate(t,{changes_left:this.props.options.changes_left},!0))}if(this.props.user.acl.name_changes_expire>0){var n=ngettext("Used changes become available again after %(name_changes_expire)s day.","Used changes become available again after %(name_changes_expire)s days.",this.props.user.acl.name_changes_expire);e.push(interpolate(n,{name_changes_expire:this.props.user.acl.name_changes_expire},!0))}return e.length?e.join(" "):null}},{key:"clean",value:function(){var e=this.validate();return e.username?(N.Z.error(e.username[0]),!1):this.state.username.trim()!==this.props.user.username||(N.Z.info(gettext("Your new username is same as current one.")),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.username,{username:this.state.username})}},{key:"handleSuccess",value:function(e){this.setState({username:""}),this.props.complete(e.username,e.slug,e.options)}},{key:"handleError",value:function(e){N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New username"),for:"id_username",helpText:this.getHelpText()},void 0,(0,a.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change username")))))}}]),u}(T.Z),$=n(7850),G=n(48927),W=n(6935);var K,J=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"onComplete",(function(e,n,a){t.setState({options:a}),k.Z.dispatch((0,G.KP)({username:e,slug:n},t.props.user,t.props.user)),k.Z.dispatch((0,W._S)(t.props.user,e,n)),N.Z.success(gettext("Your username has been changed successfully."))})),t.state={isLoaded:!1,options:null},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){var e=this;_.Z.set({title:gettext("Change username"),parent:gettext("Change your options")}),Promise.all([y.Z.get(this.props.user.api.username),y.Z.get(x.Z.get("USERNAME_CHANGES_API"),{user:this.props.user.id})]).then((function(t){k.Z.dispatch((0,G.ZB)(t[1].results)),e.setState({isLoaded:!0,options:{changes_left:t[0].changes_left,length_min:t[0].length_min,length_max:t[0].length_max,next_on:t[0].next_on?E()(t[0].next_on):null}})}))}},{key:"getChangeForm",value:function(){return this.state.isLoaded?0===this.state.options.changes_left?(0,a.Z)(F,{options:this.state.options}):(0,a.Z)(V,{complete:this.onComplete,options:this.state.options,user:this.props.user}):Y||(Y=(0,a.Z)(z,{}))}},{key:"render",value:function(){return(0,a.Z)("div",{},void 0,this.getChangeForm(),(0,a.Z)($.Z,{changes:this.props["username-history"],isLoaded:this.state.isLoaded}))}}]),u}(u().Component);var Q,X=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={new_email:"",password:"",validators:{new_email:[q.Do()],password:[]},isLoading:!1},t}return(0,i.Z)(u,[{key:"clean",value:function(){var e=this.validate();return-1!==[this.state.new_email.trim().length,this.state.password.trim().length].indexOf(0)?(N.Z.error(gettext("Fill out all fields.")),!1):!e.new_email||(N.Z.error(e.new_email[0]),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.change_email,{new_email:this.state.new_email,password:this.state.password})}},{key:"handleSuccess",value:function(e){this.setState({new_email:"",password:""}),N.Z.success(e.detail)}},{key:"handleError",value:function(e){400===e.status?e.new_email?N.Z.error(e.new_email):N.Z.error(e.password):N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change e-mail address"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New e-mail"),for:"id_new_email"},void 0,(0,a.Z)("input",{type:"text",id:"id_new_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_email"),value:this.state.new_email})),K||(K=(0,a.Z)("hr",{})),(0,a.Z)(A.Z,{label:gettext("Your current password"),for:"id_confirm_email"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change e-mail")))))}}]),u}(T.Z);var ee,te,ne,ae=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={new_password:"",repeat_password:"",password:"",validators:{new_password:[],repeat_password:[],password:[]},isLoading:!1},t}return(0,i.Z)(u,[{key:"clean",value:function(){var e=this.validate();return-1!==[this.state.new_password.trim().length,this.state.repeat_password.trim().length,this.state.password.trim().length].indexOf(0)?(N.Z.error(gettext("Fill out all fields.")),!1):e.new_password?(N.Z.error(e.new_password[0]),!1):this.state.new_password===this.state.repeat_password||(N.Z.error(gettext("New passwords are different.")),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.change_password,{new_password:this.state.new_password,password:this.state.password})}},{key:"handleSuccess",value:function(e){this.setState({new_password:"",repeat_password:"",password:""}),N.Z.success(e.detail)}},{key:"handleError",value:function(e){400===e.status?e.new_password?N.Z.error(e.new_password):N.Z.error(e.password):N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change password"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New password"),for:"id_new_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_new_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_password"),value:this.state.new_password})),(0,a.Z)(A.Z,{label:gettext("Repeat password"),for:"id_repeat_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_repeat_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("repeat_password"),value:this.state.repeat_password})),Q||(Q=(0,a.Z)("hr",{})),(0,a.Z)(A.Z,{label:gettext("Your current password"),for:"id_confirm_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change password")))))}}]),u}(T.Z),se=function(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change email or password"))),(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,ee||(ee=(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("You need to set a password for your account to be able to change your username or email.")),(0,a.Z)("p",{className:"help-block"},void 0,(0,a.Z)("a",{className:"btn btn-primary",href:x.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Set password"))))))};var ie,oe=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Change email or password"),parent:gettext("Change your options")})}},{key:"render",value:function(){return this.props.user.has_usable_password?(0,a.Z)("div",{},void 0,(0,a.Z)(X,{user:this.props.user}),(0,a.Z)(ae,{user:this.props.user}),(0,a.Z)("p",{className:"message-line"},void 0,ne||(ne=(0,a.Z)("span",{className:"material-icon"},void 0,"warning")),(0,a.Z)("a",{href:x.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Change forgotten password")))):te||(te=(0,a.Z)(se,{}))}}]),u}(u().Component),re=n(82125),le=n(98936),ce=n(59131),ue=n(99755);var de=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){var e=this,t=x.Z.get("USER_OPTIONS").filter((function(t){var n=x.Z.get("USERCP_URL")+t.component+"/";return e.props.location.pathname.substr(0,n.length)===n}))[0];return(0,a.Z)("div",{className:"page page-options"},void 0,(0,a.Z)(ue.sP,{},void 0,(0,a.Z)(ue.mr,{styleName:"options"},void 0,(0,a.Z)(ue.gC,{styleName:"options"},void 0,(0,a.Z)(le.gq,{},void 0,(0,a.Z)(le.kw,{auto:!0},void 0,(0,a.Z)(le.Z6,{auto:!0},void 0,(0,a.Z)("h1",{},void 0,gettext("Change your options"))),(0,a.Z)(le.Z6,{className:"hidden-xs hidden-md hidden-lg",shrink:!0},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Menu"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,ie||(ie=(0,a.Z)("span",{className:"material-icon"},void 0,"menu"))),(0,a.Z)(v,{className:"dropdown-menu dropdown-menu-right",baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})))),(0,a.Z)(le.kw,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,a.Z)(le.Z6,{},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-block dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,t.icon),t.name),(0,a.Z)(v,{className:"dropdown-menu",baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})))))))),(0,a.Z)(ce.Z,{},void 0,(0,a.Z)("div",{className:"row"},void 0,(0,a.Z)("div",{className:"col-md-3 hidden-xs hidden-sm"},void 0,(0,a.Z)(f,{baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})),(0,a.Z)("div",{className:"col-md-9"},void 0,this.props.children))))}}]),u}(re.Z);function pe(e){return{tick:e.tick.tick,user:e.auth.user,"username-history":e["username-history"]}}function he(){var e=[{path:x.Z.get("USERCP_URL")+"forum-options/",component:(0,d.$j)(pe)(M)},{path:x.Z.get("USERCP_URL")+"edit-details/",component:(0,d.$j)(pe)(C)},{path:x.Z.get("USERCP_URL")+"change-username/",component:(0,d.$j)(pe)(J)},{path:x.Z.get("USERCP_URL")+"sign-in-credentials/",component:(0,d.$j)(pe)(oe)}];return x.Z.get("ENABLE_DOWNLOAD_OWN_DATA")&&e.push({path:x.Z.get("USERCP_URL")+"download-data/",component:(0,d.$j)(pe)(L)}),x.Z.get("ENABLE_DELETE_OWN_ACCOUNT")&&e.push({path:x.Z.get("USERCP_URL")+"delete-account/",component:(0,d.$j)(pe)(w)}),e}var fe=n(39633);x.Z.addInitializer({name:"component:options",initializer:function(e){e.has("USER_OPTIONS")&&(0,fe.Z)({root:x.Z.get("USERCP_URL"),component:de,paths:he()})},after:"store"})},95563:function(e,t,n){"use strict";var a,s=n(37424),i=n(22928),o=n(15671),r=n(43144),l=n(97326),c=n(79340),u=n(6215),d=n(61120),p=n(4942),h=n(57588),f=n.n(h),v=n(30381),m=n.n(v),Z=n(95187),g=n(33556),b=n(32233),y=n(55547),_=n(53328);var N=function(e){(0,c.Z)(h,e);var t,n,s=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function h(e){var t;return(0,o.Z)(this,h),t=s.call(this,e),(0,p.Z)((0,l.Z)(t),"update",(function(e){e.expires_on&&(e.expires_on=m()(e.expires_on)),t.setState({isLoaded:!0,error:null,ban:e})})),(0,p.Z)((0,l.Z)(t),"error",(function(e){t.setState({isLoaded:!0,error:e.detail,ban:null})})),b.Z.has("PROFILE_BAN")?t.initWithPreloadedData(b.Z.pop("PROFILE_BAN")):t.initWithoutPreloadedData(),t.startPolling(e.profile.api.ban),t}return(0,r.Z)(h,[{key:"initWithPreloadedData",value:function(e){e.expires_on&&(e.expires_on=m()(e.expires_on)),this.state={isLoaded:!0,ban:e}}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(e){y.Z.start({poll:"ban-details",url:e,frequency:9e4,update:this.update,error:this.error})}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Ban details"),parent:this.props.profile.username})}},{key:"componentWillUnmount",value:function(){y.Z.stop("ban-details")}},{key:"getUserMessage",value:function(){return this.state.ban.user_message?(0,i.Z)("div",{className:"panel-body ban-message ban-user-message"},void 0,(0,i.Z)("h4",{},void 0,gettext("User-shown ban message")),(0,i.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.user_message.html}})):null}},{key:"getStaffMessage",value:function(){return this.state.ban.staff_message?(0,i.Z)("div",{className:"panel-body ban-message ban-staff-message"},void 0,(0,i.Z)("h4",{},void 0,gettext("Team-shown ban message")),(0,i.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.staff_message.html}})):null}},{key:"getExpirationMessage",value:function(){if(this.state.ban.expires_on){if(this.state.ban.expires_on.isAfter(m()())){var e=interpolate(gettext("This ban expires on %(expires_on)s."),{expires_on:this.state.ban.expires_on.format("LL, LT")},!0),t=interpolate(gettext("This ban expires %(expires_on)s."),{expires_on:this.state.ban.expires_on.fromNow()},!0);return(0,i.Z)("abbr",{title:e},void 0,t)}return gettext("This ban has expired.")}return interpolate(gettext("%(username)s's ban is permanent."),{username:this.props.profile.username},!0)}},{key:"getPanelBody",value:function(){return this.state.ban?Object.keys(this.state.ban).length?(0,i.Z)("div",{},void 0,this.getUserMessage(),this.getStaffMessage(),(0,i.Z)("div",{className:"panel-body ban-expires"},void 0,(0,i.Z)("h4",{},void 0,gettext("Ban expiration")),(0,i.Z)("p",{className:"lead"},void 0,this.getExpirationMessage()))):(0,i.Z)("div",{},void 0,(0,i.Z)(g.Z,{message:gettext("No ban is active at the moment.")})):this.state.error?(0,i.Z)("div",{},void 0,(0,i.Z)(g.Z,{icon:"error_outline",message:this.state.error})):a||(a=(0,i.Z)("div",{},void 0,(0,i.Z)(Z.Z,{})))}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-ban-details"},void 0,(0,i.Z)("div",{className:"panel panel-default"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Ban details"))),this.getPanelBody()))}}]),h}(f().Component),k=n(21688);function x(e){var t=e.api,n=e.display,a=e.onCancel,s=e.onSuccess;return n?(0,i.Z)(k.Z,{api:t,onCancel:a,onSuccess:s}):null}function w(e){var t,n=e.isAuthenticated,a=e.profile;return t=n?gettext("You are not sharing any details with others."):interpolate(gettext("%(username)s is not sharing any details with others."),{username:a.username},!0),(0,i.Z)("div",{className:"panel panel-default"},void 0,(0,i.Z)("div",{className:"panel-body text-center lead"},void 0,t))}function R(e){var t=e.html,n=e.text,a=e.url;return t?(0,i.Z)("div",{className:"form-control-static col-md-9",dangerouslySetInnerHTML:{__html:t}}):(0,i.Z)("div",{className:"form-control-static col-md-9"},void 0,(0,i.Z)(C,{text:n,url:a}))}function C(e){var t=e.text,n=e.url;return n?(0,i.Z)("p",{},void 0,(0,i.Z)("a",{href:n,target:"_blank",rel:"nofollow"},void 0,t||n)):t?(0,i.Z)("p",{},void 0,t):null}function S(e){return(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("strong",{className:"control-label col-md-3"},void 0,e.name,":"),f().createElement(R,e))}function E(e){var t=e.fields,n=e.name;return(0,i.Z)("div",{className:"panel panel-default panel-profile-details-group"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,n)),(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"form-horizontal"},void 0,t.map((function(e){var t=e.fieldname,n=e.html,a=e.name,s=e.text,o=e.url;return(0,i.Z)(S,{name:a,html:n,text:s,url:o},t)})))))}var L,P=n(37848);function O(e){var t=e.display,n=e.groups,a=e.isAuthenticated,s=e.loading,o=e.profile;return t?s?L||(L=(0,i.Z)(P.Z,{})):n.length?(0,i.Z)("div",{},void 0,n.map((function(e,t){return(0,i.Z)(E,{fields:e.fields,name:e.name},t)}))):(0,i.Z)(w,{isAuthenticated:a,profile:o}):null}var T=n(92490),A=function(e){var t=e.onEdit,n=e.showEditButton;return(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,gettext("Details")))),n&&(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)("button",{className:"btn btn-default btn-outline btn-block",onClick:t,type:"button"},void 0,gettext("Edit")))))},B=n(58598),I=n(78657),j=n(53904);var D=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this.props,t=e.data,n=e.dispatch,a=e.user;t&&t.id===a.id||I.Z.get(this.props.user.api.details).then((function(e){n((0,B.zD)(e))}),(function(e){j.Z.apiError(e)}))}},{key:"render",value:function(){return this.props.children}}]),s}(f().Component);var M=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"onCancel",(function(){t.setState({editing:!1})})),(0,p.Z)((0,l.Z)(t),"onEdit",(function(){t.setState({editing:!0})})),(0,p.Z)((0,l.Z)(t),"onSuccess",(function(e){var n,a=t.props,s=a.dispatch,i=a.isAuthenticated,o=a.profile;n=i?gettext("Your details have been updated."):interpolate(gettext("%(username)s's details have been updated."),{username:o.username},!0),j.Z.info(n),s((0,B.zD)(e)),t.setState({editing:!1})})),t.state={editing:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Details"),parent:this.props.profile.username})}},{key:"render",value:function(){var e=this.props,t=e.dispatch,n=e.isAuthenticated,a=e.profile,s=e.profileDetails,o=s.id!==a.id;return(0,i.Z)(D,{data:s,dispatch:t,user:a},void 0,(0,i.Z)("div",{className:"profile-details"},void 0,(0,i.Z)(A,{onEdit:this.onEdit,showEditButton:!!s.edit&&!this.state.editing}),(0,i.Z)(O,{display:!this.state.editing,groups:s.groups,isAuthenticated:n,loading:o,profile:a}),(0,i.Z)(x,{api:a.api.edit_details,dispatch:t,display:this.state.editing,onCancel:this.onCancel,onSuccess:this.onSuccess})))}}]),s}(f().Component),U=n(87462),z=n(11005),H=n(82211),F=n(21981),q=n(90287);var Y,V=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isLoading:!0}),t.loadItems(t.props.posts.next)})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"loadItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;I.Z.get(this.props.api,{start:t||0}).then((function(n){0===t?q.Z.dispatch(F.zD(n)):q.Z.dispatch(F.R3(n)),e.setState({isLoading:!1})}),(function(t){e.setState({isLoading:!1}),j.Z.apiError(t)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:this.props.title,parent:this.props.profile.username}),this.loadItems()}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-feed"},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.props.header)))),f().createElement($,(0,U.Z)({isLoading:this.state.isLoading,loadMore:this.loadMore},this.props)))}}]),s}(f().Component);function $(e){return e.posts.isLoaded&&!e.posts.results.length?(0,i.Z)("p",{className:"lead"},void 0,e.emptyMessage):(0,i.Z)("div",{},void 0,(0,i.Z)(z.Z,{isReady:e.posts.isLoaded,posts:e.posts.results,poster:e.profile}),(0,i.Z)(G,{isLoading:e.isLoading,loadMore:e.loadMore,next:e.posts.next}))}function G(e){return e.next?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:e.isLoading,onClick:e.loadMore},void 0,gettext("Show older activity"))):null}var W=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.className?"form-search "+this.props.className:"form-search"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName()},void 0,(0,i.Z)("input",{type:"text",className:"form-control",value:this.props.value,onChange:this.props.onChange,placeholder:this.props.placeholder||gettext("Search...")}),Y||(Y=(0,i.Z)("span",{className:"material-icon"},void 0,"search")))}}]),s}(f().Component),K=n(40429),J=n(6935);var Q=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadUsers(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadUsers(1,e.target.value)})),t.setSpecialProps(),b.Z.has(t.PRELOADED_DATA_KEY)?t.initWithPreloadedData(b.Z.pop(t.PRELOADED_DATA_KEY)):t.initWithoutPreloadedData(),t}return(0,r.Z)(s,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWERS",this.TITLE=gettext("Followers"),this.API_FILTER="followers"}},{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},q.Z.dispatch((0,J.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadUsers()}},{key:"loadUsers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=this.props.profile.api[this.API_FILTER];I.Z.get(a,{search:n,page:t||1},"user-"+this.API_FILTER).then((function(n){1===t?q.Z.dispatch((0,J.ZB)(n.results)):q.Z.dispatch((0,J.R3)(n.results)),e.setState({isLoaded:!0,isBusy:!1,count:n.count,more:n.more,page:n.page,pages:n.pages})}),(function(e){j.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:this.TITLE,parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("You have %(users)s follower.","You have %(users)s followers.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var n=ngettext("%(username)s has %(users)s follower.","%(username)s has %(users)s followers.",this.state.count);return interpolate(n,{username:this.props.profile.username,users:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("You have no followers."):interpolate(gettext("%(username)s has no followers."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(gettext("Show more (%(more)s)"),{more:this.state.more},!0))):null}},{key:"getListBody",value:function(){return this.state.isLoaded&&0===this.state.count?(0,i.Z)("p",{className:"lead"},void 0,this.getEmptyMessage()):(0,i.Z)("div",{},void 0,(0,i.Z)(K.Z,{cols:3,isReady:this.state.isLoaded,users:this.props.users}),this.getMoreButton())}},{key:"getClassName",value:function(){return"profile-"+this.API_FILTER}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName()},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.getLabel()))),(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)(W,{value:this.state.search,onChange:this.search,placeholder:gettext("Search users...")})))),this.getListBody())}}]),s}(f().Component);var X=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWS",this.TITLE=gettext("Follows"),this.API_FILTER="follows"}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("You are following %(users)s user.","You are following %(users)s users.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var n=ngettext("%(username)s is following %(users)s user.","%(username)s is following %(users)s users.",this.state.count);return interpolate(n,{username:this.props.profile.username,users:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("You are not following any users."):interpolate(gettext("%(username)s is not following any users."),{username:this.props.profile.username},!0)}}]),s}(Q),ee=n(7850),te=n(48927);var ne=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadChanges(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadChanges(1,e.target.value)})),b.Z.has("PROFILE_NAME_HISTORY")?t.initWithPreloadedData(b.Z.pop("PROFILE_NAME_HISTORY")):t.initWithoutPreloadedData(),t}return(0,r.Z)(s,[{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},q.Z.dispatch((0,te.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadChanges()}},{key:"loadChanges",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;I.Z.get(b.Z.get("USERNAME_CHANGES_API"),{user:this.props.profile.id,search:n,page:t||1},"search-username-history").then((function(n){1===t?q.Z.dispatch((0,te.ZB)(n.results)):q.Z.dispatch((0,te.R3)(n.results)),e.setState({isLoaded:!0,isBusy:!1,count:n.count,more:n.more,page:n.page,pages:n.pages})}),(function(e){j.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Username history"),parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(changes)s username change.","Found %(changes)s username changes.",this.state.count);return interpolate(e,{changes:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("Your username was changed %(changes)s time.","Your username was changed %(changes)s times.",this.state.count);return interpolate(t,{changes:this.state.count},!0)}var n=ngettext("%(username)s's username was changed %(changes)s time.","%(username)s's username was changed %(changes)s times.",this.state.count);return interpolate(n,{username:this.props.profile.username,changes:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no username changes matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("No name changes have been recorded for your account."):interpolate(gettext("%(username)s's username was never changed."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(gettext("Show older (%(more)s)"),{more:this.state.more},!0))):null}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-username-history"},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.getLabel()))),(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)(W,{value:this.state.search,onChange:this.search,placeholder:gettext("Search history...")})))),(0,i.Z)(ee.Z,{isLoaded:this.state.isLoaded,emptyMessage:this.getEmptyMessage(),changes:this.props["username-history"]}),this.getMoreButton())}}]),s}(f().Component),ae=n(82125),se=n(27519),ie=n(59131),oe=n(19605),re=n(98936),le=n(99755);var ce,ue=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"action",(function(){t.setState({isLoading:!0}),t.props.profile.is_followed?q.Z.dispatch((0,se.r$)({is_followed:!1,followers:t.props.profile.followers-1})):q.Z.dispatch((0,se.r$)({is_followed:!0,followers:t.props.profile.followers+1})),I.Z.post(t.props.profile.api.follow).then((function(e){t.setState({isLoading:!1}),q.Z.dispatch((0,se.r$)(e))}),(function(e){t.setState({isLoading:!1}),j.Z.apiError(e)}))})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.profile.is_followed?this.props.className+" btn-default btn-following":this.props.className+" btn-default btn-follow"}},{key:"getIcon",value:function(){return this.props.profile.is_followed?"favorite":"favorite_border"}},{key:"getLabel",value:function(){return this.props.profile.is_followed?gettext("Following"):gettext("Follow")}},{key:"render",value:function(){return(0,i.Z)(H.Z,{className:this.getClassName(),disabled:this.state.isLoading,onClick:this.action},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,this.getIcon()),this.getLabel())}}]),s}(f().Component),de=n(27950);var pe,he,fe=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){var e;(0,o.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,p.Z)((0,l.Z)(e),"onClick",(function(){de.Z.open({mode:"START_PRIVATE",submit:b.Z.get("PRIVATE_THREADS_API"),to:[e.props.profile]})})),e}return(0,r.Z)(s,[{key:"render",value:function(){var e=this.props.user.acl.can_start_private_threads,t=this.props.user.id===this.props.profile.id;return!e||t?null:(0,i.Z)("button",{className:this.props.className,onClick:this.onClick,type:"button"},void 0,ce||(ce=(0,i.Z)("span",{className:"material-icon"},void 0,"comment")),gettext("Message"))}}]),s}(f().Component),ve=n(43345),me=n(96359),Ze=n(3784),ge=n(7227),be=n(30337);var ye,_e,Ne=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e)).state={isLoaded:!1,isLoading:!1,error:null,is_avatar_locked:"",avatar_lock_user_message:"",avatar_lock_staff_message:""},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.moderate_avatar).then((function(t){e.setState({isLoaded:!0,is_avatar_locked:t.is_avatar_locked,avatar_lock_user_message:t.avatar_lock_user_message||"",avatar_lock_staff_message:t.avatar_lock_staff_message||""})}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"clean",value:function(){return!!this.isValid()||(j.Z.error(this.validate().username[0]),!1)}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.moderate_avatar,{is_avatar_locked:this.state.is_avatar_locked,avatar_lock_user_message:this.state.avatar_lock_user_message,avatar_lock_staff_message:this.state.avatar_lock_staff_message})}},{key:"handleSuccess",value:function(e){q.Z.dispatch((0,J.n1)(this.props.profile,e.avatar_hash)),j.Z.success(gettext("Avatar controls have been changed."))}},{key:"getFormBody",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("Lock avatar"),helpText:gettext("Locking user avatar will prohibit user from changing his avatar and will reset his/her avatar to default one."),for:"id_is_avatar_locked"},void 0,(0,i.Z)(ge.Z,{id:"id_is_avatar_locked",disabled:this.state.isLoading,iconOn:"lock_outline",iconOff:"lock_open",labelOn:gettext("Disallow user from changing avatar"),labelOff:gettext("Allow user to change avatar"),onChange:this.bindInput("is_avatar_locked"),value:this.state.is_avatar_locked})),(0,i.Z)(me.Z,{label:gettext("User message"),helpText:gettext("Optional message for user explaining why he/she is prohibited form changing avatar."),for:"id_avatar_lock_user_message"},void 0,(0,i.Z)("textarea",{id:"id_avatar_lock_user_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_user_message"),value:this.state.avatar_lock_user_message})),(0,i.Z)(me.Z,{label:gettext("Staff message"),helpText:gettext("Optional message for forum team members explaining why user is prohibited form changing avatar."),for:"id_avatar_lock_staff_message"},void 0,(0,i.Z)("textarea",{id:"id_avatar_lock_staff_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_staff_message"),value:this.state.avatar_lock_staff_message}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,gettext("Close")),(0,i.Z)(H.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes"))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():pe||(pe=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error?"modal-dialog modal-message modal-avatar-controls":"modal-dialog modal-avatar-controls"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,he||(he=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Avatar controls"))),this.getModalBody()))}}]),s}(ve.Z),ke=n(55210);var xe,we,Re,Ce=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e)).state={isLoaded:!1,isLoading:!1,error:null,username:"",validators:{username:[ke.lG()]}},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.moderate_username).then((function(){e.setState({isLoaded:!0})}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"clean",value:function(){return!!this.isValid()||(j.Z.error(this.validate().username[0]),!1)}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.moderate_username,{username:this.state.username})}},{key:"handleSuccess",value:function(e){this.setState({username:""}),q.Z.dispatch((0,te.KP)(e,this.props.profile,this.props.user)),q.Z.dispatch((0,J._S)(this.props.profile,e.username,e.slug)),j.Z.success(gettext("Username has been changed."))}},{key:"getFormBody",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("New username"),for:"id_username"},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,i.Z)(H.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change username"))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():ye||(ye=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error?"modal-dialog modal-message modal-rename-user":"modal-dialog modal-rename-user"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,_e||(_e=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Change username"))),this.getModalBody()))}}]),s}(ve.Z);var Se,Ee,Le,Pe=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"countdown",(function(){window.setTimeout((function(){t.state.countdown>1?(t.setState({countdown:t.state.countdown-1}),t.countdown()):t.state.confirm||t.setState({confirm:!0})}),1e3)})),t.state={isLoaded:!1,isLoading:!1,isDeleted:!1,error:null,countdown:5,confirm:!1,with_content:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.delete).then((function(){e.setState({isLoaded:!0}),e.countdown()}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.delete,{with_content:this.state.with_content})}},{key:"handleSuccess",value:function(){y.Z.stop("user-profile"),this.state.with_content?this.setState({isDeleted:interpolate(gettext("%(username)s's account, threads, posts and other content has been deleted."),{username:this.props.profile.username},!0)}):this.setState({isDeleted:interpolate(gettext("%(username)s's account has been deleted and other content has been hidden."),{username:this.props.profile.username},!0)})}},{key:"getButtonLabel",value:function(){return this.state.confirm?interpolate(gettext("Delete %(username)s"),{username:this.props.profile.username},!0):interpolate(gettext("Please wait... (%(countdown)ss)"),{countdown:this.state.countdown},!0)}},{key:"getForm",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("User content"),for:"id_with_content"},void 0,(0,i.Z)(ge.Z,{id:"id_with_content",disabled:this.state.isLoading,labelOn:gettext("Delete together with user's account"),labelOff:gettext("Hide after deleting user's account"),onChange:this.bindInput("with_content"),value:this.state.with_content}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,gettext("Cancel")),(0,i.Z)(H.Z,{className:"btn-danger",loading:this.state.isLoading,disabled:!this.state.confirm},void 0,this.getButtonLabel())))}},{key:"getDeletedBody",value:function(){return(0,i.Z)("div",{className:"modal-body"},void 0,xe||(xe=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.state.isDeleted),(0,i.Z)("p",{},void 0,(0,i.Z)("a",{href:b.Z.get("USERS_LIST_URL")},void 0,gettext("Return to users list")))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.state.isDeleted?this.getDeletedBody():this.getForm():we||(we=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error||this.state.isDeleted?"modal-dialog modal-message modal-delete-account":"modal-dialog modal-delete-account"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,Re||(Re=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Delete user account"))),this.getModalBody()))}}]),s}(ve.Z),Oe=n(59801);var Te,Ae,Be,Ie,je,De=function(e){return{tick:e.tick,user:e.auth,profile:e.profile}},Me=function(e){(0,c.Z)(h,e);var t,n,a=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function h(){var e;(0,o.Z)(this,h);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,p.Z)((0,l.Z)(e),"showAvatarDialog",(function(){Oe.Z.show((0,s.$j)(De)(Ne))})),(0,p.Z)((0,l.Z)(e),"showRenameDialog",(function(){Oe.Z.show((0,s.$j)(De)(Ce))})),(0,p.Z)((0,l.Z)(e),"showDeleteDialog",(function(){Oe.Z.show((0,s.$j)(De)(Pe))})),e}return(0,r.Z)(h,[{key:"render",value:function(){var e=this.props.moderation;return(0,i.Z)("ul",{className:"dropdown-menu dropdown-menu-right",role:"menu"},void 0,!!e.avatar&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showAvatarDialog},void 0,Se||(Se=(0,i.Z)("span",{className:"material-icon"},void 0,"portrait")),gettext("Avatar controls"))),!!e.rename&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showRenameDialog},void 0,Ee||(Ee=(0,i.Z)("span",{className:"material-icon"},void 0,"credit_card")),gettext("Change username"))),!!e.delete&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showDeleteDialog},void 0,Le||(Le=(0,i.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete account"))))}}]),h}(f().Component),Ue=n(24678),ze=function(e){var t=e.profile;return(0,i.Z)("ul",{className:"profile-data-list"},void 0,!1===t.is_active&&(0,i.Z)("li",{className:"user-account-disabled"},void 0,(0,i.Z)("abbr",{title:gettext("This user's account has been disabled by administrator.")},void 0,gettext("Account disabled"))),(0,i.Z)("li",{className:"user-status-display"},void 0,(0,i.Z)(Ue.ZP,{user:t,status:t.status},void 0,(0,i.Z)(Ue.Jj,{user:t,status:t.status}),(0,i.Z)(Ue.pg,{user:t,status:t.status,className:"status-label"}))),t.rank.is_tab?(0,i.Z)("li",{className:"user-rank"},void 0,(0,i.Z)("a",{href:t.rank.url,className:"item-title"},void 0,t.rank.name)):(0,i.Z)("li",{className:"user-rank"},void 0,(0,i.Z)("span",{className:"item-title"},void 0,t.rank.name)),(t.title||t.rank.title)&&(0,i.Z)("li",{className:"user-title"},void 0,t.title||t.rank.title),(0,i.Z)("li",{className:"user-joined-on"},void 0,(0,i.Z)("abbr",{title:interpolate(gettext("Joined on %(joined_on)s"),{joined_on:t.joined_on.format("LL, LT")},!0)},void 0,interpolate(gettext("Joined %(joined_on)s"),{joined_on:t.joined_on.fromNow()},!0))),t.email&&(0,i.Z)("li",{className:"user-email"},void 0,(0,i.Z)("a",{href:"mailto:"+t.email,className:"item-title"},void 0,t.email)))},He=function(){return(0,i.Z)("button",{className:"btn btn-default btn-icon btn-outline dropdown-toggle",type:"button",title:gettext("Options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,je||(je=(0,i.Z)("span",{className:"material-icon"},void 0,"settings")))},Fe=function(e){var t=e.profile,n=e.user,a=e.moderation,s=e.message,o=e.follow;return(0,i.Z)(le.sP,{},void 0,(0,i.Z)(le.mr,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,i.Z)(le.gC,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,i.Z)("div",{className:"profile-page-header"},void 0,(0,i.Z)("div",{className:"profile-page-header-avatar"},void 0,(0,i.Z)(oe.ZP,{className:"user-avatar hidden-sm hidden-md hidden-lg",user:t,size:200,size2x:400}),(0,i.Z)(oe.ZP,{className:"user-avatar hidden-xs hidden-md hidden-lg",user:t,size:64,size2x:128}),(0,i.Z)(oe.ZP,{className:"user-avatar hidden-xs hidden-sm",user:t,size:128,size2x:256})),(0,i.Z)("h1",{},void 0,t.username))),(0,i.Z)(le.eA,{className:"profile-page-header-details"},void 0,(0,i.Z)(re.gq,{},void 0,(0,i.Z)(re.kw,{auto:!0},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(ze,{profile:t}))),s&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(fe,{className:"btn btn-default btn-block btn-outline",profile:t,user:n})),a.available&&!o&&(0,i.Z)(re.Z6,{shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Te||(Te=(0,i.Z)(He,{})),(0,i.Z)(Me,{profile:t,moderation:a})))),o&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(ue,{className:"btn btn-block btn-outline",profile:t})),a.available&&(0,i.Z)(re.Z6,{shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Ae||(Ae=(0,i.Z)(He,{})),(0,i.Z)(Me,{profile:t,moderation:a})))),a.available&&!o&&!s&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{className:"hidden-xs",shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Be||(Be=(0,i.Z)(He,{})),(0,i.Z)(Me,{profile:t,moderation:a}))),(0,i.Z)(re.Z6,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,Ie||(Ie=(0,i.Z)("span",{className:"material-icon"},void 0,"settings")),gettext("Options")),(0,i.Z)(Me,{profile:t,moderation:a}))))))))},qe=n(69987),Ye=n(94417),Ve=function(e){var t=e.baseUrl,n=e.page,a=e.pages;return(0,i.Z)("div",{className:"nav-container"},void 0,(0,i.Z)("div",{className:"dropdown hidden-sm hidden-md hidden-lg"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,n.icon),n.name),(0,i.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,a.map((function(e){return(0,i.Z)("li",{},e.component,(0,i.Z)(qe.rU,{to:t+e.component+"/"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))})))),(0,i.Z)("ul",{className:"nav nav-pills hidden-xs",role:"menu"},void 0,a.map((function(e){return(0,i.Z)(Ye.Z,{path:t+e.component+"/"},e.component,(0,i.Z)(qe.rU,{to:t+e.component+"/"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))}))))};var $e=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"update",(function(e){q.Z.dispatch((0,se.ZB)(e))})),t.startPolling(e.profile.api.index),t}return(0,r.Z)(s,[{key:"startPolling",value:function(e){y.Z.start({poll:"user-profile",url:e,frequency:9e4,update:this.update})}},{key:"render",value:function(){var e=this,t=b.Z.get("PROFILE").url,n=b.Z.get("PROFILE_PAGES"),a=n.filter((function(n){var a=t+n.component+"/";return e.props.location.pathname===a}))[0],s=this.props,o=s.profile,r=s.user,l=Ge(o,r),c=r.acl.can_start_private_threads&&o.id!==r.id,u=o.acl.can_follow&&o.id!==r.id;return(0,i.Z)("div",{className:"page page-user-profile"},void 0,(0,i.Z)(Fe,{profile:this.props.profile,user:this.props.user,moderation:l,message:c,follow:u}),(0,i.Z)(ie.Z,{},void 0,(0,i.Z)(Ve,{baseUrl:t,page:a,pages:n}),this.props.children))}}]),s}(ae.Z),Ge=function(e,t){var n={available:!1,rename:!1,avatar:!1,delete:!1};return t.is_anonumous||(n.rename=e.acl.can_rename,n.avatar=e.acl.can_moderate_avatar,n.delete=e.acl.can_delete,n.available=n.rename||n.avatar||n.delete),n};function We(e){return{isAuthenticated:e.auth.user.id===e.profile.id,tick:e.tick.tick,user:e.auth.user,users:e.users,posts:e.posts,profile:e.profile,profileDetails:e["profile-details"],"username-history":e["username-history"]}}var Ke={posts:function(e){var t;t=e.user.id===e.profile.id?gettext("You have posted no messages."):interpolate(gettext("%(username)s posted no messages."),{username:e.profile.username},!0);var n=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){var a=ngettext("You have posted %(posts)s message.","You have posted %(posts)s messages.",e.profile.posts);n=interpolate(a,{posts:e.profile.posts},!0)}else{var s=ngettext("%(username)s has posted %(posts)s message.","%(username)s has posted %(posts)s messages.",e.profile.posts);n=interpolate(s,{username:e.profile.username,posts:e.profile.posts},!0)}else n=gettext("Loading...");return f().createElement(V,(0,U.Z)({api:e.profile.api.posts,emptyMessage:t,header:n,title:gettext("Posts")},e))},threads:function(e){var t;t=e.user.id===e.profile.id?gettext("You have no started threads."):interpolate(gettext("%(username)s started no threads."),{username:e.profile.username},!0);var n=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){var a=ngettext("You have started %(threads)s thread.","You have started %(threads)s threads.",e.profile.threads);n=interpolate(a,{threads:e.profile.threads},!0)}else{var s=ngettext("%(username)s has started %(threads)s thread.","%(username)s has started %(threads)s threads.",e.profile.threads);n=interpolate(s,{username:e.profile.username,threads:e.profile.threads},!0)}else n=gettext("Loading...");return f().createElement(V,(0,U.Z)({api:e.profile.api.threads,emptyMessage:t,header:n,title:gettext("Threads")},e))},followers:Q,follows:X,details:M,"username-history":ne,"ban-details":N};function Je(){var e=[];return b.Z.get("PROFILE_PAGES").forEach((function(t){e.push(Object.assign({},t,{path:b.Z.get("PROFILE").url+t.component+"/",component:(0,s.$j)(We)(Ke[t.component])}))})),e}var Qe=n(39633);b.Z.addInitializer({name:"component:profile",initializer:function(e){e.has("PROFILE")&&e.has("PROFILE_PAGES")&&(0,Qe.Z)({root:b.Z.get("PROFILE").url,component:(0,s.$j)(We)($e),paths:Je()})},after:"reducer:profile-hydrate"})},32488:function(e,t,n){"use strict";var a,s=n(32233),i=n(97326),o=n(4942),r=n(22928),l=n(15671),c=n(43144),u=n(79340),d=n(6215),p=n(61120),h=n(57588),f=n.n(h),v=n(82211),m=n(43345),Z=n(78657),g=n(53904),b=n(55210),y=n(93051);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}var N=function(e){(0,u.Z)(n,e);var t=_(n);function n(e){var a;return(0,l.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[b.Do()]}},a}return(0,c.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(g.Z.error(gettext("Enter a valid email address.")),!1)}},{key:"send",value:function(){return Z.Z.post(s.Z.get("SEND_ACTIVATION_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["already_active","inactive_admin"].indexOf(e.code)>-1?g.Z.info(e.detail):403===e.status&&e.ban?(0,y.Z)(e.ban):g.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"text",className:"form-control",placeholder:gettext("Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,r.Z)(v.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Send link"))))}}]),n}(m.Z),k=function(e){(0,u.Z)(n,e);var t=_(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("Activation link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link well-done"},void 0,(0,r.Z)("div",{className:"done-message"},void 0,a||(a=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{},void 0,this.getMessage())),(0,r.Z)("button",{className:"btn btn-primary btn-block",type:"button",onClick:this.props.callback},void 0,gettext("Request another link"))))}}]),n}(f().Component),x=function(e){(0,u.Z)(n,e);var t=_(n);function n(e){var a;return(0,l.Z)(this,n),a=t.call(this,e),(0,o.Z)((0,i.Z)(a),"complete",(function(e){a.setState({complete:e})})),(0,o.Z)((0,i.Z)(a),"reset",(function(){a.setState({complete:!1})})),a.state={complete:!1},a}return(0,c.Z)(n,[{key:"render",value:function(){return this.state.complete?(0,r.Z)(k,{user:this.state.complete,callback:this.reset}):(0,r.Z)(N,{callback:this.complete})}}]),n}(f().Component),w=n(4869);s.Z.addInitializer({name:"component:request-activation-link",initializer:function(){document.getElementById("request-activation-link-mount")&&(0,w.Z)(x,"request-activation-link-mount",!1)},after:"store"})},11768:function(e,t,n){"use strict";var a,s,i=n(32233),o=n(97326),r=n(4942),l=n(22928),c=n(15671),u=n(43144),d=n(79340),p=n(6215),h=n(61120),f=n(57588),v=n.n(f),m=n(73935),Z=n.n(m),g=n(82211),b=n(43345),y=n(78657),_=n(53904),N=n(55210),k=n(93051);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,h.Z)(e);if(t){var s=(0,h.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,p.Z)(this,n)}}var w=function(e){(0,d.Z)(n,e);var t=x(n);function n(e){var a;return(0,c.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[N.Do()]}},a}return(0,u.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(_.Z.error(gettext("Enter a valid email address.")),!1)}},{key:"send",value:function(){return y.Z.post(i.Z.get("SEND_PASSWORD_RESET_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["inactive_user","inactive_admin"].indexOf(e.code)>-1?this.props.showInactivePage(e):403===e.status&&e.ban?(0,k.Z)(e.ban):_.Z.apiError(e)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset"},void 0,(0,l.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,l.Z)("div",{className:"form-group"},void 0,(0,l.Z)("div",{className:"control-input"},void 0,(0,l.Z)("input",{type:"text",className:"form-control",placeholder:gettext("Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,l.Z)(g.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Send link"))))}}]),n}(b.Z),R=function(e){(0,d.Z)(n,e);var t=x(n);function n(){return(0,c.Z)(this,n),t.apply(this,arguments)}return(0,u.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("Reset password link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset well-done"},void 0,(0,l.Z)("div",{className:"done-message"},void 0,a||(a=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"check"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{},void 0,this.getMessage())),(0,l.Z)("button",{type:"button",className:"btn btn-primary btn-block",onClick:this.props.callback},void 0,gettext("Request another link"))))}}]),n}(v().Component),C=function(e){(0,d.Z)(n,e);var t=x(n);function n(){return(0,c.Z)(this,n),t.apply(this,arguments)}return(0,u.Z)(n,[{key:"getActivateButton",value:function(){return"inactive_user"===this.props.activation?(0,l.Z)("p",{},void 0,(0,l.Z)("a",{href:i.Z.get("REQUEST_ACTIVATION_URL")},void 0,gettext("Activate your account."))):null}},{key:"render",value:function(){return(0,l.Z)("div",{className:"page page-message page-message-info page-forgotten-password-inactive"},void 0,(0,l.Z)("div",{className:"container"},void 0,(0,l.Z)("div",{className:"message-panel"},void 0,s||(s=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{className:"lead"},void 0,gettext("Your account is inactive.")),(0,l.Z)("p",{},void 0,this.props.message),this.getActivateButton()))))}}]),n}(v().Component),S=function(e){(0,d.Z)(n,e);var t=x(n);function n(e){var a;return(0,c.Z)(this,n),a=t.call(this,e),(0,r.Z)((0,o.Z)(a),"complete",(function(e){a.setState({complete:e})})),(0,r.Z)((0,o.Z)(a),"reset",(function(){a.setState({complete:!1})})),a.state={complete:!1},a}return(0,u.Z)(n,[{key:"showInactivePage",value:function(e){Z().render((0,l.Z)(C,{activation:e.code,message:e.detail}),document.getElementById("page-mount"))}},{key:"render",value:function(){return this.state.complete?(0,l.Z)(R,{callback:this.reset,user:this.state.complete}):(0,l.Z)(w,{callback:this.complete,showInactivePage:this.showInactivePage})}}]),n}(v().Component),E=n(4869);i.Z.addInitializer({name:"component:request-password-reset",initializer:function(){document.getElementById("request-password-reset-mount")&&(0,E.Z)(S,"request-password-reset-mount",!1)},after:"store"})},61323:function(e,t,n){"use strict";var a,s=n(32233),i=n(97326),o=n(4942),r=n(22928),l=n(15671),c=n(43144),u=n(79340),d=n(6215),p=n(61120),h=n(57588),f=n.n(h),v=n(73935),m=n.n(v),Z=n(82211),g=n(43345),b=n(14467),y=n(78657),_=n(98274),N=n(59801),k=n(53904),x=n(93051),w=n(19755);function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}var C=function(e){(0,u.Z)(n,e);var t=R(n);function n(e){var a;return(0,l.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,password:""},a}return(0,c.Z)(n,[{key:"clean",value:function(){return!!this.state.password.trim().length||(k.Z.error(gettext("Enter new password.")),!1)}},{key:"send",value:function(){return y.Z.post(s.Z.get("CHANGE_PASSWORD_API"),{password:this.state.password})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){403===e.status&&e.ban?(0,x.Z)(e.ban):k.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-reset-password"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"password",className:"form-control",placeholder:gettext("Enter new password"),disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,r.Z)(Z.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Change password"))))}}]),n}(g.Z),S=function(e){(0,u.Z)(n,e);var t=R(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("%(username)s, your password has been changed successfully."),{username:this.props.user.username},!0)}},{key:"showSignIn",value:function(){N.Z.show(b.Z)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"page page-message page-message-success page-forgotten-password-changed"},void 0,(0,r.Z)("div",{className:"container"},void 0,(0,r.Z)("div",{className:"message-panel"},void 0,a||(a=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,r.Z)("p",{},void 0,gettext("You will have to sign in using new password before continuing.")),(0,r.Z)("p",{},void 0,(0,r.Z)("button",{type:"button",className:"btn btn-primary",onClick:this.showSignIn},void 0,gettext("Sign in")))))))}}]),n}(f().Component),E=function(e){(0,u.Z)(n,e);var t=R(n);function n(){var e;(0,l.Z)(this,n);for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return e=t.call.apply(t,[this].concat(s)),(0,o.Z)((0,i.Z)(e),"complete",(function(e){_.Z.softSignOut(),w('#hidden-login-form input[name="redirect_to"]').remove(),m().render((0,r.Z)(S,{user:e}),document.getElementById("page-mount"))})),e}return(0,c.Z)(n,[{key:"render",value:function(){return(0,r.Z)(C,{callback:this.complete})}}]),n}(f().Component),L=n(4869);s.Z.addInitializer({name:"component:reset-password-form",initializer:function(){document.getElementById("reset-password-form-mount")&&(0,L.Z)(E,"reset-password-form-mount",!1)},after:"store"})},15049:function(e,t,n){"use strict";var a,s=n(37424),i=n(22928),o=n(87462),r=n(57588),l=n.n(r),c=n(59131),u=n(15671),d=n(43144),p=n(97326),h=n(79340),f=n(6215),v=n(61120),m=n(4942),Z=n(32233),g=n(43345),b=n(21981),y=n(16427),_=n(6935),N=n(78657),k=n(53904),x=n(90287),w=n(98936),R=n(99755);var C=function(e){(0,h.Z)(o,e);var t,n,s=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function o(e){var t;return(0,u.Z)(this,o),t=s.call(this,e),(0,m.Z)((0,p.Z)(t),"onQueryChange",(function(e){t.changeValue("query",e.target.value)})),t.state={isLoading:!1,query:e.search.query},t}return(0,d.Z)(o,[{key:"componentDidMount",value:function(){this.state.query.length&&this.handleSubmit()}},{key:"clean",value:function(){return!!this.state.query.trim().length||(k.Z.error(gettext("You have to enter search query.")),!1)}},{key:"send",value:function(){x.Z.dispatch((0,y.Vx)({isLoading:!0}));var e=this.state.query.trim(),t=window.location.href,n=t.indexOf("?q=");return n>0&&(t=t.substring(0,n+3)),window.history.pushState({},"",t+encodeURIComponent(e)),N.Z.get(Z.Z.get("SEARCH_API"),{q:e})}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.Vx)({query:this.state.query.trim(),isLoading:!1,providers:e})),e.forEach((function(e){"users"===e.id?x.Z.dispatch((0,_.ZB)(e.results.results)):"threads"===e.id&&x.Z.dispatch((0,b.zD)(e.results))}))}},{key:"handleError",value:function(e){k.Z.apiError(e),x.Z.dispatch((0,y.Vx)({isLoading:!1}))}},{key:"render",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)(R.sP,{},void 0,(0,i.Z)(R.mr,{styleName:"site-search"},void 0,(0,i.Z)(R.gC,{styleName:"site-search"},void 0,(0,i.Z)("h1",{},void 0,gettext("Search"))),(0,i.Z)(R.eA,{className:"page-header-search-form"},void 0,(0,i.Z)(w.gq,{},void 0,(0,i.Z)(w.kw,{auto:!0},void 0,(0,i.Z)(w.Z6,{},void 0,(0,i.Z)("input",{className:"form-control",disabled:this.state.isLoading,type:"text",value:this.state.query,placeholder:gettext("Search"),onChange:this.onQueryChange})),(0,i.Z)(w.Z6,{shrink:!0},void 0,(0,i.Z)("button",{className:"btn btn-secondary btn-icon btn-outline",disabled:this.state.isLoading},void 0,a||(a=(0,i.Z)("span",{className:"material-icon"},void 0,"search"))))))))))}}]),o}(g.Z),S=n(69987);function E(e){return(0,i.Z)("div",{className:"list-group nav-side"},void 0,e.providers.map((function(e){return(0,i.Z)(S.rU,{activeClassName:"active",className:"list-group-item",to:e.url},e.id,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name,(0,i.Z)(L,{results:e.results}))})))}function L(e){if(!e.results)return null;var t=e.results.count;return t>1e6?t=Math.ceil(t/1e6)+"KK":t>1e3&&(t=Math.ceil(t/1e3)+"K"),(0,i.Z)("span",{className:"badge"},void 0,t)}function P(e){return(0,i.Z)("div",{className:"page page-search"},void 0,(0,i.Z)(C,{provider:e.provider,search:e.search}),(0,i.Z)(c.Z,{},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-3"},void 0,(0,i.Z)(E,{providers:e.search.providers})),(0,i.Z)("div",{className:"col-md-9"},void 0,e.children,(0,i.Z)(O,{provider:e.provider,search:e.search})))))}function O(e){var t=null;if(e.search.providers.forEach((function(n){n.id===e.provider.id&&(t=n.time)})),null===t)return null;var n=gettext("Search took %(time)s s to complete");return(0,i.Z)("footer",{className:"search-footer"},void 0,(0,i.Z)("p",{},void 0,interpolate(n,{time:t},!0)))}var T=n(11005),A=n(82211);function B(e){return(0,i.Z)("div",{},void 0,(0,i.Z)(T.Z,{isReady:!0,posts:e.results}),l().createElement(I,e))}n(69092);var I=function(e){(0,h.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function s(){var e;(0,u.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,m.Z)((0,p.Z)(e),"onClick",(function(){x.Z.dispatch((0,b.Vx)({isBusy:!0})),N.Z.get(e.props.provider.api,{q:e.props.query,page:e.props.next}).then((function(e){e.forEach((function(e){"threads"===e.id&&(x.Z.dispatch((0,b.R3)(e.results)),x.Z.dispatch((0,y.P0)(e)))})),x.Z.dispatch((0,b.Vx)({isBusy:!1}))}),(function(e){k.Z.apiError(e),x.Z.dispatch((0,b.Vx)({isBusy:!1}))}))})),e}return(0,d.Z)(s,[{key:"render",value:function(){return this.props.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(A.Z,{className:"btn btn-default btn-outline",loading:this.props.isBusy,onClick:this.onClick},void 0,gettext("Show more"))):null}}]),s}(l().Component);function j(e){var t=e.children,n=e.loading,a=e.posts,s=e.query;return a&&a.count?t:s.length?(0,i.Z)("p",{className:"lead"},void 0,n?gettext("Loading results..."):gettext("No threads matching search query have been found.")):(0,i.Z)("p",{className:"lead"},void 0,gettext("Enter at least two characters to search threads."))}var D=n(40429);function M(e){var t=e.children,n=e.loading,a=e.query;return e.users.length?t:a.length?(0,i.Z)("p",{className:"lead"},void 0,n?gettext("Loading results..."):gettext("No users matching search query have been found.")):(0,i.Z)("p",{className:"lead"},void 0,gettext("Enter at least two characters to search users."))}var U={threads:function(e){return(0,i.Z)(P,{provider:e.route.provider,search:e.search},void 0,(0,i.Z)(j,{loading:e.search.isLoading,query:e.search.query,posts:e.posts},void 0,l().createElement(B,(0,o.Z)({provider:e.route.provider,query:e.search.query},e.posts))))},users:function(e){return(0,i.Z)(P,{provider:e.route.provider,search:e.search},void 0,(0,i.Z)(M,{loading:e.search.isLoading,query:e.search.query,users:e.users},void 0,(0,i.Z)(D.Z,{cols:3,isReady:!e.search.isLoading,users:e.users})))}};function z(e){return{posts:e.posts,search:e.search,tick:e.tick.tick,user:e.auth.user,users:e.users}}var H=n(39633);Z.Z.addInitializer({name:"component:search",initializer:function(e){var t;"misago:search"===e.get("CURRENT_LINK")&&(0,H.Z)({paths:(t=Z.Z.get("SEARCH_PROVIDERS"),t.map((function(e){return{path:e.url,component:(0,s.$j)(z)(U[e.id]),provider:e}})))})},after:"store"})},61814:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588);var p={info:"alert-info",success:"alert-success",warning:"alert-warning",error:"alert-danger"},h=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"getSnackbarClass",value:function(){var e="alerts-snackbar";return this.props.isVisible?e+=" in":e+=" out",e}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getSnackbarClass()},void 0,(0,i.Z)("p",{className:"alert "+p[this.props.type]},void 0,this.props.message))}}]),s}(n.n(d)().Component);function f(e){return e.snackbar}var v=n(4869);s.Z.addInitializer({name:"component:snackbar",initializer:function(){(0,v.Z)((0,a.$j)(f)(h),"snackbar-mount")},after:"snackbar"})},95920:function(e,t,n){"use strict";var a=n(57588),s=n.n(a),i=n(22928),o=n(15671),r=n(43144),l=n(97326),c=n(79340),u=n(6215),d=n(61120),p=n(4942),h=n(32233),f=n(26106),v=n(82211),m=n(43345),Z=n(96359),g=n(78657),b=n(53904),y=n(55210),_=function(e){var t=e.backendName,n=gettext("Sign in with %(backend)s"),a=interpolate(n,{backend:t},!0);return(0,i.Z)("div",{className:"page-header-bg"},void 0,(0,i.Z)("div",{className:"page-header"},void 0,(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("h1",{},void 0,a))))};function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){(0,p.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var x=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"handlePrivacyPolicyChange",(function(e){var n=e.target.value;t.handleToggleAgreement("privacyPolicy",n)})),(0,p.Z)((0,l.Z)(t),"handleTermsOfServiceChange",(function(e){var n=e.target.value;t.handleToggleAgreement("termsOfService",n)})),(0,p.Z)((0,l.Z)(t),"handleToggleAgreement",(function(e,n){t.setState((function(a,s){if(null===a[e]){var i=k(k({},a.errors),{},(0,p.Z)({},e,null));return(0,p.Z)({errors:i},e,n)}var o=t.state.validators[e][0],r=k(k({},a.errors),{},(0,p.Z)({},e,[o(null)]));return(0,p.Z)({errors:r},e,null)}))}));var n={email:[y.Do()],username:[y.lG()]};return h.Z.get("TERMS_OF_SERVICE_ID")&&(n.termsOfService=[y.fT()]),h.Z.get("PRIVACY_POLICY_ID")&&(n.privacyPolicy=[y.jA()]),t.state={email:e.email||"",emailProtected:!!e.email,username:e.username||"",termsOfService:null,privacyPolicy:null,validators:n,errors:{},isLoading:!1},t}return(0,r.Z)(s,[{key:"clean",value:function(){if(this.validate(),-1!==[this.state.email.trim().length,this.state.username.trim().length].indexOf(0))return b.Z.error(gettext("Fill out all fields.")),!1;var e=this.state.validators;return h.Z.get("TERMS_OF_SERVICE_ID")&&null===this.state.termsOfService?(b.Z.error(e.termsOfService[0](null)),!1):!h.Z.get("PRIVACY_POLICY_ID")||null!==this.state.privacyPolicy||(b.Z.error(e.privacyPolicy[0](null)),b.Z.error(gettext("You need to accept the privacy policy.")),!1)}},{key:"send",value:function(){return g.Z.post(this.props.url,{email:this.state.email,username:this.state.username,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}},{key:"handleSuccess",value:function(e){(0,this.props.onRegistrationComplete)(e)}},{key:"handleError",value:function(e){if(200===e.status)(0,this.props.onRegistrationComplete)({activation:"active",step:"done",username:this.state.username});else if(400===e.status){var t={errors:e};e.email&&(t.emailProtected=!1),this.setState(t)}else b.Z.apiError(e)}},{key:"render",value:function(){var e=this.props.backend_name,t=this.state,n=t.email,a=t.emailProtected,s=t.username,o=t.isLoading,r=null;if(a){var l=gettext("Your e-mail address has been verified by %(backend)s.");r=interpolate(l,{backend:e},!0)}return(0,i.Z)("div",{className:"page page-social-auth page-social-sauth-register"},void 0,(0,i.Z)(_,{backendName:e}),(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Complete your details"))),(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)(Z.Z,{for:"id_username",label:gettext("Username"),validation:this.state.errors.username},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:o,onChange:this.bindInput("username"),value:s})),(0,i.Z)(Z.Z,{for:"id_email",label:gettext("E-mail address"),helpText:r,validation:a?null:this.state.errors.email},void 0,(0,i.Z)("input",{type:"email",id:"id_email",className:"form-control",disabled:o||a,onChange:this.bindInput("email"),value:n})),(0,i.Z)(f.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,i.Z)("div",{className:"panel-footer"},void 0,(0,i.Z)(v.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Sign in")))))))))}}]),s}(m.Z),w=function(e){var t,n,a=e.activation,s=e.backend_name,o=e.username;return n="user"===a?gettext("%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===a?gettext("%(username)s, your account has been created but board administrator will have to activate it before you will be able to sign in."):gettext("%(username)s, your account has been created and you have been signed in to it."),t="active"===a?"check":"info_outline",(0,i.Z)("div",{className:"page page-social-auth page-social-sauth-register"},void 0,(0,i.Z)(_,{backendName:s}),(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Registration completed!"))),(0,i.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,t)),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,interpolate(n,{username:o},!0)),(0,i.Z)("p",{className:"help-block"},void 0,(0,i.Z)("a",{className:"btn btn-default",href:h.Z.get("MISAGO_PATH")},void 0,gettext("Return to forum index"))))))))))};var R=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"handleRegistrationComplete",(function(e){var n=e.activation,a=e.email,s=e.step,i=e.username;t.setState({activation:n,email:a,step:s,username:i})})),t.state={step:e.step,activation:e.activation||"",email:e.email||"",username:e.username||""},t}return(0,r.Z)(s,[{key:"render",value:function(){var e=this.props,t=e.backend_name,n=e.url,a=this.state,s=a.activation,o=a.email,r=a.step,l=a.username;return"register"===r?(0,i.Z)(x,{backend_name:t,email:o,url:n,username:l,onRegistrationComplete:this.handleRegistrationComplete}):(0,i.Z)(w,{activation:s,backend_name:t,email:o,url:n,username:l})}}]),s}(s().Component),C=n(4869);h.Z.addInitializer({name:"component:social-auth",initializer:function(e){if("misago:social-complete"===e.get("CURRENT_LINK")){var t=e.get("SOCIAL_AUTH_FORM");(0,C.Z)(s().createElement(R,t),"page-mount")}},after:"store"})},59203:function(e,t,n){"use strict";var a,s,i=n(37424),o=n(22928),r=n(15671),l=n(43144),c=n(97326),u=n(79340),d=n(6215),p=n(61120),h=n(4942),f=n(57588),v=n.n(f),m=n(87462),Z=n(43345),g=n(96359),b=n(8154),y=n(7738),_=n(78657),N=n(59801),k=n(53904),x=n(90287);var w,R=function(e){(0,u.Z)(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=s.call(this,e),(0,h.Z)((0,c.Z)(t),"onUsernameChange",(function(e){t.changeValue("username",e.target.value)})),t.state={isLoading:!1,username:""},t}return(0,l.Z)(i,[{key:"clean",value:function(){return!!this.state.username.trim().length||(k.Z.error(gettext("You have to enter user name.")),!1)}},{key:"send",value:function(){return _.Z.patch(this.props.thread.api.index,[{op:"add",path:"participants",value:this.state.username},{op:"add",path:"acl",value:1}])}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants)),k.Z.success(gettext("New participant has been added to thread.")),N.Z.hide()}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog modal-sm",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,a||(a=(0,o.Z)(C,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_username",label:gettext("User to add")},void 0,(0,o.Z)("input",{id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.onUsernameChange,type:"text",value:this.state.username}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-block btn-primary",disabled:this.state.isLoading},void 0,gettext("Add participant")),(0,o.Z)("button",{className:"btn btn-block btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel"))))))}}]),i}(Z.Z);function C(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,s||(s=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Add participant")))}var S=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(R,{thread:e.props.thread}))})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.thread.acl.can_add_participants?(0,o.Z)("div",{className:"col-xs-12 col-sm-3"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-block",onClick:this.onClick,type:"button"},void 0,w||(w=(0,o.Z)("span",{className:"material-icon"},void 0,"person_add")),gettext("Add participant"))):null}}]),s}(v().Component),E=n(32233);var L=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onClick",(function(){var e,n,a=!1;if(t.isUser)a=window.confirm(gettext("Are you sure you want to take over this thread?"));else{var s=gettext("Are you sure you want to change thread owner to %(user)s?");a=window.confirm(interpolate(s,{user:t.props.participant.username},!0))}a&&(e=t.props.thread,n=t.props.participant,_.Z.patch(e.api.index,[{op:"replace",path:"owner",value:n.id},{op:"add",path:"acl",value:1}]).then((function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants));var t=gettext("%(user)s has been made new thread owner.");k.Z.success(interpolate(t,{user:n.username},!0))}),(function(e){k.Z.apiError(e)})))})),t.isUser=e.participant.id===e.user.id,t}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.participant.is_owner?null:this.props.thread.acl.can_change_owner?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,gettext("Make owner"))):null}}]),s}(v().Component);var P,O,T,A=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onClick",(function(){var e,n,a=!1;if(t.isUser)a=window.confirm(gettext("Are you sure you want to leave this thread?"));else{var s=gettext("Are you sure you want to remove %(user)s from this thread?");a=window.confirm(interpolate(s,{user:t.props.participant.username},!0))}a&&(t.isUser?(e=t.props.thread,n=t.props.participant,_.Z.patch(e.api.index,[{op:"remove",path:"participants",value:n.id}]).then((function(){k.Z.success(gettext("You have left this thread.")),window.setTimeout((function(){window.location=E.Z.get("PRIVATE_THREADS_URL")}),3e3)}),(function(e){k.Z.apiError(e)}))):function(e,t){_.Z.patch(e.api.index,[{op:"remove",path:"participants",value:t.id},{op:"add",path:"acl",value:1}]).then((function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants));var n=gettext("%(user)s has been removed from this thread.");k.Z.success(interpolate(n,{user:t.username},!0))}),(function(e){k.Z.apiError(e)}))}(t.props.thread,t.props.participant))})),t.isUser=e.participant.id===e.user.id,t}return(0,l.Z)(s,[{key:"render",value:function(){var e=this.props.user.acl.can_moderate_private_threads;return this.props.userIsOwner||this.isUser||e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,this.isUser?gettext("Leave thread"):gettext("Remove"))):null}}]),s}(v().Component),B=n(19605);function I(e){var t=e.participant,n="btn btn-default";return t.is_owner&&(n="btn btn-primary"),n+=" btn-user btn-block",(0,o.Z)("div",{className:"col-xs-12 col-sm-3 col-md-2 participant-card"},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{"aria-haspopup":"true","aria-expanded":"false",className:n,"data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)(B.ZP,{size:"34",user:t}),(0,o.Z)("span",{className:"btn-text"},void 0,t.username)),(0,o.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,(0,o.Z)(j,{isOwner:t.is_owner}),P||(P=(0,o.Z)("li",{className:"dropdown-header"})),(0,o.Z)("li",{},void 0,(0,o.Z)("a",{href:t.url},void 0,gettext("See profile"))),O||(O=(0,o.Z)("li",{role:"separator",className:"divider"})),v().createElement(L,e),v().createElement(A,e))))}function j(e){return e.isOwner?(0,o.Z)("li",{className:"dropdown-header dropdown-header-owner"},void 0,T||(T=(0,o.Z)("span",{className:"material-icon"},void 0,"start")),(0,o.Z)("span",{className:"icon-text"},void 0,gettext("Thread owner"))):null}function D(e){var t=e.participants,n=e.thread,a=e.user,s=e.userIsOwner;return(0,o.Z)("div",{className:"participants-cards"},void 0,(0,o.Z)("div",{className:"row"},void 0,t.map((function(e){return(0,o.Z)(I,{participant:e,thread:n,user:a,userIsOwner:s},e.id)}))))}function M(e){return e.participants.length?(0,o.Z)("div",{className:"panel panel-default panel-participants"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,v().createElement(D,(0,m.Z)({userIsOwner:U(e.user,e.participants)},e)),(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)(S,{thread:e.thread}),(0,o.Z)("div",{className:"col-xs-12 col-sm-9"},void 0,(0,o.Z)("p",{},void 0,function(e){var t=e.length,n=ngettext("This thread has %(users)s participant.","This thread has %(users)s participants.",t);return interpolate(n,{users:t},!0)}(e.participants)))))):null}function U(e,t){return t[0].id===e.id}var z=n(91876),H={changed_title:"edit",pinned_globally:"bookmark",pinned_locally:"bookmark_border",unpinned:"panorama_fish_eye",moved:"arrow_forward",merged:"call_merge",approved:"done",opened:"lock_open",closed:"lock_outline",unhid:"visibility",hid:"visibility_off",changed_owner:"grade",tookover:"grade",added_participant:"person_add",owner_left:"person_outline",participant_left:"person_outline",removed_participant:"remove_circle_outline"},F=function(e){return(0,o.Z)("span",{className:"event-icon-bg"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,H[e.post.event_type]))},q=n(89627),Y=n(30381),V=n.n(Y),$=n(92747);function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function W(e){return e.post.acl.can_hide?(0,o.Z)("li",{className:"event-controls"},void 0,v().createElement(K,e),v().createElement(J,e),v().createElement(Q,e)):null}var K=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){x.Z.dispatch($.r$(e.props.post,{is_hidden:!0,hidden_on:V()(),hidden_by_name:e.props.user.username,url:Object.assign(e.props.post.url,{hidden_by:e.props.user.url})})),_.Z.patch(e.props.post.api.index,[{op:"replace",path:"is-hidden",value:!0}]).then((function(t){x.Z.dispatch($.r$(e.props.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{is_hidden:!1}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.is_hidden?null:(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Hide"))}}]),n}(v().Component),J=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){x.Z.dispatch($.r$(e.props.post,{is_hidden:!1})),_.Z.patch(e.props.post.api.index,[{op:"replace",path:"is-hidden",value:!1}]).then((function(t){x.Z.dispatch($.r$(e.props.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{is_hidden:!0}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.is_hidden?(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Unhide")):null}}]),n}(v().Component),Q=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){window.confirm(gettext("Are you sure you wish to delete this event? This action is not reversible!"))&&e.delete()})),(0,h.Z)((0,c.Z)(e),"delete",(function(){x.Z.dispatch($.r$(e.props.post,{isDeleted:!0})),_.Z.delete(e.props.post.api.index).then((function(){k.Z.success(gettext("Event has been deleted."))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{isDeleted:!1}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Delete"))}}]),n}(v().Component),X='<span class="item-title">%(user)s</span>',ee='<a href="%(url)s" class="item-title">%(user)s</a>';function te(e){return(0,o.Z)("ul",{className:"list-inline event-info"},void 0,v().createElement(ne,e),v().createElement(ae,e),v().createElement(W,e))}function ne(e){if(e.post.is_hidden){var t;t=e.post.url.hidden_by?interpolate(ee,{url:(0,q.Z)(e.post.url.hidden_by),user:(0,q.Z)(e.post.hidden_by_name)},!0):interpolate(X,{user:(0,q.Z)(e.post.hidden_by_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.post.hidden_on.format("LLL")),relative:(0,q.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("Hidden by %(event_by)s %(event_on)s.")),{event_by:t,event_on:n},!0);return(0,o.Z)("li",{className:"event-hidden-message",dangerouslySetInnerHTML:{__html:a}})}return null}function ae(e){var t;t=e.post.poster?interpolate(ee,{url:(0,q.Z)(e.post.poster.url),user:(0,q.Z)(e.post.poster_name)},!0):interpolate(X,{user:(0,q.Z)(e.post.poster_name)},!0);var n=interpolate('<a href="%(url)s" title="%(absolute)s">%(relative)s</a>',{url:(0,q.Z)(e.post.url.index),absolute:(0,q.Z)(e.post.posted_on.format("LLL")),relative:(0,q.Z)(e.post.posted_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("By %(event_by)s %(event_on)s.")),{event_by:t,event_on:n},!0);return(0,o.Z)("li",{className:"event-posters",dangerouslySetInnerHTML:{__html:a}})}var se={pinned_globally:gettext("Thread has been pinned globally."),pinned_locally:gettext("Thread has been pinned locally."),unpinned:gettext("Thread has been unpinned."),approved:gettext("Thread has been approved."),opened:gettext("Thread has been opened."),closed:gettext("Thread has been closed."),unhid:gettext("Thread has been revealed."),hid:gettext("Thread has been made hidden."),tookover:gettext("Took thread over."),owner_left:gettext("Owner has left thread. This thread is now closed."),participant_left:gettext("Participant has left thread.")},ie='<a href="%(url)s" class="item-title">%(name)s</a>',oe='<span class="item-title">%(name)s</span>';function re(e){return se[e.post.event_type]?(0,o.Z)("p",{className:"event-message"},void 0,se[e.post.event_type]):"changed_title"===e.post.event_type?v().createElement(le,e):"moved"===e.post.event_type?v().createElement(ce,e):"merged"===e.post.event_type?v().createElement(ue,e):"changed_owner"===e.post.event_type?v().createElement(de,e):"added_participant"===e.post.event_type?v().createElement(pe,e):"removed_participant"===e.post.event_type?v().createElement(he,e):null}function le(e){var t=(0,q.Z)(gettext("Thread title has been changed from %(old_title)s.")),n=interpolate(oe,{name:(0,q.Z)(e.post.event_context.old_title)},!0),a=interpolate(t,{old_title:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function ce(e){var t=(0,q.Z)(gettext("Thread has been moved from %(from_category)s.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.from_category.url),name:(0,q.Z)(e.post.event_context.from_category.name)},!0),a=interpolate(t,{from_category:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function ue(e){var t=(0,q.Z)(gettext("The %(merged_thread)s thread has been merged into this thread.")),n=interpolate(oe,{name:(0,q.Z)(e.post.event_context.merged_thread)},!0),a=interpolate(t,{merged_thread:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function de(e){var t=(0,q.Z)(gettext("Changed thread owner to %(user)s.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function pe(e){var t=(0,q.Z)(gettext("Added %(user)s to thread.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function he(e){var t=(0,q.Z)(gettext("Removed %(user)s from thread.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function fe(e){return e.post.is_read?null:(0,o.Z)("div",{className:"event-label"},void 0,(0,o.Z)("span",{className:"label label-unread"},void 0,gettext("New event")))}var ve=n(19755);var me=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){return(0,r.Z)(this,s),a.apply(this,arguments)}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;this.props.post.is_read||ve(this.element).waypoint({handler:function(t){"down"!==t||e.props.post.is_read||window.setTimeout((function(){var t=e.element.getBoundingClientRect(),n=t.height+t.top,a=document.documentElement.clientHeight;n<5||n>a||(x.Z.dispatch($.r$(e.props.post,{is_read:!0})),_.Z.post(e.props.post.api.read).then((function(t){x.Z.dispatch(y.Vx(e.props.thread,{is_read:t.thread_is_read}))}),(function(e){k.Z.apiError(e)})))}),1e3)},offset:"bottom-in-view"})}},{key:"render",value:function(){var e=this;return v().createElement("div",{className:this.props.className,ref:function(t){t&&(e.element=t)}},this.props.children)}}]),s}(v().Component);function Ze(e){var t="event";return e.post.isDeleted?t="hide":e.post.is_hidden&&(t="event post-hidden"),(0,o.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,o.Z)(fe,{post:e.post}),(0,o.Z)("div",{className:"event-body"},void 0,(0,o.Z)("div",{className:"event-icon"},void 0,v().createElement(F,e)),(0,o.Z)(me,{className:"event-content",post:e.post},void 0,v().createElement(re,e),v().createElement(te,e))))}var ge=n(69130),be=n(48772);function ye(e){return(0,o.Z)("div",{className:"col-xs-12 col-md-6"},void 0,v().createElement(_e,e),(0,o.Z)("div",{className:"post-attachment"},void 0,(0,o.Z)("a",{href:e.attachment.url.index,className:"attachment-name item-title"},void 0,e.attachment.filename),v().createElement(xe,e)))}function _e(e){return e.attachment.is_image?(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(ke,e)):(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(Ne,e))}function Ne(e){return(0,o.Z)("a",{href:e.attachment.url.index,className:"material-icon"},void 0,"insert_drive_file")}function ke(e){var t=e.attachment.url.thumb||e.attachment.url.index;return(0,o.Z)("a",{className:"post-thumbnail",href:e.attachment.url.index,style:{backgroundImage:'url("'+(0,q.Z)(t)+'")'}})}function xe(e){var t;t=e.attachment.url.uploader?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.attachment.url.uploader),user:(0,q.Z)(e.attachment.uploader_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.attachment.uploader_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.attachment.uploaded_on.format("LLL")),relative:(0,q.Z)(e.attachment.uploaded_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.attachment.filetype,size:(0,be.Z)(e.attachment.size),uploader:t,uploaded_on:n},!0);return(0,o.Z)("p",{className:"post-attachment-description",dangerouslySetInnerHTML:{__html:a}})}function we(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&e.attachments}(e.post)?(0,o.Z)("div",{className:"post-attachments"},void 0,(0,ge.Z)(e.post.attachments,2).map((function(e){var t=e.map((function(e){return e?e.id:0})).join("_");return(0,o.Z)(Re,{row:e},t)}))):null}function Re(e){return(0,o.Z)("div",{className:"row"},void 0,e.row.map((function(e){return(0,o.Z)(ye,{attachment:e},e?e.id:0)})))}var Ce,Se,Ee,Le,Pe=n(69092);function Oe(e){return e.post.is_hidden&&!e.post.acl.can_see_hidden?v().createElement(Ae,e):e.post.content?v().createElement(Te,e):v().createElement(Be,e)}function Te(e){return(0,o.Z)(me,{className:"post-body",post:e.post},void 0,(0,o.Z)(Pe.Z,{markup:e.post.content}))}function Ae(e){var t;t=e.post.hidden_by?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.post.url.hidden_by),user:(0,q.Z)(e.post.hidden_by_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.post.hidden_by_name)},!0);var n=interpolate('<abbr class="last-title" title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.post.hidden_on.format("LLL")),relative:(0,q.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("Hidden by %(hidden_by)s %(hidden_on)s.")),{hidden_by:t,hidden_on:n},!0);return(0,o.Z)(me,{className:"post-body post-body-hidden",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("This post is hidden. You cannot see its contents.")),(0,o.Z)("p",{className:"text-muted",dangerouslySetInnerHTML:{__html:a}}))}function Be(e){return(0,o.Z)(me,{className:"post-body post-body-invalid",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("This post's contents cannot be displayed.")),(0,o.Z)("p",{className:"text-muted"},void 0,gettext("This error is caused by invalid post content manipulation.")))}function Ie(e){var t=e.post,n=e.thread,a=e.user;if(!Ue(t)||t.id!==n.best_answer)return null;var s;return s=a.id&&n.best_answer_marked_by===a.id?interpolate(gettext("Marked as best answer by you %(marked_on)s."),{marked_on:n.best_answer_marked_on.fromNow()},!0):interpolate(gettext("Marked as best answer by %(marked_by)s %(marked_on)s."),{marked_by:n.best_answer_marked_by_name,marked_on:n.best_answer_marked_on.fromNow()},!0),(0,o.Z)("div",{className:"post-status-message post-status-best-answer"},void 0,Ce||(Ce=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),(0,o.Z)("p",{},void 0,s))}function je(e){return Ue(e.post)&&e.post.is_hidden?(0,o.Z)("div",{className:"post-status-message post-status-hidden"},void 0,Se||(Se=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),(0,o.Z)("p",{},void 0,gettext("This post is hidden. Only users with permission may see its contents."))):null}function De(e){return Ue(e.post)&&e.post.is_unapproved?(0,o.Z)("div",{className:"post-status-message post-status-unapproved"},void 0,Ee||(Ee=(0,o.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline")),(0,o.Z)("p",{},void 0,gettext("This post is unapproved. Only users with permission to approve posts and its author may see its contents."))):null}function Me(e){return Ue(e.post)&&e.post.is_protected?(0,o.Z)("div",{className:"post-status-message post-status-protected visible-xs-block"},void 0,Le||(Le=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),(0,o.Z)("p",{},void 0,gettext("This post is protected. Only moderators may change it."))):null}function Ue(e){return!e.is_hidden||e.acl.can_see_hidden}function ze(e){x.Z.dispatch($.r$(e.post,{is_unapproved:!1})),Ge(e,[{op:"replace",path:"is-unapproved",value:!1}],{is_unapproved:e.post.is_unapproved})}function He(e){x.Z.dispatch($.r$(e.post,{is_protected:!0})),Ge(e,[{op:"replace",path:"is-protected",value:!0}],{is_protected:e.post.is_protected})}function Fe(e){x.Z.dispatch($.r$(e.post,{is_protected:!1})),Ge(e,[{op:"replace",path:"is-protected",value:!1}],{is_protected:e.post.is_protected})}function qe(e){x.Z.dispatch($.r$(e.post,{is_hidden:!0,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(e.post.url,{hidden_by:e.user.url})})),Ge(e,[{op:"replace",path:"is-hidden",value:!0}],{is_hidden:e.post.is_hidden,hidden_on:e.post.hidden_on,hidden_by_name:e.post.hidden_by_name,url:e.post.url})}function Ye(e){x.Z.dispatch($.r$(e.post,{is_hidden:!1})),Ge(e,[{op:"replace",path:"is-hidden",value:!1}],{is_hidden:e.post.is_hidden})}function Ve(e){var t=e.post.last_likes||[],n=[e.user].concat(t),a=n.length>3?n.slice(0,-1):n;x.Z.dispatch($.r$(e.post,{is_liked:!0,likes:e.post.likes+1,last_likes:a})),Ge(e,[{op:"replace",path:"is-liked",value:!0}],{is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes})}function $e(e){x.Z.dispatch($.r$(e.post,{is_liked:!1,likes:e.post.likes-1,last_likes:e.post.last_likes.filter((function(t){return!t.id||t.id!==e.user.id}))}));var t={is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes};Ge(e,[{op:"replace",path:"is-liked",value:!1}],t)}function Ge(e,t,n){_.Z.patch(e.post.api.index,t).then((function(t){x.Z.dispatch($.r$(e.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.post,n))}))}function We(e){window.confirm(gettext("Are you sure you want to delete this post? This action is not reversible!"))&&(x.Z.dispatch($.r$(e.post,{isDeleted:!0})),_.Z.delete(e.post.api.index).then((function(){k.Z.success(gettext("Post has been deleted."))}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),x.Z.dispatch($.r$(e.post,{isDeleted:!1}))})))}function Ke(e){var t=e.post,n=e.user;x.Z.dispatch(y.Vx({best_answer:t.id,best_answer_is_protected:t.is_protected,best_answer_marked_on:V()(),best_answer_marked_by:n.id,best_answer_marked_by_name:n.username,best_answer_marked_by_slug:n.slug})),Qe(e,[{op:"replace",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Je(e){var t=e.post;x.Z.dispatch(y.Vx({best_answer:null,best_answer_is_protected:!1,best_answer_marked_on:null,best_answer_marked_by:null,best_answer_marked_by_name:null,best_answer_marked_by_slug:null})),Qe(e,[{op:"remove",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Qe(e,t,n){_.Z.patch(e.thread.api.index,t).then((function(e){e.best_answer_marked_on&&(e.best_answer_marked_on=V()(e.best_answer_marked_on)),x.Z.dispatch(y.Vx(e))}),(function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e),x.Z.dispatch(y.Vx(n))}))}var Xe,et,tt,nt=n(30337),at=n(3784);var st=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),(t=a.call(this,e)).state={isReady:!1,error:null,likes:[]},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(this.props.post.api.likes).then((function(t){e.setState({isReady:!0,likes:t.map(it)})}),(function(t){e.setState({isReady:!0,error:t.detail})}))}},{key:"render",value:function(){return this.state.error?(0,o.Z)(ot,{className:"modal-message"},void 0,(0,o.Z)(nt.Z,{message:this.state.error})):this.state.isReady?this.state.likes.length?(0,o.Z)(ot,{className:"modal-sm",likes:this.state.likes},void 0,(0,o.Z)(rt,{likes:this.state.likes})):(0,o.Z)(ot,{className:"modal-message"},void 0,(0,o.Z)(nt.Z,{message:gettext("No users have liked this post.")})):Xe||(Xe=(0,o.Z)(ot,{className:"modal-sm"},void 0,(0,o.Z)(at.Z,{})))}}]),s}(v().Component);function it(e){return Object.assign({},e,{liked_on:V()(e.liked_on)})}function ot(e){var t=e.className,n=e.children,a=e.likes,s=gettext("Post Likes");if(a){var i=a.length,r=ngettext("%(likes)s like","%(likes)s likes",i);s=interpolate(r,{likes:i},!0)}return(0,o.Z)("div",{className:"modal-dialog "+(t||""),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,et||(et=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,s)),n))}function rt(e){return(0,o.Z)("div",{className:"modal-body modal-post-likers"},void 0,(0,o.Z)("ul",{className:"media-list"},void 0,e.likes.map((function(e){return v().createElement(lt,(0,m.Z)({key:e.id},e))}))))}function lt(e){if(e.url){var t={id:e.liker_id,avatars:e.avatars};return(0,o.Z)("li",{className:"media"},void 0,(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("a",{className:"user-avatar",href:e.url},void 0,(0,o.Z)(B.ZP,{size:"50",user:t}))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,o.Z)(ct,{likedOn:e.liked_on})))}return(0,o.Z)("li",{className:"media"},void 0,tt||(tt=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{className:"user-avatar"},void 0,(0,o.Z)(B.ZP,{size:"50"})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("strong",{},void 0,e.username)," ",(0,o.Z)(ct,{likedOn:e.liked_on})))}function ct(e){return(0,o.Z)("span",{className:"text-muted",title:e.likedOn.format("LLL")},void 0,e.likedOn.fromNow())}var ut,dt,pt,ht,ft=n(27950);function vt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function mt(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&(e.acl.can_reply||e.acl.can_edit||e.acl.can_see_likes&&(e.last_likes||[]).length||e.acl.can_like)}(e.post)?(0,o.Z)("div",{className:"post-footer"},void 0,v().createElement(Zt,e),v().createElement(gt,e),v().createElement(bt,e),v().createElement(yt,(0,m.Z)({lastLikes:e.post.last_likes,likes:e.post.likes},e)),v().createElement(_t,(0,m.Z)({likes:e.post.likes},e)),v().createElement(wt,e),v().createElement(Rt,e)):null}var Zt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||t.id===n.best_answer,onClick:this.onClick,type:"button"},void 0,ut||(ut=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Best answer")):null}}]),n}(v().Component),gt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("button",{className:"visible-xs-inline-block btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||t.id===n.best_answer,onClick:this.onClick,type:"button"},void 0,dt||(dt=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box"))):null}}]),n}(v().Component),bt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.post.is_liked?$e(e.props):Ve(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){if(!this.props.post.acl.can_like)return null;var e="btn btn-default btn-sm pull-left";return this.props.post.is_liked&&(e="btn btn-success btn-sm pull-left"),(0,o.Z)("button",{className:e,disabled:this.props.post.isBusy,onClick:this.onClick,type:"button"},void 0,this.props.post.is_liked?gettext("Liked"):gettext("Like"))}}]),n}(v().Component),yt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(st,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm pull-left hidden-xs",onClick:this.onClick,type:"button"},void 0,Nt(this.props.likes,this.props.lastLikes)):(0,o.Z)("p",{className:"pull-left hidden-xs"},void 0,Nt(this.props.likes,this.props.lastLikes)):null}}]),n}(v().Component),_t=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,l.Z)(n,[{key:"render",value:function(){var e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm likes-compact pull-left visible-xs-block",onClick:this.onClick,type:"button"},void 0,pt||(pt=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):(0,o.Z)("p",{className:"likes-compact pull-left visible-xs-block"},void 0,ht||(ht=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):null}}]),n}(yt);function Nt(e,t){var n=t.slice(0,3).map((function(e){return e.username}));if(1==n.length)return interpolate(gettext("%(user)s likes this."),{user:n[0]},!0);var a=e-n.length,s=n.slice(0,-1).join(", "),i=n.slice(-1)[0],o=interpolate(gettext("%(users)s and %(last_user)s"),{users:s,last_user:i},!0);if(0===a)return interpolate(gettext("%(users)s like this."),{users:o},!0);var r=ngettext("%(users)s and %(likes)s other user like this.","%(users)s and %(likes)s other users like this.",a);return interpolate(r,{users:n.join(", "),likes:a},!0)}var kt,xt,wt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"REPLY",config:e.props.thread.api.editor,submit:e.props.thread.api.posts.index,context:{reply:e.props.post.id}})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_reply?(0,o.Z)("button",{className:"btn btn-primary btn-sm pull-right",type:"button",onClick:this.onClick},void 0,gettext("Reply")):null}}]),n}(v().Component),Rt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"EDIT",config:e.props.post.api.editor,submit:e.props.post.api.index})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_edit?(0,o.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-right",type:"button",onClick:this.onClick},void 0,gettext("Edit")):null}}]),n}(v().Component),Ct=n(82211);var St=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.move,{new_thread:this.state.url,posts:[this.props.post.id]})}},{key:"handleSuccess",value:function(e){x.Z.dispatch($.r$(this.props.post,{isDeleted:!0})),N.Z.hide(),k.Z.success(gettext("Selected post was moved to the other thread."))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail):k.Z.apiError(e)}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,kt||(kt=(0,o.Z)(Et,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to move post to")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading},void 0,gettext("Move post"))))))}}]),s}(Z.Z);function Et(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,xt||(xt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move post")))}function Lt(e){return(0,o.Z)("div",{className:"modal-body post-changelog-diff"},void 0,(0,o.Z)("ul",{className:"list-unstyled"},void 0,e.diff.map((function(e,t){return(0,o.Z)(Pt,{item:e},t)}))))}function Pt(e){return"?"===e.item[0]?null:(0,o.Z)("li",{className:(t=e.item,n="diff-item","-"===t[0]?n+=" diff-item-sub":"+"===t[0]&&(n+=" diff-item-add"),n)},void 0,e.item.substr(2));var t,n}var Ot,Tt,At,Bt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.revertEdit(e.props.edit.id)})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.canRevert?(0,o.Z)("div",{className:"modal-footer visible-xs-block"},void 0,(0,o.Z)(Ct.Z,{className:"btn-default btn-sm btn-block",disabled:this.props.disabled,onClick:this.onClick,title:gettext("Revert post to state from before this edit.")},void 0,gettext("Revert"))):null}}]),s}(v().Component);var It,jt,Dt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"goLast",(function(){e.props.goToEdit()})),(0,h.Z)((0,c.Z)(e),"goForward",(function(){e.props.goToEdit(e.props.edit.next)})),(0,h.Z)((0,c.Z)(e),"goBack",(function(){e.props.goToEdit(e.props.edit.previous)})),(0,h.Z)((0,c.Z)(e),"revertEdit",(function(){e.props.revertEdit(e.props.edit.id)})),e}return(0,l.Z)(s,[{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-toolbar post-changelog-toolbar"},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-xs-12 col-sm-4"},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(Mt,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goBack})),(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(Ut,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goForward})),(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(zt,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goLast})))),(0,o.Z)("div",{className:"col-xs-12 col-sm-5 xs-margin-top-half post-change-label"},void 0,(0,o.Z)(Ft,{edit:this.props.edit})),(0,o.Z)(Ht,{canRevert:this.props.canRevert,disabled:this.props.disabled,onClick:this.revertEdit})))}}]),s}(v().Component);function Mt(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.previous,onClick:e.onClick,title:gettext("See previous change")},void 0,Ot||(Ot=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left")))}function Ut(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:gettext("See next change")},void 0,Tt||(Tt=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function zt(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:gettext("See previous change")},void 0,At||(At=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page")))}function Ht(e){return e.canRevert?(0,o.Z)("div",{className:"col-sm-3 hidden-xs"},void 0,(0,o.Z)(Ct.Z,{className:"btn-default btn-sm btn-block",disabled:e.disabled,onClick:e.onClick,title:gettext("Revert post to state from before this edit.")},void 0,gettext("Revert"))):null}function Ft(e){var t;t=e.edit.url.editor?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.edit.url.editor),user:(0,q.Z)(e.edit.editor_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.edit.editor_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.edit.edited_on.format("LLL")),relative:(0,q.Z)(e.edit.edited_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("By %(edited_by)s %(edited_on)s.")),{edited_by:t,edited_on:n},!0);return(0,o.Z)("p",{dangerouslySetInnerHTML:{__html:a}})}function qt(e){return Object.assign({},e,{edited_on:V()(e.edited_on)})}var Yt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"goToEdit",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t.setState({isBusy:!0});var n=t.props.post.api.edits;null!==e&&(n+="?edit="+e),_.Z.get(n).then((function(e){t.setState({isReady:!0,isBusy:!1,edit:qt(e)})}),(function(e){t.setState({isReady:!0,isBusy:!1,error:e.detail})}))})),(0,h.Z)((0,c.Z)(t),"revertEdit",(function(e){if(!t.state.isBusy&&window.confirm(gettext("Are you sure you with to revert this post to the state from before this edit?"))){t.setState({isBusy:!0});var n=t.props.post.api.edits+"?edit="+e;_.Z.post(n).then((function(e){var t=$.ZB(e);x.Z.dispatch($.r$(e,t)),k.Z.success(gettext("Post has been reverted to previous state.")),N.Z.hide()}),(function(e){k.Z.apiError(e),t.setState({isBusy:!1})}))}})),t.state={isReady:!1,isBusy:!0,canRevert:e.post.acl.can_edit,error:null,edit:null},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){this.goToEdit()}},{key:"render",value:function(){return this.state.error?(0,o.Z)(Vt,{className:"modal-dialog modal-message"},void 0,(0,o.Z)(nt.Z,{message:this.state.error})):this.state.isReady?(0,o.Z)(Vt,{},void 0,(0,o.Z)(Dt,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,goToEdit:this.goToEdit,revertEdit:this.revertEdit}),(0,o.Z)(Lt,{diff:this.state.edit.diff}),(0,o.Z)(Bt,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,revertEdit:this.revertEdit})):It||(It=(0,o.Z)(Vt,{},void 0,(0,o.Z)(at.Z,{})))}}]),s}(v().Component);function Vt(e){return(0,o.Z)("div",{className:e.className||"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,jt||(jt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Post edits history"))),e.children))}var $t,Gt,Wt,Kt,Jt,Qt,Xt=n(57026),en=n(60471),tn=n(55210);function nn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function an(e){return v().createElement(gn,(0,m.Z)({},e,{Form:bn}))}var sn,on,rn,ln,cn,un,dn,pn,hn,fn,vn,mn,Zn,gn=function(e){(0,u.Z)(n,e);var t=nn(n);function n(e){var a;return(0,r.Z)(this,n),(a=t.call(this,e)).state={isLoaded:!1,isError:!1,categories:[]},a}return(0,l.Z)(n,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(misago.get("THREAD_EDITOR_API")).then((function(t){var n=t.map((function(e){return Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})}));e.setState({isLoaded:!0,categories:n})}),(function(t){e.setState({isError:t.detail})}))}},{key:"render",value:function(){return this.state.isError?(0,o.Z)(_n,{message:this.state.isError}):this.state.isLoaded?v().createElement(bn,(0,m.Z)({},this.props,{categories:this.state.categories})):$t||($t=(0,o.Z)(yn,{}))}}]),n}(v().Component),bn=function(e){(0,u.Z)(n,e);var t=nn(n);function n(e){var a;return(0,r.Z)(this,n),a=t.call(this,e),(0,h.Z)((0,c.Z)(a),"onCategoryChange",(function(e){var t=e.target.value,n={category:t};a.acl[t].can_pin_threads<n.weight&&(n.weight=0),a.acl[t].can_hide_threads||(n.is_hidden=0),a.acl[t].can_close_threads||(n.is_closed=!1),a.setState(n)})),a.state={isLoading:!1,title:"",category:null,categories:e.categories,weight:0,is_hidden:0,is_closed:!1,validators:{title:[tn.C1()]},errors:{}},a.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],a.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],a.acl={},a.props.categories.forEach((function(e){e.post&&(a.state.category||(a.state.category=e.id),a.acl[e.id]={can_pin_threads:e.post.pin,can_close_threads:e.post.close,can_hide_threads:e.post.hide})})),a}return(0,l.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(k.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.split,{title:this.state.title,category:this.state.category,weight:this.state.weight,is_hidden:this.state.is_hidden,is_closed:this.state.is_closed,posts:[this.props.post.id]})}},{key:"handleSuccess",value:function(e){x.Z.dispatch($.r$(this.props.post,{isDeleted:!0})),N.Z.hide(),k.Z.success(gettext("Selected post was split into new thread."))}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),k.Z.error(gettext("Form contains errors."))):k.Z.apiError(e)}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,o.Z)(g.Z,{label:gettext("Thread weight"),for:"id_weight",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,o.Z)(g.Z,{label:gettext("Hide thread"),for:"id_is_hidden",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,o.Z)(g.Z,{label:gettext("Close thread"),for:"id_is_closed",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"render",value:function(){return(0,o.Z)(Nn,{className:"modal-dialog"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{label:gettext("Thread title"),for:"id_title",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.title},void 0,(0,o.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),Gt||(Gt=(0,o.Z)("div",{className:"clearfix"})),(0,o.Z)(g.Z,{label:gettext("Category"),for:"id_category",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.category},void 0,(0,o.Z)(Xt.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.state.categories})),Wt||(Wt=(0,o.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)(Ct.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Split post")))))}}]),n}(Z.Z);function yn(){return Kt||(Kt=(0,o.Z)(Nn,{className:"modal-dialog"},void 0,(0,o.Z)(at.Z,{})))}function _n(e){return(0,o.Z)(Nn,{className:"modal-dialog modal-message"},void 0,Jt||(Jt=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move this post at the moment.")),(0,o.Z)("p",{},void 0,e.message)))}function Nn(e){return(0,o.Z)("div",{className:e.className,role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Qt||(Qt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Split post into new thread"))),e.children))}function kn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function xn(e){return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,v().createElement(Rn,e),v().createElement(Cn,e),v().createElement(Sn,e),v().createElement(En,e),v().createElement(Ln,e),v().createElement(Pn,e),v().createElement(On,e),v().createElement(Tn,e),v().createElement(An,e),v().createElement(Bn,e),v().createElement(In,e),v().createElement(jn,e),v().createElement(Dn,e))}var wn,Rn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){var t=window.location.protocol+"//";t+=window.location.host,t+=e.props.post.url.index,prompt(gettext("Permament link to this post:"),t)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,sn||(sn=(0,o.Z)("span",{className:"material-icon"},void 0,"link")),gettext("Permament link")))}}]),n}(v().Component),Cn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"EDIT",config:e.props.post.api.editor,submit:e.props.post.api.index})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_edit?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,on||(on=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Edit"))):null}}]),n}(v().Component),Sn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?t.id===n.best_answer||n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,rn||(rn=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Mark as best answer"))):null}}]),n}(v().Component),En=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Je(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id!==n.best_answer?null:n.acl.can_unmark_best_answer?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,ln||(ln=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box_outline_blank")),gettext("Unmark best answer"))):null}}]),n}(v().Component),Ln=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(Yt,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("This post was edited %(edits)s time.","This post was edited %(edits)s times.",this.props.post.edits);return interpolate(n,{edits:this.props.post.edits},!0),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,cn||(cn=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Changes history")))}}]),n}(v().Component),Pn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ze(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_approve&&this.props.post.is_unapproved?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,un||(un=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))):null}}]),n}(v().Component),On=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(St,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_move?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,dn||(dn=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))):null}}]),n}(v().Component),Tn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(an,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_move?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,pn||(pn=(0,o.Z)("span",{className:"material-icon"},void 0,"call_split")),gettext("Split"))):null}}]),n}(v().Component),An=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){He(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_protect?this.props.post.is_protected?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,hn||(hn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Protect"))):null}}]),n}(v().Component),Bn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Fe(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_protect&&this.props.post.is_protected?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,fn||(fn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Remove protection"))):null}}]),n}(v().Component),In=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){qe(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id===n.best_answer?null:t.acl.can_hide?t.is_hidden?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,vn||(vn=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))):null}}]),n}(v().Component),jn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ye(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_unhide&&this.props.post.is_hidden?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,mn||(mn=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))):null}}]),n}(v().Component),Dn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){We(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id===n.best_answer?null:t.acl.can_delete?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,Zn||(Zn=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))):null}}]),n}(v().Component);function Mn(e){return(0,o.Z)("div",{className:"pull-right dropdown"},void 0,wn||(wn=(0,o.Z)("button",{"aria-expanded":"true","aria-haspopup":"true",className:"btn btn-default btn-icon dropdown-toggle","data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"expand_more"))),v().createElement(xn,e))}var Un=n(21981);var zn,Hn=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.post.isSelected?x.Z.dispatch(Un._H(e.props.post)):x.Z.dispatch(Un.Ys(e.props.post))})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.thread.acl.can_merge_posts||(e=this.props.post.acl).can_approve||e.can_hide||e.can_protect||e.can_unhide||e.can_delete||e.can_move?(0,o.Z)("div",{className:"pull-right"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-icon",onClick:this.onClick,type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,this.props.post.isSelected?"check_box":"check_box_outline_blank"))):null;var e}}]),s}(v().Component),Fn=n(24678);function qn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function Yn(e){return(0,o.Z)("div",{className:"post-heading"},void 0,v().createElement(Vn,e),v().createElement($n,e),v().createElement(Gn,e),v().createElement(Wn,e),v().createElement(Qn,e),v().createElement(Xn,e),v().createElement(ea,e),v().createElement(Hn,e),v().createElement(Mn,e))}function Vn(e){return e.post.is_read?null:(0,o.Z)("span",{className:"label label-unread hidden-xs"},void 0,gettext("New post"))}function $n(e){return e.post.is_read?null:(0,o.Z)("span",{className:"label label-unread visible-xs-inline-block"},void 0,gettext("New"))}function Gn(e){var t=interpolate(gettext("posted %(posted_on)s"),{posted_on:e.post.posted_on.format("LL, LT")},!0);return(0,o.Z)("a",{href:e.post.url.index,className:"btn btn-link posted-on hidden-xs",title:t},void 0,e.post.posted_on.fromNow())}function Wn(e){return(0,o.Z)("a",{href:e.post.url.index,className:"btn btn-link posted-on visible-xs-inline-block"},void 0,e.post.posted_on.fromNow())}var Kn,Jn,Qn=function(e){(0,u.Z)(n,e);var t=qn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(Yt,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("This post was edited %(edits)s time.","This post was edited %(edits)s times.",this.props.post.edits),a=interpolate(n,{edits:this.props.post.edits},!0),s=ngettext("edited %(edits)s time","edited %(edits)s times",this.props.post.edits);return(0,o.Z)("button",{className:"btn btn-link btn-see-edits hidden-xs",onClick:this.onClick,title:a,type:"button"},void 0,interpolate(s,{edits:this.props.post.edits},!0))}}]),n}(v().Component),Xn=function(e){(0,u.Z)(n,e);var t=qn(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("%(edits)s edit","%(edits)s edits",this.props.post.edits);return(0,o.Z)("button",{className:"btn btn-link btn-see-edits visible-xs-inline-block",onClick:this.onClick,type:"button"},void 0,interpolate(n,{edits:this.props.post.edits},!0))}}]),n}(Qn);function ea(e){var t=e.post.poster&&e.post.poster.id===e.user.id,n=e.post.acl.can_protect;return e.user.id&&e.post.is_protected&&(t||n)?(0,o.Z)("span",{className:"label label-protected hidden-xs",title:gettext("This post is protected and may not be edited.")},void 0,zn||(zn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("protected")):null}function ta(e){var t=e.post,n=e.thread;return(0,o.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,o.Z)(Hn,{post:t,thread:n}),(0,o.Z)(Mn,{post:t,thread:n}),(0,o.Z)("div",{className:"media"},void 0,Kn||(Kn=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:100})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("span",{className:"media-heading item-title"},void 0,t.poster_name),(0,o.Z)("span",{className:"user-title user-title-anonymous"},void 0,gettext("Removed user")))))}function na(e){var t=e.title,n=e.rank;return n.is_tab||!!t||!!n.title}function aa(e){var t=e.poster,n=ngettext("%(posts)s post","%(posts)s posts",t.posts),a="user-postcount";return na(t)&&(a+=" hidden-xs hidden-sm"),(0,o.Z)("span",{className:a},void 0,interpolate(n,{posts:t.posts},!0))}function sa(e){var t=e.poster,n="hidden-xs";return na(t)&&(n+=" hidden-sm"),(0,o.Z)("span",{className:n},void 0,(0,o.Z)(Fn.ZP,{status:t.status},void 0,(0,o.Z)(Fn.pg,{status:t.status,user:t})))}function ia(e){var t=e.rank,n=e.title||t.title;if(!n&&t.is_tab&&(n=t.name),!n)return null;var a="user-title";return t.css_class&&(a+=" user-title-"+t.css_class),t.is_tab?(0,o.Z)("div",{className:a},void 0,(0,o.Z)("a",{href:t.url},void 0,n)):(0,o.Z)("div",{className:a},void 0,n)}function oa(e){var t=e.post,n=e.thread,a=t.poster;return(0,o.Z)("div",{className:"post-side post-side-registered"},void 0,(0,o.Z)(Hn,{post:t,thread:n}),(0,o.Z)(Mn,{post:t,thread:n}),(0,o.Z)("div",{className:"media"},void 0,(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("a",{href:a.url},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:100,user:a}))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("div",{className:"media-heading"},void 0,(0,o.Z)("a",{className:"item-title",href:a.url},void 0,a.username),(0,o.Z)(Fn.ZP,{status:a.status},void 0,(0,o.Z)(Fn.Jj,{status:a.status}))),(0,o.Z)(ia,{rank:a.rank,title:a.title}),(0,o.Z)(sa,{poster:a}),(0,o.Z)(aa,{poster:a}))))}function ra(e){return e.post.poster?v().createElement(oa,e):v().createElement(ta,e)}function la(e){var t="post";return e.post.isDeleted?t="hide":e.post.is_hidden&&!e.post.acl.can_see_hidden&&(t="post post-hidden"),e.post.poster&&e.post.poster.rank.css_class&&(t+=" post-"+e.post.poster.rank.css_class),e.post.is_read||(t+=" post-new"),(0,o.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,o.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,v().createElement(ra,e),(0,o.Z)("div",{className:"panel-content"},void 0,v().createElement(Yn,e),v().createElement(Ie,e),v().createElement(De,e),v().createElement(Me,e),v().createElement(je,e),v().createElement(Oe,e),v().createElement(we,e),v().createElement(mt,e)))))}var ca,ua=function(){return(0,o.Z)("li",{className:"post"},void 0,(0,o.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,(0,o.Z)("div",{className:"post-side post-side-registered"},void 0,(0,o.Z)("div",{className:"media"},void 0,Jn||(Jn=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:"100"})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("span",{className:"media-heading item-title"},void 0,(0,o.Z)("span",{className:"ui-preview-text",style:{width:"80px"}},void 0," ")),(0,o.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,o.Z)("span",{className:"ui-preview-text",style:{width:"60px"}},void 0," "))))),(0,o.Z)("div",{className:"panel-content"},void 0,(0,o.Z)("div",{className:"post-body"},void 0,(0,o.Z)("article",{className:"misago-markup"},void 0,(0,o.Z)("p",{className:"ui-preview-text",style:{width:"100%"}},void 0," "),(0,o.Z)("p",{className:"ui-preview-text",style:{width:"70%"}},void 0," "),(0,o.Z)("p",{className:"ui-preview-text hidden-xs hidden-sm",style:{width:"85%"}},void 0," ")))))))};function da(e){return e.posts.isLoaded?(0,o.Z)("ul",{className:"posts-list ui-ready"},void 0,e.posts.results.map((function(t){return v().createElement(pa,(0,m.Z)({key:t.id,post:t},e))}))):ca||(ca=(0,o.Z)("ul",{className:"posts-list ui-preview"},void 0,(0,o.Z)(ua,{})))}function pa(e){return e.post.is_event?v().createElement(Ze,e):v().createElement(la,e)}var ha,fa,va,ma=n(59752),Za=n(55547),ga=n(53328),ba=n(59131),ya=n(98936),_a=n(50366),Na=n(16768),ka=function(e){var t=e.thread;return(0,o.Z)("div",{className:"thread-user-card"},void 0,(0,o.Z)("div",{className:"thread-user-card-media"},void 0,t.starter?(0,o.Z)("a",{href:t.url.starter},void 0,(0,o.Z)(B.ZP,{size:40,user:t.starter})):ha||(ha=(0,o.Z)(B.ZP,{size:40}))),(0,o.Z)("div",{className:"thread-user-card-body"},void 0,(0,o.Z)("div",{className:"thread-user-card-header"},void 0,t.starter?(0,o.Z)("a",{className:"item-title",href:t.url.starter,title:gettext("Thread author")},void 0,t.starter.username):(0,o.Z)("span",{className:"item-title",title:gettext("Thread author")},void 0,t.starter_name)),(0,o.Z)("div",{},void 0,(0,o.Z)("span",{className:"text-muted",title:interpolate(gettext("Started on: %(timestamp)s"),{timestamp:t.started_on.format("LLL")},!0)},void 0,t.started_on.fromNow()))))},xa=n(99755),wa=n(12891);var Ra=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSuccess",(function(e){t.handleSuccessUnmounted(e),t.setState({isLoading:!0}),N.Z.hide()})),(0,h.Z)((0,c.Z)(t),"handleSuccessUnmounted",(function(e){x.Z.dispatch(y.Ar()),x.Z.dispatch(y.Vx(e))})),(0,h.Z)((0,c.Z)(t),"handleError",(function(e){x.Z.dispatch(y.Ar()),400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)})),(0,h.Z)((0,c.Z)(t),"onChange",(function(e){t.changeValue("title",e.target.value)})),t.state={isLoading:!1,title:e.thread.title,validators:{title:(0,wa.jn)()},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){if(!this.state.title.trim().length)return k.Z.error(gettext("You have to enter thread title.")),!1;var e=this.validate();return!e.title||(k.Z.error(e.title[0]),!1)}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.patch(this.props.thread.api.index,[{op:"replace",path:"title",value:this.state.title}])}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,fa||(fa=(0,o.Z)(Ca,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_modal_title",label:gettext("Thread title")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_modal_title",onChange:this.onChange,value:this.state.title}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Change title"))))))}}]),s}(Z.Z);function Ca(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,va||(va=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Change title")))}var Sa,Ea,La=n(52753);var Pa,Oa,Ta,Aa,Ba,Ia,ja=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSuccess",(function(e){t.handleSuccessUnmounted(e),t.setState({isLoading:!0})})),(0,h.Z)((0,c.Z)(t),"handleSuccessUnmounted",(function(e){k.Z.success(gettext("Thread has been merged with other one.")),window.location=e.url})),(0,h.Z)((0,c.Z)(t),"handleError",(function(e){x.Z.dispatch(y.Ar()),400===e.status?e.best_answers||e.polls?N.Z.show((0,o.Z)(La.ZP,{api:t.props.thread.api.merge,bestAnswers:e.best_answers,data:{other_thread:t.state.url},polls:e.polls,onError:t.handleError,onSuccess:t.handleSuccessUnmounted})):e.best_answer?k.Z.error(e.best_answer[0]):e.poll?k.Z.error(e.poll[0]):k.Z.error(e.detail):k.Z.apiError(e)})),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.post(this.props.thread.api.merge,{other_thread:this.state.url})}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Sa||(Sa=(0,o.Z)(Da,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to merge with"),help_text:gettext("Merge will delete current thread and move its contents to the thread specified here.")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Merge thread"))))))}}]),s}(Z.Z);function Da(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ea||(Ea=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Merge thread")))}var Ma,Ua,za,Ha,Fa,qa,Ya,Va,$a,Ga,Wa,Ka,Ja=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onCategoryChange",(function(e){t.changeValue("category",e.target.value)})),t.state={isReady:!1,isLoading:!1,isError:!1,category:null,categories:[]},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(E.Z.get("THREAD_EDITOR_API")).then((function(t){var n=null,a=t.map((function(e){return!1===e.post||n||(n=e.id),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id})}));e.setState({isReady:!0,category:n,categories:a})}),(function(t){e.setState({isError:t.detail})}))}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.patch(this.props.thread.api.index,[{op:"replace",path:"category",value:this.state.category}])}},{key:"handleSuccess",value:function(){_.Z.get(this.props.thread.api.posts.index,{page:this.props.posts.page}).then((function(e){x.Z.dispatch(y.gx(e)),x.Z.dispatch(Un.zD(e.post_set)),x.Z.dispatch(y.Ar()),k.Z.success(gettext("Thread has been moved.")),N.Z.hide()}),(function(e){x.Z.dispatch(y.Ar()),k.Z.apiError(e)}))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Pa||(Pa=(0,o.Z)(Qa,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_category",label:gettext("New category")},void 0,(0,o.Z)(Xt.Z,{choices:this.state.categories,disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_category",onChange:this.onCategoryChange,value:this.state.category}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Move thread")))))):this.state.isError?(0,o.Z)(es,{message:this.state.isError}):Oa||(Oa=(0,o.Z)(Xa,{}))}}]),s}(Z.Z);function Qa(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ta||(Ta=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move thread")))}function Xa(e){return Aa||(Aa=(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)(Qa,{}),(0,o.Z)(at.Z,{}))))}function es(e){return(0,o.Z)("div",{className:"modal-dialog modal-message",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Ba||(Ba=(0,o.Z)(Qa,{})),Ia||(Ia=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move this thread at the moment.")),(0,o.Z)("p",{},void 0,e.message),(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok")))))}var ts,ns,as,ss,is=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"callApi",(function(t,n){x.Z.dispatch(y.n6()),t.push({op:"add",path:"acl",value:!0}),_.Z.patch(e.props.thread.api.index,t).then((function(e){x.Z.dispatch(y.Vx(e)),x.Z.dispatch(y.Ar()),k.Z.success(n)}),(function(e){x.Z.dispatch(y.Ar()),400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)}))})),(0,h.Z)((0,c.Z)(e),"changeTitle",(function(){N.Z.show((0,o.Z)(Ra,{thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"pinGlobally",(function(){e.callApi([{op:"replace",path:"weight",value:2}],gettext("Thread has been pinned globally."))})),(0,h.Z)((0,c.Z)(e),"pinLocally",(function(){e.callApi([{op:"replace",path:"weight",value:1}],gettext("Thread has been pinned locally."))})),(0,h.Z)((0,c.Z)(e),"unpin",(function(){e.callApi([{op:"replace",path:"weight",value:0}],gettext("Thread has been unpinned."))})),(0,h.Z)((0,c.Z)(e),"approve",(function(){e.callApi([{op:"replace",path:"is-unapproved",value:!1}],gettext("Thread has been approved."))})),(0,h.Z)((0,c.Z)(e),"open",(function(){e.callApi([{op:"replace",path:"is-closed",value:!1}],gettext("Thread has been opened."))})),(0,h.Z)((0,c.Z)(e),"close",(function(){e.callApi([{op:"replace",path:"is-closed",value:!0}],gettext("Thread has been closed."))})),(0,h.Z)((0,c.Z)(e),"unhide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!1}],gettext("Thread has been made visible."))})),(0,h.Z)((0,c.Z)(e),"hide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!0}],gettext("Thread has been made hidden."))})),(0,h.Z)((0,c.Z)(e),"move",(function(){N.Z.show((0,o.Z)(Ja,{posts:e.props.posts,thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"merge",(function(){N.Z.show((0,o.Z)(ja,{thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"delete",(function(){window.confirm(gettext("Are you sure you want to delete this thread?"))&&(x.Z.dispatch(y.n6()),_.Z.delete(e.props.thread.api.index).then((function(t){k.Z.success(gettext("Thread has been deleted.")),window.location=e.props.thread.category.url.index}),(function(e){x.Z.dispatch(y.Ar()),k.Z.apiError(e)})))})),e}return(0,l.Z)(s,[{key:"render",value:function(){var e=this.props.moderation;return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,!!e.edit&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.changeTitle,type:"button"},void 0,Ma||(Ma=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Change title"))),!!e.pinGlobally&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.pinGlobally,type:"button"},void 0,Ua||(Ua=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark")),gettext("Pin globally"))),!!e.pinLocally&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.pinLocally,type:"button"},void 0,za||(za=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark_border")),gettext("Pin locally"))),!!e.unpin&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.unpin,type:"button"},void 0,Ha||(Ha=(0,o.Z)("span",{className:"material-icon"},void 0,"panorama_fish_eye")),gettext("Unpin"))),!!e.move&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.move,type:"button"},void 0,Fa||(Fa=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))),!!e.merge&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.merge,type:"button"},void 0,qa||(qa=(0,o.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge"))),!!e.approve&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.approve,type:"button"},void 0,Ya||(Ya=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))),!!e.open&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.open,type:"button"},void 0,Va||(Va=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Open"))),!!e.close&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.close,type:"button"},void 0,$a||($a=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Close"))),!!e.unhide&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.unhide,type:"button"},void 0,Ga||(Ga=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))),!!e.hide&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.hide,type:"button"},void 0,Wa||(Wa=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))),!!e.delete&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.delete,type:"button"},void 0,Ka||(Ka=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))))}}]),s}(v().Component),os=is,rs=function(e){var t=e.thread,n=e.posts,a=e.moderation;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Thread options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:t.isBusy},void 0,ts||(ts=(0,o.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,o.Z)(os,{thread:t,posts:n,moderation:a}))},ls=n(94184),cs=n.n(ls);function us(e,t,n){var a={subscription:e.subscription};x.Z.dispatch(y.Vx({subscription:t})),_.Z.patch(e.api.index,[{op:"replace",path:"subscription",value:n}]).then((function(e){x.Z.dispatch(y.Vx(e))}),(function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e),x.Z.dispatch(y.Vx(a))}))}var ds,ps,hs,fs,vs,ms,Zs,gs,bs,ys,_s,Ns,ks,xs=function(e){var t,n=e.stickToBottom,a=e.thread;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-block","aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,!0===(t=a.subscription)?"star":!1===t?"star_half":"star_border"),function(e){return!0===e?gettext("E-mail"):!1===e?gettext("Enabled"):gettext("Disabled")}(a.subscription)),(0,o.Z)("ul",{className:cs()("dropdown-menu dropdown-menu-right",{"stick-to-bottom":n})},void 0,(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){null!==e.subscription&&us(e,null,"unsubscribe")}(a)}},void 0,ns||(ns=(0,o.Z)("span",{className:"material-icon"},void 0,"star_border")),gettext("Unsubscribe"))),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){!1!==e.subscription&&us(e,!1,"notify")}(a)}},void 0,as||(as=(0,o.Z)("span",{className:"material-icon"},void 0,"star_half")),gettext("Subscribe"))),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){!0!==e.subscription&&us(e,!0,"email")}(a)}},void 0,ss||(ss=(0,o.Z)("span",{className:"material-icon"},void 0,"star")),gettext("Subscribe with e-mail")))))},ws=function(e){var t=e.children,n=e.className;return(0,o.Z)("ul",{className:cs()("breadcrumbs",n)},void 0,t)},Rs=function(e){var t=e.category,n=e.className;return(0,o.Z)("li",{className:cs()("breadcrumbs-item",n)},void 0,(0,o.Z)("a",{href:t.url.index},void 0,(0,o.Z)("span",{className:"material-icon",style:{color:t.color||"inherit"}},void 0,"label"),!!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name hidden-sm hidden-md hidden-lg",title:t.name},void 0,t.short_name),!!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name hidden-xs"},void 0,t.name),!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name"},void 0,t.name)))},Cs=function(e){var t=e.category,n=e.className;return(0,o.Z)("li",{className:cs()("breadcrumbs-item",n)},void 0,(0,o.Z)("a",{href:t.url.index},void 0,ds||(ds=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right")),(0,o.Z)("span",{className:"breadcrumbs-item-name"},void 0,"root_category"===t.special_role?gettext("Threads"):gettext("Private threads"))))},Ss=function(e){var t=e.breadcrumbs;return(0,o.Z)(ws,{},void 0,t.map((function(e){return e.special_role?(0,o.Z)(Cs,{category:e},e.id):(0,o.Z)(Rs,{category:e},e.id)})))},Es=function(e){var t=e.styleName,n=e.thread,a=e.posts,s=e.user,i=e.moderation;return(0,o.Z)(xa.sP,{},void 0,(0,o.Z)(xa.mr,{styleName:t},void 0,(0,o.Z)(xa.gC,{styleName:t},void 0,(0,o.Z)(Ss,{breadcrumbs:n.path}),(0,o.Z)("h1",{},void 0,n.title)),(0,o.Z)(xa.eA,{className:"page-header-thread-details"},void 0,(0,o.Z)(ya.gq,{},void 0,(0,o.Z)(ya.kw,{auto:!0},void 0,(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(ka,{thread:n})),ps||(ps=(0,o.Z)(ya.Z6,{auto:!0})),n.replies>0&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(Na.Z,{thread:n})),function(e){return e.is_closed||e.is_hidden||e.is_unapproved||e.weight>0||e.best_answer||e.has_poll||e.has_unapproved_posts}(n)&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(_a.Z,{thread:n}))),s.is_authenticated&&(0,o.Z)(ya.kw,{},void 0,(0,o.Z)(ya.Z6,{},void 0,(0,o.Z)(xs,{thread:n})),i.enabled&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(rs,{thread:n,posts:a,moderation:i})))))))},Ls=n(92490),Ps=n(69987),Os=function(e){var t=e.baseUrl,n=e.posts;return(0,o.Z)("div",{className:"misago-pagination"},void 0,n.isLoaded&&n.first?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t,title:gettext("Go to first page")},void 0,hs||(hs=(0,o.Z)("span",{className:"material-icon"},void 0,"first_page"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to first page"),type:"button",disabled:!0},void 0,fs||(fs=(0,o.Z)("span",{className:"material-icon"},void 0,"first_page"))),n.isLoaded&&n.previous?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+(n.previous>1?n.previous+"/":""),title:gettext("Go to previous page")},void 0,vs||(vs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to previous page"),type:"button",disabled:!0},void 0,ms||(ms=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left"))),n.isLoaded&&n.next?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.next+"/",title:gettext("Go to next page")},void 0,Zs||(Zs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to next page"),type:"button",disabled:!0},void 0,gs||(gs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right"))),n.isLoaded&&n.last?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.last+"/",title:gettext("Go to last page")},void 0,bs||(bs=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to last page"),type:"button",disabled:!0},void 0,ys||(ys=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page"))))},Ts=function(e){var t=e.posts;return t.more?(0,o.Z)("p",{},void 0,interpolate(ngettext("There is %(more)s more post in this thread.","There are %(more)s more posts in this thread.",t.more),{more:t.more},!0)):(0,o.Z)("p",{},void 0,gettext("There are no more posts in this thread."))};function As(e){var t=e.errors,n=e.posts;return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,_s||(_s=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Moderation"))),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("One or more posts could not be changed:")),(0,o.Z)("ul",{className:"list-unstyled list-errored-items"},void 0,t.map((function(e){return(0,o.Z)(Bs,{errors:e.detail,post:n[e.id]},e.id)}))))))}function Bs(e){var t=e.errors,n=e.post,a=interpolate(gettext("%(username)s on %(posted_on)s"),{posted_on:n.posted_on.format("LL, LT"),username:n.poster_name},!0);return(0,o.Z)("li",{},void 0,(0,o.Z)("h5",{},void 0,a,":"),t.map((function(e,t){return(0,o.Z)("p",{},t,e)})))}function Is(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_unapproved:!1}})),a=t.map((function(e){return{id:e.id,is_unapproved:e.is_unapproved}}));zs(e,[{op:"replace",path:"is-unapproved",value:!1}],n,a)}function js(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_protected:!0}})),a=t.map((function(e){return{id:e.id,is_protected:e.is_protected}}));zs(e,[{op:"replace",path:"is-protected",value:!0}],n,a)}function Ds(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_protected:!1}})),a=t.map((function(e){return{id:e.id,is_protected:e.is_protected}}));zs(e,[{op:"replace",path:"is-protected",value:!1}],n,a)}function Ms(e){var t=e.selection,n=t.map((function(t){return{id:t.id,is_hidden:!0,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(t.url,{hidden_by:e.user.url})}})),a=t.map((function(e){return{id:e.id,is_hidden:e.is_hidden,hidden_on:e.hidden_on,hidden_by_name:e.hidden_by_name,url:e.url}}));zs(e,[{op:"replace",path:"is-hidden",value:!0}],n,a)}function Us(e){var t=e.selection,n=t.map((function(t){return{id:t.id,is_hidden:!1,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(t.url,{hidden_by:e.user.url})}})),a=t.map((function(e){return{id:e.id,is_hidden:e.is_hidden,hidden_on:e.hidden_on,hidden_by_name:e.hidden_by_name,url:e.url}}));zs(e,[{op:"replace",path:"is-hidden",value:!1}],n,a)}function zs(e,t,n,a){var s=e.selection,i=e.thread;n.forEach((function(e){$.r$(e,e)})),x.Z.dispatch(Un.kR());var r={ops:t,ids:s.map((function(e){return e.id}))};_.Z.patch(i.api.posts.index,r).then((function(e){e.forEach((function(e){x.Z.dispatch($.r$(e,e))}))}),(function(e){if(400!==e.status)return a.forEach((function(e){x.Z.dispatch($.r$(e,e))})),k.Z.apiError(e);var t=[],n=[];e.forEach((function(e){e.detail?(t.push(e),n.push(e.id)):x.Z.dispatch($.r$(e,e)),a.forEach((function(e){-1!==n.indexOf(e)&&x.Z.dispatch($.r$(e,e))}))}));var i={};s.forEach((function(e){i[e.id]=e})),N.Z.show((0,o.Z)(As,{errors:t,posts:i}))}))}function Hs(e){window.confirm(gettext("Are you sure you want to merge selected posts? This action is not reversible!"))&&(e.selection.slice(1).map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),_.Z.post(e.thread.api.posts.merge,{posts:e.selection.map((function(e){return e.id}))}).then((function(e){x.Z.dispatch($.r$(e,$.ZB(e)))}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),e.selection.slice(1).map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!1}))}))})),x.Z.dispatch(Un.kR()))}function Fs(e){if(window.confirm(gettext("Are you sure you want to delete selected posts? This action is not reversible!"))){e.selection.map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))}));var t=e.selection.map((function(e){return e.id}));_.Z.delete(e.thread.api.posts.index,t).then((function(){}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),e.selection.map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!1}))}))})),x.Z.dispatch(Un.kR())}}var qs,Ys,Vs,$s,Gs,Ws,Ks=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.move,{new_thread:this.state.url,posts:this.props.selection.map((function(e){return e.id}))})}},{key:"handleSuccess",value:function(e){this.props.selection.forEach((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),N.Z.hide(),k.Z.success(gettext("Selected posts were moved to the other thread."))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail):k.Z.apiError(e)}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Ns||(Ns=(0,o.Z)(Js,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to move posts to")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading},void 0,gettext("Move posts"))))))}}]),s}(Z.Z);function Js(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,ks||(ks=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move posts")))}function Qs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function Xs(e){return v().createElement(ci,(0,m.Z)({},e,{Form:ui}))}var ei,ti,ni,ai,si,ii,oi,ri,li,ci=function(e){(0,u.Z)(n,e);var t=Qs(n);function n(e){var a;return(0,r.Z)(this,n),(a=t.call(this,e)).state={isLoaded:!1,isError:!1,categories:[]},a}return(0,l.Z)(n,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(misago.get("THREAD_EDITOR_API")).then((function(t){var n=t.map((function(e){return Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})}));e.setState({isLoaded:!0,categories:n})}),(function(t){e.setState({isError:t.detail})}))}},{key:"render",value:function(){return this.state.isError?(0,o.Z)(pi,{message:this.state.isError}):this.state.isLoaded?v().createElement(ui,(0,m.Z)({},this.props,{categories:this.state.categories})):qs||(qs=(0,o.Z)(di,{}))}}]),n}(v().Component),ui=function(e){(0,u.Z)(n,e);var t=Qs(n);function n(e){var a;return(0,r.Z)(this,n),a=t.call(this,e),(0,h.Z)((0,c.Z)(a),"onCategoryChange",(function(e){var t=e.target.value,n={category:t};a.acl[t].can_pin_threads<n.weight&&(n.weight=0),a.acl[t].can_hide_threads||(n.is_hidden=0),a.acl[t].can_close_threads||(n.is_closed=!1),a.setState(n)})),a.state={isLoading:!1,title:"",category:null,categories:e.categories,weight:0,is_hidden:0,is_closed:!1,validators:{title:[tn.C1()]},errors:{}},a.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],a.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],a.acl={},a.props.categories.forEach((function(e){e.post&&(a.state.category||(a.state.category=e.id),a.acl[e.id]={can_pin_threads:e.post.pin,can_close_threads:e.post.close,can_hide_threads:e.post.hide})})),a}return(0,l.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(k.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.split,{title:this.state.title,category:this.state.category,weight:this.state.weight,is_hidden:this.state.is_hidden,is_closed:this.state.is_closed,posts:this.props.selection.map((function(e){return e.id}))})}},{key:"handleSuccess",value:function(e){this.props.selection.forEach((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),N.Z.hide(),k.Z.success(gettext("Selected posts were split into new thread."))}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),k.Z.error(gettext("Form contains errors."))):403===e.status&&Array.isArray(e)?N.Z.show((0,o.Z)(As,{errors:e})):k.Z.apiError(e)}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,o.Z)(g.Z,{label:gettext("Thread weight"),for:"id_weight",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,o.Z)(g.Z,{label:gettext("Hide thread"),for:"id_is_hidden",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,o.Z)(g.Z,{label:gettext("Close thread"),for:"id_is_closed",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"render",value:function(){return(0,o.Z)(hi,{className:"modal-dialog"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{label:gettext("Thread title"),for:"id_title",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.title},void 0,(0,o.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),Ys||(Ys=(0,o.Z)("div",{className:"clearfix"})),(0,o.Z)(g.Z,{label:gettext("Category"),for:"id_category",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.category},void 0,(0,o.Z)(Xt.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.state.categories})),Vs||(Vs=(0,o.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)(Ct.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Split posts")))))}}]),n}(Z.Z);function di(){return $s||($s=(0,o.Z)(hi,{className:"modal-dialog"},void 0,(0,o.Z)(at.Z,{})))}function pi(e){return(0,o.Z)(hi,{className:"modal-dialog modal-message"},void 0,Gs||(Gs=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move selected posts at the moment.")),(0,o.Z)("p",{},void 0,e.message),(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}function hi(e){return(0,o.Z)("div",{className:e.className,role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ws||(Ws=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Split posts into new thread"))),e.children))}function fi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function vi(e){return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,v().createElement(Ri,e),v().createElement(Ci,e),v().createElement(Si,e),v().createElement(Ei,e),v().createElement(Li,e),v().createElement(Pi,e),v().createElement(Ti,e),v().createElement(Oi,e),v().createElement(Ai,e))}var mi,Zi,gi,bi,yi,_i,Ni,ki,xi,wi,Ri=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Is(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_approve&&e.is_unapproved}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ei||(ei=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))):null}}]),n}(v().Component),Ci=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Hs(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.length>1&&this.props.selection.find((function(e){return e.acl.can_merge}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ti||(ti=(0,o.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge"))):null}}]),n}(v().Component),Si=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(Ks,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_move}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ni||(ni=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))):null}}]),n}(v().Component),Ei=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(Xs,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_move}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ai||(ai=(0,o.Z)("span",{className:"material-icon"},void 0,"call_split")),gettext("Split"))):null}}]),n}(v().Component),Li=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){js(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return!e.is_protected&&e.acl.can_protect}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,si||(si=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Protect"))):null}}]),n}(v().Component),Pi=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ds(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.is_protected&&e.acl.can_protect}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ii||(ii=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Unprotect"))):null}}]),n}(v().Component),Oi=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ms(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_hide&&!e.is_hidden}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,oi||(oi=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))):null}}]),n}(v().Component),Ti=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Us(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_unhide&&e.is_hidden}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ri||(ri=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))):null}}]),n}(v().Component),Ai=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Fs(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_delete}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,li||(li=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))):null}}]),n}(v().Component),Bi=function(e){var t=e.thread,n=e.user,a=e.selection,s=e.dropup;return(0,o.Z)("div",{className:s?"dropup":"dropdown"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Posts options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:0===a.length},void 0,mi||(mi=(0,o.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,o.Z)(vi,{thread:t,user:n,selection:a}))},Ii=function(e){var t=e.onClick;return(0,o.Z)("button",{className:"btn btn-primary btn-outline btn-block",type:"button",onClick:t},void 0,Zi||(Zi=(0,o.Z)("span",{className:"material-icon"},void 0,"chat")),gettext("Reply"))},ji=function(e){var t=e.thread,n=e.posts,a=e.user,s=e.selection,i=e.moderation,r=e.onReply;return(0,o.Z)(Ls.o8,{},void 0,(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Os,{baseUrl:t.url.index,posts:n})),(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s,dropup:!0}))),(0,o.Z)(Ls.Z2,{className:"hidden-xs hidden-sm",auto:!0},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ts,{posts:n}))),gi||(gi=(0,o.Z)(Ls.tw,{className:"hidden-md hidden-lg"})),a.is_authenticated&&(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(xs,{thread:t})),t.acl.can_reply&&(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ii,{onClick:r})),i.enabled&&(0,o.Z)(Ls.Eg,{className:"hidden-xs",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s,dropup:!0}))))},Di=function(e){var t=e.compact,n=e.onClick;return(0,o.Z)("button",{className:cs()("btn btn-default btn-outline",{"btn-block":!t,"btn-icon":t}),type:"button",title:t?gettext("Add poll"):null,onClick:n},void 0,bi||(bi=(0,o.Z)("span",{className:"material-icon"},void 0,"poll")),!t&&gettext("Add poll"))},Mi=function(e){var t=e.user,n=e.thread;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Shortcuts"),"aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button"},void 0,yi||(yi=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark"))),(0,o.Z)("ul",{className:"dropdown-menu"},void 0,t.is_authenticated&&n.is_new&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.new_post},void 0,_i||(_i=(0,o.Z)("span",{className:"material-icon"},void 0,"comment")),gettext("Go to new post"))),n.best_answer&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.best_answer},void 0,Ni||(Ni=(0,o.Z)("span",{className:"material-icon"},void 0,"check_circle")),gettext("Go to best answer"))),n.has_unapproved_posts&&n.acl.can_approve&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.unapproved_post},void 0,ki||(ki=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Go to unapproved post"))),(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.last_post},void 0,xi||(xi=(0,o.Z)("span",{className:"material-icon"},void 0,"reply")),gettext("Go to last post")))))},Ui=function(e){var t=e.thread,n=e.posts,a=e.user,s=e.selection,i=e.moderation,r=e.onPoll,l=e.onReply;return(0,o.Z)(Ls.o8,{},void 0,(0,o.Z)(Ls.Z2,{className:"hidden-xs"},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Mi,{thread:t,user:a})),(0,o.Z)(Ls.Eg,{className:"hidden-xs hidden-sm"},void 0,(0,o.Z)(Os,{baseUrl:t.url.index,posts:n}))),wi||(wi=(0,o.Z)(Ls.tw,{})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Z2,{className:"hidden-xs"},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Di,{onClick:r}))),t.acl.can_reply?(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Mi,{thread:t,user:a})),(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ii,{onClick:l})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Di,{onClick:r,compact:!0})),i.enabled&&(0,o.Z)(Ls.Eg,{className:"hidden-xs",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s}))):(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Mi,{thread:t,user:a})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Di,{onClick:r})),i.enabled&&(0,o.Z)(Ls.Eg,{shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s}))))};var zi=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"update",(function(t){x.Z.dispatch(y.gx(t)),x.Z.dispatch(Un.zD(t.post_set)),t.participants&&x.Z.dispatch(b.gx(t.participants)),t.poll&&x.Z.dispatch(ma.gx(t.poll)),e.setPageTitle()})),(0,h.Z)((0,c.Z)(e),"openPollForm",(function(){ft.Z.open({mode:"POLL",submit:e.props.thread.api.poll,thread:e.props.thread,poll:null})})),(0,h.Z)((0,c.Z)(e),"openReplyForm",(function(){ft.Z.open({mode:"REPLY",config:e.props.thread.api.editor,submit:e.props.thread.api.posts.index})})),e}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){this.shouldFetchData()&&(this.fetchData(),this.setPageTitle()),this.startPollingApi()}},{key:"componentDidUpdate",value:function(){this.shouldFetchData()&&(this.fetchData(),this.startPollingApi(),this.setPageTitle())}},{key:"componentWillUnmount",value:function(){this.stopPollingApi()}},{key:"shouldFetchData",value:function(){return!!this.props.posts.isLoaded&&1*(this.props.params.page||1)!=this.props.posts.page}},{key:"fetchData",value:function(){var e=this;x.Z.dispatch(Un.Rz()),_.Z.get(this.props.thread.api.posts.index,{page:this.props.params.page||1},"posts").then((function(t){e.update(t)}),(function(e){k.Z.apiError(e)}))}},{key:"startPollingApi",value:function(){Za.Z.start({poll:"thread-posts",url:this.props.thread.api.posts.index,data:{page:this.props.params.page||1},update:this.update,frequency:12e4,delayed:!0})}},{key:"stopPollingApi",value:function(){Za.Z.stop("thread-posts")}},{key:"setPageTitle",value:function(){ga.Z.set({title:this.props.thread.title,parent:this.props.thread.category.name,page:1*(this.props.params.page||1)})}},{key:"render",value:function(){var e=this.props.thread.category,t="page page-thread";e.css_class&&(t+=" page-thread-"+e.css_class);var n="private_threads"===e.special_role?"private-threads":e.css_class||"category-threads",a=Hi(this.props.thread,this.props.user),s=Fi(this.props.posts.results,this.props.user),i=this.props.posts.results.filter((function(e){return e.isSelected}));return(0,o.Z)("div",{className:t},void 0,(0,o.Z)(Es,{styleName:n,thread:this.props.thread,posts:this.props.posts,user:this.props.user,moderation:a}),(0,o.Z)(ba.Z,{},void 0,(0,o.Z)(M,{participants:this.props.participants,thread:this.props.thread,user:this.props.user}),(0,o.Z)(Ui,{thread:this.props.thread,posts:this.props.posts,user:this.props.user,selection:i,moderation:s,onPoll:this.openPollForm,onReply:this.openReplyForm}),(0,o.Z)(z.n,{poll:this.props.poll,thread:this.props.thread,user:this.props.user}),v().createElement(da,this.props),(0,o.Z)(ji,{thread:this.props.thread,posts:this.props.posts,user:this.props.user,selection:i,moderation:s,onReply:this.openReplyForm})))}}]),s}(v().Component),Hi=function(e,t){var n={enabled:!1,edit:!1,approve:!1,close:!1,open:!1,hide:!1,unhide:!1,move:!1,merge:!1,pinGlobally:!1,pinLocally:!1,unpin:!1,delete:!1};return t.is_authenticated?(n.edit=e.acl.can_edit,n.approve=e.acl.can_approve&&e.is_unapproved,n.close=e.acl.can_close&&!e.is_closed,n.open=e.acl.can_close&&e.is_closed,n.hide=e.acl.can_hide&&!e.is_hidden,n.unhide=e.acl.can_unhide&&e.is_hidden,n.move=e.acl.can_move,n.merge=e.acl.can_merge,n.pinGlobally=e.acl.can_pin_globally&&e.weight<2,n.pinLocally=e.acl.can_pin&&1!==e.weight,n.unpin=e.acl.can_pin&&1===e.weight||e.acl.can_pin_globally&&2===e.weight,n.delete=e.acl.can_delete,n.enabled=n.edit||n.approve||n.close||n.open||n.hide||n.unhide||n.move||n.merge||n.pinGlobally||n.pinLocally||n.unpin||n.delete,n):n},Fi=function(e,t){var n={enabled:!1,approve:!1,move:!1,merge:!1,protect:!1,hide:!1,delete:!1};return t.is_authenticated?(e.forEach((function(e){e.is_event||(e.acl.can_approve&&e.is_unapproved&&(n.approve=!0),e.acl.can_move&&(n.move=!0),e.acl.can_merge&&(n.merge=!0),(e.acl.can_protect||e.acl.can_unprotect)&&(n.protect=!0),(e.acl.can_hide||e.acl.can_unhide)&&(n.hide=!0),e.acl.can_delete&&(n.delete=!0),(n.approve||n.move||n.merge||n.protect||n.hide||n.delete)&&(n.enabled=!0))})),n):n};function qi(e){return{participants:e.participants,poll:e.poll,posts:e.posts,thread:e.thread,tick:e.tick.tick,user:e.auth.user}}var Yi=n(39633);E.Z.addInitializer({name:"component:thread",initializer:function(e){var t,n;e.has("THREAD")&&e.has("POSTS")&&(0,Yi.Z)({paths:(t=E.Z.get("THREAD"),n=t.url.index.replace(t.slug+"-"+t.pk,":slug"),[{path:n,component:(0,i.$j)(qi)(zi)},{path:n+":page/",component:(0,i.$j)(qi)(zi)}])})},after:"store"})},72168:function(e,t,n){"use strict";var a=n(37424),s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(57588),h=n.n(p),f=n(82211);function v(e,t){return e.last_post>t.last_post?-1:e.last_post<t.last_post?1:0}function m(e,t){return 2===e.weight&&e.weight>t.weight?-1:2===t.weight&&e.weight<t.weight?1:v(e,t)}function Z(e,t){return e.weight>t.weight?-1:e.weight<t.weight?1:v(e,t)}var g,b,y=n(59131),_=n(27950),N=n(92490),k=n(69987),x=function(e){var t=e.allItems,n=e.parentUrl,a=e.category,i=e.categories,o=e.list;return(0,s.Z)("div",{className:"dropdown threads-category-picker"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline dropdown-toggle btn-block text-ellipsis","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,a&&(0,s.Z)("span",{className:"material-icon",style:{color:a.color||"inherit"}},void 0,"label"),a&&a.short_name&&(0,s.Z)("span",{className:a.short_name&&"hidden-md hidden-lg"},void 0,a.short_name),a?(0,s.Z)("span",{className:a.short_name&&"hidden-xs hidden-sm"},void 0,a.name):t),(0,s.Z)("ul",{className:"dropdown-menu"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)(k.rU,{to:n+o.path},void 0,t)),g||(g=(0,s.Z)("li",{role:"separator",className:"divider"})),i.map((function(e){return(0,s.Z)("li",{},e.id,(0,s.Z)(k.rU,{to:e.url.index+o.path},void 0,(0,s.Z)("span",{className:"material-icon",style:{color:e.color||"inherit"}},void 0,"label"),e.name))}))))},w=function(e){var t=e.baseUrl,n=e.list,a=e.lists;return(0,s.Z)("div",{className:"dropdown threads-list-picker"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline dropdown-toggle btn-block","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,n.longName),(0,s.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,a.map((function(e){return(0,s.Z)("li",{},e.type,(0,s.Z)(k.rU,{to:t+e.path},void 0,e.longName))}))))};var R=function(e){(0,l.Z)(r,e);var t,n,a=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function r(){return(0,i.Z)(this,r),a.apply(this,arguments)}return(0,o.Z)(r,[{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,b||(b=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Threads moderation"))),(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("One or more threads could not be deleted:")),(0,s.Z)("ul",{className:"list-unstyled list-errored-items"},void 0,this.props.errors.map((function(e){return(0,s.Z)(C,{errors:e.errors,thread:e.thread},e.thread.id)}))))))}}]),r}(h().Component);function C(e){var t=e.errors,n=e.thread;return(0,s.Z)("li",{},void 0,(0,s.Z)("h5",{},void 0,n.title),t.map((function(e,t){return(0,s.Z)("p",{},void 0,e)})))}var S,E,L,P,O=n(43345),T=n(96359),A=n(57026),B=n(60471),I=n(32233),j=n(61340),D=n(77751),M=n(52753),U=n(78657),z=n(59801),H=n(53904),F=n(90287),q=n(55210);var Y,V,$=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;for(var n in(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"getFormdata",(function(){return{threads:t.props.threads.map((function(e){return e.id})),title:t.state.title,category:t.state.category,weight:t.state.weight,is_hidden:t.state.is_hidden,is_closed:t.state.is_closed}})),(0,d.Z)((0,r.Z)(t),"handleSuccess",(function(e){t.props.threads.forEach((function(e){t.props.freezeThread(e.id),t.props.deleteThread(e)})),F.Z.dispatch(D.YP()),t.props.addThreads([e]),F.Z.dispatch((0,j.V8)(t.props.route.category,t.props.categoriesMap)),z.Z.hide()})),(0,d.Z)((0,r.Z)(t),"handleError",(function(e){400===e.status?e.best_answers||e.polls?z.Z.show((0,s.Z)(M.ZP,{api:I.Z.get("MERGE_THREADS_API"),bestAnswers:e.best_answers,data:t.getFormdata(),polls:e.polls,onError:t.handleError,onSuccess:t.handleSuccess})):(t.setState({errors:Object.assign({},t.state.errors,e)}),H.Z.error(gettext("Form contains errors."))):403===e.status&&Array.isArray(e)?z.Z.show((0,s.Z)(R,{errors:e})):e.best_answer?H.Z.error(e.best_answer[0]):e.poll?H.Z.error(e.poll[0]):H.Z.apiError(e)})),(0,d.Z)((0,r.Z)(t),"onCategoryChange",(function(e){var n=e.target.value,a={category:n};t.acl[n].can_pin_threads<a.weight&&(a.weight=0),t.acl[n].can_hide_threads||(a.is_hidden=0),t.acl[n].can_close_threads||(a.is_closed=!1),t.setState(a)})),t.state={isLoading:!1,title:"",category:null,weight:0,is_hidden:0,is_closed:!1,validators:{title:[q.C1()]},errors:{}},t.acl={},e.user.acl.categories)if(e.user.acl.categories.hasOwnProperty(n)){var o=e.user.acl.categories[n];t.acl[o.id]=o}return t.categoryChoices=[],e.categories.forEach((function(e){if(e.level>0){var n=t.acl[e.id],a=!n.can_start_threads||e.is_closed&&!n.can_close_threads;t.categoryChoices.push({value:e.id,disabled:a,level:e.level-1,label:e.name}),a||t.state.category||(t.state.category=e.id)}})),t.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],t.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],t}return(0,o.Z)(p,[{key:"clean",value:function(){return!!this.isValid()||(H.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return U.Z.post(I.Z.get("MERGE_THREADS_API"),this.getFormdata())}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,s.Z)(T.Z,{label:gettext("Thread weight"),for:"id_weight"},void 0,(0,s.Z)(B.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,s.Z)(T.Z,{label:gettext("Hide thread"),for:"id_is_hidden"},void 0,(0,s.Z)(B.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,s.Z)(T.Z,{label:gettext("Close thread"),for:"id_is_closed"},void 0,(0,s.Z)(B.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"renderForm",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(T.Z,{label:gettext("Thread title"),for:"id_title",validation:this.state.errors.title},void 0,(0,s.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),S||(S=(0,s.Z)("div",{className:"clearfix"})),(0,s.Z)(T.Z,{label:gettext("Category"),for:"id_category",validation:this.state.errors.category},void 0,(0,s.Z)(A.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.categoryChoices})),E||(E=(0,s.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)(f.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Merge threads"))))}},{key:"renderCantMergeMessage",value:function(){return(0,s.Z)("div",{className:"modal-body"},void 0,L||(L=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"message-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("You can't move threads because there are no categories you are allowed to move them to.")),(0,s.Z)("p",{},void 0,gettext("You need permission to start threads in category to be able to merge threads to it.")),(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}},{key:"getClassName",value:function(){return this.state.category?"modal-dialog":"modal-dialog modal-message"}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,P||(P=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Merge threads"))),this.state.category?this.renderForm():this.renderCantMergeMessage()))}}]),p}(O.Z);var G,W,K,J,Q,X,ee,te,ne,ae,se,ie,oe,re,le=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"handleSubmit",(function(e){e.preventDefault(),z.Z.hide(),t.props.callApi([{op:"replace",path:"category",value:t.state.category},{op:"replace",path:"flatten-categories",value:null},{op:"add",path:"acl",value:!0}],gettext("Selected threads were moved."),(function(){F.Z.dispatch((0,j.V8)(t.props.route.category,t.props.categoriesMap));var e=F.Z.getState(),n=e.threads.map((function(e){return e.id}));F.Z.dispatch(D.$6(e.selection.filter((function(e){return-1!==n.indexOf(e)}))))}))})),t.state={category:null};var n={};for(var s in e.user.acl.categories)if(e.user.acl.categories.hasOwnProperty(s)){var o=e.user.acl.categories[s];n[o.id]=o}return t.categoryChoices=[],e.categories.forEach((function(e){if(e.level>0){var a=n[e.id],s=!a.can_start_threads||e.is_closed&&!a.can_close_threads;t.categoryChoices.push({value:e.id,disabled:s,level:e.level-1,label:e.name}),s||t.state.category||(t.state.category=e.id)}})),t}return(0,o.Z)(p,[{key:"getClassName",value:function(){return this.state.category?"modal-dialog":"modal-dialog modal-message"}},{key:"renderForm",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(T.Z,{label:gettext("New category"),for:"id_new_category"},void 0,(0,s.Z)(A.Z,{id:"id_new_category",onChange:this.bindInput("category"),value:this.state.category,choices:this.categoryChoices}))),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)("button",{className:"btn btn-primary"},void 0,gettext("Move threads"))))}},{key:"renderCantMoveMessage",value:function(){return(0,s.Z)("div",{className:"modal-body"},void 0,Y||(Y=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"message-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("You can't move threads because there are no categories you are allowed to move them to.")),(0,s.Z)("p",{},void 0,gettext("You need permission to start threads in category to be able to move threads to it.")),(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,V||(V=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Move threads"))),this.state.category?this.renderForm():this.renderCantMoveMessage()))}}]),p}(O.Z);var ce,ue,de,pe=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(){var e;(0,i.Z)(this,p);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,d.Z)((0,r.Z)(e),"callApi",(function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.props.threads.forEach((function(t){e.props.freezeThread(t.id)}));var i=e.props.threads.map((function(e){return e.id}));t.push({op:"add",path:"acl",value:!0}),U.Z.patch(e.props.api,{ids:i,ops:t}).then((function(t){e.props.threads.forEach((function(t){e.props.freezeThread(t.id)})),t.forEach((function(t){e.props.updateThread(t)})),H.Z.success(n),a&&a()}),(function(t){if(e.props.threads.forEach((function(t){e.props.freezeThread(t.id)})),400!==t.status)return H.Z.apiError(t);var n=[],a={};e.props.threads.forEach((function(e){a[e.id]=e})),t.forEach((function(e){var t=e.id,s=e.detail;void 0!==a[t]&&n.push({errors:s,thread:a[t]})})),z.Z.show((0,s.Z)(R,{errors:n}))}))})),(0,d.Z)((0,r.Z)(e),"pinGlobally",(function(){e.callApi([{op:"replace",path:"weight",value:2}],gettext("Selected threads were pinned globally."))})),(0,d.Z)((0,r.Z)(e),"pinLocally",(function(){e.callApi([{op:"replace",path:"weight",value:1}],gettext("Selected threads were pinned locally."))})),(0,d.Z)((0,r.Z)(e),"unpin",(function(){e.callApi([{op:"replace",path:"weight",value:0}],gettext("Selected threads were unpinned."))})),(0,d.Z)((0,r.Z)(e),"approve",(function(){e.callApi([{op:"replace",path:"is-unapproved",value:!1}],gettext("Selected threads were approved."))})),(0,d.Z)((0,r.Z)(e),"open",(function(){e.callApi([{op:"replace",path:"is-closed",value:!1}],gettext("Selected threads were opened."))})),(0,d.Z)((0,r.Z)(e),"close",(function(){e.callApi([{op:"replace",path:"is-closed",value:!0}],gettext("Selected threads were closed."))})),(0,d.Z)((0,r.Z)(e),"unhide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!1}],gettext("Selected threads were unhidden."))})),(0,d.Z)((0,r.Z)(e),"hide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!0}],gettext("Selected threads were hidden."))})),(0,d.Z)((0,r.Z)(e),"move",(function(){z.Z.show((0,s.Z)(le,{callApi:e.callApi,categories:e.props.categories,categoriesMap:e.props.categoriesMap,route:e.props.route,user:e.props.user}))})),(0,d.Z)((0,r.Z)(e),"merge",(function(){var t=[];if(e.props.threads.forEach((function(e){e.acl.can_merge||t.append({id:e.id,title:e.title,errors:[gettext("You don't have permission to merge this thread with others.")]})})),e.props.threads.length<2)H.Z.info(gettext("You have to select at least two threads to merge."));else{if(t.length)return void z.Z.show((0,s.Z)(R,{errors:t}));z.Z.show(h().createElement($,e.props))}})),(0,d.Z)((0,r.Z)(e),"delete",(function(){if(window.confirm(gettext("Are you sure you want to delete selected threads?"))){e.props.threads.map((function(t){e.props.freezeThread(t.id)}));var t=e.props.threads.map((function(e){return e.id}));U.Z.delete(e.props.api,t).then((function(){e.props.threads.map((function(t){e.props.freezeThread(t.id),e.props.deleteThread(t)})),H.Z.success(gettext("Selected threads were deleted."))}),(function(t){if(400===t.status){var n=t.map((function(e){return e.id}));e.props.threads.map((function(t){e.props.freezeThread(t.id),-1===n.indexOf(t.id)&&e.props.deleteThread(t)})),z.Z.show((0,s.Z)(R,{errors:t}))}else H.Z.apiError(t)}))}})),e}return(0,o.Z)(p,[{key:"render",value:function(){var e=this.props,t=e.moderation,n=e.threads,a=0==this.props.selection.length;return(0,s.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",onClick:function(){return F.Z.dispatch(D.$6(n.map((function(e){return e.id}))))}},void 0,G||(G=(0,s.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Select all"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:function(){return F.Z.dispatch(D.YP())}},void 0,W||(W=(0,s.Z)("span",{className:"material-icon"},void 0,"check_box_outline_blank")),gettext("Select none"))),K||(K=(0,s.Z)("li",{role:"separator",className:"divider"})),!!t.can_pin_globally&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.pinGlobally},void 0,J||(J=(0,s.Z)("span",{className:"material-icon"},void 0,"bookmark")),gettext("Pin threads globally"))),!!t.can_pin&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.pinLocally},void 0,Q||(Q=(0,s.Z)("span",{className:"material-icon"},void 0,"bookmark_border")),gettext("Pin threads locally"))),!!t.can_pin&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.unpin},void 0,X||(X=(0,s.Z)("span",{className:"material-icon"},void 0,"panorama_fish_eye")),gettext("Unpin threads"))),!!t.can_move&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.move},void 0,ee||(ee=(0,s.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move threads"))),!!t.can_merge&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.merge},void 0,te||(te=(0,s.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge threads"))),!!t.can_approve&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.approve},void 0,ne||(ne=(0,s.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve threads"))),!!t.can_close&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.open},void 0,ae||(ae=(0,s.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Open threads"))),!!t.can_close&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.close},void 0,se||(se=(0,s.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Close threads"))),!!t.can_unhide&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.unhide},void 0,ie||(ie=(0,s.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide threads"))),!!t.can_hide&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.hide},void 0,oe||(oe=(0,s.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide threads"))),!!t.can_delete&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.delete},void 0,re||(re=(0,s.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete threads"))))}}]),p}(h().Component),he=function(e){var t=e.api,n=e.categoriesMap,a=e.categories,i=e.threads,o=e.addThreads,r=e.freezeThread,l=e.updateThread,c=e.deleteThread,u=e.selection,d=e.moderation,p=e.route,h=e.user,f=e.disabled;return(0,s.Z)("div",{className:"dropdown threads-moderation"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Moderation"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:f},void 0,ce||(ce=(0,s.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,s.Z)(pe,{api:t,categories:a,categoriesMap:n,threads:i,addThreads:o,freezeThread:r,updateThread:l,deleteThread:c,selection:u,moderation:d,route:p,user:h,disabled:f}))},fe=function(e){var t=e.api,n=e.baseUrl,a=e.category,i=e.categories,o=e.categoriesMap,r=e.topCategory,l=e.topCategories,c=e.subCategory,u=e.subCategories,d=e.list,p=e.lists,h=e.threads,v=e.addThreads,m=e.startThread,Z=e.freezeThread,g=e.updateThread,b=e.deleteThread,y=e.selection,k=e.moderation,R=e.route,C=e.user,S=e.disabled;return(0,s.Z)(N.o8,{},void 0,l.length>0&&(0,s.Z)(N.Z2,{},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(x,{allItems:gettext("All categories"),parentUrl:d.path,category:r,categories:l,list:d})),r&&u.length>0&&(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(x,{allItems:gettext("All subcategories"),parentUrl:r.url.index,category:c,categories:u,list:d}))),p.length>1&&(0,s.Z)(N.Z2,{className:"hidden-xs"},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(w,{baseUrl:n,list:d,lists:p}))),ue||(ue=(0,s.Z)(N.tw,{})),!!C.id&&(0,s.Z)(N.Z2,{},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(f.Z,{className:"btn-primary btn-outline btn-block",disabled:S,onClick:function(){_.Z.open(m||{mode:"START",config:misago.get("THREAD_EDITOR_API"),submit:misago.get("THREADS_API"),category:a.id})}},void 0,de||(de=(0,s.Z)("span",{className:"material-icon"},void 0,"chat")),gettext("Start thread"))),!!k.allow&&(0,s.Z)(N.Eg,{shrink:!0},void 0,(0,s.Z)(he,{api:t,categories:i,categoriesMap:o,threads:h.filter((function(e){return-1!==y.indexOf(e.id)})),addThreads:v,freezeThread:Z,updateThread:g,deleteThread:b,selection:y,moderation:k,route:R,user:C,disabled:S}))))};var ve=function(e){(0,l.Z)(r,e);var t,n,a=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function r(){return(0,i.Z)(this,r),a.apply(this,arguments)}return(0,o.Z)(r,[{key:"render",value:function(){var e=this.props.root,t=this.props.route,n=t.category,a=t.categories,i=t.categoriesMap,o=me(e,n,i);return(0,s.Z)(y.Z,{},void 0,(0,s.Z)(fe,{api:this.props.api,baseUrl:n.url.index,category:n,categories:a,categoriesMap:i,topCategory:o,topCategories:a.filter((function(t){return t.parent===e.id})),subCategories:o?a.filter((function(e){return e.parent===o.id})):[],subCategory:2===n.level?n:null,subcategories:this.props.subcategories,list:this.props.route.list,lists:this.props.route.lists,threads:this.props.threads,addThreads:this.props.addThreads,startThread:this.props.startThread,freezeThread:this.props.freezeThread,deleteThread:this.props.deleteThread,updateThread:this.props.updateThread,selection:this.props.selection,moderation:this.props.moderation,route:this.props.route,user:this.props.user,disabled:!this.props.isLoaded||this.props.isBusy||this.props.busyThreads.length}),this.props.children)}}]),r}(h().Component),me=function(e,t,n){return t.parent?t.parent===e.id?t:n[t.parent]:null};function Ze(e){var t={allow:!1,can_approve:0,can_close:0,can_delete:0,can_hide:0,can_merge:0,can_move:0,can_pin:0,can_pin_globally:0,can_unhide:0};return e.forEach((function(e){e.is_unapproved&&e.acl.can_approve>t.can_approve&&(t.can_approve=e.acl.can_approve),e.acl.can_close>t.can_close&&(t.can_close=e.acl.can_close),e.acl.can_delete>t.can_delete&&(t.can_delete=e.acl.can_delete),e.acl.can_hide>t.can_hide&&(t.can_hide=e.acl.can_hide),e.acl.can_merge>t.can_merge&&(t.can_merge=e.acl.can_merge),e.acl.can_move>t.can_move&&(t.can_move=e.acl.can_move),e.acl.can_pin>t.can_pin&&(t.can_pin=e.acl.can_pin),e.acl.can_pin_globally>t.can_pin_globally&&(t.can_pin_globally=e.acl.can_pin_globally),e.is_hidden&&e.acl.can_unhide>t.can_unhide&&(t.can_unhide=e.acl.can_unhide),t.allow=t.can_approve||t.can_close||t.can_delete||t.can_hide||t.can_merge||t.can_move||t.can_pin||t.can_pin_globally||t.can_unhide})),t}var ge,be,ye,_e,Ne=function(e){var t=e.category,n=e.list,a=e.message;return"all"===n.type?a?(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,a),(0,s.Z)("p",{},void 0,gettext("Why not start one yourself?"))):(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,t.special_role?gettext("There are no threads on this forum... yet!"):gettext("There are no threads in this category.")),(0,s.Z)("p",{},void 0,gettext("Why not start one yourself?"))):(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("No threads matching specified criteria were found.")))},ke=n(50366),xe=n(16768),we=function(e){var t=e.thread;return(0,s.Z)("a",{href:t.url.last_post,className:"threads-list-item-last-activity",title:interpolate(gettext("Last activity: %(timestamp)s"),{timestamp:t.last_post_on.format("LLL")},!0)},void 0,t.last_post_on.fromNow(!0))},Re=function(e){var t="threads-list-item-category threads-list-category-label";return e.color&&(t+=" threads-list-category-label-color"),t},Ce=function(e){var t=e.parent,n=e.category;return(0,s.Z)("span",{},void 0,t&&(0,s.Z)("a",{href:t.url.index,className:Re(t)+" threads-list-item-parent-category",style:t.color?{"--label-color":t.color}:null,title:t.short_name?t.name:null},void 0,t.short_name||t.name),(0,s.Z)("a",{href:n.url.index,className:Re(n),style:n.color?{"--label-color":n.color}:null,title:n.short_name?n.name:null},void 0,n.short_name||n.name))},Se=function(e){var t=e.checked,n=e.disabled,a=e.thread;return(0,s.Z)("button",{className:"btn btn-default btn-icon",type:"button",disabled:n,onClick:function(){return F.Z.dispatch(D.wc(a.id))}},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,t?"check_box":"check_box_outline_blank"))},Ee=function(e){var t=e.thread,n="threads-list-icon";return t.is_read||(n+=" threads-list-icon-new"),(0,s.Z)("a",{title:t.is_read?gettext("No new posts"):gettext("New posts"),href:t.is_read?t.url.last_post:t.url.new_post,className:n},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,t.is_read?"chat_bubble_outline":"chat_bubble"))},Le=n(19605),Pe=function(e){var t=e.thread;return t.last_poster?(0,s.Z)("a",{href:t.url.last_poster,className:"threads-list-item-last-poster",title:interpolate(gettext("Last post by: %(poster)s"),{poster:t.last_poster.username},!0)},void 0,(0,s.Z)(Le.ZP,{size:32,user:t.last_poster})):(0,s.Z)("span",{className:"threads-list-item-last-poster",title:interpolate(gettext("Last post by: %(poster)s"),{poster:t.last_poster_name},!0)},void 0,ge||(ge=(0,s.Z)(Le.ZP,{size:32})))};var Oe,Te,Ae,Be,Ie,je,De,Me,Ue,ze,He={unsubscribe:null,notify:!1,email:!0},Fe=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;return(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"update",(function(e){var n=t.props.thread;t.setState({loading:!0}),F.Z.dispatch((0,j.r$)(n,{subscription:He[e]})),U.Z.patch(n.api.index,[{op:"replace",path:"subscription",value:e}]).then((function(){}),(function(e){F.Z.dispatch((0,j.r$)(n,{subscription:He[n.subscription]})),H.Z.apiError(e)})).then((function(){return t.setState({loading:!1})}))})),(0,d.Z)((0,r.Z)(t),"render",(function(){var e=t.state.loading,n=t.props,a=n.disabled,i=n.thread;return(0,s.Z)("ul",{className:"dropdown-menu dropdown-menu-right"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||null===i.subscription,onClick:function(){return t.update("unsubscribe")}},void 0,be||(be=(0,s.Z)("span",{className:"material-icon"},void 0,"star_border")),gettext("Unsubscribe"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||!1===i.subscription,onClick:function(){return t.update("notify")}},void 0,ye||(ye=(0,s.Z)("span",{className:"material-icon"},void 0,"star_half")),gettext("Subscribe with alert"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||!0===i.subscription,onClick:function(){return t.update("email")}},void 0,_e||(_e=(0,s.Z)("span",{className:"material-icon"},void 0,"star")),gettext("Subscribe with e-mail"))))})),t.state={loading:!1},t}return(0,o.Z)(p)}(h().Component),qe=function(e){var t,n=e.disabled,a=e.thread;return(0,s.Z)("div",{className:"dropdown"},void 0,(0,s.Z)("button",{className:"btn btn-default btn-icon",type:"button",title:(t=a.subscription,!0===t?gettext("Subscribed to e-mails"):!1===t?gettext("Subscribed to alerts"):gettext("Not subscribed")),disabled:n,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return!0===e?"star":!1===e?"star_half":"star_border"}(a.subscription))),(0,s.Z)(Fe,{disabled:n,thread:a}))},Ye=function(e){var t=e.activeCategory,n=e.categories,a=e.showOptions,i=e.showSubscription,o=e.thread,r=e.isBusy,l=e.isSelected,c=null,u=null;t.id!==o.category&&(u=n[o.category]).parent&&u.parent!==t.id&&n[u.parent]&&!n[u.parent].special_role&&(c=n[u.parent]);var d=o.is_closed||o.is_hidden||o.is_unapproved||o.weight>0||o.best_answer||o.has_poll||o.has_unapproved_posts,p=!a||o.is_new;return(0,s.Z)("li",{className:"list-group-item threads-list-item"+(r?" threads-list-item-is-busy":"")},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,a&&(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)(Ee,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("a",{href:o.url.index,className:"threads-list-item-title"},void 0,o.title),(0,s.Z)("a",{href:p?o.url.new_post:o.url.index,className:"threads-list-item-title-sm"+(p?" threads-list-item-title-new":"")},void 0,o.title)),a&&o.moderation.length>0&&(0,s.Z)("div",{className:"threads-list-item-col-checkbox-sm"},void 0,(0,s.Z)(Se,{checked:l,disabled:r,thread:o}))),(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,d&&(0,s.Z)("div",{className:"threads-list-item-col-flags"},void 0,(0,s.Z)(ke.Z,{thread:o})),!!u&&(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ce,{parent:c,category:u})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(xe.Z,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)(Pe,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)(we,{thread:o})),a&&i&&(0,s.Z)("div",{className:"threads-list-item-col-subscription"},void 0,(0,s.Z)(qe,{disabled:r,thread:o})),a&&o.moderation.length>0&&(0,s.Z)("div",{className:"threads-list-item-col-checkbox"},void 0,(0,s.Z)(Se,{checked:l,disabled:r,thread:o}))))},Ve=function(e){var t=e.width;return(0,s.Z)("span",{className:"ui-preview-text",style:{width:t+"px"}},void 0," ")},$e=function(e){var t=e.showOptions;return(0,s.Z)("div",{className:"threads-list threads-list-loader"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(Oe||(Oe=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Te||(Te=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"90"})," ",(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"90"})," ",(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"}))))),Ae||(Ae=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"70"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"50"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"50"})))))),(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(Be||(Be=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Ie||(Ie=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"30"})," ",(0,s.Z)(Ve,{width:"60"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"30"})," ",(0,s.Z)(Ve,{width:"60"}))))),je||(je=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"55"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"60"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"70"})))))),(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(De||(De=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Me||(Me=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"80"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"80"}))))),Ue||(Ue=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"75"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"40"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"60"}))))))))},Ge=function(e){var t=e.threads,n=e.onClick;return(0,s.Z)("li",{className:"list-group-item threads-list-update-prompt"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-block threads-list-update-prompt-btn",onClick:n},void 0,ze||(ze=(0,s.Z)("span",{className:"material-icon"},void 0,"cached")),(0,s.Z)("span",{className:"threads-list-update-prompt-message"},void 0,interpolate(ngettext("There is %(threads)s new or updated thread. Click here to show it.","There are %(threads)s new or updated threads. Click here to show them.",t),{threads:t},!0))))},We=function(e){var t=e.list,n=e.categories,a=e.category,i=e.threads,o=e.busyThreads,r=e.selection,l=e.isLoaded,c=e.showOptions,u=e.updatedThreads,d=e.applyUpdate,p=e.emptyMessage;return l?(0,s.Z)("div",{className:"threads-list"},void 0,i.length>0?(0,s.Z)("ul",{className:"list-group"},void 0,u>0&&(0,s.Z)(Ge,{threads:u,onClick:d}),i.map((function(e){return(0,s.Z)(Ye,{activeCategory:a,categories:n,thread:e,showOptions:c,showSubscription:c&&"subscribed"===t.type,isBusy:o.indexOf(e.id)>=0,isSelected:r.indexOf(e.id)>=0},e.id)}))):(0,s.Z)("ul",{className:"list-group"},void 0,u>0&&(0,s.Z)(Ge,{threads:u,onClick:d}),(0,s.Z)(Ne,{category:a,list:t,message:p}))):(0,s.Z)($e,{showOptions:c})},Ke=n(82125),Je=n(55547),Qe=n(53328),Xe=n(20370),et=n(99755);var tt=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadThreads(t.getCategory(),t.state.next)})),(0,d.Z)((0,r.Z)(t),"pollResponse",(function(e){var n,a,s;t.setState({diff:Object.assign({},e,{results:(n=t.props.threads,a=e.results,s={},n.forEach((function(e){s[e.id]=e})),a.filter((function(e){return!s[e.id]||function(e,t){return[e.title===t.title,e.weight===t.weight,e.category===t.category,e.last_post===t.last_post,e.last_poster_name===t.last_poster_name].indexOf(!1)>=0}(s[e.id],e)})))})})})),(0,d.Z)((0,r.Z)(t),"addThreads",(function(e){F.Z.dispatch((0,j.R3)(e,t.getSorting()))})),(0,d.Z)((0,r.Z)(t),"applyDiff",(function(){t.addThreads(t.state.diff.results),t.setState(Object.assign({},t.state.diff,{moderation:Ze(F.Z.getState().threads),diff:{results:[]}}))})),(0,d.Z)((0,r.Z)(t),"freezeThread",(function(e){t.setState((function(t){return{busyThreads:Xe.ZN(t.busyThreads,e)}}))})),(0,d.Z)((0,r.Z)(t),"updateThread",(function(e){F.Z.dispatch((0,j.r$)(e,e,t.getSorting()))})),(0,d.Z)((0,r.Z)(t),"deleteThread",(function(e){F.Z.dispatch((0,j.l8)(e))})),t.state={isMounted:!0,isLoaded:!1,isBusy:!1,diff:{results:[]},moderation:[],busyThreads:[],dropdown:!1,subcategories:[],next:0};var n=t.getCategory();return I.Z.has("THREADS")?t.initWithPreloadedData(n,I.Z.get("THREADS")):t.initWithoutPreloadedData(n),t}return(0,o.Z)(p,[{key:"getCategory",value:function(){return this.props.route.category.special_role?null:this.props.route.category.id}},{key:"initWithPreloadedData",value:function(e,t){this.state=Object.assign(this.state,{moderation:Ze(t.results),subcategories:t.subcategories,next:t.next}),this.startPolling(e)}},{key:"initWithoutPreloadedData",value:function(e){this.loadThreads(e)}},{key:"loadThreads",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;U.Z.get(this.props.options.api,{category:e,list:this.props.route.list.type,start:n||0},"threads").then((function(a){t.state.isMounted&&(0===n?F.Z.dispatch((0,j.ZB)(a.results)):F.Z.dispatch((0,j.R3)(a.results,t.getSorting())),t.setState({isLoaded:!0,isBusy:!1,moderation:Ze(F.Z.getState().threads),subcategories:a.subcategories,next:a.next}),t.startPolling(e))}),(function(e){H.Z.apiError(e)}))}},{key:"startPolling",value:function(e){Je.Z.start({poll:"threads",url:this.props.options.api,data:{category:e,list:this.props.route.list.type},frequency:12e4,update:this.pollResponse})}},{key:"componentDidMount",value:function(){this.setPageTitle(),I.Z.has("THREADS")&&(F.Z.dispatch((0,j.ZB)(I.Z.pop("THREADS").results)),this.setState({isLoaded:!0})),F.Z.dispatch(D.YP())}},{key:"componentWillUnmount",value:function(){this.state.isMounted=!1,Je.Z.stop("threads")}},{key:"getTitle",value:function(){return this.props.options.title?this.props.options.title:(e=this.props.route).category.level?e.category.name:I.Z.get("THREADS_ON_INDEX")?I.Z.get("SETTINGS").index_header?I.Z.get("SETTINGS").index_header:I.Z.get("SETTINGS").forum_name:gettext("Threads");var e}},{key:"setPageTitle",value:function(){var e;this.props.route.category.level||!I.Z.get("THREADS_ON_INDEX")?Qe.Z.set((e=this.props.route).category.level?e.list.path?{title:e.list.longName,parent:e.category.name}:{title:e.category.name}:I.Z.get("THREADS_ON_INDEX")?e.list.path?{title:e.list.longName}:null:e.list.path?{title:e.list.longName,parent:gettext("Threads")}:{title:gettext("Threads")}):this.props.options.title?Qe.Z.set(this.props.options.title):I.Z.get("SETTINGS").index_title?document.title=I.Z.get("SETTINGS").index_title:document.title=I.Z.get("SETTINGS").forum_name}},{key:"getSorting",value:function(){return this.props.route.category.level?Z:m}},{key:"getMoreButton",value:function(){return this.state.next?(0,s.Z)("div",{className:"pager-more"},void 0,(0,s.Z)(f.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy||this.state.busyThreads.length,onClick:this.loadMore},void 0,gettext("Show more"))):null}},{key:"getClassName",value:function(){var e,t="page page-threads";return t+=" page-threads-"+this.props.route.list.type,(e=this.props).route.category.level||!I.Z.get("THREADS_ON_INDEX")||e.options.title||(t+=" page-threads-index"),this.props.route.category.css_class&&(t+=" page-threads-"+this.props.route.category.css_class),t}},{key:"render",value:function(){var e=this.props.route.categories[0],t=this.props.route,n=t.category,a=t.list,i=n.special_role;return(0,s.Z)("div",{className:this.getClassName()},void 0,"root_category"==i&&I.Z.get("THREADS_ON_INDEX")&&I.Z.get("SETTINGS").index_header&&(0,s.Z)(et.Iv,{header:I.Z.get("SETTINGS").index_header,message:n.description&&(0,s.Z)(et.Ql,{message:n.description.html}),styleName:"forum-index"}),"root_category"==i&&!I.Z.get("THREADS_ON_INDEX")&&(0,s.Z)(et.Iv,{header:gettext("Threads"),styleName:"threads"}),"private_threads"==i&&(0,s.Z)(et.Iv,{header:this.props.options.title,message:this.props.options.pageLead&&(0,s.Z)(et.bM,{},void 0,(0,s.Z)("p",{},void 0,this.props.options.pageLead)),styleName:"private-threads"}),!i&&(0,s.Z)(et.Iv,{header:n.name,message:n.description&&(0,s.Z)(et.Ql,{message:n.description.html}),styleName:n.css_class||"category-threads"}),(0,s.Z)(ve,{api:this.props.options.api,root:e,route:this.props.route,user:this.props.user,pageLead:this.props.options.pageLead,threads:this.props.threads,threadsCount:this.state.count,moderation:this.state.moderation,selection:this.props.selection,busyThreads:this.state.busyThreads,addThreads:this.addThreads,startThread:this.props.options.startThread,freezeThread:this.freezeThread,deleteThread:this.deleteThread,updateThread:this.updateThread,isLoaded:this.state.isLoaded,isBusy:this.state.isBusy},void 0,(0,s.Z)(We,{category:n,categories:this.props.route.categoriesMap,list:a,selection:this.props.selection,threads:this.props.threads,updatedThreads:this.state.diff.results.length,applyUpdate:this.applyDiff,showOptions:!!this.props.user.id,isLoaded:this.state.isLoaded,busyThreads:this.state.busyThreads,emptyMessage:this.props.options.emptyMessage}),this.getMoreButton()))}}]),p}(Ke.Z);var nt=n(39633),at="misago:private-threads";function st(e){return e.get("CURRENT_LINK").substr(0,at.length)===at?{api:e.get("PRIVATE_THREADS_API"),startThread:{mode:"START_PRIVATE",submit:I.Z.get("PRIVATE_THREADS_API")},title:gettext("Private threads"),pageLead:gettext("Private threads are threads which only those that started them and those they have invited may see and participate in."),emptyMessage:gettext("You aren't participating in any private threads.")}:{api:e.get("THREADS_API")}}I.Z.addInitializer({name:"component:threads",initializer:function(e){var t,n,s,i,o;e.has("THREADS")&&e.has("CATEGORIES")&&(0,nt.Z)({paths:(t=e.get("user"),n=st(e),s=function(e){var t=[{type:"all",path:"",name:gettext("All"),longName:gettext("All threads")}];return e.id&&(t.push({type:"my",path:"my/",name:gettext("My"),longName:gettext("My threads")}),t.push({type:"new",path:"new/",name:gettext("New"),longName:gettext("New threads")}),t.push({type:"unread",path:"unread/",name:gettext("Unread"),longName:gettext("Unread threads")}),t.push({type:"subscribed",path:"subscribed/",name:gettext("Subscribed"),longName:gettext("Subscribed threads")}),e.acl.can_see_unapproved_content_lists&&t.push({type:"unapproved",path:"unapproved/",name:gettext("Unapproved"),longName:gettext("Unapproved content")})),t}(t),i=[],o={},I.Z.get("CATEGORIES").forEach((function(e){s.forEach((function(t){var r;o[e.id]=e,i.push({path:e.url.index+t.path,component:(0,a.$j)((r=n,function(e){return{options:r,selection:e.selection,threads:e.threads,tick:e.tick.tick,user:e.auth.user}}))(tt),categories:I.Z.get("CATEGORIES"),categoriesMap:o,category:e,lists:s,list:t})}))})),i)})},after:"store"})},47806:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588),p=n.n(d),h=n(19605),f=n(97326),v=n(4942),m=n(78657),Z=n(53904);function g(e){return e.filter((function(e){return e.results.count>0})).map((function(e){return Object.assign({},e,{count:e.results.count,results:e.results.results.slice(0,5)})}))}var b=n(87462),y="HEADER",_="RESULT",N="FOOTER";function k(e){var t=e.value,n=e.onChange;return(0,i.Z)("input",{"aria-haspopup":"true","aria-expanded":"false","aria-controls":"dropdown-menu dropdown-search-results",autoComplete:"off",className:"form-control",value:t,onChange:n,placeholder:gettext("Search"),role:"combobox",type:"text"})}function x(e){var t=e.children,n=e.onChange,a=e.query;return(0,i.Z)("ul",{className:"dropdown-menu dropdown-search-results",role:"menu"},void 0,(0,i.Z)("li",{className:"form-group"},void 0,(0,i.Z)(k,{value:a,onChange:n})),t)}function w(){return(0,i.Z)("li",{className:"dropdown-search-message"},void 0,gettext("Search returned no results."))}var R,C=n(37848);function S(e){return e.message,R||(R=(0,i.Z)("li",{className:"dropdown-search-loader"},void 0,(0,i.Z)(C.Z,{})))}function E(e){var t=e.provider,n=e.query,a=t.url+"?q="+encodeURI(n),s=ngettext('See full "%(provider)s" results page with %(count)s result.','See full "%(provider)s" results page with %(count)s results.',t.count);return(0,i.Z)("li",{className:"dropdown-search-footer"},void 0,(0,i.Z)("a",{href:a},void 0,interpolate(s,{count:t.count,provider:t.name},!0)))}function L(e){var t=e.provider;return(0,i.Z)("li",{className:"dropdown-search-header"},void 0,t.name)}var P,O,T,A=n(30381),B=n.n(A),I=n(19755);function j(e){var t=e.result,n=(t.poster,t.thread),a=gettext("Posted by %(poster)s on %(posted_on)s in %(category)s.");return(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:t.url.index,className:"dropdown-search-thread"},void 0,(0,i.Z)("h5",{},void 0,n.title),(0,i.Z)("small",{className:"dropdown-search-post-content"},void 0,I(t.content).text()),(0,i.Z)("small",{className:"dropdown-search-post-footer"},void 0,interpolate(a,{category:t.category.name,posted_on:B()(t.posted_on).format("LL"),poster:t.poster_name},!0))))}function D(e){var t=e.result,n=t.rank,a=gettext("%(title)s, joined on %(joined_on)s"),s=t.title||n.title||n.name;return(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:t.url,className:"dropdown-search-user"},void 0,(0,i.Z)("div",{className:"media"},void 0,(0,i.Z)("div",{className:"media-left"},void 0,(0,i.Z)(h.ZP,{size:38,user:t})),(0,i.Z)("div",{className:"media-body"},void 0,(0,i.Z)("h5",{className:"media-heading"},void 0,t.username),(0,i.Z)("small",{},void 0,interpolate(a,{title:s,joined_on:B()(t.joined_on).format("LL")},!0))))))}function M(e){var t=e.provider,n=e.result;return"threads"===t.id?(0,i.Z)(j,{result:n}):(0,i.Z)(D,{result:n})}function U(e){var t=e.provider,n=e.result,a=e.type,s=e.query;return a===y?(0,i.Z)(L,{provider:t}):a===N?(0,i.Z)(E,{provider:t,query:s}):(0,i.Z)(M,{provider:t,result:n})}function z(e,t){for(var n=e.results.length,a=0;a<n;a++){var s=e.results[a];t.push({provider:e,result:s,type:_})}t.push({provider:e,type:N})}function H(e){var t=e.isLoading,n=e.onChange,a=e.results,s=e.query;if(!s.trim().length)return(0,i.Z)(x,{onChange:n,query:s});if(a.length){var o=function(e){var t=[];return function(e,t){for(var n=e.length,a=0;a<n;a++){var s=e[a];t.push({provider:s,type:y}),z(s,t)}}(e,t),t}(a);return(0,i.Z)(x,{onChange:n,query:s},void 0,o.map((function(e){var t=e.type,n=e.provider,a=e.result;return t===_?p().createElement(U,(0,b.Z)({key:[n.id,t,a.id].join("_")},e)):p().createElement(U,(0,b.Z)({key:[n.id,t].join("_"),query:s},e))})))}return t?(0,i.Z)(x,{onChange:n,query:s},void 0,P||(P=(0,i.Z)(S,{}))):(0,i.Z)(x,{onChange:n,query:s},void 0,O||(O=(0,i.Z)(w,{})))}var F=function(e){(0,l.Z)(d,e);var t,n,a=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function d(){var e;return(0,o.Z)(this,d),e=a.call(this),(0,v.Z)((0,f.Z)(e),"onToggle",(function(t){e.setState((function(t,n){return t.isOpen||window.setTimeout((function(){e.container.querySelector("input").focus()}),100),{isOpen:!t.isOpen}}))})),(0,v.Z)((0,f.Z)(e),"onDocumentMouseDown",(function(t){for(var n=!0,a=t.target;null!==a&&a!==document;){if(a===e.container)return void(n=!1);a=a.parentNode}n&&e.setState({isOpen:!1})})),(0,v.Z)((0,f.Z)(e),"onEscape",(function(t){"Escape"===t.key&&e.setState({isOpen:!1})})),(0,v.Z)((0,f.Z)(e),"onChange",(function(t){var n=t.target.value;e.setState({query:n}),e.loadResults(n.trim())})),e.state={isLoading:!1,isOpen:!1,query:"",results:[]},e.intervalId=null,e}return(0,r.Z)(d,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("keydown",this.onEscape)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("keydown",this.onEscape)}},{key:"loadResults",value:function(e){var t=this;if(e.length){var n=300+300*Math.random();this.intervalId&&window.clearTimeout(this.intervalId),this.setState({isLoading:!0}),this.intervalId=window.setTimeout((function(){m.Z.get(s.Z.get("SEARCH_API"),{q:e}).then((function(e){t.setState({intervalId:null,isLoading:!1,results:g(e)})}),(function(e){Z.Z.apiError(e),t.setState({intervalId:null,isLoading:!1,results:[]})}))}),n)}}},{key:"render",value:function(){var e=this,t="navbar-search dropdown";return this.state.isOpen&&(t+=" open"),p().createElement("div",{className:t,ref:function(t){return e.container=t}},(0,i.Z)("a",{"aria-haspopup":"true","aria-expanded":"false",className:"navbar-icon","data-toggle":"dropdown",href:s.Z.get("SEARCH_URL"),onClick:this.onToggle},void 0,T||(T=(0,i.Z)("i",{className:"material-icon"},void 0,"search"))),(0,i.Z)(H,{isLoading:this.state.isLoading,onChange:this.onChange,results:this.state.results,query:this.state.query}))}}]),d}(p().Component),q=n(82211),Y=n(43345),V=n(96359),$=n(59940);var G,W,K,J=["progress-bar-danger","progress-bar-warning","progress-bar-warning","progress-bar-primary","progress-bar-success"],Q=[gettext("Entered password is very weak."),gettext("Entered password is weak."),gettext("Entered password is average."),gettext("Entered password is strong."),gettext("Entered password is very strong.")],X=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e))._score=0,t._password=null,t._inputs=[],t.state={loaded:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;$.Z.load().then((function(){e.setState({loaded:!0})}))}},{key:"getScore",value:function(e,t){var n=this,a=!1;return e!==this._password&&(a=!0),t.length!==this._inputs.length?a=!0:t.map((function(e,t){e.trim()!==n._inputs[t]&&(a=!0)})),a&&(this._score=$.Z.scorePassword(e,t),this._password=e,this._inputs=t.map((function(e){return e.trim()}))),this._score}},{key:"render",value:function(){if(!this.state.loaded)return null;var e=this.getScore(this.props.password,this.props.inputs);return(0,i.Z)("div",{className:"help-block password-strength"},void 0,(0,i.Z)("div",{className:"progress"},void 0,(0,i.Z)("div",{className:"progress-bar "+J[e],style:{width:20+20*e+"%"},role:"progress-bar","aria-valuenow":e,"aria-valuemin":"0","aria-valuemax":"4"},void 0,(0,i.Z)("span",{className:"sr-only"},void 0,Q[e]))),(0,i.Z)("p",{className:"text-small"},void 0,Q[e]))}}]),s}(p().Component),ee=n(26106),te=n(47235),ne=n(98274),ae=n(93825),se=n(59801),ie=n(93051),oe=n(55210);function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach((function(t){(0,v.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ue,de=function(e){(0,l.Z)(n,e);var t=ce(n);function n(e){var a;(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"handlePrivacyPolicyChange",(function(e){var t=e.target.value;a.handleToggleAgreement("privacyPolicy",t)})),(0,v.Z)((0,f.Z)(a),"handleTermsOfServiceChange",(function(e){var t=e.target.value;a.handleToggleAgreement("termsOfService",t)})),(0,v.Z)((0,f.Z)(a),"handleToggleAgreement",(function(e,t){a.setState((function(n,s){if(null===n[e]){var i=le(le({},n.errors),{},(0,v.Z)({},e,null));return(0,v.Z)({errors:i},e,t)}var o=a.state.validators[e][0],r=le(le({},n.errors),{},(0,v.Z)({},e,[o(null)]));return(0,v.Z)({errors:r},e,null)}))}));var i=a.props.criteria,r=i.username,l=i.password,c=0;l.forEach((function(e){"MinimumLengthValidator"===e.name&&(c=e.min_length)}));var u={username:[oe.lG(),oe.HR(r.min_length),oe.gS(r.max_length)],email:[oe.Do()],password:[oe.Vb(c)],captcha:ae.ZP.validator()};return s.Z.get("TERMS_OF_SERVICE_ID")&&(u.termsOfService=[oe.fT()]),s.Z.get("PRIVACY_POLICY_ID")&&(u.privacyPolicy=[oe.jA()]),a.state={isLoading:!1,username:"",email:"",password:"",captcha:"",termsOfService:null,privacyPolicy:null,validators:u,errors:{}},a}return(0,r.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(Z.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return m.Z.post(s.Z.get("USERS_API"),{username:this.state.username,email:this.state.email,password:this.state.password,captcha:this.state.captcha,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),e.__all__&&e.__all__.length>0?Z.Z.error(e.__all__[0]):Z.Z.error(gettext("Form contains errors."))):403===e.status&&e.ban?((0,ie.Z)(e.ban),se.Z.hide()):Z.Z.apiError(e)}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog modal-register",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,G||(G=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Register"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("input",{type:"type",style:{display:"none"}}),(0,i.Z)("input",{type:"password",style:{display:"none"}}),(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(te.Z,{buttonClassName:"col-xs-12 col-sm-6",buttonLabel:gettext("Join with %(site)s"),formLabel:gettext("Or create forum account:")}),(0,i.Z)(V.Z,{label:gettext("Username"),for:"id_username",validation:this.state.errors.username},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control","aria-describedby":"id_username_status",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username})),(0,i.Z)(V.Z,{label:gettext("E-mail"),for:"id_email",validation:this.state.errors.email},void 0,(0,i.Z)("input",{type:"text",id:"id_email",className:"form-control","aria-describedby":"id_email_status",disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email})),(0,i.Z)(V.Z,{label:gettext("Password"),for:"id_password",validation:this.state.errors.password,extra:(0,i.Z)(X,{password:this.state.password,inputs:[this.state.username,this.state.email]})},void 0,(0,i.Z)("input",{type:"password",id:"id_password",className:"form-control","aria-describedby":"id_password_status",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password})),ae.ZP.component({form:this}),(0,i.Z)(ee.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,i.Z)(q.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Register account"))))))}}]),n}(Y.Z),pe=function(e){(0,l.Z)(n,e);var t=ce(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"getLead",value:function(){return"user"===this.props.activation?gettext("%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===this.props.activation?gettext("%(username)s, your account has been created but board administrator will have to activate it before you will be able to sign in."):void 0}},{key:"getSubscript",value:function(){return"user"===this.props.activation?gettext("We have sent an e-mail to %(email)s with link that you have to click to activate your account."):"admin"===this.props.activation?gettext("We will send an e-mail to %(email)s when this takes place."):void 0}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog modal-message modal-register",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,W||(W=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Registration complete"))),(0,i.Z)("div",{className:"modal-body"},void 0,K||(K=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,interpolate(this.getLead(),{username:this.props.username},!0)),(0,i.Z)("p",{},void 0,interpolate(this.getSubscript(),{email:this.props.email},!0)),(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))))}}]),n}(p().Component),he=function(e){(0,l.Z)(n,e);var t=ce(n);function n(e){var a;return(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"completeRegistration",(function(e){"active"===e.activation?(se.Z.hide(),ne.Z.signIn(e)):a.setState({complete:e})})),a.state={complete:!1},a}return(0,r.Z)(n,[{key:"render",value:function(){return this.state.complete?(0,i.Z)(pe,{activation:this.state.complete.activation,email:this.state.complete.email,username:this.state.complete.username}):p().createElement(de,(0,b.Z)({callback:this.completeRegistration},this.props))}}]),n}(p().Component);var fe,ve,me=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"showRegisterForm",(function(){"closed"===misago.get("SETTINGS").account_activation?Z.Z.info(gettext("New registrations are currently disabled.")):t.state.isLoaded?se.Z.show((0,i.Z)(he,{criteria:t.state.criteria})):(t.setState({isLoading:!0}),Promise.all([ae.ZP.load(),m.Z.get(misago.get("AUTH_CRITERIA_API"))]).then((function(e){t.setState({isLoading:!1,isLoaded:!0,criteria:e[1]}),se.Z.show((0,i.Z)(he,{criteria:e[1]}))}),(function(){t.setState({isLoading:!1}),Z.Z.error(gettext("Registration is currently unavailable due to an error."))})))})),t.state={isLoading:!1,isLoaded:!1,criteria:null},t}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.className+(this.state.isLoading?" btn-loading":"")}},{key:"render",value:function(){return(0,i.Z)("button",{className:"btn "+this.getClassName(),disabled:this.state.isLoading,onClick:this.showRegisterForm,type:"button"},void 0,gettext("Register"),this.state.isLoading?ue||(ue=(0,i.Z)(C.Z,{})):null)}}]),s}(p().Component),Ze=n(14467),ge=n(8621);function be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ye,_e=function(e){(0,l.Z)(n,e);var t=be(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showSignInModal",value:function(){se.Z.show(Ze.Z)}},{key:"render",value:function(){return(0,i.Z)("ul",{className:"dropdown-menu user-dropdown dropdown-menu-right",role:"menu"},void 0,(0,i.Z)("li",{className:"guest-preview"},void 0,(0,i.Z)("h4",{},void 0,gettext("You are browsing as guest.")),(0,i.Z)("p",{},void 0,gettext("Sign in or register to start and participate in discussions.")),(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-xs-6"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-sign-in btn-block",onClick:this.showSignInModal,type:"button"},void 0,gettext("Sign in"))),(0,i.Z)("div",{className:"col-xs-6"},void 0,(0,i.Z)(me,{className:"btn-primary btn-register btn-block"},void 0,gettext("Register"))))))}}]),n}(p().Component),Ne=function(e){(0,l.Z)(n,e);var t=be(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return(0,i.Z)("div",{className:"nav nav-guest"},void 0,(0,i.Z)("button",{className:"btn navbar-btn btn-default btn-sign-in",onClick:this.showSignInModal,type:"button"},void 0,gettext("Sign in")),(0,i.Z)(me,{className:"navbar-btn btn-primary btn-register"},void 0,gettext("Register")),fe||(fe=(0,i.Z)("div",{className:"navbar-left"},void 0,(0,i.Z)(F,{}))))}}]),n}(_e),ke=function(e){(0,l.Z)(n,e);var t=be(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showGuestMenu",value:function(){ge.Z.show(_e)}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",onClick:this.showGuestMenu},void 0,ve||(ve=(0,i.Z)(h.ZP,{size:"64"})))}}]),n}(p().Component);var xe,we=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"setGravatar",(function(){t.callApi("gravatar")})),(0,v.Z)((0,f.Z)(t),"setGenerated",(function(){t.callApi("generated")})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"callApi",value:function(e){var t=this;if(this.state.isLoading)return!1;this.setState({isLoading:!0}),m.Z.post(this.props.user.api.avatar,{avatar:e}).then((function(e){t.setState({isLoading:!1}),Z.Z.success(e.detail),t.props.onComplete(e)}),(function(e){400===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))}},{key:"getGravatarButton",value:function(){return this.props.options.gravatar?(0,i.Z)(q.Z,{onClick:this.setGravatar,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-gravatar"},void 0,gettext("Download my Gravatar")):null}},{key:"getCropButton",value:function(){return this.props.options.crop_src?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-crop",disabled:this.state.isLoading,onClick:this.props.showCrop},void 0,gettext("Re-crop uploaded image")):null}},{key:"getUploadButton",value:function(){return this.props.options.upload?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-upload",disabled:this.state.isLoading,onClick:this.props.showUpload},void 0,gettext("Upload new image")):null}},{key:"getGalleryButton",value:function(){return this.props.options.galleries?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-gallery",disabled:this.state.isLoading,onClick:this.props.showGallery},void 0,gettext("Pick avatar from gallery")):null}},{key:"getAvatarPreview",value:function(){var e={id:this.props.user.id,avatars:this.props.options.avatars};return this.state.isLoading?(0,i.Z)("div",{className:"avatar-preview preview-loading"},void 0,(0,i.Z)(h.ZP,{size:"200",user:e}),ye||(ye=(0,i.Z)(C.Z,{}))):(0,i.Z)("div",{className:"avatar-preview"},void 0,(0,i.Z)(h.ZP,{size:"200",user:e}))}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-index"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-5"},void 0,this.getAvatarPreview()),(0,i.Z)("div",{className:"col-md-7"},void 0,this.getGravatarButton(),(0,i.Z)(q.Z,{onClick:this.setGenerated,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-generate"},void 0,gettext("Generate my individual avatar")),this.getCropButton(),this.getUploadButton(),this.getGalleryButton())))}}]),s}(p().Component),Re=n(19755);var Ce,Se=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"cropAvatar",(function(){if(t.state.isLoading)return!1;t.setState({isLoading:!0});var e=t.props.upload?"crop_tmp":"crop_src",n=Re(".crop-form"),a=n.cropit("exportZoom"),s=n.cropit("offset");m.Z.post(t.props.user.api.avatar,{avatar:e,crop:{offset:{x:s.x*a,y:s.y*a},zoom:n.cropit("zoom")*a}}).then((function(e){t.props.onComplete(e),Z.Z.success(e.detail)}),(function(e){400===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))})),t.state={isLoading:!1,deviceRatio:1},t}return(0,r.Z)(s,[{key:"getAvatarSize",value:function(){return this.props.upload?this.props.options.crop_tmp.size:this.props.options.crop_src.size}},{key:"getImagePath",value:function(){return this.props.upload?this.props.dataUrl:this.props.options.crop_src.url}},{key:"componentDidMount",value:function(){for(var e=this,t=Re(".crop-form"),n=this.getAvatarSize(),a=t.width();a<n;)n/=2;var s=this.getAvatarSize()/n;t.width(n),t.cropit({width:n,height:n,exportZoom:s,imageState:{src:this.getImagePath()},onImageLoaded:function(){if(e.props.upload){var n=t.cropit("zoom"),a=t.cropit("imageSize");if(a.width>a.height){var s=(a.width*n-e.getAvatarSize())/-2;t.cropit("offset",{x:s,y:0})}else if(a.width<a.height){var i=(a.height*n-e.getAvatarSize())/-2;t.cropit("offset",{x:0,y:i})}else t.cropit("offset",{x:0,y:0})}else{var o=e.props.options.crop_src.crop;o&&(t.cropit("zoom",o.zoom),t.cropit("offset",{x:o.x,y:o.y}))}}})}},{key:"componentWillUnmount",value:function(){Re(".crop-form").cropit("disable")}},{key:"render",value:function(){return(0,i.Z)("div",{},void 0,xe||(xe=(0,i.Z)("div",{className:"modal-body modal-avatar-crop"},void 0,(0,i.Z)("div",{className:"crop-form"},void 0,(0,i.Z)("div",{className:"cropit-preview"}),(0,i.Z)("input",{type:"range",className:"cropit-image-zoom-input"})))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.cropAvatar,loading:this.state.isLoading,className:"btn-primary btn-block"},void 0,this.props.upload?gettext("Set avatar"):gettext("Crop image")),(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:this.state.isLoading,className:"btn-default btn-block"},void 0,gettext("Cancel")))))}}]),s}(p().Component),Ee=n(48772);var Le,Pe=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"pickFile",(function(){document.getElementById("avatar-hidden-upload").click()})),(0,v.Z)((0,f.Z)(t),"uploadFile",(function(){var e=document.getElementById("avatar-hidden-upload").files[0];if(e){var n=t.validateFile(e);if(n)Z.Z.error(n);else{t.setState({image:e,preview:URL.createObjectURL(e),progress:0});var a=new FormData;a.append("avatar","upload"),a.append("image",e),m.Z.upload(t.props.user.api.avatar,a,(function(e){t.setState({progress:e})})).then((function(e){t.setState({options:e,uploaded:e.detail}),Z.Z.info(gettext("Your image has been uploaded and you may now crop it."))}),(function(e){400===e.status||413===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1,image:null,progress:0})):t.props.showError(e)}))}}})),t.state={image:null,preview:null,progress:0,uploaded:null,dataUrl:null},t}return(0,r.Z)(s,[{key:"validateFile",value:function(e){if(e.size>this.props.options.upload.limit)return interpolate(gettext("Selected file is too big. (%(filesize)s)"),{filesize:(0,Ee.Z)(e.size)},!0);var t=gettext("Selected file type is not supported.");if(-1===this.props.options.upload.allowed_mime_types.indexOf(e.type))return t;var n=!1,a=e.name.toLowerCase();return this.props.options.upload.allowed_extensions.map((function(e){a.substr(-1*e.length)===e&&(n=!0)})),!n&&t}},{key:"getUploadRequirements",value:function(e){var t=e.allowed_extensions.map((function(e){return e.substr(1)}));return interpolate(gettext("%(files)s files smaller than %(limit)s"),{files:t.join(", "),limit:(0,Ee.Z)(e.limit)},!0)}},{key:"getUploadButton",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,i.Z)(q.Z,{className:"btn-pick-file",onClick:this.pickFile},void 0,Ce||(Ce=(0,i.Z)("div",{className:"material-icon"},void 0,"input")),gettext("Select file")),(0,i.Z)("p",{className:"text-muted"},void 0,this.getUploadRequirements(this.props.options.upload)))}},{key:"getUploadProgressLabel",value:function(){return interpolate(gettext("%(progress)s % complete"),{progress:this.state.progress},!0)}},{key:"getUploadProgress",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,i.Z)("div",{className:"upload-progress"},void 0,(0,i.Z)("img",{src:this.state.preview}),(0,i.Z)("div",{className:"progress"},void 0,(0,i.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":"{this.state.progress}","aria-valuemin":"0","aria-valuemax":"100",style:{width:this.state.progress+"%"}},void 0,(0,i.Z)("span",{className:"sr-only"},void 0,this.getUploadProgressLabel())))))}},{key:"renderUpload",value:function(){return(0,i.Z)("div",{},void 0,(0,i.Z)("input",{type:"file",id:"avatar-hidden-upload",className:"hidden-file-upload",onChange:this.uploadFile}),this.state.image?this.getUploadProgress():this.getUploadButton(),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:!!this.state.image,className:"btn-default btn-block"},void 0,gettext("Cancel")))))}},{key:"renderCrop",value:function(){return(0,i.Z)(Se,{options:this.state.options,user:this.props.user,upload:this.state.uploaded,dataUrl:this.state.preview,onComplete:this.props.onComplete,showError:this.props.showError,showIndex:this.props.showIndex})}},{key:"render",value:function(){return this.state.uploaded?this.renderCrop():this.renderUpload()}}]),s}(p().Component),Oe=n(69130);function Te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var Ae,Be,Ie,je=function(e){(0,l.Z)(n,e);var t=Te(n);function n(){var e;(0,o.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,v.Z)((0,f.Z)(e),"select",(function(){e.props.select(e.props.id)})),e}return(0,r.Z)(n,[{key:"getClassName",value:function(){return this.props.selection===this.props.id?this.props.disabled?"btn btn-avatar btn-disabled avatar-selected":"btn btn-avatar avatar-selected":this.props.disabled?"btn btn-avatar btn-disabled":"btn btn-avatar"}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",className:this.getClassName(),disabled:this.props.disabled,onClick:this.select},void 0,(0,i.Z)("img",{src:this.props.url}))}}]),n}(p().Component),De=function(e){(0,l.Z)(n,e);var t=Te(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=this;return(0,i.Z)("div",{className:"avatars-gallery"},void 0,(0,i.Z)("h3",{},void 0,this.props.name),(0,i.Z)("div",{className:"avatars-gallery-images"},void 0,(0,Oe.Z)(this.props.images,4,null).map((function(t,n){return(0,i.Z)("div",{className:"row"},n,t.map((function(t,n){return(0,i.Z)("div",{className:"col-xs-3"},n,t?p().createElement(je,(0,b.Z)({disabled:e.props.disabled,select:e.props.select,selection:e.props.selection},t)):Le||(Le=(0,i.Z)("div",{className:"blank-avatar"})))})))}))))}}]),n}(p().Component),Me=function(e){(0,l.Z)(n,e);var t=Te(n);function n(e){var a;return(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"select",(function(e){a.setState({selection:e})})),(0,v.Z)((0,f.Z)(a),"save",(function(){if(a.state.isLoading)return!1;a.setState({isLoading:!0}),m.Z.post(a.props.user.api.avatar,{avatar:"galleries",image:a.state.selection}).then((function(e){a.setState({isLoading:!1}),Z.Z.success(e.detail),a.props.onComplete(e),a.props.showIndex()}),(function(e){400===e.status?(Z.Z.error(e.detail),a.setState({isLoading:!1})):a.props.showError(e)}))})),a.state={selection:null,isLoading:!1},a}return(0,r.Z)(n,[{key:"render",value:function(){var e=this;return(0,i.Z)("div",{},void 0,(0,i.Z)("div",{className:"modal-body modal-avatar-gallery"},void 0,this.props.options.galleries.map((function(t,n){return(0,i.Z)(De,{name:t.name,images:t.images,selection:e.state.selection,disabled:e.state.isLoading,select:e.select},n)}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.save,loading:this.state.isLoading,disabled:!this.state.selection,className:"btn-primary btn-block"},void 0,this.state.selection?gettext("Save choice"):gettext("Select avatar")),(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:this.state.isLoading,className:"btn-default btn-block"},void 0,gettext("Cancel"))))))}}]),n}(p().Component),Ue=n(3784),ze=n(6935),He=n(90287);function Fe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var qe,Ye,Ve,$e,Ge,We,Ke,Je,Qe,Xe,et,tt,nt=function(e){(0,l.Z)(n,e);var t=Fe(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"getErrorReason",value:function(){return this.props.reason?(0,i.Z)("p",{dangerouslySetInnerHTML:{__html:this.props.reason}}):null}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-body"},void 0,Ae||(Ae=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.props.message),this.getErrorReason(),(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}}]),n}(p().Component),at=function(e){(0,l.Z)(n,e);var t=Fe(n);function n(){var e;(0,o.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,v.Z)((0,f.Z)(e),"showError",(function(t){e.setState({error:t})})),(0,v.Z)((0,f.Z)(e),"showIndex",(function(){e.setState({component:we})})),(0,v.Z)((0,f.Z)(e),"showUpload",(function(){e.setState({component:Pe})})),(0,v.Z)((0,f.Z)(e),"showCrop",(function(){e.setState({component:Se})})),(0,v.Z)((0,f.Z)(e),"showGallery",(function(){e.setState({component:Me})})),(0,v.Z)((0,f.Z)(e),"completeFlow",(function(t){He.Z.dispatch((0,ze.n1)(e.props.user,t.avatars)),e.setState({component:we,options:t})})),e}return(0,r.Z)(n,[{key:"componentDidMount",value:function(){var e=this;m.Z.get(this.props.user.api.avatar).then((function(t){e.setState({component:we,options:t,error:null})}),(function(t){e.showError(t)}))}},{key:"getBody",value:function(){return this.state?this.state.error?(0,i.Z)(nt,{message:this.state.error.detail,reason:this.state.error.reason}):(0,i.Z)(this.state.component,{options:this.state.options,user:this.props.user,onComplete:this.completeFlow,showError:this.showError,showIndex:this.showIndex,showCrop:this.showCrop,showUpload:this.showUpload,showGallery:this.showGallery}):Be||(Be=(0,i.Z)(Ue.Z,{}))}},{key:"getClassName",value:function(){return this.state&&this.state.error?"modal-dialog modal-message modal-change-avatar":"modal-dialog modal-change-avatar"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,Ie||(Ie=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Change your avatar"))),this.getBody()))}}]),n}(p().Component);function st(e){return{user:e.auth.user}}function it(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ot=function(e){(0,l.Z)(n,e);var t=it(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"changeAvatar",value:function(){se.Z.show((0,a.$j)(st)(at))}},{key:"render",value:function(){var e=this.props.user;return(0,i.Z)("ul",{className:"dropdown-menu user-dropdown dropdown-menu-right",role:"menu"},void 0,(0,i.Z)("li",{className:"dropdown-header"},void 0,(0,i.Z)("strong",{},void 0,e.username),(0,i.Z)("div",{className:"row user-stats"},void 0,(0,i.Z)("div",{className:"col-sm-3"},void 0,qe||(qe=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),e.posts),(0,i.Z)("div",{className:"col-sm-3"},void 0,Ye||(Ye=(0,i.Z)("span",{className:"material-icon"},void 0,"forum")),e.threads),(0,i.Z)("div",{className:"col-sm-3"},void 0,Ve||(Ve=(0,i.Z)("span",{className:"material-icon"},void 0,"favorite")),e.followers),(0,i.Z)("div",{className:"col-sm-3"},void 0,$e||($e=(0,i.Z)("span",{className:"material-icon"},void 0,"favorite_outline")),e.following))),Ge||(Ge=(0,i.Z)("li",{className:"divider"})),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:e.url},void 0,We||(We=(0,i.Z)("span",{className:"material-icon"},void 0,"account_circle")),gettext("See your profile"))),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:s.Z.get("USERCP_URL")},void 0,Ke||(Ke=(0,i.Z)("span",{className:"material-icon"},void 0,"done_all")),gettext("Change options"))),(0,i.Z)("li",{},void 0,(0,i.Z)("button",{className:"btn-link",onClick:this.changeAvatar,type:"button"},void 0,Je||(Je=(0,i.Z)("span",{className:"material-icon"},void 0,"portrait")),gettext("Change avatar"))),!!e.acl.can_use_private_threads&&(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:s.Z.get("PRIVATE_THREADS_URL")},void 0,Qe||(Qe=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),gettext("Private threads"),(0,i.Z)(rt,{user:e}))),Xe||(Xe=(0,i.Z)("li",{className:"divider"})),(0,i.Z)("li",{className:"dropdown-buttons"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block",onClick:function(){return document.getElementById("hidden-logout-form").submit()},type:"button"},void 0,gettext("Log out"))))}}]),n}(p().Component);function rt(e){var t=e.user;return t.unread_private_threads?(0,i.Z)("span",{className:"badge"},void 0,t.unread_private_threads):null}function lt(e){var t=e.user;return(0,i.Z)("ul",{className:"ul nav navbar-nav nav-user"},void 0,et||(et=(0,i.Z)("li",{},void 0,(0,i.Z)(F,{}))),(0,i.Z)(ct,{user:t}),(0,i.Z)("li",{className:"dropdown"},void 0,(0,i.Z)("a",{"aria-haspopup":"true","aria-expanded":"false",className:"dropdown-toggle","data-toggle":"dropdown",href:t.url,role:"button"},void 0,(0,i.Z)(h.ZP,{user:t,size:"64"})),(0,i.Z)(ot,{user:t})))}function ct(e){var t=e.user;if(!t.acl.can_use_private_threads)return null;var n;return n=t.unread_private_threads?gettext("You have unread private threads!"):gettext("Private threads"),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{className:"navbar-icon",href:s.Z.get("PRIVATE_THREADS_URL"),title:n},void 0,tt||(tt=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),t.unread_private_threads>0&&(0,i.Z)("span",{className:"badge"},void 0,t.unread_private_threads)))}function ut(e){return{user:e.auth.user}}var dt,pt,ht=function(e){(0,l.Z)(n,e);var t=it(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showUserMenu",value:function(){ge.Z.showConnected("user-menu",(0,a.$j)(ut)(ot))}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",onClick:this.showUserMenu},void 0,(0,i.Z)(h.ZP,{user:this.props.user,size:"50"}))}}]),n}(p().Component);function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var vt=function(e){(0,l.Z)(n,e);var t=ft(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return this.props.isAuthenticated?(0,i.Z)(lt,{user:this.props.user}):dt||(dt=(0,i.Z)(Ne,{}))}}]),n}(p().Component),mt=function(e){(0,l.Z)(n,e);var t=ft(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return this.props.isAuthenticated?(0,i.Z)(ht,{user:this.props.user}):pt||(pt=(0,i.Z)(ke,{}))}}]),n}(p().Component);function Zt(e){return e.auth}var gt=n(4869);s.Z.addInitializer({name:"component:user-menu",initializer:function(){(0,gt.Z)((0,a.$j)(Zt)(vt),"user-menu-mount"),(0,gt.Z)((0,a.$j)(Zt)(mt),"user-menu-compact-mount")},after:"store"})},77031:function(e,t,n){"use strict";var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37424),h=n(97326),f=n(4942),v=n(59131),m=n(69987),Z=n(94417),g=function(e,t){var n=e;return"rank"===t.component?n+=t.slug:n+=t.component,n+"/"},b=function(e){var t=e.baseUrl,n=e.page,i=e.pages;return(0,s.Z)("div",{className:"nav-container"},void 0,(0,s.Z)("div",{className:"dropdown hidden-sm hidden-md hidden-lg"},void 0,(0,s.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,a||(a=(0,s.Z)("span",{className:"material-icon"},void 0,"menu")),n.name),(0,s.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,i.map((function(e){var n=g(t,e);return(0,s.Z)("li",{},n,(0,s.Z)(m.rU,{to:n},void 0,e.name))})))),(0,s.Z)("ul",{className:"nav nav-pills hidden-xs",role:"menu"},void 0,i.map((function(e){var n=g(t,e);return(0,s.Z)(Z.Z,{path:n},n,(0,s.Z)(m.rU,{to:n},void 0,e.name))}))))};var y,_,N=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getEmptyMessage",value:function(){return interpolate(gettext("No users have posted any new messages during last %(days)s days."),{days:this.props.trackedPeriod},!0)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead"},void 0,this.getEmptyMessage())))}}]),u}(d().Component),k=n(19605),x=n(44039);var w=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getClassName",value:function(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}},{key:"render",value:function(){return(0,s.Z)("li",{className:this.getClassName()},void 0,y||(y=(0,s.Z)("div",{className:"rank-user-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(k.ZP,{size:"50"})))),(0,s.Z)("div",{className:"rank-user"},void 0,(0,s.Z)("div",{className:"user-name"},void 0,(0,s.Z)("span",{className:"item-title"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,80)+"px"}},void 0," "))),(0,s.Z)("div",{className:"user-details"},void 0,(0,s.Z)("span",{className:"user-status"},void 0,_||(_=(0,s.Z)("span",{className:"status-icon ui-preview-text"},void 0," ")),(0,s.Z)("span",{className:"status-label ui-preview-text hidden-xs hidden-sm",style:{width:x.e(30,50)+"px"}},void 0," ")),(0,s.Z)("span",{className:"rank-name"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,50)+"px"}},void 0," ")),(0,s.Z)("span",{className:"user-title hidden-xs hidden-sm"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,50)+"px"}},void 0," "))),(0,s.Z)("div",{className:"user-compact-stats visible-xs-block"},void 0,(0,s.Z)("span",{className:"rank-position"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("span",{className:"rank-posts-counted"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))))),(0,s.Z)("div",{className:"rank-position hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("div",{className:"rank-posts-counted hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))),(0,s.Z)("div",{className:"rank-posts-total hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Total posts"))))}}]),u}(d().Component);var R,C=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead ui-preview"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(50,220)+"px"}},void 0," ")),(0,s.Z)("div",{className:"active-posters ui-preview"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((function(e){return(0,s.Z)(w,{hiddenOnMobile:e>0},e)}))))))}}]),u}(d().Component),S=n(24678),E=n(32233);var L=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getClassName",value:function(){return this.props.rank.css_class?"list-group-item list-group-rank-"+this.props.rank.css_class:"list-group-item"}},{key:"getUserStatus",value:function(){return this.props.user.status?(0,s.Z)(S.ZP,{user:this.props.user,status:this.props.user.status},void 0,(0,s.Z)(S.Jj,{user:this.props.user,status:this.props.user.status}),(0,s.Z)(S.pg,{user:this.props.user,status:this.props.user.status,className:"status-label hidden-xs hidden-sm"})):(0,s.Z)("span",{className:"user-status"},void 0,R||(R=(0,s.Z)("span",{className:"status-icon ui-preview-text"},void 0," ")),(0,s.Z)("span",{className:"status-label ui-preview-text hidden-xs hidden-sm",style:{width:x.e(30,50)+"px"}},void 0," "))}},{key:"getRankName",value:function(){if(!this.props.rank.is_tab)return(0,s.Z)("span",{className:"rank-name item-title"},void 0,this.props.rank.name);var e=E.Z.get("USERS_LIST_URL")+this.props.rank.slug+"/";return(0,s.Z)(m.rU,{to:e,className:"rank-name item-title"},void 0,this.props.rank.name)}},{key:"getUserTitle",value:function(){return this.props.user.title?(0,s.Z)("span",{className:"user-title hidden-xs hidden-sm"},void 0,this.props.user.title):null}},{key:"render",value:function(){return(0,s.Z)("li",{className:this.getClassName()},void 0,(0,s.Z)("div",{className:"rank-user-avatar"},void 0,(0,s.Z)("a",{href:this.props.user.url},void 0,(0,s.Z)(k.ZP,{user:this.props.user,size:50,size2x:64}))),(0,s.Z)("div",{className:"rank-user"},void 0,(0,s.Z)("div",{className:"user-name"},void 0,(0,s.Z)("a",{href:this.props.user.url,className:"item-title"},void 0,this.props.user.username)),(0,s.Z)("div",{className:"user-details"},void 0,this.getUserStatus(),this.getRankName(),this.getUserTitle()),(0,s.Z)("div",{className:"user-compact-stats visible-xs-block"},void 0,(0,s.Z)("span",{className:"rank-position"},void 0,(0,s.Z)("strong",{},void 0,"#",this.props.counter),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("span",{className:"rank-posts-counted"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.meta.score),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))))),(0,s.Z)("div",{className:"rank-position hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,"#",this.props.counter),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("div",{className:"rank-posts-counted hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.meta.score),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))),(0,s.Z)("div",{className:"rank-posts-total hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.posts),(0,s.Z)("small",{},void 0,gettext("Total posts"))))}}]),u}(d().Component);var P=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getLeadMessage",value:function(){var e=ngettext("%(posters)s top poster from last %(days)s days.","%(posters)s top posters from last %(days)s days.",this.props.count);return interpolate(e,{posters:this.props.count,days:this.props.trackedPeriod},!0)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead"},void 0,this.getLeadMessage()),(0,s.Z)("div",{className:"active-posters ui-ready"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,this.props.users.map((function(e,t){return(0,s.Z)(L,{user:e,rank:e.rank,counter:t+1},e.id)}))))))}}]),u}(d().Component),O=n(6935),T=n(55547),A=n(90287),B=n(53328);var I=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(e){var t;return(0,i.Z)(this,u),t=a.call(this,e),(0,f.Z)((0,h.Z)(t),"update",(function(e){A.Z.dispatch((0,O.ZB)(e.results)),t.setState({isLoaded:!0,trackedPeriod:e.tracked_period,count:e.count})})),E.Z.has("USERS")?t.initWithPreloadedData(E.Z.pop("USERS")):t.initWithoutPreloadedData(),t.startPolling(),t}return(0,o.Z)(u,[{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,trackedPeriod:e.tracked_period,count:e.count},A.Z.dispatch((0,O.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(){T.Z.start({poll:"active-posters",url:E.Z.get("USERS_API"),data:{list:"active"},frequency:9e4,update:this.update})}},{key:"componentDidMount",value:function(){B.Z.set({title:this.props.route.extra.name,parent:gettext("Users")})}},{key:"componentWillUnmount",value:function(){T.Z.stop("active-posters")}},{key:"render",value:function(){var e={name:this.props.route.extra.name};return this.state.isLoaded?this.state.count>0?(0,s.Z)(P,{page:e,users:this.props.users,trackedPeriod:this.state.trackedPeriod,count:this.state.count}):(0,s.Z)(N,{page:e,trackedPeriod:this.state.trackedPeriod}):(0,s.Z)(C,{page:e})}}]),u}(d().Component);var j,D=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getClassName",value:function(){return this.props.copy&&this.props.copy.length&&1===function(e,t){if(e=(e+"").toLowerCase(),(t=(t+"").toLowerCase()).length<=0)return 0;for(var n=0,a=0,s=t.length;(a=e.indexOf(t,a))>=0;)n+=1,a+=s;return n}(this.props.copy,"<p")&&-1===this.props.copy.indexOf("<br")?"page-lead lead":"page-lead"}},{key:"render",value:function(){return this.props.copy&&this.props.copy.length?(0,s.Z)("div",{className:this.getClassName(),dangerouslySetInnerHTML:{__html:this.props.copy}}):null}}]),u}(d().Component),M=n(40429),U=function(e){var t=e.users;return(0,s.Z)(M.Z,{cols:4,isReady:!0,showStatus:!0,users:t})};var z,H,F,q,Y,V,$,G,W,K=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){var e;(0,i.Z)(this,u);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,f.Z)((0,h.Z)(e),"render",(function(){return j||(j=(0,s.Z)(M.Z,{cols:4,isReady:!1}))})),e}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}}]),u}(d().Component),J=K,Q=n(92490),X=function(e){var t=e.users;return t.more?(0,s.Z)("p",{},void 0,interpolate(ngettext("There is %(more)s more member with this role.","There are %(more)s more members with this role.",t.more),{more:t.more},!0)):(0,s.Z)("p",{},void 0,gettext("There are no more members with this role."))},ee=function(e){var t=e.baseUrl,n=e.users;return(0,s.Z)("div",{className:"misago-pagination"},void 0,n.isLoaded&&n.first?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t,title:gettext("Go to first page")},void 0,z||(z=(0,s.Z)("span",{className:"material-icon"},void 0,"first_page"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to first page"),type:"button",disabled:!0},void 0,H||(H=(0,s.Z)("span",{className:"material-icon"},void 0,"first_page"))),n.isLoaded&&n.previous?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+(n.previous>1?n.previous+"/":""),title:gettext("Go to previous page")},void 0,F||(F=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_left"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to previous page"),type:"button",disabled:!0},void 0,q||(q=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_left"))),n.isLoaded&&n.next?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.next+"/",title:gettext("Go to next page")},void 0,Y||(Y=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_right"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to next page"),type:"button",disabled:!0},void 0,V||(V=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_right"))),n.isLoaded&&n.last?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.last+"/",title:gettext("Go to last page")},void 0,$||($=(0,s.Z)("span",{className:"material-icon"},void 0,"last_page"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to last page"),type:"button",disabled:!0},void 0,G||(G=(0,s.Z)("span",{className:"material-icon"},void 0,"last_page"))))},te=function(e){var t=e.baseUrl,n=e.users;return(0,s.Z)(Q.o8,{},void 0,(0,s.Z)(Q.Z2,{},void 0,(0,s.Z)(Q.Eg,{},void 0,(0,s.Z)(ee,{baseUrl:t,users:n}))),(0,s.Z)(Q.Z2,{auto:!0},void 0,(0,s.Z)(Q.Eg,{},void 0,(0,s.Z)(X,{users:n}))))};var ne=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(e){var t;return(0,i.Z)(this,u),t=a.call(this,e),(0,f.Z)((0,h.Z)(t),"update",(function(e){A.Z.dispatch((0,O.ZB)(e.results)),e.isLoaded=!0,t.setState(e)})),E.Z.has("USERS")?t.initWithPreloadedData(E.Z.pop("USERS")):t.initWithoutPreloadedData(),t.startPolling(e.params.page||1),t}return(0,o.Z)(u,[{key:"initWithPreloadedData",value:function(e){this.state=Object.assign(e,{isLoaded:!0}),A.Z.dispatch((0,O.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(e){T.Z.start({poll:"rank-users",url:E.Z.get("USERS_API"),data:{rank:this.props.route.rank.id,page:e},frequency:9e4,update:this.update})}},{key:"componentDidMount",value:function(){B.Z.set({title:this.props.route.rank.name,page:this.props.params.page||null,parent:gettext("Users")})}},{key:"componentWillUnmount",value:function(){T.Z.stop("rank-users")}},{key:"componentWillReceiveProps",value:function(e){this.props.params.page!==e.params.page&&(B.Z.set({title:this.props.route.rank.name,page:e.params.page||null,parent:gettext("Users")}),this.setState({isLoaded:!1}),T.Z.stop("rank-users"),this.startPolling(e.params.page))}},{key:"getClassName",value:function(){return this.props.route.rank.css_class?"rank-users-list rank-users-"+this.props.route.rank.css_class:"rank-users-list"}},{key:"getRankDescription",value:function(){return this.props.route.rank.description?(0,s.Z)("div",{className:"rank-description"},void 0,(0,s.Z)(D,{copy:this.props.route.rank.description.html})):null}},{key:"getComponent",value:function(){return this.state.isLoaded?this.state.count>0?(0,s.Z)(U,{users:this.props.users}):(0,s.Z)("p",{className:"lead"},void 0,gettext("There are no users with this rank at the moment.")):W||(W=(0,s.Z)(J,{}))}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName()},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:E.Z.get("USERS_LIST_URL"),page:{name:this.props.route.rank.name},pages:E.Z.get("USERS_LISTS")}),this.getRankDescription(),this.getComponent(),(0,s.Z)(te,{baseUrl:E.Z.get("USERS_LIST_URL")+this.props.route.rank.slug+"/",users:this.state})))}}]),u}(d().Component),ae=n(82125),se=n(99755);var ie=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"render",value:function(){return(0,s.Z)("div",{className:"page page-users-lists"},void 0,(0,s.Z)(se.sP,{},void 0,(0,s.Z)(se.mr,{styleName:"users-lists"},void 0,(0,s.Z)(se.gC,{styleName:"users-lists"},void 0,(0,s.Z)("h1",{},void 0,gettext("Users"))))),this.props.children)}}]),u}(ae.Z);function oe(e){return{tick:e.tick.tick,user:e.auth.user,users:e.users}}function re(){var e=[];return E.Z.get("USERS_LISTS").forEach((function(t){"rank"===t.component?(e.push({path:E.Z.get("USERS_LIST_URL")+t.slug+"/:page/",component:(0,p.$j)(oe)(ne),rank:t}),e.push({path:E.Z.get("USERS_LIST_URL")+t.slug+"/",component:(0,p.$j)(oe)(ne),rank:t})):"active-posters"===t.component&&e.push({path:E.Z.get("USERS_LIST_URL")+t.component+"/",component:(0,p.$j)(oe)(I),extra:{name:t.name}})})),e}var le=n(39633);E.Z.addInitializer({name:"component:users",initializer:function(e){e.has("USERS_LISTS")&&(0,le.Z)({root:E.Z.get("USERS_LIST_URL"),component:ie,paths:re()})},after:"store"})},97751:function(e,t,n){"use strict";var a=n(32233),s=n(96142);a.Z.addInitializer({name:"include",initializer:function(e){s.Z.init(e.get("STATIC_URL"))}})},76093:function(e,t,n){"use strict";var a=n(32233),s=n(62833);a.Z.addInitializer({name:"local-storage",initializer:function(){s.Z.init("misago_")}})},19764:function(e,t,n){"use strict";var a=n(32233),s=n(8621);a.Z.addInitializer({name:"dropdown",initializer:function(){var e=document.getElementById("mobile-navbar-dropdown-mount");e&&s.Z.init(e)},before:"store"})},47549:function(e,t,n){"use strict";var a=n(32233),s=n(59801);a.Z.addInitializer({name:"modal",initializer:function(){var e=document.getElementById("modal-mount");e&&s.Z.init(e)},before:"store"})},22331:function(e,t,n){"use strict";var a=n(30381),s=n.n(a),i=n(32233),o=n(19755);i.Z.addInitializer({name:"moment",initializer:function(){s().locale(o("html").attr("lang"))}})},21513:function(e,t,n){"use strict";var a=n(32233),s=n(53328);a.Z.addInitializer({name:"page-title",initializer:function(e){s.Z.init(e.get("SETTINGS").forum_index_title,e.get("SETTINGS").forum_name)}})},98749:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(53904),o=n(55547);a.Z.addInitializer({name:"polls",initializer:function(){o.Z.init(s.Z,i.Z)}})},98251:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(27950),o=n(53904);a.Z.addInitializer({name:"posting",initializer:function(){i.Z.init(s.Z,o.Z,document.getElementById("posting-placeholder"))}})},6720:function(e,t,n){"use strict";var a=n(32233),s=n(35486),i=n(90287);a.Z.addInitializer({name:"reducer:auth",initializer:function(e){i.Z.addReducer("auth",s.ZP,Object.assign({isAuthenticated:e.get("isAuthenticated"),isAnonymous:!e.get("isAuthenticated"),user:e.get("user")},s.E3))},before:"store"})},10846:function(e,t,n){"use strict";var a=n(32233),s=n(8154),i=n(90287);a.Z.addInitializer({name:"reducer:participants",initializer:function(){var e=null;a.Z.has("THREAD")&&(e=a.Z.get("THREAD").participants),i.Z.addReducer("participants",s.ZP,e||[])},before:"store"})},18255:function(e,t,n){"use strict";var a=n(32233),s=n(59752),i=n(90287);a.Z.addInitializer({name:"reducer:poll",initializer:function(){var e;e=a.Z.has("THREAD")&&a.Z.get("THREAD").poll?(0,s.ZB)(a.Z.get("THREAD").poll):{isBusy:!1},i.Z.addReducer("poll",s.ZP,e)},before:"store"})},14113:function(e,t,n){"use strict";var a=n(32233),s=n(21981),i=n(90287);a.Z.addInitializer({name:"reducer:posts",initializer:function(){var e;e=a.Z.has("POSTS")?(0,s.ZB)(a.Z.get("POSTS")):{isLoaded:!1,isBusy:!1},i.Z.addReducer("posts",s.ZP,e)},before:"store"})},24444:function(e,t,n){"use strict";var a=n(32233),s=n(58598),i=n(90287);a.Z.addInitializer({name:"reducer:profile-details",initializer:function(){var e=null;a.Z.has("PROFILE_DETAILS")&&(e=a.Z.get("PROFILE_DETAILS")),i.Z.addReducer("profile-details",s.ZP,e||{})},before:"store"})},1764:function(e,t,n){"use strict";var a=n(32233),s=n(27519),i=n(90287);a.Z.addInitializer({name:"reducer:profile-hydrate",initializer:function(){a.Z.has("PROFILE")&&i.Z.dispatch((0,s.ZB)(a.Z.get("PROFILE")))},after:"store"})},68351:function(e,t,n){"use strict";var a=n(32233),s=n(27519),i=n(90287);a.Z.addInitializer({name:"reducer:profile",initializer:function(){i.Z.addReducer("profile",s.ZP,{})},before:"store"})},81521:function(e,t,n){"use strict";var a=n(32233),s=n(16427),i=n(90287);a.Z.addInitializer({name:"reducer:search",initializer:function(){i.Z.addReducer("search",s.ZP,Object.assign({},s.E3,{providers:a.Z.get("SEARCH_PROVIDERS")||[],query:a.Z.get("SEARCH_QUERY")||""}))},before:"store"})},19984:function(e,t,n){"use strict";var a=n(32233),s=n(77751),i=n(90287);a.Z.addInitializer({name:"reducer:selection",initializer:function(){i.Z.addReducer("selection",s.ZP,[])},before:"store"})},41229:function(e,t,n){"use strict";var a=n(32233),s=n(27346),i=n(90287);a.Z.addInitializer({name:"reducer:snackbar",initializer:function(){i.Z.addReducer("snackbar",s.ZP,s.E3)},before:"store"})},43589:function(e,t,n){"use strict";var a=n(32233),s=n(7738),i=n(90287);a.Z.addInitializer({name:"reducer:thread",initializer:function(){var e;e=a.Z.has("THREAD")?(0,s.ZB)(a.Z.get("THREAD")):{isBusy:!1},i.Z.addReducer("thread",s.ZP,e)},before:"store"})},24108:function(e,t,n){"use strict";var a=n(32233),s=n(61340),i=n(90287);a.Z.addInitializer({name:"reducer:threads",initializer:function(){i.Z.addReducer("threads",s.ZP,[])},before:"store"})},33934:function(e,t,n){"use strict";var a=n(32233),s=n(85586),i=n(90287);a.Z.addInitializer({name:"reducer:tick",initializer:function(){i.Z.addReducer("tick",s.ZP,s.E3)},before:"store"})},85577:function(e,t,n){"use strict";var a=n(32233),s=n(48927),i=n(90287);a.Z.addInitializer({name:"reducer:username-history",initializer:function(){i.Z.addReducer("username-history",s.ZP,[])},before:"store"})},83526:function(e,t,n){"use strict";var a=n(32233),s=n(6935),i=n(90287);a.Z.addInitializer({name:"reducer:users",initializer:function(){i.Z.addReducer("users",s.ZP,[])},before:"store"})},43060:function(e,t,n){"use strict";var a=n(32233),s=n(53904),i=n(90287);a.Z.addInitializer({name:"snackbar",initializer:function(){s.Z.init(i.Z)},after:"store"})},92292:function(e,t,n){"use strict";var a=n(32233),s=n(90287);a.Z.addInitializer({name:"store",initializer:function(){s.Z.init()},before:"_end"})},33409:function(e,t,n){"use strict";var a=n(32233),s=n(85586),i=n(90287);a.Z.addInitializer({name:"tick-start",initializer:function(){window.setInterval((function(){i.Z.dispatch((0,s.bq)())}),5e4)},after:"store"})},31341:function(e,t,n){"use strict";var a=n(32233),s=n(96142),i=n(59940);a.Z.addInitializer({name:"zxcvbn",initializer:function(){i.Z.init(s.Z)}})},35486:function(e,t,n){"use strict";n.d(t,{E3:function(){return s},ZP:function(){return d},r$:function(){return l},w7:function(){return u},zB:function(){return c}});var a=n(6935),s={signedIn:!1,signedOut:!1},i="PATCH_USER",o="SIGN_IN",r="SIGN_OUT";function l(e){return{type:i,patch:e}}function c(e){return{type:o,user:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:r,soft:e}}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:var n=Object.assign({},e);return n.user=Object.assign({},e.user,t.patch),n;case o:return Object.assign({},e,{signedIn:t.user});case r:return Object.assign({},e,{isAuthenticated:!1,isAnonymous:!0,signedOut:!t.soft});case a.oB:if(e.isAuthenticated&&e.user.id===t.userId){var l=Object.assign({},e);return l.user=Object.assign({},e.user,{avatars:t.avatars}),l}return e;case a.D9:if(e.isAuthenticated&&e.user.id===t.userId){var c=Object.assign({},e);return c.user=Object.assign({},e.user,{username:t.username,slug:t.slug}),c}return e;default:return e}}},8154:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i},gx:function(){return s}});var a="REPLACE_PARTICIPANTS";function s(e){return{type:a,state:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===a?t.state:e}},59752:function(e,t,n){"use strict";n.d(t,{Ar:function(){return p},Od:function(){return f},ZB:function(){return u},ZH:function(){return r},ZP:function(){return v},b9:function(){return l},gx:function(){return h},n6:function(){return d}});var a=n(30381),s=n.n(a),i="BUSY_POLL",o="RELEASE_POLL",r="REMOVE_POLL",l="REPLACE_POLL",c="UPDATE_POLL";function u(e){var t=!1;for(var n in e.choices)if(e.choices[n].selected){t=!0;break}return Object.assign({},e,{posted_on:s()(e.posted_on),hasSelectedChoices:t,endsOn:e.length?s()(e.posted_on).add(e.length,"days"):null,isBusy:!1})}function d(){return{type:i}}function p(){return{type:o}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:u(e)}}function f(){return{type:r}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:return Object.assign({},e,{isBusy:!0});case o:return Object.assign({},e,{isBusy:!1});case r:return{isBusy:!1};case l:return t.state;case c:return Object.assign({},e,t.data);default:return e}}},92747:function(e,t,n){"use strict";n.d(t,{Qu:function(){return o},ZB:function(){return r},ZP:function(){return u},r$:function(){return c}});var a=n(30381),s=n.n(a),i=n(6935),o="PATCH_POST";function r(e){return Object.assign({},e,{posted_on:s()(e.posted_on),updated_on:s()(e.updated_on),hidden_on:s()(e.hidden_on),attachments:e.attachments?e.attachments.map(l):null,poster:e.poster?(0,i.Ru)(e.poster):null,isSelected:!1,isBusy:!1,isDeleted:!1})}function l(e){return Object.assign({},e,{uploaded_on:s()(e.uploaded_on)})}function c(e,t){return{type:o,post:e,patch:t}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===o&&e.id==t.post.id?Object.assign({},e,t.patch):e}},21981:function(e,t,n){"use strict";n.d(t,{R3:function(){return m},Rz:function(){return Z},Vx:function(){return g},Ys:function(){return d},ZB:function(){return f},ZP:function(){return b},_H:function(){return p},kR:function(){return h},zD:function(){return v}});var a=n(92747),s="APPEND_POSTS",i="SELECT_POST",o="DESELECT_POST",r="DESELECT_POSTS",l="LOAD_POSTS",c="UNLOAD_POSTS",u="UPDATE_POSTS";function d(e){return{type:i,post:e}}function p(e){return{type:o,post:e}}function h(){return{type:r}}function f(e){return Object.assign({},e,{results:e.results.map(a.ZB),isLoaded:!0,isBusy:!1,isSelected:!1})}function v(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:f(e)}}function m(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:s,state:t?e:f(e)}}function Z(){return{type:c}}function g(e){return{type:u,update:e}}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:var n=e.results.map((function(e){return e.id==t.post.id?Object.assign({},e,{isSelected:!0}):e}));return Object.assign({},e,{results:n});case o:var d=e.results.map((function(e){return e.id==t.post.id?Object.assign({},e,{isSelected:!1}):e}));return Object.assign({},e,{results:d});case r:var p=e.results.map((function(e){return Object.assign({},e,{isSelected:!1})}));return Object.assign({},e,{results:p});case s:var h=e.results.slice(),f=e.results.map((function(e){return e.id}));return t.state.results.map((function(e){-1===f.indexOf(e.id)&&h.push(e)})),Object.assign({},t.state,{results:h});case l:return t.state;case c:return Object.assign({},e,{isLoaded:!1});case u:return Object.assign({},e,t.update);case a.Qu:var v=e.results.map((function(e){return(0,a.ZP)(e,t)}));return Object.assign({},e,{results:v});default:return e}}},58598:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i},zD:function(){return s}});var a="LOAD_DETAILS";function s(e){return{type:a,newState:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===a?t.newState:e}},27519:function(e,t,n){"use strict";n.d(t,{ZB:function(){return l},ZP:function(){return u},r$:function(){return c}});var a=n(30381),s=n.n(a),i=n(6935),o="HYDRATE_PROFILE",r="PATCH_PROFILE";function l(e){return{type:o,profile:e}}function c(e){return{type:r,patch:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return Object.assign({},t.profile,{joined_on:s()(t.profile.joined_on),status:(0,i.$q)(t.profile.status)});case r:return Object.assign({},e,t.patch);case i.oB:return e.id===t.userId?Object.assign({},e,{avatars:t.avatars}):e;case i.D9:return e.id===t.userId?Object.assign({},e,{username:t.username,slug:t.slug}):e;default:return e}}},16427:function(e,t,n){"use strict";n.d(t,{E3:function(){return o},P0:function(){return l},Vx:function(){return r},ZP:function(){return c}});var a="REPLACE_SEARCH",s="UPDATE_SEARCH",i="UPDATE_SEARCH_PROVIDER",o={isLoading:!1,query:"",providers:[]};function r(e){return{type:s,update:e}}function l(e){return{type:i,provider:e}}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case a:return t.state;case s:return Object.assign({},e,t.update);case i:return Object.assign({},e,{providers:e.providers.map((function(e){return e.id===t.provider.id?t.provider:e}))});default:return e}}},77751:function(e,t,n){"use strict";n.d(t,{$6:function(){return r},YP:function(){return l},ZP:function(){return u},wc:function(){return c}});var a=n(20370),s="SELECT_ALL",i="SELECT_NONE",o="SELECT_ITEM";function r(e){return{type:s,items:e}}function l(){return{type:i}}function c(e){return{type:o,item:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case s:return t.items;case i:return[];case o:return(0,a.ZN)(e,t.item);default:return e}}},27346:function(e,t,n){"use strict";n.d(t,{E3:function(){return a},OV:function(){return o},ZP:function(){return l},p2:function(){return r}});var a={type:"info",message:"",isVisible:!1},s="SHOW_SNACKBAR",i="HIDE_SNACKBAR";function o(e,t){return{type:s,message:e,messageType:t}}function r(){return{type:i}}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===s?{type:t.messageType,message:t.message,isVisible:!0}:t.type===i?Object.assign({},e,{isVisible:!1}):e}},7738:function(e,t,n){"use strict";n.d(t,{Ar:function(){return h},Vx:function(){return v},ZB:function(){return d},ZP:function(){return Z},gx:function(){return f},n6:function(){return p},y8:function(){return m}});var a=n(30381),s=n.n(a),i=n(59752),o="BUSY_THREAD",r="RELEASE_THREAD",l="REPLACE_THREAD",c="UPDATE_THREAD",u="UPDATE_THREAD_ACL";function d(e){return Object.assign({},e,{started_on:s()(e.started_on),last_post_on:s()(e.last_post_on),best_answer_marked_on:e.best_answer_marked_on?s()(e.best_answer_marked_on):null,isBusy:!1})}function p(){return{type:o}}function h(){return{type:r}}function f(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:d(e)}}function v(e){return{type:c,data:e}}function m(e){return{type:u,data:e}}function Z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return Object.assign({},e,{isBusy:!0});case r:return Object.assign({},e,{isBusy:!1});case i.ZH:return Object.assign({},e,{poll:null});case i.b9:return Object.assign({},e,{poll:t.state});case l:return t.state;case c:return Object.assign({},e,t.data);case u:var n=Object.assign({},e.acl,t.data);return Object.assign({},e,{acl:n});default:return e}}},61340:function(e,t,n){"use strict";n.d(t,{R3:function(){return h},V8:function(){return v},ZB:function(){return m},ZP:function(){return b},l8:function(){return f},r$:function(){return Z}});var a=n(30381),s=n.n(a),i=n(89759),o="APPEND_THREADS",r="DELETE_THREAD",l="FILTER_THREADS",c="HYDRATE_THREADS",u="PATCH_THREAD",d="SORT_THREADS",p=["can_announce","can_approve","can_close","can_hide","can_move","can_merge","can_pin","can_review"];function h(e,t){return{type:o,items:e,sorting:t}}function f(e){return{type:r,thread:e}}function v(e,t){return{type:l,category:e,categoriesMap:t}}function m(e){return{type:c,items:e}}function Z(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return{type:u,thread:e,patch:t,sorting:n}}function g(e){return Object.assign({},e,{started_on:s()(e.started_on),last_post_on:s()(e.last_post_on),moderation:(t=e.acl,n=[],p.forEach((function(e){t[e]&&n.push(e)})),n)});var t,n}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:var n=(0,i.Z)(t.items.map(g),e);return n.sort(t.sorting);case r:return e.filter((function(e){return e.id!==t.thread.id}));case l:return e.filter((function(e){var n=t.categoriesMap[e.category];return n.lft>=t.category.lft&&n.rght<=t.category.rght||2==e.weight}));case c:return t.items.map(g);case u:var a=e.map((function(e){return e.id===t.thread.id?Object.assign({},e,t.patch):e}));return t.sorting?a.sort(t.sorting):a;case d:return e.sort(t.sorting);default:return e}}},85586:function(e,t,n){"use strict";n.d(t,{E3:function(){return a},ZP:function(){return o},bq:function(){return i}});var a={tick:0},s="TICK";function i(){return{type:s}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===s?Object.assign({},e,{tick:e.tick+1}):e}},48927:function(e,t,n){"use strict";n.d(t,{KP:function(){return u},R3:function(){return d},ZB:function(){return p},ZP:function(){return f}});var a=n(30381),s=n.n(a),i=n(6935),o=n(89759),r="ADD_NAME_CHANGE",l="APPEND_HISTORY",c="HYDRATE_HISTORY";function u(e,t,n){return{type:r,change:e,user:t,changedBy:n}}function d(e){return{type:l,items:e}}function p(e){return{type:c,items:e}}function h(e){return Object.assign({},e,{changed_on:s()(e.changed_on)})}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case r:var n=e.slice();return n.unshift({id:Math.floor(Date.now()/1e3),changed_by:t.changedBy,changed_by_username:t.changedBy.username,changed_on:s()(),new_username:t.change.username,old_username:t.user.username}),n;case l:return(0,o.Z)(e,t.items.map(h));case c:return t.items.map(h);case i.oB:return e.map((function(e){return(e=Object.assign({},e)).changed_by&&e.changed_by.id===t.userId&&(e.changed_by=Object.assign({},e.changed_by,{avatars:t.avatars})),e}));case i.D9:return e.map((function(e){return(e=Object.assign({},e)).changed_by&&e.changed_by.id===t.userId&&(e.changed_by=Object.assign({},e.changed_by,{username:t.username,slug:t.slug})),Object.assign({},e)}));default:return e}}},6935:function(e,t,n){"use strict";n.d(t,{$q:function(){return p},D9:function(){return c},R3:function(){return u},Ru:function(){return h},ZB:function(){return d},ZP:function(){return m},_S:function(){return v},n1:function(){return f},oB:function(){return l}});var a=n(30381),s=n.n(a),i=n(89759),o="APPEND_USERS",r="HYDRATE_USERS",l="UPDATE_AVATAR",c="UPDATE_USERNAME";function u(e){return{type:o,items:e}}function d(e){return{type:r,items:e}}function p(e){return e?Object.assign({},e,{last_click:e.last_click?s()(e.last_click):null,banned_until:e.banned_until?s()(e.banned_until):null}):null}function h(e){return Object.assign({},e,{joined_on:s()(e.joined_on),status:p(e.status)})}function f(e,t){return{type:l,userId:e.id,avatars:t}}function v(e,t,n){return{type:c,userId:e.id,username:t,slug:n}}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return(0,i.Z)(e,t.items.map(h));case r:return t.items.map(h);case l:return e.map((function(e){return(e=Object.assign({},e)).id===t.userId&&(e.avatars=t.avatars),e}));default:return e}}},78657:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(19755),o=function(){function e(){(0,a.Z)(this,e),this._cookieName=null,this._csrfToken=null,this._locks={}}return(0,s.Z)(e,[{key:"init",value:function(e){this._cookieName=e}},{key:"getCsrfToken",value:function(){if(-1!==document.cookie.indexOf(this._cookieName)){var e=new RegExp(this._cookieName+"=([^;]*)"),t=document.cookie.match(e)[0];return t?t.split("=")[1]:null}return null}},{key:"request",value:function(e,t,n){var a=this;return new Promise((function(s,o){var r={url:t,method:e,headers:{"X-CSRFToken":a.getCsrfToken()},data:n?JSON.stringify(n):null,contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){s(e)},error:function(e){var t=e.responseJSON||{};t.status=e.status,0===t.status&&(t.detail=gettext("Lost connection with application.")),404===t.status&&(t.detail&&"NOT FOUND"!==t.detail||(t.detail=gettext("Action link is invalid."))),500!==t.status||t.detail||(t.detail=gettext("Unknown error has occured.")),t.statusText=e.statusText,o(t)}};i.ajax(r)}))}},{key:"get",value:function(e,t,n){if(t&&(e+="?"+i.param(t)),n){var a=this;return this._locks[n]&&(this._locks[n].url=e),this._locks[n]&&this._locks[n].waiter?{then:function(){}}:this._locks[n]&&this._locks[n].wait?(this._locks[n].waiter=!0,new Promise((function(t,s){var i=function e(i){a._locks[n].wait?window.setTimeout((function(){e(i)}),300):a._locks[n].url!==i?e(a._locks[n].url):(a._locks[n].waiter=!1,a.request("GET",a._locks[n].url).then((function(s){a._locks[n].url===i?t(s):(a._locks[n].waiter=!0,e(a._locks[n].url))}),(function(t){a._locks[n].url===i?s(t):(a._locks[n].waiter=!0,e(a._locks[n].url))})))};window.setTimeout((function(){i(e)}),300)}))):(this._locks[n]={url:e,wait:!0,waiter:!1},new Promise((function(t,s){a.request("GET",e).then((function(s){a._locks[n].wait=!1,a._locks[n].url===e&&t(s)}),(function(t){a._locks[n].wait=!1,a._locks[n].url===e&&s(t)}))})))}return this.request("GET",e)}},{key:"post",value:function(e,t){return this.request("POST",e,t)}},{key:"patch",value:function(e,t){return this.request("PATCH",e,t)}},{key:"put",value:function(e,t){return this.request("PUT",e,t)}},{key:"delete",value:function(e,t){return this.request("DELETE",e,t)}},{key:"upload",value:function(e,t,n){var a=this;return new Promise((function(s,o){var r={url:e,method:"POST",headers:{"X-CSRFToken":a.getCsrfToken()},data:t,contentType:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",(function(e){e.lengthComputable&&n(Math.round(e.loaded/e.total*100))}),!1),e},success:function(e){s(e)},error:function(e){var t=e.responseJSON||{};t.status=e.status,0===t.status&&(t.detail=gettext("Lost connection with application.")),413!==t.status||t.detail||(t.detail=gettext("Upload was rejected by server as too large.")),404===t.status&&(t.detail&&"NOT FOUND"!==t.detail||(t.detail=gettext("Action link is invalid."))),500!==t.status||t.detail||(t.detail=gettext("Unknown error has occured.")),t.statusText=e.statusText,o(t)}};i.ajax(r)}))}}]),e}();t.Z=new o},98274:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(35486),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t,n){this._store=e,this._local=t,this._modal=n,this.syncSession(),this.watchState()}},{key:"syncSession",value:function(){var e=this._store.getState().auth;e.isAuthenticated?this._local.set("auth",{isAuthenticated:!0,username:e.user.username}):this._local.set("auth",{isAuthenticated:!1})}},{key:"watchState",value:function(){var e=this,t=this._store.getState().auth;this._local.watch("auth",(function(n){n.isAuthenticated?e._store.dispatch((0,i.zB)({username:n.username})):t.isAuthenticated&&e._store.dispatch((0,i.w7)())})),this._modal.hide()}},{key:"signIn",value:function(e){this._store.dispatch((0,i.zB)(e)),this._local.set("auth",{isAuthenticated:!0,username:e.username}),this._modal.hide()}},{key:"signOut",value:function(){this._store.dispatch((0,i.w7)()),this._local.set("auth",{isAuthenticated:!1}),this._modal.hide()}},{key:"softSignOut",value:function(){this._store.dispatch((0,i.w7)(!0)),this._local.set("auth",{isAuthenticated:!1}),this._modal.hide()}}]),e}();t.Z=new o},93825:function(e,t,n){"use strict";var a,s=n(22928),i=n(79340),o=n(6215),r=n(61120),l=n(15671),c=n(43144),u=n(57588),d=n.n(u),p=n(96359);function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,r.Z)(e);if(t){var s=(0,r.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,o.Z)(this,n)}}var f=function(){function e(){(0,l.Z)(this,e)}return(0,c.Z)(e,[{key:"init",value:function(e,t,n,a){this._context=e,this._ajax=t,this._include=n,this._snackbar=a}}]),e}(),v=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){return new Promise((function(e){e()}))}},{key:"validator",value:function(){return null}},{key:"component",value:function(){return null}}]),n}(f),m=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){var e=this;return new Promise((function(t,n){e._ajax.get(e._context.get("CAPTCHA_API")).then((function(n){e.question=n.question,e.helpText=n.help_text,t()}),(function(){e._snackbar.error(gettext("Failed to load CAPTCHA.")),n()}))}))}},{key:"validator",value:function(){return[]}},{key:"component",value:function(e){return(0,s.Z)(p.Z,{label:this.question,for:"id_captcha",labelClass:e.labelClass||"",controlClass:e.controlClass||"",validation:e.form.state.errors.captcha,helpText:this.helpText||null},void 0,(0,s.Z)("input",{"aria-describedby":"id_captcha_status",className:"form-control",disabled:e.form.state.isLoading,id:"id_captcha",onChange:e.form.bindInput("captcha"),type:"text",value:e.form.state.captcha}))}}]),n}(f),Z=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"componentDidMount",value:function(){var e=this;grecaptcha.render("recaptcha",{sitekey:this.props.siteKey,callback:function(t){e.props.binding({target:{value:t}})}})}},{key:"render",value:function(){return a||(a=(0,s.Z)("div",{id:"recaptcha"}))}}]),n}(d().Component),g=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){return this._include.include("https://www.google.com/recaptcha/api.js",!0),new Promise((function(e){!function t(){"undefined"==typeof grecaptcha?window.setTimeout((function(){t()}),200):e()}()}))}},{key:"validator",value:function(){return[]}},{key:"component",value:function(e){return(0,s.Z)(p.Z,{label:gettext("Please solve the quick test"),for:"id_captcha",labelClass:e.labelClass||"",controlClass:e.controlClass||"",validation:e.form.state.errors.captcha,helpText:gettext("This test helps us prevent automated spam registrations on our site.")},void 0,(0,s.Z)(Z,{binding:e.form.bindInput("captcha"),siteKey:this._context.get("SETTINGS").recaptcha_site_key}))}}]),n}(f),b=function(){function e(){(0,l.Z)(this,e)}return(0,c.Z)(e,[{key:"init",value:function(e,t,n,a){switch(e.get("SETTINGS").captcha_type){case"no":this._captcha=new v;break;case"qa":this._captcha=new m;break;case"re":this._captcha=new g}this._captcha.init(e,t,n,a)}},{key:"load",value:function(){return this._captcha.load()}},{key:"validator",value:function(){return this._captcha.validator()}},{key:"component",value:function(e){return this._captcha.component(e)}}]),e}();t.ZP=new b},96142:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(19755),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._staticUrl=e,this._included=[]}},{key:"include",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];-1===this._included.indexOf(e)&&(this._included.push(e),this._include(e,t))}},{key:"_include",value:function(e,t){i.ajax({url:(t?"":this._staticUrl)+e,cache:!0,dataType:"script"})}}]),e}();t.Z=new o},62833:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=window.localStorage,o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){var t=this;this._prefix=e,this._watchers=[],window.addEventListener("storage",(function(e){var n=JSON.parse(e.newValue);t._watchers.forEach((function(t){t.key===e.key&&e.oldValue!==e.newValue&&t.callback(n)}))}))}},{key:"set",value:function(e,t){i.setItem(this._prefix+e,JSON.stringify(t))}},{key:"get",value:function(e){var t=i.getItem(this._prefix+e);return t?JSON.parse(t):null}},{key:"watch",value:function(e,t){this._watchers.push({key:this._prefix+e,callback:t})}}]),e}();t.Z=new o},8621:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(4869),o=n(19755),r=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._element=e,this._component=null}},{key:"show",value:function(e){this._component===e?this.hide():(this._component=e,(0,i.Z)(e,this._element.id),o(this._element).addClass("open"))}},{key:"showConnected",value:function(e,t){this._component===e?this.hide():(this._component=e,(0,i.Z)(t,this._element.id,!0),o(this._element).addClass("open"))}},{key:"hide",value:function(){o(this._element).removeClass("open"),this._component=null}}]),e}();t.Z=new r},59801:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(73935),o=n.n(i),r=n(4869),l=n(19755),c=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){var t=this;this._element=e,this._modal=l(e).modal({show:!1}),this._modal.on("hidden.bs.modal",(function(){o().unmountComponentAtNode(t._element)}))}},{key:"show",value:function(e){(0,r.Z)(e,this._element.id),this._modal.modal("show")}},{key:"hide",value:function(){this._modal.modal("hide")}}]),e}();t.Z=new c},53328:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t){this._indexTitle=e,this._forumName=t}},{key:"set",value:function(e){if(e){"string"==typeof e&&(e={title:e});var t=e.title;e.page>1&&(t+=" ("+interpolate(gettext("page: %(page)s"),{page:e.page},!0)+")"),e.parent&&(t+=" | "+e.parent),document.title=t+" | "+this._forumName}else document.title=this._indexTitle||this._forumName}}]),e}();t.Z=new i},55547:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t){this._ajax=e,this._snackbar=t,this._polls={}}},{key:"start",value:function(e){var t=this;this.stop(e.poll);var n=function n(){t._polls[e.poll]=e,t._ajax.get(e.url,e.data||null).then((function(a){t._polls[e.poll]._stopped||(e.update(a),t._polls[e.poll].timeout=window.setTimeout(n,e.frequency))}),(function(n){t._polls[e.poll]._stopped||(e.error?e.error(n):t._snackbar.apiError(n))}))};e.delayed?this._polls[e.poll]={timeout:window.setTimeout(n,e.frequency)}:n()}},{key:"stop",value:function(e){this._polls[e]&&(window.clearTimeout(this._polls[e].timeout),this._polls[e]._stopped=!0)}}]),e}();t.Z=new i},27950:function(e,t,n){"use strict";n.d(t,{Z:function(){return ft}});var a=n(15671),s=n(43144),i=n(4942),o=n(57588),r=n.n(o),l=n(73935),c=n.n(l),u=n(91876),d=n(22928),p=n(97326),h=n(79340),f=n(6215),v=n(61120),m=n(57026),Z=n(87462);var g,b,y,_=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){e.props.replaceSelection(e.props.execAction)})),e}return(0,s.Z)(r,[{key:"render",value:function(){return(0,d.Z)("button",{className:"btn btn-icon "+this.props.className,disabled:this.props.disabled,onClick:this.onClick,title:this.props.title,type:"button"},void 0,this.props.children)}}]),r}(r().Component),N=n(19755);function k(e){return r().createElement(_,(0,Z.Z)({execAction:x,title:gettext("Insert code")},e),g||(g=(0,d.Z)("span",{className:"material-icon"},void 0,"functions")))}function x(e,t){t("\n\n```"+N.trim(prompt(gettext("Enter name of syntax of your code (optional)")+":"))+"\n"+e+"\n```\n\n")}function w(e){return r().createElement(_,(0,Z.Z)({execAction:R,title:gettext("Emphase selection")},e),b||(b=(0,d.Z)("span",{className:"material-icon"},void 0,"format_italic")))}function R(e,t){e.length&&t("*"+e+"*")}function C(e){return r().createElement(_,(0,Z.Z)({execAction:S,title:gettext("Insert horizontal ruler")},e),y||(y=(0,d.Z)("span",{className:"material-icon"},void 0,"remove")))}function S(e,t){t("\n\n- - - - -\n\n")}var E=n(19755),L=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");function P(e){return L.test(E.trim(e))}var O,T=n(19755);function A(e){return r().createElement(_,(0,Z.Z)({execAction:B,title:gettext("Insert image")},e),O||(O=(0,d.Z)("span",{className:"material-icon"},void 0,"insert_photo")))}function B(e,t){var n="",a="";e.length&&(P(e)?n=e:a=e),(n=T.trim(prompt(gettext("Enter link to image")+":",n))).length&&((a=T.trim(prompt(gettext("Enter image label (optional)")+":",a))).length>0?t("!["+a+"]("+n+")"):t("!("+n+")"))}var I,j,D,M,U=n(19755);function z(e){return r().createElement(_,(0,Z.Z)({execAction:H,title:gettext("Insert link")},e),I||(I=(0,d.Z)("span",{className:"material-icon"},void 0,"insert_link")))}function H(e,t){var n="",a="";if(e.length&&(P(e)?n=e:a=e),0===(n=U.trim(prompt(gettext("Enter link address")+":",n)||"")).length)return!1;a=U.trim(prompt(gettext("Enter link label (optional)")+":",a)),n.length&&(a.length>0?t("["+a+"]("+n+")"):t(n))}function F(e){return r().createElement(_,(0,Z.Z)({execAction:q,title:gettext("Insert spoiler")},e),j||(j=(0,d.Z)("span",{className:"material-icon"},void 0,"not_interested")))}function q(e,t){t("\n\n[spoiler]\n"+e+"\n[/spoiler]\n\n")}function Y(e){return r().createElement(_,(0,Z.Z)({execAction:V,title:gettext("Strikethrough selection")},e),D||(D=(0,d.Z)("span",{className:"material-icon"},void 0,"format_strikethrough")))}function V(e,t){e.length&&t("~~"+e+"~~")}function $(e){return r().createElement(_,(0,Z.Z)({execAction:G,title:gettext("Bolder selection")},e),M||(M=(0,d.Z)("span",{className:"material-icon"},void 0,"format_bold")))}function G(e,t){e.length&&t("**"+e+"**")}var W,K=n(19755);function J(e){return r().createElement(_,(0,Z.Z)({execAction:Q,title:gettext("Insert quote")},e),W||(W=(0,d.Z)("span",{className:"material-icon"},void 0,"format_quote")))}function Q(e,t){var n=K.trim(prompt(gettext("Enter quote autor, prefix usernames with @")+":",n));t(n?'\n\n[quote="'+n+'"]\n'+e+"\n[/quote]\n\n":"\n\n[quote]\n"+e+"\n[/quote]\n\n")}var X,ee=n(32233),te=n(89627),ne=n(48772);var ae,se=function(e){(0,h.Z)(l,e);var t,n,o=(t=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function l(){var e;(0,a.Z)(this,l);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onInsert",(function(){e.props.replaceSelection(e.insertAttachment)})),(0,i.Z)((0,p.Z)(e),"insertAttachment",(function(t,n){var a=e.props.item;a.is_image?a.url.thumb?n("[!["+a.filename+"]("+a.url.thumb+")]("+a.url.index+")"):n("[!["+a.filename+"]("+a.url.index+")]("+a.url.index+")"):n("["+a.filename+"]("+a.url.index+")")})),(0,i.Z)((0,p.Z)(e),"onRemove",(function(){e.updateItem({isRemoved:!0})})),(0,i.Z)((0,p.Z)(e),"onUndo",(function(){e.updateItem({isRemoved:!1})})),(0,i.Z)((0,p.Z)(e),"updateItem",(function(t){var n=e.props.attachments.map((function(n){return n.id===e.props.item.id?Object.assign({},n,t):n}));e.props.onAttachmentsChange(n)})),e}return(0,s.Z)(l,[{key:"render",value:function(){return(0,d.Z)("li",{className:"editor-attachment-complete"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-xs-12 col-sm-8 col-md-9"},void 0,r().createElement(ie,this.props),(0,d.Z)("div",{className:"editor-attachment-details"},void 0,r().createElement(le,this.props),r().createElement(ce,this.props))),(0,d.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3 xs-margin-top-half"},void 0,r().createElement(ue,(0,Z.Z)({onInsert:this.onInsert,onRemove:this.onRemove,onUndo:this.onUndo},this.props)))))}}]),l}(r().Component);function ie(e){return e.item.is_image?r().createElement(oe,e):r().createElement(re,e)}function oe(e){var t=e.item.url.thumb||e.item.url.index;return(0,d.Z)("div",{className:"editor-attachment-image"},void 0,(0,d.Z)("a",{href:e.item.url.index+"?shva=1",style:{backgroundImage:"url('"+t+"?shva=1')"},target:"_blank"}))}function re(e){return X||(X=(0,d.Z)("div",{className:"editor-attachment-icon"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,"insert_drive_file")))}function le(e){return(0,d.Z)("h4",{},void 0,(0,d.Z)("a",{className:"item-title",href:e.item.url.index+"?shva=1",target:"_blank"},void 0,e.item.filename))}function ce(e){var t;t=e.item.url.uploader?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,te.Z)(e.item.url.uploader),user:(0,te.Z)(e.item.uploader_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,te.Z)(e.item.uploader_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,te.Z)(e.item.uploaded_on.format("LLL")),relative:(0,te.Z)(e.item.uploaded_on.fromNow())},!0),a=interpolate((0,te.Z)(gettext("%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.item.filetype,size:(0,ne.Z)(e.item.size),uploader:t,uploaded_on:n},!0);return(0,d.Z)("p",{dangerouslySetInnerHTML:{__html:a}})}function ue(e){return(0,d.Z)("div",{className:"editor-attachment-actions"},void 0,(0,d.Z)("div",{className:"row"},void 0,r().createElement(de,e),r().createElement(pe,e),r().createElement(he,e)))}function de(e){return e.item.isRemoved?null:(0,d.Z)("div",{className:"col-xs-6"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onInsert,type:"button"},void 0,gettext("Insert")))}function pe(e){return e.item.isRemoved&&e.item.acl.can_delete?null:(0,d.Z)("div",{className:"col-xs-6"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onRemove,type:"button"},void 0,gettext("Remove")))}function he(e){return e.item.isRemoved?(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onUndo,type:"button"},void 0,gettext("Undo removal"))):null}var fe=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){var t=e.props.attachments.filter((function(t){return t.key!==e.props.item.key}));e.props.onAttachmentsChange(t)})),e}return(0,s.Z)(r,[{key:"render",value:function(){var e=interpolate("<strong>%(name)s</strong>",{name:(0,te.Z)(this.props.item.filename)},!0),t=interpolate(gettext("Error uploading %(filename)s"),{filename:e,progress:this.props.item.progress+"%"},!0);return(0,d.Z)("li",{className:"editor-attachment-error"},void 0,ae||(ae=(0,d.Z)("div",{className:"editor-attachment-error-icon"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,"warning"))),(0,d.Z)("div",{className:"editor-attachment-error-message"},void 0,(0,d.Z)("h4",{dangerouslySetInnerHTML:{__html:t+":"}}),(0,d.Z)("p",{},void 0,this.props.item.error),(0,d.Z)("button",{className:"btn btn-default btn-sm",onClick:this.onClick,type:"button"},void 0,gettext("Dismiss"))))}}]),r}(r().Component);function ve(e){var t=interpolate("<strong>%(name)s</strong>",{name:(0,te.Z)(e.item.filename)},!0),n=interpolate(gettext("Uploading %(filename)s... %(progress)s"),{filename:t,progress:e.item.progress+"%"},!0);return(0,d.Z)("li",{className:"editor-attachment-upload"},void 0,(0,d.Z)("div",{className:"editor-attachment-progress-bar"},void 0,(0,d.Z)("div",{className:"editor-attachment-progress",style:{width:e.item.progress+"%"}})),(0,d.Z)("p",{className:"editor-attachment-upload-message",dangerouslySetInnerHTML:{__html:n}}))}function me(e){return e.item.id?r().createElement(se,e):e.item.error?r().createElement(fe,e):r().createElement(ve,e)}function Ze(e){return(0,d.Z)("ul",{className:"list-unstyled editor-attachments-list"},void 0,e.attachments.map((function(t){return r().createElement(me,(0,Z.Z)({item:t,key:t.id||t.key},e))})))}var ge=n(30381),be=n.n(ge),ye=n(78657),_e=n(53904);var Ne,ke=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onChange",(function(t){var n=t.target.files[0];if(n){var a={id:null,key:xe(),progress:0,error:null,filename:n.name};e.props.onAttachmentsChange([a].concat(e.props.attachments));var s=new FormData;s.append("upload",n),ye.Z.upload(ee.Z.get("ATTACHMENTS_API"),s,(function(t){a.progress=t,e.props.onAttachmentsChange(e.props.attachments.concat())})).then((function(t){t.uploaded_on=be()(t.uploaded_on),Object.assign(a,t),e.props.onAttachmentsChange(e.props.attachments.concat())}),(function(t){400===t.status||413===t.status?(a.error=t.detail,e.props.onAttachmentsChange(e.props.attachments.concat())):_e.Z.apiError(t)}))}})),e}return(0,s.Z)(r,[{key:"render",value:function(){return(0,d.Z)("input",{id:"editor-upload-field",onChange:this.onChange,type:"file"})}}]),r}(r().Component);function xe(){return"upld-"+Math.round((new Date).getTime())}function we(e){return ee.Z.get("user").acl.max_attachment_size?(0,d.Z)("div",{className:"editor-attachments"},void 0,r().createElement(Ze,e),r().createElement(ke,e)):null}var Re,Ce=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){document.getElementById("editor-upload-field").click()})),e}return(0,s.Z)(r,[{key:"render",value:function(){return ee.Z.get("user").acl.max_attachment_size?(0,d.Z)("button",{className:"btn btn-icon "+this.props.className,disabled:this.props.disabled,onClick:this.onClick,title:gettext("Upload file"),type:"button"},void 0,Ne||(Ne=(0,d.Z)("span",{className:"material-icon"},void 0,"file_upload"))):null}}]),r}(r().Component),Se=n(69092);function Ee(e){return(0,d.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,d.Z)("div",{className:"modal-content"},void 0,(0,d.Z)("div",{className:"modal-header"},void 0,(0,d.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Re||(Re=(0,d.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,d.Z)("h4",{className:"modal-title"},void 0,gettext("Preview message"))),(0,d.Z)("div",{className:"modal-body markup-preview"},void 0,(0,d.Z)(Se.Z,{markup:e.markup}))))}var Le=n(19755),Pe="editor-textarea";function Oe(){return document.getElementById(Pe)}function Te(e,t){return{start:e,end:t}}function Ae(){var e=Oe();if(document.selection){e.focus();var t=document.selection.createRange(),n=t.text.length;return t.moveStart("character",-e.value.length),Te(t.text.length-n,t.text.length)}if(e.selectionStart||"0"==e.selectionStart)return Te(e.selectionStart,e.selectionEnd)}function Be(e,t){var n=Oe(),a=n.value,s=a.substring(0,e.start);return n.value=a.substring(0,e.start)+t+a.substring(e.end),function(e){var t=Oe();if(t.setSelectionRange)t.focus(),t.setSelectionRange(e.start,e.end);else if(t.createTextRange){var n=t.createTextRange();n.collapse(!0),n.moveStart("character",e.start),n.moveEnd("character",e.end),n.select()}}(Te(s.length+t.length,s.length+t.length)),n.value}var Ie,je=n(82211),De=n(59801),Me=n(19755);var Ue=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"onPreviewClick",(function(){t.state.isPreviewLoading||(t.setState({isPreviewLoading:!0}),ye.Z.post(ee.Z.get("PARSE_MARKUP_API"),{post:t.props.value}).then((function(e){De.Z.show((0,d.Z)(Ee,{markup:e.parsed})),t.setState({isPreviewLoading:!1})}),(function(e){400===e.status?_e.Z.error(e.detail):_e.Z.apiError(e),t.setState({isPreviewLoading:!1})})))})),(0,i.Z)((0,p.Z)(t),"replaceSelection",(function(e){var n;e((n=Ae(),Le.trim(document.getElementById(Pe).value.substring(n.start,n.end))),t._replaceSelection)})),(0,i.Z)((0,p.Z)(t),"_replaceSelection",(function(e){var n;t.props.onChange({target:{value:(n=e,Be(Ae(),n))}})})),t.state={isPreviewLoading:!1},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){var e=this;Me("#editor-textarea").atwho({at:"@",displayTpl:'<li><img src="${avatar}" alt="">${username}</li>',insertTpl:"@${username}",searchKey:"username",callbacks:{remoteFilter:function(e,t){Me.getJSON(ee.Z.get("MENTION_API"),{q:e},t)}}}),Me("#editor-textarea").on("inserted.atwho",(function(t,n,a){e.props.onChange(t)}))}},{key:"render",value:function(){return(0,d.Z)("div",{className:"editor-border"},void 0,(0,d.Z)("textarea",{className:"form-control",value:this.props.value,disabled:this.props.loading,id:"editor-textarea",onChange:this.props.onChange,rows:"9"}),(0,d.Z)("div",{className:"editor-footer"},void 0,(0,d.Z)("div",{className:"buttons-list pull-left"},void 0,(0,d.Z)($,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(w,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(Y,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(C,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(z,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(A,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(J,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(F,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(k,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(Ce,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading})),(0,d.Z)(je.Z,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,onClick:this.onPreviewClick,type:"button"},void 0,gettext("Preview")),(0,d.Z)(je.Z,{className:"btn-primary btn-sm pull-right",loading:this.props.loading},void 0,this.props.submitLabel||gettext("Post")),(0,d.Z)("button",{className:"btn btn-default btn-sm pull-right",disabled:this.props.loading,onClick:this.props.onCancel,type:"button"},void 0,gettext("Cancel")),Ie||(Ie=(0,d.Z)("div",{className:"clearfix visible-xs-block"})),(0,d.Z)(ze,{canProtect:this.props.canProtect,disabled:this.props.loading,onProtect:this.props.onProtect,onUnprotect:this.props.onUnprotect,protect:this.props.protect})),(0,d.Z)(we,{attachments:this.props.attachments,onAttachmentsChange:this.props.onAttachmentsChange,placeholder:this.props.placeholder,replaceSelection:this.replaceSelection}))}}]),r}(r().Component);function ze(e){if(!e.canProtect)return null;var t=e.protect?gettext("Protected"):gettext("Protect");return(0,d.Z)("button",{className:"btn btn-icon btn-default btn-protect btn-sm pull-right",disabled:e.disabled,onClick:e.protect?e.onUnprotect:e.onProtect,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.protect?"lock":"lock_outline"),(0,d.Z)("span",{className:"btn-text hidden-md hidden-lg"},void 0,t))}var He=n(43345);function Fe(e){return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("div",{className:"container"},void 0,e.children))}var qe,Ye,Ve=n(37848);function $e(e){return qe||(qe=(0,d.Z)(Fe,{className:"posting-loader"},void 0,(0,d.Z)(Ve.Z,{})))}function Ge(e){return(0,d.Z)(Fe,{className:"posting-message"},void 0,(0,d.Z)("div",{className:"message-body"},void 0,(0,d.Z)("p",{},void 0,Ye||(Ye=(0,d.Z)("span",{className:"material-icon"},void 0,"error_outline")),e.message),(0,d.Z)("button",{type:"button",className:"btn btn-default",onClick:ft.close},void 0,gettext("Dismiss"))))}function We(e){if(!e.showOptions)return null;var t=e.columns,n="col-xs-12 xs-margin-top";n+=1===t?" col-sm-2":" sm-margin-top",n+=3===t?" col-md-3":" col-md-2",n+=" posting-options";var a="col-xs-"+12/t,s="btn-text";return s+=3===t?" visible-sm-inline-block":2===t?" hidden-md hidden-lg":" hidden-sm",(0,d.Z)("div",{className:n},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)(Qe,{className:a,disabled:e.disabled,onPinGlobally:e.onPinGlobally,onPinLocally:e.onPinLocally,onUnpin:e.onUnpin,pin:e.pin,show:e.options.pin,textClassName:s}),(0,d.Z)(Je,{className:a,disabled:e.disabled,hide:e.hide,onHide:e.onHide,onUnhide:e.onUnhide,show:e.options.hide,textClassName:s}),(0,d.Z)(Ke,{className:a,close:e.close,disabled:e.disabled,onClose:e.onClose,onOpen:e.onOpen,show:e.options.close,textClassName:s})))}function Ke(e){if(!e.show)return null;var t=e.close?gettext("Closed"):gettext("Open");return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:e.close?e.onOpen:e.onClose,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.close?"lock":"lock_outline"),(0,d.Z)("span",{className:e.textClassName},void 0,t)))}function Je(e){if(!e.show)return null;var t=e.hide?gettext("Hidden"):gettext("Not hidden");return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:e.hide?e.onUnhide:e.onHide,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.hide?"visibility_off":"visibility"),(0,d.Z)("span",{className:e.textClassName},void 0,t)))}function Qe(e){if(!e.show)return null;var t=null,n=null,a=null;switch(e.pin){case 0:t="radio_button_unchecked",n=e.onPinLocally,a=gettext("Unpinned");break;case 1:t="bookmark_outline",n=e.onPinGlobally,a=gettext("Pinned locally"),n=2==e.show?e.onPinGlobally:e.onUnpin;break;case 2:t="bookmark",n=e.onUnpin,a=gettext("Pinned globally")}return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:n,title:a,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,t),(0,d.Z)("span",{className:e.textClassName},void 0,a)))}function Xe(e){var t=e.filter((function(e){return e.id&&!e.isRemoved}));return t.map((function(e){return e.id}))}function et(e){return e.map((function(e){return Object.assign({},e,{uploaded_on:be()(e.uploaded_on)})}))}var tt,nt=n(12891);var at=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){var n=null,a=!1,s=null,i=e.map((function(e){return!1===e.post||n&&e.id!=t.state.category||(n=e.id,s=e.post),e.post&&(e.post.close||e.post.hide||e.post.pin)&&(a=!0),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id})}));t.setState({isReady:!0,showOptions:a,categories:i,category:n,categoryOptions:s})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard thread?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onCategoryChange",(function(e){var n=t.state.categories.find((function(t){return e.target.value==t.value})),a=t.state.pin;n.post.pin&&n.post.pin<a&&(a=n.post.pin),t.setState({category:n.id,categoryOptions:n.post,pin:a})})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),(0,i.Z)((0,p.Z)(t),"onClose",(function(){t.changeValue("close",!0)})),(0,i.Z)((0,p.Z)(t),"onOpen",(function(){t.changeValue("close",!1)})),(0,i.Z)((0,p.Z)(t),"onPinGlobally",(function(){t.changeValue("pin",2)})),(0,i.Z)((0,p.Z)(t),"onPinLocally",(function(){t.changeValue("pin",1)})),(0,i.Z)((0,p.Z)(t),"onUnpin",(function(){t.changeValue("pin",0)})),(0,i.Z)((0,p.Z)(t),"onHide",(function(){t.changeValue("hide",!0)})),(0,i.Z)((0,p.Z)(t),"onUnhide",(function(){t.changeValue("hide",!1)})),t.state={isReady:!1,isLoading:!1,isErrored:!1,showOptions:!1,categoryOptions:null,title:"",category:e.category||null,categories:[],post:"",attachments:[],close:!1,hide:!1,pin:0,validators:{title:(0,nt.jn)(),post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config).then(this.loadSuccess,this.loadError)}},{key:"clean",value:function(){if(!this.state.title.trim().length)return _e.Z.error(gettext("You have to enter thread title.")),!1;if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return e.title?(_e.Z.error(e.title[0]),!1):!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{title:this.state.title,category:this.state.category,post:this.state.post,attachments:Xe(this.state.attachments),close:this.state.close,hide:this.state.hide,pin:this.state.pin})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your thread has been posted.")),window.location=e.url,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){if(this.state.isErrored)return(0,d.Z)(Ge,{message:this.state.isErrored});if(!this.state.isReady)return tt||(tt=(0,d.Z)($e,{}));var e=0;this.state.categoryOptions.close&&(e+=1),this.state.categoryOptions.hide&&(e+=1),this.state.categoryOptions.pin&&(e+=1);var t=null;return t=1===e?"col-sm-6":"col-sm-8",t+=3===e?" col-md-6":e?" col-md-7":" col-md-9",(0,d.Z)(Fe,{className:"posting-form",withFirstRow:!0},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:t},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:gettext("Thread title"),type:"text",value:this.state.title})),(0,d.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3 xs-margin-top"},void 0,(0,d.Z)(m.Z,{choices:this.state.categories,disabled:this.state.isLoading,onChange:this.onCategoryChange,value:this.state.category})),(0,d.Z)(We,{close:this.state.close,columns:e,disabled:this.state.isLoading,hide:this.state.hide,onClose:this.onClose,onHide:this.onHide,onOpen:this.onOpen,onPinGlobally:this.onPinGlobally,onPinLocally:this.onPinLocally,onUnhide:this.onUnhide,onUnpin:this.onUnpin,options:this.state.categoryOptions,pin:this.state.pin,showOptions:this.state.showOptions})),(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Ue,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post thread"),value:this.state.post})))))}}]),r}(He.Z);function st(e){var t=e.split(",").map((function(e){return e.trim().toLowerCase()})).filter((function(e){return e.length>0}));return t.filter((function(e,n){return t.indexOf(e)==n}))}var it,ot=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard private thread?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onToChange",(function(e){t.changeValue("to",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})}));var n=(e.to||[]).map((function(e){return e.username})).join(", ");return t.state={isLoading:!1,to:n,title:"",post:"",attachments:[],validators:{title:(0,nt.jn)(),post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"clean",value:function(){if(!st(this.state.to).length)return _e.Z.error(gettext("You have to enter at least one recipient.")),!1;if(!this.state.title.trim().length)return _e.Z.error(gettext("You have to enter thread title.")),!1;if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return e.title?(_e.Z.error(e.title[0]),!1):!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{to:st(this.state.to),title:this.state.title,post:this.state.post,attachments:Xe(this.state.attachments)})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your thread has been posted.")),window.location=e.url,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.to||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return(0,d.Z)(Fe,{className:"posting-form",withFirstRow:!0},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onToChange,placeholder:gettext("Comma separated list of user names, eg.: Danny, Lisa"),type:"text",value:this.state.to}))),(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:gettext("Thread title"),type:"text",value:this.state.title}))),(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)(Ue,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post thread"),value:this.state.post})))))}}]),r}(He.Z);var rt,lt=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){t.setState({isReady:!0,post:e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":""})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"appendData",(function(e){var n=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";t.setState((function(e,t){return e.post.length>0?{post:e.post+"\n\n"+n}:{post:n}}))})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard your reply?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),t.state={isReady:!1,isLoading:!1,isErrored:!1,post:"",attachments:[],validators:{post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config,this.props.context||null).then(this.loadSuccess,this.loadError)}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.context,n=e.context;t&&n&&t.reply===n.reply||ye.Z.get(e.config,e.context||null).then(this.appendData,_e.Z.apiError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{post:this.state.post,attachments:Xe(this.state.attachments)})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your reply has been posted.")),window.location=e.url.index,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,d.Z)(Fe,{className:"posting-form"},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit,method:"POST"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Ue,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post reply"),value:this.state.post}))))):this.state.isErrored?(0,d.Z)(Ge,{message:this.state.isErrored}):it||(it=(0,d.Z)($e,{}))}}]),r}(He.Z);var ct=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){t.setState({isReady:!0,post:e.post,attachments:et(e.attachments),protect:e.is_protected,canProtect:e.can_protect})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard changes?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onProtect",(function(){t.setState({protect:!0})})),(0,i.Z)((0,p.Z)(t),"onUnprotect",(function(){t.setState({protect:!1})})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),t.state={isReady:!1,isLoading:!1,isErrored:!1,post:"",attachments:[],protect:!1,canProtect:!1,validators:{post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config).then(this.loadSuccess,this.loadError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.put(this.props.submit,{post:this.state.post,attachments:Xe(this.state.attachments),protect:this.state.protect})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Reply has been edited.")),window.location=e.url.index,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,d.Z)(Fe,{className:"posting-form"},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit,method:"POST"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Ue,{attachments:this.state.attachments,canProtect:this.state.canProtect,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,onProtect:this.onProtect,onUnprotect:this.onUnprotect,protect:this.state.protect,submitLabel:gettext("Edit reply"),value:this.state.post}))))):this.state.isErrored?(0,d.Z)(Ge,{message:this.state.isErrored}):rt||(rt=(0,d.Z)($e,{}))}}]),r}(He.Z);function ut(e){return"START"===e.mode?r().createElement(at,e):"START_PRIVATE"===e.mode?r().createElement(ot,e):"REPLY"===e.mode?r().createElement(lt,e):"EDIT"===e.mode?r().createElement(ct,e):null}var dt=n(4869),pt=n(19755),ht=function(){function e(){var t=this;(0,a.Z)(this,e),(0,i.Z)(this,"close",(function(){t._isOpen&&!t._isClosing&&(t._isClosing=!0,t._placeholder.removeClass("slide-in"),window.setTimeout((function(){c().unmountComponentAtNode(document.getElementById("posting-mount")),t._isClosing=!1,t._isOpen=!1}),300))}))}return(0,s.Z)(e,[{key:"init",value:function(e,t,n){this._ajax=e,this._snackbar=t,this._placeholder=pt(n),this._mode=null,this._isOpen=!1,this._isClosing=!1}},{key:"open",value:function(e){if(!1===this._isOpen)this._mode=e.mode,this._isOpen=e.submit,this._realOpen(e);else if(this._isOpen!==e.submit){var t=gettext("You are already working on other message. Do you want to discard it?");"POLL"==this._mode&&(t=gettext("You are already working on a poll. Do you want to discard it?")),window.confirm(t)&&(this._mode=e.mode,this._isOpen=e.submit,this._realOpen(e))}else"REPLY"==this._mode&&"REPLY"==e.mode&&this._realOpen(e)}},{key:"_realOpen",value:function(e){"POLL"==e.mode?(0,dt.Z)(r().createElement(u.y,e),"posting-mount"):(0,dt.Z)(r().createElement(ut,e),"posting-mount"),this._placeholder.addClass("slide-in"),pt("html, body").animate({scrollTop:this._placeholder.offset().top},1e3)}}]),e}(),ft=new ht},53904:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(27346),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._store=e,this._timeout=null}},{key:"alert",value:function(e,t){var n=this;this._timeout?(window.clearTimeout(this._timeout),this._store.dispatch((0,i.p2)()),this._timeout=window.setTimeout((function(){n._timeout=null,n.alert(e,t)}),300)):(this._store.dispatch((0,i.OV)(e,t)),this._timeout=window.setTimeout((function(){n._store.dispatch((0,i.p2)()),n._timeout=null}),5e3))}},{key:"info",value:function(e){this.alert(e,"info")}},{key:"success",value:function(e){this.alert(e,"success")}},{key:"warning",value:function(e){this.alert(e,"warning")}},{key:"error",value:function(e){this.alert(e,"error")}},{key:"apiError",value:function(e){var t=e.detail;t||(t=404===e.status?gettext("Action link is invalid."):gettext("Unknown error has occured.")),403===e.status&&"Permission denied"===t&&(t=gettext("You don't have permission to perform this action.")),this.error(t)}}]),e}();t.Z=new o},90287:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(41438),o=function(){function e(){(0,a.Z)(this,e),this._store=null,this._reducers={},this._initialState={}}return(0,s.Z)(e,[{key:"addReducer",value:function(e,t,n){this._reducers[e]=t,this._initialState[e]=n}},{key:"init",value:function(){this._store=(0,i.createStore)((0,i.combineReducers)(this._reducers),this._initialState)}},{key:"getStore",value:function(){return this._store}},{key:"getState",value:function(){return this._store.getState()}},{key:"dispatch",value:function(e){return this._store.dispatch(e)}}]),e}();t.Z=new o},59940:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._include=e,this._isLoaded=!1}},{key:"scorePassword",value:function(e,t){return this._isLoaded?zxcvbn(e,t).score:0}},{key:"load",value:function(){return this._isLoaded?this._loadedPromise():(this._include.include("misago/js/zxcvbn.js"),this._loadingPromise())}},{key:"_loadingPromise",value:function(){var e=this;return new Promise((function(t,n){!function a(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(s+=1)>200?n():"undefined"==typeof zxcvbn?window.setTimeout((function(){a(s)}),200):(e._isLoaded=!0,t())}()}))}},{key:"_loadedPromise",value:function(){return new Promise((function(e){e()}))}}]),e}();t.Z=new i},93051:function(e,t,n){"use strict";n.d(t,{Z:function(){return _}});var a,s=n(22928),i=n(30381),o=n.n(i),r=n(57588),l=n.n(r),c=n(73935),u=n.n(c),d=n(37424),p=n(15671),h=n(43144),f=n(79340),v=n(6215),m=n(61120);var Z=function(e){(0,f.Z)(r,e);var t,n,i=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,m.Z)(t);if(n){var s=(0,m.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,v.Z)(this,e)});function r(){return(0,p.Z)(this,r),i.apply(this,arguments)}return(0,h.Z)(r,[{key:"getReasonMessage",value:function(){return this.props.message.html?(0,s.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.props.message.html}}):(0,s.Z)("p",{className:"lead"},void 0,this.props.message.plain)}},{key:"getExpirationMessage",value:function(){if(this.props.expires){if(this.props.expires.isAfter(o()())){var e=interpolate(gettext("This ban expires on %(expires_on)s."),{expires_on:this.props.expires.format("LL, LT")},!0),t=interpolate(gettext("This ban expires %(expires_on)s."),{expires_on:this.props.expires.fromNow()},!0);return(0,s.Z)("abbr",{title:e},void 0,t)}return gettext("This ban has expired.")}return gettext("This ban is permanent.")}},{key:"render",value:function(){return(0,s.Z)("div",{className:"page page-error page-error-banned"},void 0,(0,s.Z)("div",{className:"container"},void 0,(0,s.Z)("div",{className:"message-panel"},void 0,a||(a=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"highlight_off"))),(0,s.Z)("div",{className:"message-body"},void 0,this.getReasonMessage(),(0,s.Z)("p",{className:"message-footnote"},void 0,this.getExpirationMessage())))))}}]),r}(l().Component),g=n(32233),b=n(90287),y=(0,d.$j)((function(e){return e.tick}))(Z);function _(e,t){if(u().render((0,s.Z)(d.zt,{store:b.Z.getStore()},void 0,(0,s.Z)(y,{message:e.message,expires:e.expires_on?o()(e.expires_on):null})),document.getElementById("page-mount")),void 0===t||t){var n=g.Z.get("SETTINGS").forum_name;document.title=gettext("You are banned")+" | "+n,window.history.pushState({},"",g.Z.get("BANNED_URL"))}}},69130:function(e,t,n){"use strict";function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=[],s=[];if(e.forEach((function(e){s.push(e),s.length===t&&(a.push(s),s=[])})),!1!==n&&s.length>0&&s.length<t)for(var i=s.length;i<t;i++)s.push(n);return s.length&&a.push(s),a}n.d(t,{Z:function(){return a}})},89759:function(e,t,n){"use strict";function a(e,t){var n=[];return e.concat(t).filter((function(e){return-1===n.indexOf(e.id)&&(n.push(e.id),!0)}))}n.d(t,{Z:function(){return a}})},89627:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function s(e){return e.replace(/[&<>"']/g,(function(e){return a[e]}))}},48772:function(e,t,n){"use strict";function a(e){return e>1073741824?s(e/1073741824)+" GB":e>1048576?s(e/1048576)+" MB":e>1024?s(e/1024)+" KB":s(e)+" B"}function s(e){return e.toFixed(1)}n.d(t,{Z:function(){return a}})},4869:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var a=n(22928),s=(n(57588),n(73935)),i=n.n(s),o=n(37424),r=n(90287);function l(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=document.getElementById(t),l=e.props?e:(0,a.Z)(e,{});s&&(n?i().render((0,a.Z)(o.zt,{store:r.Z.getStore()},void 0,l),s):i().render(l,s))}},44039:function(e,t,n){"use strict";function a(e,t){return Math.floor(Math.random()*(t-e+1))+e}n.d(t,{e:function(){return a}})},39633:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=(n(57588),n(73935)),i=n.n(s),o=n(37424),r=n(69987),l=n(90287),c=document.getElementById("page-mount");function u(e){var t={component:e.component||null,childRoutes:[]};e.root?t.childRoutes=[{path:e.root,onEnter:function(t,n){n(null,e.paths[0].path)}}].concat(e.paths):t.childRoutes=e.paths,i().render((0,a.Z)(o.zt,{store:l.Z.getStore()},void 0,(0,a.Z)(r.F0,{routes:t,history:r.mW})),c)}},20370:function(e,t,n){"use strict";function a(e,t){if(-1===e.indexOf(t)){var n=e.slice();return n.push(t),n}return e.filter((function(e){return e!==t}))}n.d(t,{ZN:function(){return a}})},55210:function(e,t,n){"use strict";n.d(t,{BS:function(){return d},C1:function(){return o},Do:function(){return c},Ei:function(){return u},HR:function(){return p},Vb:function(){return v},fT:function(){return r},gS:function(){return h},jA:function(){return l},lG:function(){return f}});var a=n(19755),s=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,i=new RegExp("^[0-9a-z]+$","i");function o(e){return function(t){if(!1===t||null===t||0===a.trim(t).length)return e||gettext("This field is required.")}}function r(e){var t=gettext("You have to accept the terms of service.");return o(e||t)}function l(e){var t=gettext("You have to accept the privacy policy.");return o(e||t)}function c(e){return function(t){if(!s.test(t))return e||gettext("Enter a valid email address.")}}function u(e,t){return function(n){var s="",i=a.trim(n).length;if(i<e)return s=t?t(e,i):ngettext("Ensure this value has at least %(limit_value)s character (it has %(show_value)s).","Ensure this value has at least %(limit_value)s characters (it has %(show_value)s).",e),interpolate(s,{limit_value:e,show_value:i},!0)}}function d(e,t){return function(n){var s="",i=a.trim(n).length;if(i>e)return s=t?t(e,i):ngettext("Ensure this value has at most %(limit_value)s character (it has %(show_value)s).","Ensure this value has at most %(limit_value)s characters (it has %(show_value)s).",e),interpolate(s,{limit_value:e,show_value:i},!0)}}function p(e){return u(e,(function(e){return ngettext("Username must be at least %(limit_value)s character long.","Username must be at least %(limit_value)s characters long.",e)}))}function h(e){return d(e,(function(e){return ngettext("Username cannot be longer than %(limit_value)s character.","Username cannot be longer than %(limit_value)s characters.",e)}))}function f(){return function(e){if(!i.test(a.trim(e)))return gettext("Username can only contain latin alphabet letters and digits.")}}function v(e){return function(t){var n=t.length;if(n<e){var a=ngettext("Valid password must be at least %(limit_value)s character long.","Valid password must be at least %(limit_value)s characters long.",e);return interpolate(a,{limit_value:e,show_value:n},!0)}}}},46700:function(e,t,n){var a={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function s(e){var t=i(e);return n(t)}function i(e){if(!n.o(a,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return a[e]}s.keys=function(){return Object.keys(a)},s.resolve=i,e.exports=s,s.id=46700}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=t,e=[],a.O=function(t,n,s,i){if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],s=e[u][1],i=e[u][2];for(var r=!0,l=0;l<n.length;l++)(!1&i||o>=i)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(r=!1,i<o&&(o=i));if(r){e.splice(u--,1);var c=s();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,s,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},function(){var e={174:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,o=n[0],r=n[1],l=n[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(s in r)a.o(r,s)&&(a.m[s]=r[s]);if(l)var u=l(a)}for(t&&t(n);c<o.length;c++)i=o[c],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(u)},n=self.webpackChunkmisago=self.webpackChunkmisago||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}(),a.O(void 0,[736],(function(){return a(32233)})),a.O(void 0,[736],(function(){return a(58339)})),a.O(void 0,[736],(function(){return a(64109)})),a.O(void 0,[736],(function(){return a(46226)})),a.O(void 0,[736],(function(){return a(93240)})),a.O(void 0,[736],(function(){return a(75147)})),a.O(void 0,[736],(function(){return a(4894)})),a.O(void 0,[736],(function(){return a(29223)})),a.O(void 0,[736],(function(){return a(3026)})),a.O(void 0,[736],(function(){return a(94795)})),a.O(void 0,[736],(function(){return a(95563)})),a.O(void 0,[736],(function(){return a(32488)})),a.O(void 0,[736],(function(){return a(11768)})),a.O(void 0,[736],(function(){return a(61323)})),a.O(void 0,[736],(function(){return a(15049)})),a.O(void 0,[736],(function(){return a(61814)})),a.O(void 0,[736],(function(){return a(95920)})),a.O(void 0,[736],(function(){return a(59203)})),a.O(void 0,[736],(function(){return a(72168)})),a.O(void 0,[736],(function(){return a(47806)})),a.O(void 0,[736],(function(){return a(77031)})),a.O(void 0,[736],(function(){return a(97751)})),a.O(void 0,[736],(function(){return a(76093)})),a.O(void 0,[736],(function(){return a(19764)})),a.O(void 0,[736],(function(){return a(47549)})),a.O(void 0,[736],(function(){return a(22331)})),a.O(void 0,[736],(function(){return a(21513)})),a.O(void 0,[736],(function(){return a(98749)})),a.O(void 0,[736],(function(){return a(98251)})),a.O(void 0,[736],(function(){return a(6720)})),a.O(void 0,[736],(function(){return a(10846)})),a.O(void 0,[736],(function(){return a(18255)})),a.O(void 0,[736],(function(){return a(14113)})),a.O(void 0,[736],(function(){return a(24444)})),a.O(void 0,[736],(function(){return a(1764)})),a.O(void 0,[736],(function(){return a(68351)})),a.O(void 0,[736],(function(){return a(81521)})),a.O(void 0,[736],(function(){return a(19984)})),a.O(void 0,[736],(function(){return a(41229)})),a.O(void 0,[736],(function(){return a(43589)})),a.O(void 0,[736],(function(){return a(24108)})),a.O(void 0,[736],(function(){return a(33934)})),a.O(void 0,[736],(function(){return a(85577)})),a.O(void 0,[736],(function(){return a(83526)})),a.O(void 0,[736],(function(){return a(43060)})),a.O(void 0,[736],(function(){return a(92292)})),a.O(void 0,[736],(function(){return a(33409)}));var s=a.O(void 0,[736],(function(){return a(31341)}));s=a.O(s)}();
+!function(){var e,t={54116:function(e,t){var n,a;(a="object"==typeof window&&window||"object"==typeof self&&self)&&(a.hljs=function(e){function t(e){return e.replace(/[&<>]/gm,(function(e){return x[e]}))}function n(e){return e.nodeName.toLowerCase()}function a(e,t){var n=e&&e.exec(t);return n&&0===n.index}function s(e){return b.test(e)}function i(e,t){var n,a={};for(n in e)a[n]=e[n];if(t)for(n in t)a[n]=t[n];return a}function o(e){var t=[];return function e(a,s){for(var i=a.firstChild;i;i=i.nextSibling)3===i.nodeType?s+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:s,node:i}),s=e(i,s),n(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:s,node:i}));return s}(e,0),t}function r(e,a,s){function i(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset<a[0].offset?e:a:"start"===a[0].event?e:a:e.length?e:a}function o(e){u+="<"+n(e)+v.map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+t(e.value)+'"'})).join("")+">"}function r(e){u+="</"+n(e)+">"}function l(e){("start"===e.event?o:r)(e.node)}for(var c=0,u="",d=[];e.length||a.length;){var p=i();if(u+=t(s.substring(c,p[0].offset)),c=p[0].offset,p===e){d.reverse().forEach(r);do{l(p.splice(0,1)[0]),p=i()}while(p===e&&p.length&&p[0].offset===c);d.reverse().forEach(o)}else"start"===p[0].event?d.push(p[0].node):d.pop(),l(p.splice(0,1)[0])}return u+t(s.substr(c))}function l(e){function t(e){return e&&e.source||e}function n(n,a){return new RegExp(t(n),"m"+(e.cI?"i":"")+(a?"g":""))}!function a(s,o){if(!s.compiled){if(s.compiled=!0,s.k=s.k||s.bK,s.k){var r={},l=function(t,n){e.cI&&(n=n.toLowerCase()),n.split(" ").forEach((function(e){var n=e.split("|");r[n[0]]=[t,n[1]?Number(n[1]):1]}))};"string"==typeof s.k?l("keyword",s.k):m(s.k).forEach((function(e){l(e,s.k[e])})),s.k=r}s.lR=n(s.l||/\w+/,!0),o&&(s.bK&&(s.b="\\b("+s.bK.split(" ").join("|")+")\\b"),s.b||(s.b=/\B|\b/),s.bR=n(s.b),s.e||s.eW||(s.e=/\B|\b/),s.e&&(s.eR=n(s.e)),s.tE=t(s.e)||"",s.eW&&o.tE&&(s.tE+=(s.e?"|":"")+o.tE)),s.i&&(s.iR=n(s.i)),null==s.r&&(s.r=1),s.c||(s.c=[]);var c=[];s.c.forEach((function(e){e.v?e.v.forEach((function(t){c.push(i(e,t))})):c.push("self"===e?s:e)})),s.c=c,s.c.forEach((function(e){a(e,s)})),s.starts&&a(s.starts,o);var u=s.c.map((function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b})).concat([s.tE,s.i]).map(t).filter(Boolean);s.t=u.length?n(u.join("|"),!0):{exec:function(){return null}}}}(e)}function c(e,n,s,i){function o(e,t){var n,s;for(n=0,s=t.c.length;s>n;n++)if(a(t.c[n].bR,e))return t.c[n]}function r(e,t){if(a(e.eR,t)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?r(e.parent,t):void 0}function d(e,t){return!s&&a(t.iR,e)}function p(e,t){var n=b.cI?t[0].toLowerCase():t[0];return e.k.hasOwnProperty(n)&&e.k[n]}function h(e,t,n,a){var s='<span class="'+(a?"":k.classPrefix);return(s+=e+'">')+t+(n?"":N)}function v(){w+=null!=_.sL?function(){var e="string"==typeof _.sL;if(e&&!Z[_.sL])return t(R);var n=e?c(_.sL,R,!0,x[_.sL]):u(R,_.sL.length?_.sL:void 0);return _.r>0&&(C+=n.r),e&&(x[_.sL]=n.top),h(n.language,n.value,!1,!0)}():function(){var e,n,a,s;if(!_.k)return t(R);for(s="",n=0,_.lR.lastIndex=0,a=_.lR.exec(R);a;)s+=t(R.substring(n,a.index)),(e=p(_,a))?(C+=e[1],s+=h(e[0],t(a[0]))):s+=t(a[0]),n=_.lR.lastIndex,a=_.lR.exec(R);return s+t(R.substr(n))}(),R=""}function m(e){w+=e.cN?h(e.cN,"",!0):"",_=Object.create(e,{parent:{value:_}})}function g(e,t){if(R+=e,null==t)return v(),0;var n=o(t,_);if(n)return n.skip?R+=t:(n.eB&&(R+=t),v(),n.rB||n.eB||(R=t)),m(n),n.rB?0:t.length;var a=r(_,t);if(a){var s=_;s.skip?R+=t:(s.rE||s.eE||(R+=t),v(),s.eE&&(R=t));do{_.cN&&(w+=N),_.skip||(C+=_.r),_=_.parent}while(_!==a.parent);return a.starts&&m(a.starts),s.rE?0:t.length}if(d(t,_))throw new Error('Illegal lexeme "'+t+'" for mode "'+(_.cN||"<unnamed>")+'"');return R+=t,t.length||1}var b=f(e);if(!b)throw new Error('Unknown language: "'+e+'"');l(b);var y,_=i||b,x={},w="";for(y=_;y!==b;y=y.parent)y.cN&&(w=h(y.cN,"",!0)+w);var R="",C=0;try{for(var S,E,L=0;_.t.lastIndex=L,S=_.t.exec(n);)E=g(n.substring(L,S.index),S[0]),L=S.index+E;for(g(n.substr(L)),y=_;y.parent;y=y.parent)y.cN&&(w+=N);return{r:C,value:w,language:e,top:_}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:t(n)};throw e}}function u(e,n){n=n||k.languages||m(Z);var a={r:0,value:t(e)},s=a;return n.filter(f).forEach((function(t){var n=c(t,e,!1);n.language=t,n.r>s.r&&(s=n),n.r>a.r&&(s=a,a=n)})),s.language&&(a.second_best=s),a}function d(e){return k.tabReplace||k.useBR?e.replace(_,(function(e,t){return k.useBR&&"\n"===e?"<br>":k.tabReplace?t.replace(/\t/g,k.tabReplace):void 0})):e}function p(e){var t,n,a,i,l,p=function(e){var t,n,a,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",n=y.exec(o))return f(n[1])?n[1]:"no-highlight";for(t=0,a=(o=o.split(/\s+/)).length;a>t;t++)if(s(i=o[t])||f(i))return i}(e);s(p)||(k.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n"):t=e,l=t.textContent,a=p?c(p,l,!0):u(l),(n=o(t)).length&&((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=a.value,a.value=r(n,o(i),l)),a.value=d(a.value),e.innerHTML=a.value,e.className=function(e,t,n){var a=t?g[t]:n,s=[e.trim()];return e.match(/\bhljs\b/)||s.push("hljs"),-1===e.indexOf(a)&&s.push(a),s.join(" ").trim()}(e.className,p,a.language),e.result={language:a.language,re:a.r},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.r}))}function h(){if(!h.called){h.called=!0;var e=document.querySelectorAll("pre code");v.forEach.call(e,p)}}function f(e){return e=(e||"").toLowerCase(),Z[e]||Z[g[e]]}var v=[],m=Object.keys,Z={},g={},b=/^(no-?highlight|plain|text)$/i,y=/\blang(?:uage)?-([\w-]+)\b/i,_=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,N="</span>",k={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},x={"&":"&amp;","<":"&lt;",">":"&gt;"};return e.highlight=c,e.highlightAuto=u,e.fixMarkup=d,e.highlightBlock=p,e.configure=function(e){k=i(k,e)},e.initHighlighting=h,e.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",h,!1),addEventListener("load",h,!1)},e.registerLanguage=function(t,n){var a=Z[t]=n(e);a.aliases&&a.aliases.forEach((function(e){g[e]=t}))},e.listLanguages=function(){return m(Z)},e.getLanguage=f,e.inherit=i,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(t,n,a){var s=e.inherit({cN:"comment",b:t,e:n,c:[]},a||{});return s.c.push(e.PWM),s.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),s},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e}({}),void 0===(n=function(){return a.hljs}.apply(t,[]))||(e.exports=n)),hljs.registerLanguage("xml",(function(e){var t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:"[A-Za-z0-9\\._:-]+",r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("\x3c!--","--\x3e",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"<\/script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}})),hljs.registerLanguage("markdown",(function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}})),hljs.registerLanguage("ini",(function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}})),hljs.registerLanguage("python",(function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},n={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},s={cN:"params",b:/\(/,e:/\)/,c:["self",t,a,n]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,a,n,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,s,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}})),hljs.registerLanguage("css",(function(e){var t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:"[a-zA-Z-][a-zA-Z0-9_-]*",r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}})),hljs.registerLanguage("less",(function(e){var t="[\\w-]+",n="("+t+"|@{"+t+"})",a=[],s=[],i=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},o=function(e,t,n){return{cN:e,b:t,r:n}},r={b:"\\(",e:"\\)",c:s,r:0};s.push(e.CLCM,e.CBCM,i("'"),i('"'),e.CSSNM,{b:"(url|data-uri)\\(",starts:{cN:"string",e:"[\\)\\n]",eE:!0}},o("number","#[0-9A-Fa-f]+\\b"),r,o("variable","@@?"+t,10),o("variable","@{"+t+"}"),o("built_in","~?`[^`]*?`"),{cN:"attribute",b:t+"\\s*:",e:":",rB:!0,eE:!0},{cN:"meta",b:"!important"});var l=s.concat({b:"{",e:"}",c:a}),c={bK:"when",eW:!0,c:[{bK:"and not"}].concat(s)},u={b:n+"\\s*:",rB:!0,e:"[;}]",r:0,c:[{cN:"attribute",b:n,e:":",eE:!0,starts:{eW:!0,i:"[<=$]",r:0,c:s}}]},d={cN:"keyword",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:s,r:0}},p={cN:"variable",v:[{b:"@"+t+"\\s*:",r:15},{b:"@"+t}],starts:{e:"[;}]",rE:!0,c:l}},h={v:[{b:"[\\.#:&\\[>]",e:"[;{}]"},{b:n,e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",r:0,c:[e.CLCM,e.CBCM,c,o("keyword","all\\b"),o("variable","@{"+t+"}"),o("selector-tag",n+"%?",0),o("selector-id","#"+n),o("selector-class","\\."+n,0),o("selector-tag","&",0),{cN:"selector-attr",b:"\\[",e:"\\]"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"\\(",e:"\\)",c:l},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,d,p,u,h),{cI:!0,i:"[=>'/<($\"]",c:a}})),hljs.registerLanguage("scss",(function(e){var t={cN:"variable",b:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b"},n={cN:"number",b:"#[0-9A-Fa-f]+"};return e.CSSNM,e.QSM,e.ASM,e.CBCM,{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},t,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[t,n,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[t,e.QSM,e.ASM,n,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}})),hljs.registerLanguage("json",(function(e){var t={literal:"true false null"},n=[e.QSM,e.CNM],a={e:",",eW:!0,eE:!0,c:n,k:t},s={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(a,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(a)],i:"\\S"};return n.splice(n.length,0,s,i),{c:n,k:t,i:"\\S"}})),hljs.registerLanguage("javascript",(function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",n={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},s={cN:"subst",b:"\\$\\{",e:"\\}",k:n,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,s]};s.c=[e.ASM,e.QSM,i,a,e.RM];var o=s.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:n,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:n,c:o}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:o}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}})),hljs.registerLanguage("bash",(function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},n={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,n,{cN:"string",b:/'/,e:/'/},t]}}))},98936:function(e,t,n){"use strict";n.d(t,{gq:function(){return o},Z6:function(){return r},kw:function(){return l}});var a=n(22928),s=n(94184),i=n.n(s),o=(n(57588),function(e){var t=e.children,n=e.className;return(0,a.Z)("div",{className:i()("flex-row",n)},void 0,t)}),r=function(e){var t=e.children,n=e.className,s=e.shrink;return(0,a.Z)("div",{className:i()("flex-row-col",n,{"flex-row-col-shrink":s})},void 0,t)},l=function(e){var t=e.auto,n=e.children,s=e.className;return(0,a.Z)("div",{className:i()("flex-row-section",{"flex-row-section-auto":t},s)},void 0,n)}},59131:function(e,t,n){"use strict";var a=n(22928);n(57588),t.Z=function(e){var t=e.children;return(0,a.Z)("div",{className:"container page-container"},void 0,t)}},99755:function(e,t,n){"use strict";n.d(t,{mr:function(){return r},gC:function(){return l},sP:function(){return c},eA:function(){return u},Ql:function(){return d},bM:function(){return p},Iv:function(){return h}});var a,s=n(22928),i=n(94184),o=n.n(i),r=(n(57588),function(e){var t=e.children,n=e.className,i=e.styleName;return(0,s.Z)("div",{className:o()("page-header",n,i&&"page-header-"+i)},void 0,(0,s.Z)("div",{className:"page-header-bg-image"},void 0,(0,s.Z)("div",{className:"page-header-bg-overlay"},void 0,a||(a=(0,s.Z)("div",{className:"page-header-image"})),t)))}),l=function(e){var t=e.children,n=e.className,a=e.styleName;return(0,s.Z)("div",{className:o()("page-header-banner",n,a&&"page-header-banner-"+a)},void 0,(0,s.Z)("div",{className:"page-header-banner-bg-image"},void 0,(0,s.Z)("div",{className:"page-header-banner-bg-overlay"},void 0,t)))},c=function(e){var t=e.children;return(0,s.Z)("div",{className:"container page-header-container"},void 0,t)},u=function(e){var t=e.children,n=e.className;return(0,s.Z)("div",{className:o()("page-header-details",n)},void 0,t)},d=function(e){var t=e.className,n=e.message;return(0,s.Z)("div",{className:o()("page-header-message",t),dangerouslySetInnerHTML:{__html:n}})},p=function(e){var t=e.children,n=e.className;return(0,s.Z)("div",{className:o()("page-header-message",n)},void 0,t)},h=function(e){var t=e.styleName,n=e.header,a=e.message;return(0,s.Z)(c,{},void 0,(0,s.Z)(r,{styleName:t},void 0,(0,s.Z)(l,{styleName:t},void 0,(0,s.Z)("h1",{},void 0,n)),a&&(0,s.Z)(u,{styleName:t},void 0,a)))}},26106:function(e,t,n){"use strict";var a=n(22928),s=(n(57588),n(32233)),i=n(89627),o=function(e){var t=e.agreement,n=e.checked,s=e.errors,o=e.url,r=e.value,l=e.onChange;if(!o)return null;var c=interpolate('<a href="%(url)s" target="_blank">%(agreement)s</a>',{agreement:(0,i.Z)(t),url:(0,i.Z)(o)},!0),u=interpolate(gettext("I have read and accept %(agreement)s."),{agreement:c},!0);return(0,a.Z)("div",{className:"checkbox legal-footnote"},void 0,(0,a.Z)("label",{},void 0,(0,a.Z)("input",{checked:n,type:"checkbox",value:r,onChange:l}),(0,a.Z)("span",{dangerouslySetInnerHTML:{__html:u}})),s&&s.map((function(e,t){return(0,a.Z)("div",{className:"help-block errors"},t,e)})))};t.Z=function(e){var t=e.errors,n=e.privacyPolicy,i=e.termsOfService,r=e.onPrivacyPolicyChange,l=e.onTermsOfServiceChange,c=s.Z.get("TERMS_OF_SERVICE_ID"),u=s.Z.get("TERMS_OF_SERVICE_URL"),d=s.Z.get("PRIVACY_POLICY_ID"),p=s.Z.get("PRIVACY_POLICY_URL");return c||d?(0,a.Z)("div",{},void 0,(0,a.Z)(o,{agreement:gettext("the terms of service"),checked:null!==i,errors:t.termsOfService,url:u,value:c,onChange:l}),(0,a.Z)(o,{agreement:gettext("the privacy policy"),checked:null!==n,errors:t.privacyPolicy,url:p,value:d,onChange:r})):null}},47235:function(e,t,n){"use strict";var a,s=n(22928),i=(n(57588),n(32233)),o=function(e){var t=e.className,n=e.text;return n?(0,s.Z)("h5",{className:t||""},void 0,n):null};t.Z=function(e){var t=e.buttonClassName,n=e.buttonLabel,r=e.formLabel,l=e.header,c=e.labelClassName,u=i.Z.get("SOCIAL_AUTH");return 0===u.length?null:(0,s.Z)("div",{className:"form-group form-social-auth"},void 0,(0,s.Z)(o,{className:c,text:l}),(0,s.Z)("div",{className:"row"},void 0,u.map((function(e){var a=e.id,i=e.name,o=e.button_text,r=e.button_color,l=e.url,c="btn btn-block btn-default btn-social-"+a,u=r?{color:r}:null,d=o||interpolate(n,{site:i},!0);return(0,s.Z)("div",{className:t||"col-xs-12"},a,(0,s.Z)("a",{className:c,style:u,href:l},void 0,d))}))),a||(a=(0,s.Z)("hr",{})),(0,s.Z)(o,{className:c,text:r}))}},50366:function(e,t,n){"use strict";var a,s,i,o,r,l,c,u=n(22928);n(57588),t.Z=function(e){var t=e.thread;return(0,u.Z)("ul",{className:"thread-flags"},void 0,2==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-globally",title:gettext("Pinned globally")},void 0,a||(a=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark"))),1==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-locally",title:gettext("Pinned in category")},void 0,s||(s=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark_outline"))),t.best_answer&&(0,u.Z)("li",{className:"thread-flag-answered",title:gettext("Answered")},void 0,i||(i=(0,u.Z)("span",{className:"material-icon"},void 0,"check_circle"))),t.has_poll&&(0,u.Z)("li",{className:"thread-flag-poll",title:gettext("Poll")},void 0,o||(o=(0,u.Z)("span",{className:"material-icon"},void 0,"poll"))),(t.is_unapproved||t.has_unapproved_posts)&&(0,u.Z)("li",{className:"thread-flag-unapproved",title:t.is_unapproved?gettext("Awaiting approval"):gettext("Has unapproved posts")},void 0,r||(r=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility"))),t.is_closed&&(0,u.Z)("li",{className:"thread-flag-closed",title:gettext("Closed")},void 0,l||(l=(0,u.Z)("span",{className:"material-icon"},void 0,"lock"))),t.is_hidden&&(0,u.Z)("li",{className:"thread-flag-hidden",title:gettext("Hidden")},void 0,c||(c=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility_off"))))}},16768:function(e,t,n){"use strict";var a,s=n(22928);n(57588),t.Z=function(e){var t=e.thread;return(0,s.Z)("span",{className:"threads-replies",title:interpolate(ngettext("%(replies)s reply","%(replies)s replies",t.replies),{replies:t.replies},!0)},void 0,a||(a=(0,s.Z)("span",{className:"material-icon"},void 0,"chat_bubble_outline")),t.replies>980?Math.round(t.replies/1e3)+"K":t.replies)}},92490:function(e,t,n){"use strict";n.d(t,{o8:function(){return s},Eg:function(){return r},Z2:function(){return l},tw:function(){return c}});var a=n(22928),s=(n(57588),function(e){var t=e.children;return(0,a.Z)("nav",{className:"toolbar"},void 0,t)}),i=n(94184),o=n.n(i),r=function(e){var t=e.children,n=e.className,s=e.shrink;return(0,a.Z)("div",{className:o()("toolbar-item",n,{"toolbar-item-shrink":s})},void 0,t)},l=function(e){var t=e.auto,n=e.children,s=e.className;return(0,a.Z)("div",{className:o()("toolbar-section",{"toolbar-section-auto":t},s)},void 0,n)},c=function(e){var t=e.className;return(0,a.Z)("div",{className:o()("toolbar-spacer",t)})}},19605:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i}});var a=n(22928),s=(n(57588),n(32233));function i(e){var t=e.size||100,n=e.size2x||t;return(0,a.Z)("img",{alt:"",className:e.className||"user-avatar",src:o(e.user,t),srcSet:o(e.user,n),width:t,height:t})}function o(e,t){return e&&e.id?function(e,t){var n=e[0];return e.forEach((function(e){e.size>=t&&(n=e)})),n}(e.avatars,t).url:s.Z.get("BLANK_AVATAR_URL")}},82211:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){var e="btn "+this.props.className,t=this.props.disabled;return this.props.loading&&(e+=" btn-loading",t=!0),(0,s.Z)("button",{className:e,disabled:t,onClick:this.props.onClick,type:this.props.onClick?"button":"submit"},void 0,this.props.children,this.props.loading?a||(a=(0,s.Z)(p.Z,{})):null)}}]),d}(d().Component);h.defaultProps={className:"btn-default",type:"submit",loading:!1,disabled:!1,onClick:null}},57026:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(22928);function s(e){return(0,a.Z)("select",{className:e.className||"form-control",disabled:e.disabled||!1,id:e.id||null,onChange:e.onChange,value:e.value},void 0,e.choices.map((function(e){return(0,a.Z)("option",{disabled:e.disabled||!1,value:e.value},e.value,"- - ".repeat(e.level)+e.label)})))}n(57588)},21688:function(e,t,n){"use strict";n.d(t,{Z:function(){return S}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c),d=n(33556);function p(e){return e.display?(0,a.Z)(d.Z,{helpText:gettext("No profile details are editable at this time."),message:gettext("This option is currently unavailable.")}):null}var h,f=n(37848);function v(e){return e.display?h||(h=(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(f.Z,{}))):null}var m=n(97326),Z=n(4942),g=n(60471);var b=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){var e;(0,s.Z)(this,u);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=c.call.apply(c,[this].concat(n)),(0,Z.Z)((0,m.Z)(e),"onChange",(function(t){var n=e.props,a=n.field;(0,n.onChange)(a.fieldname,t.target.value)})),e}return(0,i.Z)(u,[{key:"render",value:function(){var e=this.props,t=e.disabled,n=e.field,s=e.value,i=n.input;return"select"===i.type?(0,a.Z)(g.Z,{choices:i.choices,disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,value:s}):"textarea"===i.type?(0,a.Z)("textarea",{className:"form-control",disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,rows:"4",type:"text",value:s}):"text"===i.type?(0,a.Z)("input",{className:"form-control",disabled:t,id:"id_"+n.fieldname,onChange:this.onChange,type:"text",value:s}):null}}]),u}(u().Component),y=n(96359);function _(e){var t=e.disabled,n=e.errors,s=e.fields,i=e.name,o=e.onChange,r=e.value;return(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,i),s.map((function(e){return(0,a.Z)(y.Z,{for:"id_"+e.fieldname,helpText:e.help_text,label:e.label,validation:n[e.fieldname]},e.fieldname,(0,a.Z)(b,{disabled:t,field:e,onChange:o,value:r[e.fieldname]}))})))}var N=n(82211),k=n(43345),x=n(78657),w=n(53904);var R=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;(0,s.Z)(this,u),t=c.call(this,e),(0,Z.Z)((0,m.Z)(t),"onChange",(function(e,n){t.setState((0,Z.Z)({},e,n))})),t.state={isLoading:!1,errors:{}};for(var n=e.groups.length,a=0;a<n;a++)for(var i=e.groups[a],o=i.fields.length,r=0;r<o;r++){var l=i.fields[r].fieldname,d=i.fields[r].initial;t.state[l]=d}return t}return(0,i.Z)(u,[{key:"send",value:function(){var e=Object.assign({},this.state,{errors:null,isLoading:null});return x.Z.post(this.props.api,e)}},{key:"handleSuccess",value:function(e){this.props.onSuccess(e)}},{key:"handleError",value:function(e){400===e.status?(w.Z.error(gettext("Form contains errors.")),this.setState({errors:e})):w.Z.apiError(e)}},{key:"render",value:function(){var e=this;return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,this.props.groups.map((function(t,n){return(0,a.Z)(_,{disabled:e.state.isLoading,errors:e.state.errors,fields:t.fields,name:t.name,onChange:e.onChange,value:e.state},n)}))),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(C,{disabled:this.state.isLoading,onCancel:this.props.onCancel})," ",(0,a.Z)(N.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes"))))}}]),u}(k.Z);function C(e){var t=e.onCancel,n=e.disabled;return t?(0,a.Z)("button",{className:"btn btn-default",disabled:n,onClick:t,type:"button"},void 0,gettext("Cancel")):null}var S=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={loading:!0,groups:null},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){var e=this;x.Z.get(this.props.api).then((function(t){e.setState({loading:!1,groups:t})}),(function(t){w.Z.apiError(t),e.props.cancel&&e.props.cancel()}))}},{key:"render",value:function(){var e=this.state,t=e.groups,n=e.loading;return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Edit details"))),(0,a.Z)(v,{display:n}),(0,a.Z)(p,{display:!n&&!t.length}),(0,a.Z)(E,{api:this.props.api,display:!n&&t.length,groups:t,onCancel:this.props.onCancel,onSuccess:this.props.onSuccess}))}}]),u}(u().Component);function E(e){var t=e.api,n=e.display,s=e.groups,i=e.onCancel,o=e.onSuccess;return n?(0,a.Z)(R,{api:t,groups:s,onCancel:i,onSuccess:o}):null}},96359:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"isValidated",value:function(){return void 0!==this.props.validation}},{key:"getClassName",value:function(){var e="form-group";return this.isValidated()&&(e+=" has-feedback",null===this.props.validation?e+=" has-success":e+=" has-error"),e}},{key:"getFeedback",value:function(){var e=this;return this.props.validation?(0,a.Z)("div",{className:"help-block errors"},void 0,this.props.validation.map((function(t,n){return(0,a.Z)("p",{},e.props.for+"FeedbackItem"+n,t)}))):null}},{key:"getFeedbackDescription",value:function(){return this.isValidated()?(0,a.Z)("span",{id:this.props.for+"_status",className:"sr-only"},void 0,this.props.validation?gettext("(error)"):gettext("(success)")):null}},{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:this.getClassName()},void 0,(0,a.Z)("label",{className:"control-label "+(this.props.labelClass||""),htmlFor:this.props.for||""},void 0,this.props.label+":"),(0,a.Z)("div",{className:this.props.controlClass||""},void 0,this.props.children,this.getFeedbackDescription(),this.getFeedback(),this.getHelpText(),this.props.extra||null))}}]),u}(n.n(c)().Component)},43345:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var a=n(15671),s=n(43144),i=n(97326),o=n(79340),r=n(6215),l=n(61120),c=n(4942),u=n(57588),d=n.n(u),p=n(55210),h=n(53904);var f=(0,p.C1)(),v=function(e){(0,o.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function d(){var e;(0,a.Z)(this,d);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=u.call.apply(u,[this].concat(n)),(0,c.Z)((0,i.Z)(e),"bindInput",(function(t){return function(n){e.changeValue(t,n.target.value)}})),(0,c.Z)((0,i.Z)(e),"changeValue",(function(t,n){var a=(0,c.Z)({},t,n),s=e.state.errors||{};s[t]=e.validateField(t,a[t]),a.errors=s,e.setState(a)})),(0,c.Z)((0,i.Z)(e),"handleSubmit",(function(t){if(t&&t.preventDefault(),!e.state.isLoading&&e.clean()){e.setState({isLoading:!0});var n=e.send();n?n.then((function(t){e.setState({isLoading:!1}),e.handleSuccess(t)}),(function(t){e.setState({isLoading:!1}),e.handleError(t)})):e.setState({isLoading:!1})}})),e}return(0,s.Z)(d,[{key:"validate",value:function(){var e={};if(!this.state.validators)return e;var t={required:this.state.validators.required||this.state.validators,optional:this.state.validators.optional||{}},n=[];for(var a in t.required)t.required.hasOwnProperty(a)&&t.required[a]&&n.push(a);for(var s in t.optional)t.optional.hasOwnProperty(s)&&t.optional[s]&&n.push(s);for(var i in n){var o=n[i],r=this.validateField(o,this.state[o]);null===r?e[o]=null:r&&(e[o]=r)}return e}},{key:"isValid",value:function(){var e=this.validate();for(var t in e)if(e.hasOwnProperty(t)&&null!==e[t])return!1;return!0}},{key:"validateField",value:function(e,t){var n=[];if(!this.state.validators)return n;var a={required:(this.state.validators.required||this.state.validators)[e],optional:(this.state.validators.optional||{})[e]},s=f(t)||!1;if(a.required){if(s)n=[s];else for(var i in a.required){var o=a.required[i](t);o&&n.push(o)}return n.length?n:null}if(!1===s&&a.optional){for(var r in a.optional){var l=a.optional[r](t);l&&n.push(l)}return n.length?n:null}return!1}},{key:"clean",value:function(){return!0}},{key:"send",value:function(){return null}},{key:"handleSuccess",value:function(e){}},{key:"handleError",value:function(e){h.Z.apiError(e)}}]),d}(d().Component)},94417:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"isActive",value:function(){return this.props.isControlled?this.props.isActive:!!this.props.path&&0===document.location.pathname.indexOf(this.props.path)}},{key:"getClassName",value:function(){return this.isActive()?(this.props.className||"")+" "+(this.props.activeClassName||"active"):this.props.className||""}},{key:"render",value:function(){return(0,a.Z)("li",{className:this.getClassName()},void 0,this.props.children)}}]),u}(n.n(c)().Component)},37848:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a,s=n(22928);function i(e){return(0,s.Z)("div",{className:e.className||"loader"},void 0,a||(a=(0,s.Z)("div",{className:"loader-spinning-wheel"})))}n(57588)},52753:function(e,t,n){"use strict";n.d(t,{ZP:function(){return Z}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=(n(57588),n(82211)),h=n(43345),f=n(96359),v=n(78657),m=n(59801);var Z=function(e){(0,l.Z)(f,e);var t,n,h=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function f(e){var t;return(0,i.Z)(this,f),t=h.call(this,e),(0,d.Z)((0,r.Z)(t),"handleSuccess",(function(e){t.props.onSuccess(e),m.Z.hide()})),(0,d.Z)((0,r.Z)(t),"handleError",(function(e){t.props.onError(e)})),(0,d.Z)((0,r.Z)(t),"onBestAnswerChange",(function(e){t.changeValue("bestAnswer",e.target.value)})),(0,d.Z)((0,r.Z)(t),"onPollChange",(function(e){t.changeValue("poll",e.target.value)})),t.state={isLoading:!1,bestAnswer:"0",poll:"0"},t}return(0,o.Z)(f,[{key:"clean",value:function(){return!this.props.polls||"0"!==this.state.poll||window.confirm(gettext("Are you sure you want to delete all polls?"))}},{key:"send",value:function(){var e=Object.assign({},this.props.data,{best_answer:this.state.bestAnswer,poll:this.state.poll});return v.Z.post(this.props.api,e)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Merge threads"))),(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(g,{choices:this.props.bestAnswers,onChange:this.onBestAnswerChange,value:this.state.bestAnswer}),(0,s.Z)(b,{choices:this.props.polls,onChange:this.onPollChange,value:this.state.poll})),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)(p.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Merge threads"))))))}}]),f}(h.Z);function g(e){var t=e.choices,n=e.onChange,a=e.value;return t?(0,s.Z)(f.Z,{label:gettext("Best answer"),helpText:gettext("Please select the best answer for your newly merged thread. No posts will be deleted during the merge."),for:"id_best_answer"},void 0,(0,s.Z)("select",{className:"form-control",id:"id_best_answer",onChange:n,value:a},void 0,t.map((function(e){return(0,s.Z)("option",{value:e[0]},e[0],e[1])})))):null}function b(e){var t=e.choices,n=e.onChange,a=e.value;return t?(0,s.Z)(f.Z,{label:gettext("Poll"),helpText:gettext("Please select the poll for your newly merged thread. Rejected polls will be permanently deleted and cannot be recovered."),for:"id_poll"},void 0,(0,s.Z)("select",{className:"form-control",id:"id_poll",onChange:n,value:a},void 0,t.map((function(e){return(0,s.Z)("option",{value:e[0]},e[0],e[1])})))):null}},69092:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var a=n(15671),s=n(43144),i=n(79340),o=n(6215),r=n(61120),l=n(57588),c=n.n(l),u=n(4942),d=n(19755),p=new RegExp("^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*"),h=new(function(){function e(){var t=this;(0,a.Z)(this,e),(0,u.Z)(this,"render",(function(e){e&&(t.highlightCode(e),t.embedYoutubePlayers(e))})),this._youtube={}}return(0,s.Z)(e,[{key:"highlightCode",value:function(e){for(var t=e.querySelectorAll("pre>code"),n=0;n<t.length;n++){var a=t[n];hljs.highlightBlock(a)}}},{key:"embedYoutubePlayers",value:function(e){for(var t=e.querySelectorAll("p>a"),n=0;n<t.length;n++){var a=t[n],s=1===a.parentNode.childNodes.length;this._youtube[a.href]||(this._youtube[a.href]=f(a.href));var i=this._youtube[a.href];s&&i&&!1!==i.data&&this.swapYoutubePlayer(a,i)}}},{key:"swapYoutubePlayer",value:function(e,t){var n="https://www.youtube.com/embed/";n+=t.video,n+="?rel=0",t.start&&(n+="&start="+t.start);var a=d('<iframe class="embed-responsive-item" src="'+n+'" allowfullscreen></iframe>');d(e).replaceWith(a),a.wrap('<div class="embed-responsive embed-responsive-16by9"></div>')}}]),e}());function f(e){var t=function(e){var t=e;return"https://"===e.substr(0,8)?t=t.substr(8):"http://"===e.substr(0,7)&&(t=t.substr(7)),"www."===t.substr(0,4)&&(t=t.substr(4)),t}(e),n=function(e){if(-1===e.indexOf("youtu"))return null;var t=e.match(p);return t?t[1]:null}(t);if(!n)return null;var a=0;if(t.indexOf("?")>0){var s=t.substr(t.indexOf("?")+1).split("&").filter((function(e){return"t="===e.substr(0,2)}))[0];if(s){var i=s.substr(2).split("m");"s"===i[0].substr(-1)?a+=parseInt(i[0].substr(0,i[0].length-1)):(a+=60*parseInt(i[0]),i[1]&&"s"===i[1].substr(-1)&&(a+=parseInt(i[1].substr(0,i[1].length-1))))}}return{start:a,video:n}}var v=n(19755);var m=function(e){(0,i.Z)(u,e);var t,n,l=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,r.Z)(t);if(n){var s=(0,r.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,o.Z)(this,e)});function u(){return(0,a.Z)(this,u),l.apply(this,arguments)}return(0,s.Z)(u,[{key:"componentDidMount",value:function(){h.render(this.documentNode),v(this.documentNode).find(".spoiler-reveal").click(Z)}},{key:"componentDidUpdate",value:function(e,t){h.render(this.documentNode),v(this.documentNode).find(".spoiler-reveal").click(Z)}},{key:"shouldComponentUpdate",value:function(e,t){return e.markup!==this.props.markup}},{key:"render",value:function(){var e=this;return c().createElement("article",{className:"misago-markup",dangerouslySetInnerHTML:{__html:this.props.markup},ref:function(t){e.documentNode=t}})}}]),u}(c().Component);function Z(e){var t=e.target;v(t).parent().parent().addClass("revealed")}},3784:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){return a||(a=(0,s.Z)("div",{className:"modal-body modal-loader"},void 0,(0,s.Z)(p.Z,{})))}}]),d}(d().Component)},30337:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120);n(57588);var c=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:"modal-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText(),(0,a.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}}]),u}(n(33556).Z)},95187:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37848);var h=function(e){(0,r.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,i.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){return a||(a=(0,s.Z)("div",{className:"panel-body panel-body-loading"},void 0,(0,s.Z)(p.Z,{className:"loader loader-spaced"})))}}]),d}(d().Component)},33556:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588);var u=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText()))}}]),u}(n.n(c)().Component)},91876:function(e,t,n){"use strict";n.d(t,{n:function(){return me},y:function(){return ke}});var a,s=n(87462),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(57588),h=n.n(p),f=n(30381),v=n.n(f),m=n(22928);function Z(e){return(0,m.Z)("div",{className:"poll-choices-bars"},void 0,e.poll.choices.map((function(t){return(0,m.Z)(g,{choice:t,poll:e.poll},t.hash)})))}function g(e){var t=0;return e.choice.votes&&e.poll.votes&&(t=Math.ceil(100*e.choice.votes/e.poll.votes)),(0,m.Z)("dl",{className:"dl-horizontal"},void 0,(0,m.Z)("dt",{},void 0,e.choice.label),(0,m.Z)("dd",{},void 0,(0,m.Z)("div",{className:"progress"},void 0,(0,m.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100",style:{width:t+"%"}},void 0,(0,m.Z)("span",{className:"sr-only"},void 0,y(e.votes,e.proc)))),(0,m.Z)("ul",{className:"list-unstyled list-inline poll-chart"},void 0,(0,m.Z)(b,{proc:t,votes:e.choice.votes}),(0,m.Z)(_,{selected:e.choice.selected}))))}function b(e){return(0,m.Z)("li",{className:"poll-chart-votes"},void 0,y(e.votes,e.proc))}function y(e,t){var n=ngettext("%(votes)s vote, %(proc)s% of total.","%(votes)s votes, %(proc)s% of total.",e);return interpolate(n,{votes:e,proc:t},!0)}function _(e){return e.selected?(0,m.Z)("li",{className:"poll-chart-selected"},void 0,a||(a=(0,m.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Your choice.")):null}var N,k,x,w=n(30337),R=n(3784),C=n(78657);var S=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,i.Z)(this,s),(t=a.call(this,e)).state={isLoading:!0,error:null,data:[]},t}return(0,o.Z)(s,[{key:"componentDidMount",value:function(){var e=this;C.Z.get(this.props.poll.api.votes).then((function(t){var n=t.map((function(e){return Object.assign({},e,{voters:e.voters.map((function(e){return Object.assign({},e,{voted_on:v()(e.voted_on)})}))})}));e.setState({isLoading:!1,data:n})}),(function(t){e.setState({isLoading:!1,error:t.detail})}))}},{key:"render",value:function(){return(0,m.Z)("div",{className:"modal-dialog"+(this.state.error?" modal-message":" modal-sm"),role:"document"},void 0,(0,m.Z)("div",{className:"modal-content"},void 0,(0,m.Z)("div",{className:"modal-header"},void 0,(0,m.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,N||(N=(0,m.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,m.Z)("h4",{className:"modal-title"},void 0,gettext("Poll votes"))),(0,m.Z)(E,{data:this.state.data,error:this.state.error,isLoading:this.state.isLoading})))}}]),s}(h().Component);function E(e){return e.isLoading?k||(k=(0,m.Z)(R.Z,{})):e.error?(0,m.Z)(w.Z,{icon:"error_outline",message:e.error}):(0,m.Z)(L,{data:e.data})}function L(e){return(0,m.Z)("div",{className:"modal-body modal-poll-votes"},void 0,(0,m.Z)("ul",{className:"list-unstyled votes-details"},void 0,e.data.map((function(e){return h().createElement(P,(0,s.Z)({key:e.hash},e))}))))}function P(e){return(0,m.Z)("li",{},void 0,(0,m.Z)("h4",{},void 0,e.label),(0,m.Z)(O,{votes:e.votes}),(0,m.Z)(T,{voters:e.voters}),x||(x=(0,m.Z)("hr",{})))}function O(e){var t=ngettext("%(votes)s user has voted for this choice.","%(votes)s users have voted for this choice.",e.votes),n=interpolate(t,{votes:e.votes},!0);return(0,m.Z)("p",{},void 0,n)}function T(e){return e.voters.length?(0,m.Z)("ul",{className:"list-unstyled"},void 0,e.voters.map((function(e){return h().createElement(A,(0,s.Z)({key:e.username},e))}))):null}function A(e){return e.url?(0,m.Z)("li",{},void 0,(0,m.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,m.Z)(B,{voted_on:e.voted_on})):(0,m.Z)("li",{},void 0,(0,m.Z)("strong",{},void 0,e.username)," ",(0,m.Z)(B,{voted_on:e.voted_on}))}function B(e){return(0,m.Z)("abbr",{className:"text-muted",title:e.voted_on.format("LLL")},void 0,e.voted_on.fromNow())}var I=n(59752),j=n(7738),D=n(59801),U=n(27950),M=n(53904),z=n(90287);function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}function F(e){var t=e.isPollOver,n=e.poll,a=e.showVoting,s=e.thread;if(!function(e,t,n){return n.is_public||t.can_delete||t.can_edit||t.can_see_votes||t.can_vote&&!e&&(!n.hasSelectedChoices||n.allow_revotes)}(t,n.acl,n))return null;var i=[],o=n.acl.can_vote,r=!n.hasSelectedChoices||n.allow_revotes;return o&&r&&i.push(0),(n.is_public||n.acl.can_see_votes)&&i.push(1),n.acl.can_edit&&i.push(2),n.acl.can_delete&&i.push(3),(0,m.Z)("div",{className:"row poll-options"},void 0,(0,m.Z)(Y,{controls:i,isPollOver:t,poll:n,showVoting:a}),(0,m.Z)(V,{controls:i,poll:n}),(0,m.Z)($,{controls:i,poll:n,thread:s}),(0,m.Z)(G,{controls:i,poll:n}))}function q(e,t){var n="col-xs-6";return 1===e.length&&(n="col-xs-12"),3===e.length&&e[0]===t&&(n="col-xs-12"),n+" col-sm-3 col-md-2"}function Y(e){var t=e.poll.acl.can_vote,n=!e.poll.hasSelectedChoices||e.poll.allow_revotes;return t&&n?(0,m.Z)("div",{className:q(e.controls,0)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:e.poll.isBusy,onClick:e.showVoting,type:"button"},void 0,gettext("Vote"))):null}var V=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){D.Z.show((0,m.Z)(S,{poll:e.props.poll}))})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.is_public||this.props.poll.acl.can_see_votes?(0,m.Z)("div",{className:q(this.props.controls,1)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("See votes"))):null}}]),n}(h().Component),$=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){U.Z.open({submit:e.props.poll.api.index,thread:e.props.thread,poll:e.props.poll,mode:"POLL"})})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.acl.can_edit?(0,m.Z)("div",{className:q(this.props.controls,2)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("Edit"))):null}}]),n}(h().Component),G=function(e){(0,l.Z)(n,e);var t=H(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){if(!window.confirm(gettext("Are you sure you want to delete this poll? This action is not reversible.")))return!1;z.Z.dispatch(I.n6()),C.Z.delete(e.props.poll.api.index).then(e.handleSuccess,e.handleError)})),(0,d.Z)((0,r.Z)(e),"handleSuccess",(function(e){M.Z.success("Poll has been deleted"),z.Z.dispatch(I.Od()),z.Z.dispatch(j.y8(e))})),(0,d.Z)((0,r.Z)(e),"handleError",(function(e){M.Z.apiError(e),z.Z.dispatch(I.Ar())})),e}return(0,o.Z)(n,[{key:"render",value:function(){return this.props.poll.acl.can_delete?(0,m.Z)("div",{className:q(this.props.controls,3)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,gettext("Delete"))):null}}]),n}(h().Component),W=n(89627),K='<abbr title="%(absolute)s">%(relative)s</abbr>';function J(e){return(0,m.Z)("ul",{className:"list-unstyled list-inline poll-details"},void 0,(0,m.Z)(ae,{votes:e.poll.votes}),(0,m.Z)(te,{poll:e.poll}),(0,m.Z)(se,{poll:e.poll}),(0,m.Z)(Q,{poll:e.poll}))}function Q(e){var t=interpolate((0,W.Z)(gettext("Posted by %(poster)s %(posted_on)s.")),{poster:X(e.poll),posted_on:ee(e.poll)},!0);return(0,m.Z)("li",{className:"poll-info-creation",dangerouslySetInnerHTML:{__html:t}})}function X(e){return e.url.poster?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,W.Z)(e.url.poster),user:(0,W.Z)(e.poster_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,W.Z)(e.poster_name)},!0)}function ee(e){return interpolate(K,{absolute:(0,W.Z)(e.posted_on.format("LLL")),relative:(0,W.Z)(e.posted_on.fromNow())},!0)}function te(e){if(!e.poll.length)return null;var t=interpolate((0,W.Z)(gettext("Voting ends %(ends_on)s.")),{ends_on:ne(e.poll)},!0);return(0,m.Z)("li",{className:"poll-info-ends-on",dangerouslySetInnerHTML:{__html:t}})}function ne(e){return interpolate(K,{absolute:(0,W.Z)(e.endsOn.format("LLL")),relative:(0,W.Z)(e.endsOn.fromNow())},!0)}function ae(e){var t=ngettext("%(votes)s vote.","%(votes)s votes.",e.votes),n=interpolate(t,{votes:e.votes},!0);return(0,m.Z)("li",{className:"poll-info-votes"},void 0,n)}function se(e){return e.poll.is_public?(0,m.Z)("li",{className:"poll-info-public"},void 0,gettext("Votes are public.")):null}function ie(e){return(0,m.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("h2",{},void 0,e.poll.question),(0,m.Z)(J,{poll:e.poll}),(0,m.Z)(Z,{poll:e.poll}),(0,m.Z)(F,{isPollOver:e.isPollOver,poll:e.poll,showVoting:e.showVoting,thread:e.thread})))}function oe(e){return(0,m.Z)("ul",{className:"list-unstyled list-inline poll-help"},void 0,(0,m.Z)(re,{choicesLeft:e.choicesLeft}),(0,m.Z)(le,{poll:e.poll}))}function re(e){var t=e.choicesLeft;if(0===t)return(0,m.Z)("li",{className:"poll-help-choices-left"},void 0,gettext("You can't select any more choices."));var n=ngettext("You can select %(choices)s more choice.","You can select %(choices)s more choices.",t),a=interpolate(n,{choices:t},!0);return(0,m.Z)("li",{className:"poll-help-choices-left"},void 0,a)}function le(e){return e.poll.allow_revotes?(0,m.Z)("li",{className:"poll-help-allow-revotes"},void 0,gettext("You can change your vote later.")):(0,m.Z)("li",{className:"poll-help-no-revotes"},void 0,gettext("Votes are final."))}function ce(e){return(0,m.Z)("ul",{className:"list-unstyled poll-select-choices"},void 0,e.choices.map((function(t){return(0,m.Z)(ue,{choice:t,toggleChoice:e.toggleChoice},t.hash)})))}var ue=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){var e;(0,i.Z)(this,s);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,d.Z)((0,r.Z)(e),"onClick",(function(){e.props.toggleChoice(e.props.choice.hash)})),e}return(0,o.Z)(s,[{key:"render",value:function(){return(0,m.Z)("li",{className:"poll-select-choice"},void 0,(0,m.Z)("button",{className:this.props.choice.selected?"btn btn-selected":"btn",onClick:this.onClick,type:"button"},void 0,(0,m.Z)("span",{className:"material-icon"},void 0,this.props.choice.selected?"check_box":"check_box_outline_blank"),(0,m.Z)("strong",{},void 0,this.props.choice.label)))}}]),s}(h().Component);function de(e,t){var n=[];for(var a in t){var s=t[a];s.selected&&n.push(s)}return e.allowed_choices-n.length}var pe=n(82211),he=n(43345);var fe=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,i.Z)(this,s),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"toggleChoice",(function(e){var n,a=function(e,t){for(var n in e){var a=e[n];if(a.hash===t)return a}return null}(t.state.choices,e);n=a.selected?t.deselectChoice(a,e):t.selectChoice(a,e),t.setState({choices:n,choicesLeft:de(t.props.poll,n)})})),(0,d.Z)((0,r.Z)(t),"selectChoice",(function(e,n){if(!de(t.props.poll,t.state.choices))for(var a in t.state.choices.slice()){var s=t.state.choices[a];if(s.selected&&s.hash!=n){s.selected=!1;break}}return t.state.choices.map((function(e){return Object.assign({},e,{selected:e.hash==n||e.selected})}))})),(0,d.Z)((0,r.Z)(t),"deselectChoice",(function(e,n){return t.state.choices.map((function(e){return Object.assign({},e,{selected:e.hash!=n&&e.selected})}))})),t.state={isLoading:!1,choices:e.poll.choices,choicesLeft:de(e.poll,e.poll.choices)},t}return(0,o.Z)(s,[{key:"clean",value:function(){return this.state.choicesLeft!==this.props.poll.allowed_choices||(M.Z.error(gettext("You need to select at least one choice")),!1)}},{key:"send",value:function(){var e=[];for(var t in this.state.choices.slice()){var n=this.state.choices[t];n.selected&&e.push(n.hash)}return C.Z.post(this.props.poll.api.votes,e)}},{key:"handleSuccess",value:function(e){z.Z.dispatch(I.gx(e)),M.Z.success(gettext("Your vote has been saved.")),this.props.showResults()}},{key:"handleError",value:function(e){400===e.status?M.Z.error(e.detail):M.Z.apiError(e)}},{key:"render",value:function(){var e=[];return this.props.poll.acl.can_vote&&e.push(0),(this.props.poll.is_public||this.props.poll.acl.can_see_votes)&&e.push(1),this.props.poll.acl.can_edit&&e.push(2),this.props.poll.acl.can_delete&&e.push(3),(0,m.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,m.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("h2",{},void 0,this.props.poll.question),(0,m.Z)(J,{poll:this.props.poll}),(0,m.Z)(ce,{choices:this.state.choices,toggleChoice:this.toggleChoice}),(0,m.Z)(oe,{choicesLeft:this.state.choicesLeft,poll:this.props.poll})),(0,m.Z)("div",{className:"panel-footer"},void 0,(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)("div",{className:q(e,0)},void 0,(0,m.Z)(pe.Z,{className:"btn-primary btn-block btn-sm",loading:this.state.isLoading},void 0,gettext("Save your vote"))),(0,m.Z)("div",{className:q(e,1)},void 0,(0,m.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.state.isLoading,onClick:this.props.showResults,type:"button"},void 0,gettext("See results"))),(0,m.Z)($,{controls:e,poll:this.props.poll,thread:this.props.thread}),(0,m.Z)(G,{controls:e,poll:this.props.poll})))))}}]),s}(he.Z);var ve,me=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"showResults",(function(){t.setState({showResults:!0})})),(0,d.Z)((0,r.Z)(t),"showVoting",(function(){t.setState({showResults:!1})}));var n=!0;return e.user.id&&!e.poll.hasSelectedChoices&&(n=!1),t.state={showResults:n},t}return(0,o.Z)(p,[{key:"render",value:function(){if(!this.props.thread.poll)return null;var e=function(e){return!!e.length&&v()().isAfter(e.endsOn)}(this.props.poll);return e||!this.props.poll.acl.can_vote||this.state.showResults?h().createElement(ie,(0,s.Z)({isPollOver:e,showVoting:this.showVoting},this.props)):h().createElement(fe,(0,s.Z)({showResults:this.showResults},this.props))}}]),p}(h().Component);function Ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ge=function(e){(0,l.Z)(n,e);var t=Ze(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onAdd",(function(){var t=e.props.choices.slice();t.push({hash:ye(),label:""}),e.props.setChoices(t)})),(0,d.Z)((0,r.Z)(e),"onChange",(function(t,n){var a=e.props.choices.map((function(e){return e.hash===t&&(e.label=n),e}));e.props.setChoices(a)})),(0,d.Z)((0,r.Z)(e),"onDelete",(function(t){var n=e.props.choices.filter((function(e){return e.hash!==t}));e.props.setChoices(n)})),e}return(0,o.Z)(n,[{key:"render",value:function(){var e=this;return(0,m.Z)("div",{className:"poll-choices-control"},void 0,(0,m.Z)("ul",{className:"list-group"},void 0,this.props.choices.map((function(t){return(0,m.Z)(be,{canDelete:e.props.choices.length>2,choice:t,disabled:e.props.disabled,onChange:e.onChange,onDelete:e.onDelete},t.hash)}))),(0,m.Z)("button",{className:"btn btn-default btn-sm",disabled:this.props.disabled,onClick:this.onAdd,type:"button"},void 0,gettext("Add choice")))}}]),n}(h().Component),be=function(e){(0,l.Z)(n,e);var t=Ze(n);function n(){var e;(0,i.Z)(this,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),(0,d.Z)((0,r.Z)(e),"onChange",(function(t){e.props.onChange(e.props.choice.hash,t.target.value)})),(0,d.Z)((0,r.Z)(e),"onDelete",(function(){window.confirm(gettext("Are you sure you want to delete this choice?"))&&e.props.onDelete(e.props.choice.hash)})),e}return(0,o.Z)(n,[{key:"render",value:function(){return(0,m.Z)("li",{className:"list-group-item"},void 0,(0,m.Z)("button",{className:"btn",disabled:!this.props.canDelete||this.props.disabled,onClick:this.onDelete,title:gettext("Delete this choice"),type:"button"},void 0,ve||(ve=(0,m.Z)("span",{className:"material-icon"},void 0,"close"))),(0,m.Z)("input",{disabled:this.props.disabled,maxLength:"255",placeholder:gettext("choice label"),type:"text",onChange:this.onChange,value:this.props.choice.label}))}}]),n}(h().Component);function ye(){for(var e="";12!=e.length;)e=Math.random().toString(36).replace(/[^a-zA-Z0-9]+/g,"").substr(1,12);return e}var _e=n(96359),Ne=n(7227);var ke=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;(0,i.Z)(this,s),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"setChoices",(function(e){var n=Object.assign({},n,{choices:null});t.setState({choices:e,errors:n})})),(0,d.Z)((0,r.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard poll?"))&&U.Z.close()}));var n=e.poll||{question:"",choices:[{hash:"choice-10000",label:""},{hash:"choice-20000",label:""}],length:0,allowed_choices:1,allow_revotes:0,is_public:0};return t.state={isLoading:!1,isEdit:!!n.question,question:n.question,choices:n.choices,length:n.length,allowed_choices:n.allowed_choices,allow_revotes:n.allow_revotes,is_public:n.is_public,validators:{question:[],choices:[],length:[],allowed_choices:[]},errors:{}},t}return(0,o.Z)(s,[{key:"send",value:function(){var e={question:this.state.question,choices:this.state.choices,length:this.state.length,allowed_choices:this.state.allowed_choices,allow_revotes:this.state.allow_revotes,is_public:this.state.is_public};return this.state.isEdit?C.Z.put(this.props.poll.api.index,e):C.Z.post(this.props.thread.api.poll,e)}},{key:"handleSuccess",value:function(e){z.Z.dispatch(I.gx(e)),this.state.isEdit?M.Z.success(gettext("Poll has been edited.")):M.Z.success(gettext("Poll has been posted.")),U.Z.close()}},{key:"handleError",value:function(e){400===e.status?(e.non_field_errors&&(e.allowed_choices=e.non_field_errors),this.setState({errors:Object.assign({},e)}),M.Z.error(gettext("Form contains errors."))):M.Z.apiError(e)}},{key:"render",value:function(){return(0,m.Z)("div",{className:"poll-form"},void 0,(0,m.Z)("div",{className:"container"},void 0,(0,m.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,m.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,m.Z)("div",{className:"panel-body"},void 0,(0,m.Z)("fieldset",{},void 0,(0,m.Z)("legend",{},void 0,gettext("Question and choices")),(0,m.Z)(_e.Z,{label:gettext("Poll question"),for:"id_questions",validation:this.state.errors.question},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_questions",onChange:this.bindInput("question"),type:"text",maxLength:"255",value:this.state.question})),(0,m.Z)(_e.Z,{label:gettext("Available choices"),validation:this.state.errors.choices},void 0,(0,m.Z)(ge,{choices:this.state.choices,disabled:this.state.isLoading,setChoices:this.setChoices}))),(0,m.Z)("fieldset",{},void 0,(0,m.Z)("legend",{},void 0,gettext("Voting")),(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Poll length"),helpText:gettext("Enter number of days for which voting in this poll should be possible or zero to run this poll indefinitely."),for:"id_length",validation:this.state.errors.length},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_length",onChange:this.bindInput("length"),type:"text",value:this.state.length}))),(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Allowed choices"),for:"id_allowed_choices",validation:this.state.errors.allowed_choices},void 0,(0,m.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_allowed_choices",onChange:this.bindInput("allowed_choices"),type:"text",maxLength:"255",value:this.state.allowed_choices})))),(0,m.Z)("div",{className:"row"},void 0,(0,m.Z)(xe,{bindInput:this.bindInput,disabled:this.state.isLoading,isEdit:this.state.isEdit,value:this.state.is_public}),(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Allow vote changes"),for:"id_allow_revotes"},void 0,(0,m.Z)(Ne.Z,{id:"id_allow_revotes",disabled:this.state.isLoading,iconOn:"check",iconOff:"close",labelOn:gettext("Allow participants to change their vote"),labelOff:gettext("Don't allow participants to change their vote"),onChange:this.bindInput("allow_revotes"),value:this.state.allow_revotes})))))),(0,m.Z)("div",{className:"panel-footer text-right"},void 0,(0,m.Z)("button",{className:"btn btn-default",disabled:this.state.isLoading,onClick:this.onCancel,type:"button"},void 0,gettext("Cancel"))," ",(0,m.Z)(pe.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,this.state.isEdit?gettext("Save changes"):gettext("Post poll")))))))}}]),s}(he.Z);function xe(e){return e.isEdit?null:(0,m.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,m.Z)(_e.Z,{label:gettext("Make voting public"),helpText:gettext("Making voting public will allow everyone to access detailed list of votes, showing which users voted for which choices and at which times. This option can't be changed after poll's creation. Moderators may see voting details for all polls."),for:"id_is_public"},void 0,(0,m.Z)(Ne.Z,{id:"id_is_public",disabled:e.disabled,iconOn:"visibility",iconOff:"visibility_off",labelOn:gettext("Votes are public"),labelOff:gettext("Votes are hidden"),onChange:e.bindInput("is_public"),value:e.value})))}},11005:function(e,t,n){"use strict";n.d(t,{Z:function(){return x}});var a=n(22928),s=n(57588),i=n.n(s),o=n(69092);function r(e){return e.post.content?i().createElement(l,e):i().createElement(c,e)}function l(e){return(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)(o.Z,{markup:e.post.content}))}function c(e){return(0,a.Z)("div",{className:"post-body post-body-invalid"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("This post's contents cannot be displayed.")),(0,a.Z)("p",{className:"text-muted"},void 0,gettext("This error is caused by invalid post content manipulation.")))}function u(e){var t=e.post,n=t.category,s=t.thread,i=interpolate(gettext("posted %(posted_on)s"),{posted_on:t.posted_on.format("LL, LT")},!0);return(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("a",{className:"btn btn-link item-title",href:s.url},void 0,s.title),(0,a.Z)("a",{className:"btn btn-link post-category",href:n.url.index},void 0,n.name),(0,a.Z)("a",{href:t.url.index,className:"btn btn-link posted-on",title:i},void 0,t.posted_on.fromNow()))}n(89627);var d,p,h=n(19605);function f(e){var t=e.post;return(0,a.Z)("a",{className:"btn btn-default btn-icon pull-right",href:t.url.index},void 0,(0,a.Z)("span",{className:"btn-text-left hidden-xs"},void 0,gettext("See post")),d||(d=(0,a.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function v(e){var t=e.post;return(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)(f,{post:t}),(0,a.Z)("div",{className:"media"},void 0,p||(p=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,t.poster_name)),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,gettext("Removed user")))))}function m(e){var t=e.rank,n=e.title||t.title||t.name,s="user-title";return t.css_class&&(s+=" user-title-"+t.css_class),t.is_tab?(0,a.Z)("a",{className:s,href:t.url},void 0,n):(0,a.Z)("span",{className:s},void 0,n)}function Z(e){var t=e.post,n=e.poster;return(0,a.Z)("div",{className:"post-side post-side-registered"},void 0,(0,a.Z)(f,{post:t}),(0,a.Z)("div",{className:"media"},void 0,(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("a",{href:n.url},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50,user:n}))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("a",{className:"item-title",href:n.url},void 0,n.username)),(0,a.Z)(m,{title:n.title,rank:n.rank}))))}function g(e){var t=e.post,n=e.poster;return n&&n.id?(0,a.Z)(Z,{post:t,poster:n}):(0,a.Z)(v,{post:t})}function b(e){var t=e.post,n=e.poster||t.poster,s="post";return n&&n.rank.css_class&&(s+=" post-"+n.rank.css_class),(0,a.Z)("li",{className:s,id:"post-"+t.id},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(g,{post:t,poster:n}),(0,a.Z)(u,{post:t}),(0,a.Z)(r,{post:t}))))}var y,_,N=n(44039);function k(){return(0,a.Z)("ul",{className:"posts-list post-feed ui-preview"},void 0,(0,a.Z)("li",{className:"post"},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)("div",{className:"media"},void 0,y||(y=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))))),(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")),(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)("article",{className:"misago-markup"},void 0,(0,a.Z)("p",{},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))))))))}function x(e){var t=e.isReady,n=e.posts,s=e.poster;return t?(0,a.Z)("ul",{className:"posts-list post-feed ui-ready"},void 0,n.map((function(e){return(0,a.Z)(b,{post:e,poster:s},e.id)}))):_||(_=(0,a.Z)(k,{}))}},12891:function(e,t,n){"use strict";n.d(t,{Jh:function(){return o},jn:function(){return i}});var a=n(55210),s=n(32233);function i(){return[(0,a.Ei)(s.Z.get("SETTINGS").thread_title_length_min,(function(e,t){var n=ngettext("Thread title should be at least %(limit_value)s character long (it has %(show_value)s).","Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)})),(0,a.BS)(s.Z.get("SETTINGS").thread_title_length_max,(function(e,t){var n=ngettext("Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).","Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))]}function o(){return s.Z.get("SETTINGS").post_length_max?[r(),(0,a.BS)(s.Z.get("SETTINGS").post_length_max||1e6,(function(e,t){var n=ngettext("Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).","Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))]:[r()]}function r(){return(0,a.Ei)(s.Z.get("SETTINGS").post_length_min,(function(e,t){var n=ngettext("Posted message should be at least %(limit_value)s character long (it has %(show_value)s).","Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(n,{limit_value:e,show_value:t},!0)}))}},60471:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a=n(22928),s=n(15671),i=n(43144),o=n(97326),r=n(79340),l=n(6215),c=n(61120),u=n(4942),d=n(57588);var p=function(e){(0,r.Z)(p,e);var t,n,d=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,s.Z)(this,p);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=d.call.apply(d,[this].concat(n)),(0,u.Z)((0,o.Z)(e),"change",(function(t){return function(){e.props.onChange({target:{value:t}})}})),e}return(0,i.Z)(p,[{key:"getChoice",value:function(){var e=this,t=null;return this.props.choices.map((function(n){n.value===e.props.value&&(t=n)})),t}},{key:"getIcon",value:function(){return this.getChoice().icon}},{key:"getLabel",value:function(){return this.getChoice().label}},{key:"render",value:function(){var e=this;return(0,a.Z)("div",{className:"btn-group btn-select-group"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-select dropdown-toggle",id:this.props.id||null,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)(h,{icon:this.getIcon()}),this.getLabel()),(0,a.Z)("ul",{className:"dropdown-menu"},void 0,this.props.choices.map((function(t,n){return(0,a.Z)("li",{},n,(0,a.Z)("button",{type:"button",className:"btn-link",onClick:e.change(t.value)},void 0,(0,a.Z)(h,{icon:t.icon}),t.label))}))))}}]),p}(n.n(d)().Component);function h(e){var t=e.icon;return t?(0,a.Z)("span",{className:"material-icon"},void 0,t):null}},14467:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=(n(57588),n(32233)),d=n(82211),p=n(43345),h=n(47235),f=n(78657),v=n(59801),m=n(53904),Z=n(93051),g=n(19755);var b=function(e){(0,r.Z)(b,e);var t,n,p=(t=b,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function b(e){var t;return(0,i.Z)(this,b),(t=p.call(this,e)).state={isLoading:!1,showActivation:!1,username:"",password:"",validators:{username:[],password:[]}},t}return(0,o.Z)(b,[{key:"clean",value:function(){return!!this.isValid()||(m.Z.error(gettext("Fill out both fields.")),!1)}},{key:"send",value:function(){return f.Z.post(u.Z.get("AUTH_API"),{username:this.state.username,password:this.state.password})}},{key:"handleSuccess",value:function(){var e=g("#hidden-login-form");e.append('<input type="text" name="username" />'),e.append('<input type="password" name="password" />'),e.find('input[type="hidden"]').val(f.Z.getCsrfToken()),e.find('input[name="redirect_to"]').val(window.location.pathname),e.find('input[name="username"]').val(this.state.username),e.find('input[name="password"]').val(this.state.password),e.submit(),this.setState({isLoading:!0})}},{key:"handleError",value:function(e){400===e.status?"inactive_admin"===e.code?m.Z.info(e.detail):"inactive_user"===e.code?(m.Z.info(e.detail),this.setState({showActivation:!0})):"banned"===e.code?((0,Z.Z)(e.detail),v.Z.hide()):m.Z.error(e.detail):403===e.status&&e.ban?((0,Z.Z)(e.ban),v.Z.hide()):m.Z.apiError(e)}},{key:"getActivationButton",value:function(){return this.state.showActivation?(0,s.Z)("a",{className:"btn btn-success btn-block",href:u.Z.get("REQUEST_ACTIVATION_URL")},void 0,gettext("Activate account")):null}},{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog modal-sm modal-sign-in",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Sign in"))),(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(h.Z,{buttonLabel:gettext("Sign in with %(site)s"),formLabel:gettext("Or use your forum account:"),labelClassName:"text-center"}),(0,s.Z)("div",{className:"form-group"},void 0,(0,s.Z)("div",{className:"control-input"},void 0,(0,s.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_username",onChange:this.bindInput("username"),placeholder:gettext("Username or e-mail"),type:"text",value:this.state.username}))),(0,s.Z)("div",{className:"form-group"},void 0,(0,s.Z)("div",{className:"control-input"},void 0,(0,s.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_password",onChange:this.bindInput("password"),placeholder:gettext("Password"),type:"password",value:this.state.password})))),(0,s.Z)("div",{className:"modal-footer"},void 0,this.getActivationButton(),(0,s.Z)(d.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Sign in")),(0,s.Z)("a",{className:"btn btn-default btn-block",href:u.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Forgot password?"))))))}}]),b}(p.Z)},24678:function(e,t,n){"use strict";n.d(t,{Jj:function(){return h},ZP:function(){return p},pg:function(){return f}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,l.Z)(e);if(t){var s=(0,l.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,r.Z)(this,n)}}var p=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getClass",value:function(){return e=this.props.status,t="",e.is_banned?t="banned":e.is_hidden?t="offline":e.is_online_hidden?t="online":e.is_offline_hidden?t="offline":e.is_online?t="online":e.is_offline&&(t="offline"),"user-status user-"+t;var e,t}},{key:"render",value:function(){return(0,a.Z)("span",{className:this.getClass()},void 0,this.props.children)}}]),n}(u().Component),h=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getIcon",value:function(){return this.props.status.is_banned?"remove_circle_outline":this.props.status.is_hidden?"help_outline":this.props.status.is_online_hidden?"label":this.props.status.is_offline_hidden?"label_outline":this.props.status.is_online?"lens":this.props.status.is_offline?"panorama_fish_eye":void 0}},{key:"render",value:function(){return(0,a.Z)("span",{className:"material-icon status-icon"},void 0,this.getIcon())}}]),n}(u().Component),f=function(e){(0,o.Z)(n,e);var t=d(n);function n(){return(0,s.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"getHelp",value:function(){return e=this.props.user,(t=this.props.status).is_banned?t.banned_until?interpolate(gettext("%(username)s is banned until %(ban_expires)s"),{username:e.username,ban_expires:t.banned_until.format("LL, LT")},!0):interpolate(gettext("%(username)s is banned"),{username:e.username},!0):t.is_hidden?interpolate(gettext("%(username)s is hiding presence"),{username:e.username},!0):t.is_online_hidden?interpolate(gettext("%(username)s is online (hidden)"),{username:e.username},!0):t.is_offline_hidden?interpolate(gettext("%(username)s was last seen %(last_click)s (hidden)"),{username:e.username,last_click:t.last_click.fromNow()},!0):t.is_online?interpolate(gettext("%(username)s is online"),{username:e.username},!0):t.is_offline?interpolate(gettext("%(username)s was last seen %(last_click)s"),{username:e.username,last_click:t.last_click.fromNow()},!0):void 0;var e,t}},{key:"getLabel",value:function(){return this.props.status.is_banned?gettext("Banned"):this.props.status.is_hidden?gettext("Hidden"):this.props.status.is_online_hidden?gettext("Online (hidden)"):this.props.status.is_offline_hidden?gettext("Offline (hidden)"):this.props.status.is_online?gettext("Online"):this.props.status.is_offline?gettext("Offline"):void 0}},{key:"render",value:function(){return(0,a.Z)("span",{className:this.props.className||"status-label",title:this.getHelp()},void 0,this.getLabel())}}]),n}(u().Component)},7850:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c);var d,p,h=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getEmptyMessage",value:function(){return this.props.emptyMessage?this.props.emptyMessage:gettext("No name changes have been recorded for your account.")}},{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-ready"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,(0,a.Z)("li",{className:"list-group-item empty-message"},void 0,this.getEmptyMessage())))}}]),u}(u().Component),f=n(19605);var v=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"renderUserAvatar",value:function(){return this.props.change.changed_by?(0,a.Z)("a",{href:this.props.change.changed_by.url,className:"user-avatar-wrapper"},void 0,(0,a.Z)(f.ZP,{user:this.props.change.changed_by,size:"100"})):d||(d=(0,a.Z)("span",{className:"user-avatar-wrapper"},void 0,(0,a.Z)(f.ZP,{size:"100"})))}},{key:"renderUsername",value:function(){return this.props.change.changed_by?(0,a.Z)("a",{href:this.props.change.changed_by.url,className:"item-title"},void 0,this.props.change.changed_by.username):(0,a.Z)("span",{className:"item-title"},void 0,this.props.change.changed_by_username)}},{key:"render",value:function(){return(0,a.Z)("li",{className:"list-group-item"},this.props.change.id,(0,a.Z)("div",{className:"change-avatar"},void 0,this.renderUserAvatar()),(0,a.Z)("div",{className:"change-author"},void 0,this.renderUsername()),(0,a.Z)("div",{className:"change"},void 0,(0,a.Z)("span",{className:"old-username"},void 0,this.props.change.old_username),p||(p=(0,a.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,a.Z)("span",{className:"new-username"},void 0,this.props.change.new_username)),(0,a.Z)("div",{className:"change-date"},void 0,(0,a.Z)("abbr",{title:this.props.change.changed_on.format("LLL")},void 0,this.props.change.changed_on.fromNow())))}}]),u}(u().Component);var m,Z,g=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-ready"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,this.props.changes.map((function(e){return(0,a.Z)(v,{change:e},e.id)}))))}}]),u}(u().Component),b=n(44039);var y=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getClassName",value:function(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}},{key:"render",value:function(){return(0,a.Z)("li",{className:this.getClassName()},void 0,m||(m=(0,a.Z)("div",{className:"change-avatar"},void 0,(0,a.Z)("span",{className:"user-avatar"},void 0,(0,a.Z)(f.ZP,{size:"100"})))),(0,a.Z)("div",{className:"change-author"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,100)+"px"}},void 0," ")),(0,a.Z)("div",{className:"change"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,70)+"px"}},void 0," "),Z||(Z=(0,a.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(30,70)+"px"}},void 0," ")),(0,a.Z)("div",{className:"change-date"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:b.e(80,140)+"px"}},void 0," ")))}}]),u}(u().Component);var _,N=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,a.Z)("div",{className:"username-history ui-preview"},void 0,(0,a.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((function(e){return(0,a.Z)(y,{hiddenOnMobile:e>0},e)}))))}}]),u}(u().Component);var k=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){return this.props.isLoaded?this.props.changes.length?(0,a.Z)(g,{changes:this.props.changes}):(0,a.Z)(h,{emptyMessage:this.props.emptyMessage}):_||(_=(0,a.Z)(N,{}))}}]),u}(u().Component)},40429:function(e,t,n){"use strict";n.d(t,{Z:function(){return L}});var a,s=n(22928),i=n(57588),o=n.n(i),r=n(19605),l=n(24678);function c(e){var t=e.showStatus,n=e.user;return(0,s.Z)("ul",{className:"list-unstyled"},void 0,(0,s.Z)(u,{showStatus:t,user:n}),(0,s.Z)(d,{user:n}),a||(a=(0,s.Z)("li",{className:"user-stat-divider"})),(0,s.Z)(p,{user:n}),(0,s.Z)(h,{user:n}),(0,s.Z)(f,{user:n}))}function u(e){var t=e.showStatus,n=e.user;return t?(0,s.Z)("li",{className:"user-stat-status"},void 0,(0,s.Z)(l.ZP,{status:n.status},void 0,(0,s.Z)(l.pg,{status:n.status,user:n}))):null}function d(e){var t=e.user.joined_on,n=interpolate(gettext("Joined on %(joined_on)s"),{joined_on:t.format("LL, LT")},!0),a=interpolate(gettext("Joined %(joined_on)s"),{joined_on:t.fromNow()},!0);return(0,s.Z)("li",{className:"user-stat-join-date"},void 0,(0,s.Z)("abbr",{title:n},void 0,a))}function p(e){var t=e.user,n=v("user-stat-posts",t.posts),a=ngettext("%(posts)s post","%(posts)s posts",t.posts);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{posts:t.posts},!0))}function h(e){var t=e.user,n=v("user-stat-threads",t.threads),a=ngettext("%(threads)s thread","%(threads)s threads",t.threads);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{threads:t.threads},!0))}function f(e){var t=e.user,n=v("user-stat-followers",t.followers),a=ngettext("%(followers)s follower","%(followers)s followers",t.followers);return(0,s.Z)("li",{className:n},void 0,interpolate(a,{followers:t.followers},!0))}function v(e,t){return 0===t?e+" user-stat-empty":e}function m(e){var t=e.rank,n=e.title||t.title||t.name,a="user-title";return t.css_class&&(a+=" user-title-"+t.css_class),t.is_tab?(0,s.Z)("a",{className:a,href:t.url},void 0,n):(0,s.Z)("span",{className:a},void 0,n)}function Z(e){var t=e.showStatus,n=e.user,a=n.rank,i="panel user-card";return a.css_class&&(i+=" user-card-"+a.css_class),(0,s.Z)("div",{className:i},void 0,(0,s.Z)("div",{className:"panel-body"},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,s.Z)("div",{className:"user-card-small-avatar"},void 0,(0,s.Z)("a",{href:n.url},void 0,(0,s.Z)(r.ZP,{size:"50",size2x:"80",user:n})))),(0,s.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,(0,s.Z)("div",{className:"user-card-avatar"},void 0,(0,s.Z)("a",{href:n.url},void 0,(0,s.Z)(r.ZP,{size:"150",size2x:"200",user:n}))),(0,s.Z)("div",{className:"user-card-username"},void 0,(0,s.Z)("a",{href:n.url},void 0,n.username)),(0,s.Z)("div",{className:"user-card-title"},void 0,(0,s.Z)(m,{rank:a,title:n.title})),(0,s.Z)("div",{className:"user-card-stats"},void 0,(0,s.Z)(c,{showStatus:t,user:n}))))))}var g,b,y,_=n(15671),N=n(43144),k=n(79340),x=n(6215),w=n(61120),R=n(44039);var C,S=function(e){(0,k.Z)(i,e);var t,n,a=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,w.Z)(t);if(n){var s=(0,w.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,x.Z)(this,e)});function i(){return(0,_.Z)(this,i),a.apply(this,arguments)}return(0,N.Z)(i,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,s.Z)("div",{className:"panel user-card user-card-preview"},void 0,(0,s.Z)("div",{className:"panel-body"},void 0,(0,s.Z)("div",{className:"row"},void 0,g||(g=(0,s.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,s.Z)("div",{className:"user-card-small-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(r.ZP,{size:"50",size2x:"80"}))))),(0,s.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,b||(b=(0,s.Z)("div",{className:"user-card-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(r.ZP,{size:"150",size2x:"200"})))),(0,s.Z)("div",{className:"user-card-username"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(60,150)+"px"}},void 0," ")),(0,s.Z)("div",{className:"user-card-title"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(60,150)+"px"}},void 0," ")),(0,s.Z)("div",{className:"user-card-stats"},void 0,(0,s.Z)("ul",{className:"list-unstyled"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),y||(y=(0,s.Z)("li",{className:"user-stat-divider"})),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," ")),(0,s.Z)("li",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:R.e(30,70)+"px"}},void 0," "))))))))}}]),i}(o().Component);function E(e){var t=e.colClassName,n=e.cols,a=Array.apply(null,{length:n}).map(Number.call,Number);return(0,s.Z)("div",{className:"users-cards-list ui-preview"},void 0,(0,s.Z)("div",{className:"row"},void 0,a.map((function(e){var n=t;return 0!==e&&(n+=" hidden-xs"),3===e&&(n+=" hidden-sm"),(0,s.Z)("div",{className:n},e,C||(C=(0,s.Z)(S,{})))}))))}function L(e){var t=e.cols,n=e.isReady,a=e.showStatus,i=e.users,o="col-xs-12 col-sm-4";return 4===t&&(o+=" col-md-3"),n?(0,s.Z)("div",{className:"users-cards-list ui-ready"},void 0,(0,s.Z)("div",{className:"row"},void 0,i.map((function(e){return(0,s.Z)("div",{className:o},e.id,(0,s.Z)(Z,{showStatus:a,user:e}))})))):(0,s.Z)(E,{colClassName:o,cols:t})}},82125:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var a=n(15671),s=n(43144),i=n(97326),o=n(79340),r=n(6215),l=n(61120),c=n(4942),u=n(57588);var d=function(e){(0,o.Z)(d,e);var t,n,u=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function d(e){var t;return(0,a.Z)(this,d),t=u.call(this,e),(0,c.Z)((0,i.Z)(t),"toggleNav",(function(){t.setState({dropdown:!t.state.dropdown})})),(0,c.Z)((0,i.Z)(t),"hideNav",(function(){t.setState({dropdown:!1})})),t.state={dropdown:!1},t}return(0,s.Z)(d,[{key:"getCompactNavClassName",value:function(){return this.state.dropdown?"compact-nav open":"compact-nav"}}]),d}(n.n(u)().Component)},7227:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a=n(22928),s=n(15671),i=n(43144),o=n(97326),r=n(79340),l=n(6215),c=n(61120),u=n(4942),d=n(57588);var p=function(e){(0,r.Z)(p,e);var t,n,d=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,s.Z)(this,p);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=d.call.apply(d,[this].concat(n)),(0,u.Z)((0,o.Z)(e),"toggle",(function(){e.props.onChange({target:{value:!e.props.value}})})),e}return(0,i.Z)(p,[{key:"getClassName",value:function(){return this.props.value?"btn btn-yes-no btn-yes-no-on":"btn btn-yes-no btn-yes-no-off"}},{key:"getIcon",value:function(){return this.props.value?this.props.iconOn||"check_box":this.props.iconOff||"check_box_outline_blank"}},{key:"getLabel",value:function(){return this.props.value?this.props.labelOn||gettext("yes"):this.props.labelOff||gettext("no")}},{key:"render",value:function(){return(0,a.Z)("button",{type:"button",onClick:this.toggle,className:this.getClassName(),id:this.props.id||null,"aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.getIcon()),(0,a.Z)("span",{className:"btn-text"},void 0,this.getLabel()))}}]),p}(n.n(d)().Component)},32233:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var a=n(15671),s=n(43144),i=(n(58294),n(95377),n(68852),n(39737),n(14316),n(43204),n(43511),n(7023),n(54116),function(){function e(t){(0,a.Z)(this,e),this.isOrdered=!1,this._items=t||[]}return(0,s.Z)(e,[{key:"add",value:function(e,t,n){this._items.push({key:e,item:t,after:n&&n.after||null,before:n&&n.before||null})}},{key:"get",value:function(e,t){for(var n=0;n<this._items.length;n++)if(this._items[n].key===e)return this._items[n].item;return t}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"values",value:function(){for(var e=[],t=0;t<this._items.length;t++)e.push(this._items[t].item);return e}},{key:"order",value:function(e){return this.isOrdered||(this._items=this._order(this._items),this.isOrdered=!0),e||void 0===e?this.values():this._items}},{key:"orderedValues",value:function(){return this.order(!0)}},{key:"_order",value:function(e){var t=[];e.forEach((function(e){t.push(e.key)}));var n=[],a=[];function s(e){var t=-1;-1===a.indexOf(e.key)&&(e.after?-1!==(t=a.indexOf(e.after))&&(t+=1):e.before&&(t=a.indexOf(e.before)),-1!==t&&(n.splice(t,0,e),a.splice(t,0,e.key)))}e.forEach((function(e){e.after||e.before||(n.push(e),a.push(e.key))})),e.forEach((function(e){"_end"===e.before&&(n.push(e),a.push(e.key))}));for(var i=200;i>0&&t.length!==a.length;)i-=1,e.forEach(s);return n}}]),e}()),o=new(function(){function e(){(0,a.Z)(this,e),this._initializers=[],this._context={}}return(0,s.Z)(e,[{key:"addInitializer",value:function(e){this._initializers.push({key:e.name,item:e.initializer,after:e.after,before:e.before})}},{key:"init",value:function(e){var t=this;this._context=e,new i(this._initializers).orderedValues().forEach((function(e){e(t)}))}},{key:"has",value:function(e){return!!this._context[e]}},{key:"get",value:function(e,t){return this.has(e)?this._context[e]:t||void 0}},{key:"pop",value:function(e){if(this.has(e)){var t=this._context[e];return this._context[e]=null,t}}}]),e}());window.misago=o;var r=o},58339:function(e,t,n){"use strict";var a=n(32233),s=n(78657);a.Z.addInitializer({name:"ajax",initializer:function(){s.Z.init(a.Z.get("CSRF_COOKIE_NAME"))}})},64109:function(e,t,n){"use strict";var a=n(32233),s=n(35486),i=n(78657),o=n(53904),r=n(90287);a.Z.addInitializer({name:"auth-sync",initializer:function(e){e.get("isAuthenticated")&&window.setInterval((function(){i.Z.get(e.get("AUTH_API")).then((function(e){r.Z.dispatch((0,s.r$)(e))}),(function(e){o.Z.apiError(e)}))}),45e3)},after:"auth"})},46226:function(e,t,n){"use strict";var a=n(32233),s=n(98274),i=n(59801),o=n(90287),r=n(62833);a.Z.addInitializer({name:"auth",initializer:function(){s.Z.init(o.Z,r.Z,i.Z)},after:"store"})},93240:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(93825),o=n(96142),r=n(53904);a.Z.addInitializer({name:"captcha",initializer:function(e){i.ZP.init(e,s.Z,o.Z,r.Z)}})},75147:function(e,t,n){"use strict";var a=n(22928),s=n(57588),i=n.n(s),o=n(32233),r=n(15671),l=n(43144),c=n(97326),u=n(79340),d=n(6215),p=n(61120),h=n(4942),f=n(78657);var v=function(e){(0,u.Z)(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=s.call(this,e),(0,h.Z)((0,c.Z)(t),"handleDecline",(function(){t.state.submiting||window.confirm(gettext("Declining will result in immediate deactivation and deletion of your account. This action is not reversible."))&&(t.setState({submiting:!0}),f.Z.post(t.props.api,{accept:!1}).then((function(){window.location.reload(!0)})))})),(0,h.Z)((0,c.Z)(t),"handleAccept",(function(){t.state.submiting||(t.setState({submiting:!0}),f.Z.post(t.props.api,{accept:!0}).then((function(){window.location.reload(!0)})))})),t.state={submiting:!1},t}return(0,l.Z)(i,[{key:"render",value:function(){return(0,a.Z)("div",{},void 0,(0,a.Z)("button",{className:"btn btn-default",disabled:this.state.submiting,type:"buton",onClick:this.handleDecline},void 0,gettext("Decline")),(0,a.Z)("button",{className:"btn btn-primary",disabled:this.state.submiting,type:"buton",onClick:this.handleAccept},void 0,gettext("Accept and continue")))}}]),i}(i().Component),m=n(4869);o.Z.addInitializer({name:"component:accept-agreement",initializer:function(e){document.getElementById("required-agreement-mount")&&(0,m.Z)((0,a.Z)(v,{api:e.get("REQUIRED_AGREEMENT_API")}),"required-agreement-mount",!1)},after:"store"})},4894:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588);var p=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"refresh",value:function(){window.location.reload()}},{key:"getMessage",value:function(){return this.props.signedIn?interpolate(gettext("You have signed in as %(username)s. Please refresh the page before continuing."),{username:this.props.signedIn.username},!0):this.props.signedOut?interpolate(gettext("%(username)s, you have been signed out. Please refresh the page before continuing."),{username:this.props.user.username},!0):void 0}},{key:"render",value:function(){var e="auth-message";return(this.props.signedIn||this.props.signedOut)&&(e+=" show"),(0,i.Z)("div",{className:e},void 0,(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,i.Z)("p",{},void 0,(0,i.Z)("button",{className:"btn btn-default",type:"button",onClick:this.refresh},void 0,gettext("Reload page")),(0,i.Z)("span",{className:"hidden-xs hidden-sm"},void 0," "+gettext("or press F5 key.")))))}}]),s}(n.n(d)().Component);function h(e){return{user:e.auth.user,signedIn:e.auth.signedIn,signedOut:e.auth.signedOut}}var f=n(4869);s.Z.addInitializer({name:"component:auth-message",initializer:function(){(0,f.Z)((0,a.$j)(h)(p),"auth-message-mount")},after:"store"})},29223:function(e,t,n){"use strict";var a=n(32233),s=n(93051);a.Z.addInitializer({name:"component:banmed-page",initializer:function(e){e.has("BAN_MESSAGE")&&(0,s.Z)(e.get("BAN_MESSAGE"),!1)},after:"store"})},3026:function(e,t,n){"use strict";var a=n(37424),s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(30381),h=n.n(p),f=n(57588),v=n.n(f);function m(e){return(0,s.Z)("div",{className:"categories-list"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("No categories exist or you don't have permission to see them.")))))}function Z(e){var t=e.category;return t.description?(0,s.Z)("div",{className:"category-description",dangerouslySetInnerHTML:{__html:t.description.html}}):null}function g(e){var t=e.category;return(0,s.Z)("div",{className:b(t),title:y(t)},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)))}function b(e){return e.is_read?"read-status item-read":"read-status item-new"}function y(e){return e.is_closed?e.is_read?gettext("This category has no new posts. (closed)"):gettext("This category has new posts. (closed)"):e.is_read?gettext("This category has no new posts."):gettext("This category has new posts.")}function _(e){var t=e.category;return(0,s.Z)("div",{className:"col-xs-12 col-sm-6 col-md-6 category-main"},void 0,(0,s.Z)("div",{className:"media"},void 0,(0,s.Z)("div",{className:"media-left"},void 0,(0,s.Z)(g,{category:t})),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("h4",{className:"media-heading"},void 0,(0,s.Z)("a",{href:t.url.index},void 0,t.name)),(0,s.Z)(Z,{category:t}))))}var N,k,x,w=n(19605);function R(e){var t=e.category;return(0,s.Z)("div",{className:"col-xs-12 col-sm-6 col-md-4 category-last-thread"},void 0,(0,s.Z)(C,{category:t}),(0,s.Z)(L,{category:t}),(0,s.Z)(P,{category:t}),(0,s.Z)(O,{category:t}))}function C(e){var t=e.category;return t.acl.can_browse&&t.acl.can_see_all_threads&&t.last_thread_title?(0,s.Z)("div",{className:"media"},void 0,(0,s.Z)("div",{className:"media-left hidden-xs"},void 0,(0,s.Z)(S,{category:t})),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("div",{className:"media-heading"},void 0,(0,s.Z)("a",{className:"item-title thread-title",href:t.url.last_thread_new,title:t.last_thread_title},void 0,t.last_thread_title)),(0,s.Z)("ul",{className:"list-inline"},void 0,(0,s.Z)("li",{className:"category-last-thread-poster"},void 0,(0,s.Z)(E,{category:t})),N||(N=(0,s.Z)("li",{className:"divider"},void 0,"—")),(0,s.Z)("li",{className:"category-last-thread-date"},void 0,(0,s.Z)("a",{href:t.url.last_post},void 0,t.last_post_on.fromNow()))))):null}function S(e){var t=e.category;return t.last_poster?(0,s.Z)("a",{className:"last-poster-avatar",href:t.last_poster.url,title:t.last_poster_name},void 0,(0,s.Z)(w.ZP,{className:"media-object",size:40,user:t.last_poster})):(0,s.Z)("span",{className:"last-poster-avatar",title:t.last_poster_name},void 0,k||(k=(0,s.Z)(w.ZP,{className:"media-object",size:40})))}function E(e){var t=e.category;return t.last_poster?(0,s.Z)("a",{className:"item-title",href:t.last_poster.url},void 0,t.last_poster_name):(0,s.Z)("span",{className:"item-title"},void 0,t.last_poster_name)}function L(e){var t=e.category;return t.acl.can_browse&&t.acl.can_see_all_threads?t.last_thread_title?null:(0,s.Z)(T,{message:gettext("This category is empty. No threads were posted within it so far.")}):null}function P(e){var t=e.category;return t.acl.can_browse?t.acl.can_see_all_threads?null:(0,s.Z)(T,{message:gettext("This category is private. You can see only your own threads within it.")}):null}function O(e){return e.category.acl.can_browse?null:(0,s.Z)(T,{message:gettext("This category is protected. You can't browse its contents.")})}function T(e){var t=e.message;return(0,s.Z)("div",{className:"media category-thread-message"},void 0,x||(x=(0,s.Z)("div",{className:"media-left"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"media-body"},void 0,(0,s.Z)("p",{},void 0,t)))}function A(e){var t=e.category;return(0,s.Z)("div",{className:"col-md-2 hidden-xs hidden-sm"},void 0,(0,s.Z)("ul",{className:"list-unstyled category-stats"},void 0,(0,s.Z)(B,{threads:t.threads}),(0,s.Z)(I,{posts:t.posts})))}function B(e){var t=e.threads,n=ngettext("%(threads)s thread","%(threads)s threads",t);return(0,s.Z)("li",{className:"category-stat-threads"},void 0,interpolate(n,{threads:t},!0))}function I(e){var t=e.posts,n=ngettext("%(posts)s post","%(posts)s posts",t);return(0,s.Z)("li",{className:"category-stat-posts"},void 0,interpolate(n,{posts:t},!0))}function j(e){var t=e.category,n="btn btn-default btn-block btn-sm btn-subcategory";return t.is_read||(n+=" btn-subcategory-new"),(0,s.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3"},void 0,(0,s.Z)("a",{className:n,href:t.url.index},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)),(0,s.Z)("span",{className:"icon-text"},void 0,t.name)))}function D(e){var t=e.category;return e.isFirst||0===t.subcategories.length?null:(0,s.Z)("div",{className:"row subcategories-list"},void 0,t.subcategories.map((function(e){return(0,s.Z)(j,{category:e},e.id)})))}function U(e){var t=e.category,n=e.isFirst,a="list-group-item";return t.description?a+=" list-group-category-has-description":a+=" list-group-category-no-description",n&&(a+=" list-group-item-first"),t.css_class&&(a+=" list-group-category-has-flavor",a+=" list-group-item-category-"+t.css_class),(0,s.Z)("li",{className:a},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)(_,{category:t}),(0,s.Z)(A,{category:t}),(0,s.Z)(R,{category:t})),(0,s.Z)(D,{category:t,isFirst:n}))}function M(e){var t=e.category,n="list-group list-group-category";return t.css_class&&(n+=" list-group-category-has-flavor",n+=" list-group-category-"+t.css_class),(0,s.Z)("ul",{className:n},void 0,(0,s.Z)(U,{category:t,isFirst:!0}),t.subcategories.map((function(e){return(0,s.Z)(U,{category:e,isFirst:!1},e.id)})))}function z(e){var t=e.categories;return(0,s.Z)("div",{className:"categories-list"},void 0,t.map((function(e){return(0,s.Z)(M,{category:e},e.id)})))}var H,F=n(32233),q=n(55547);var Y=function e(t){return Object.assign({},t,{last_post_on:t.last_post_on?h()(t.last_post_on):null,subcategories:t.subcategories.map(e)})},V=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;return(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"update",(function(e){t.setState({categories:e.map(Y)})})),t.state={categories:F.Z.get("CATEGORIES").map(Y)},t.startPolling(F.Z.get("CATEGORIES_API")),t}return(0,o.Z)(p,[{key:"startPolling",value:function(e){q.Z.start({poll:"categories",url:e,frequency:18e4,update:this.update})}},{key:"render",value:function(){var e=this.state.categories;return 0===e.length?H||(H=(0,s.Z)(m,{})):(0,s.Z)(z,{categories:e})}}]),p}(v().Component);function $(e){return{tick:e.tick.tick}}var G=n(4869);F.Z.addInitializer({name:"component:categories",initializer:function(){document.getElementById("categories-mount")&&(0,G.Z)((0,a.$j)($)(V),"categories-mount")},after:"store"})},94795:function(e,t,n){"use strict";var a=n(22928),s=n(15671),i=n(43144),o=n(79340),r=n(6215),l=n(61120),c=n(57588),u=n.n(c),d=n(37424),p=n(69987),h=n(94417);function f(e){return(0,a.Z)("div",{className:"list-group nav-side"},void 0,e.options.map((function(t){return(0,a.Z)(p.rU,{to:e.baseUrl+t.component+"/",className:"list-group-item",activeClassName:"active"},t.component,(0,a.Z)("span",{className:"material-icon"},void 0,t.icon),t.name)})))}function v(e){return(0,a.Z)("ul",{className:e.className||"dropdown-menu",role:"menu"},void 0,e.options.map((function(t){return(0,a.Z)(h.Z,{path:e.baseUrl+t.component+"/"},t.component,(0,a.Z)(p.rU,{to:e.baseUrl+t.component+"/",onClick:e.hideNav},void 0,(0,a.Z)("span",{className:"material-icon hidden-sm"},void 0,t.icon),t.name))})))}var m,Z=n(97326),g=n(4942),b=n(82211),y=n(78657),_=n(53328),N=n(53904),k=n(90287),x=n(32233);var w=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"onPasswordChange",(function(e){t.setState({password:e.target.value})})),(0,g.Z)((0,Z.Z)(t),"handleSubmit",(function(e){e.preventDefault();var n=t.state,a=n.isLoading,s=n.password,i=t.props.user;return 0==s.length?(N.Z.error(gettext("Enter your password to confirm account deletion.")),!1):!a&&(t.setState({isLoading:!0}),void y.Z.post(i.api.delete,{password:s}).then((function(e){window.location.href=x.Z.get("MISAGO_PATH")}),(function(e){t.setState({isLoading:!1}),e.password?N.Z.error(e.password[0]):N.Z.apiError(e)})))})),t.state={isLoading:!1,password:""},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Delete account"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-danger panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Delete account"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("You are going to delete your account. This action is nonreversible, and will result in following data being deleted:")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Stored IP addresses associated with content that you have posted will be deleted.")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Your username will become available for other user to rename to or for new user to register their account with.")),(0,a.Z)("p",{},void 0,"-"," ",gettext("Your e-mail will become available for use in new account registration.")),m||(m=(0,a.Z)("hr",{})),(0,a.Z)("p",{},void 0,gettext("All your posted content will NOT be deleted, but username associated with it will be changed to one shared by all deleted accounts."))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)("div",{className:"input-group"},void 0,(0,a.Z)("input",{className:"form-control",disabled:this.state.isLoading,name:"password-confirmation",type:"password",placeholder:gettext("Enter your password to confirm account deletion."),value:this.state.password,onChange:this.onPasswordChange}),(0,a.Z)("span",{className:"input-group-btn"},void 0,(0,a.Z)(b.Z,{className:"btn-danger",loading:this.state.isLoading},void 0,gettext("Delete my account")))))))}}]),u}(u().Component),R=n(21688);var C=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){var e;(0,s.Z)(this,u);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return e=c.call.apply(c,[this].concat(n)),(0,g.Z)((0,Z.Z)(e),"onSuccess",(function(){N.Z.info(gettext("Your details have been updated."))})),e}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Edit details"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)(R.Z,{api:this.props.user.api.edit_details,onSuccess:this.onSuccess})}}]),u}(u().Component),S=n(30381),E=n.n(S);var L=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"handleLoadDownloads",(function(){y.Z.get(t.props.user.api.data_downloads).then((function(e){t.setState({isLoading:!1,downloads:e})}),(function(e){N.Z.apiError(e)}))})),(0,g.Z)((0,Z.Z)(t),"handleRequestDataDownload",(function(){t.setState({isSubmiting:!0}),y.Z.post(t.props.user.api.request_data_download).then((function(){t.handleLoadDownloads(),N.Z.success(gettext("Your request for data download has been registered.")),t.setState({isSubmiting:!1})}),(function(e){N.Z.apiError(e),t.setState({isSubmiting:!1})}))})),t.state={isLoading:!1,isSubmiting:!1,downloads:[]},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Download your data"),parent:gettext("Change your options")}),this.handleLoadDownloads()}},{key:"render",value:function(){return(0,a.Z)("div",{},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Download your data"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{},void 0,gettext('To download your data from the site, click the "Request data download" button. Depending on amount of data to be archived and number of users wanting to download their data at same time it may take up to few days for your download to be prepared. An e-mail with notification will be sent to you when your data is ready to be downloaded.')),(0,a.Z)("p",{},void 0,gettext("The download will only be available for limited amount of time, after which it will be deleted from the site and marked as expired."))),(0,a.Z)("table",{className:"table"},void 0,(0,a.Z)("thead",{},void 0,(0,a.Z)("tr",{},void 0,(0,a.Z)("th",{},void 0,gettext("Requested on")),(0,a.Z)("th",{className:"col-md-4"},void 0,gettext("Download")))),(0,a.Z)("tbody",{},void 0,this.state.downloads.map((function(e){return(0,a.Z)("tr",{},e.id,(0,a.Z)("td",{style:P},void 0,E()(e.requested_on).fromNow()),(0,a.Z)("td",{},void 0,(0,a.Z)(O,{exportFile:e.file,status:e.status})))})),0==this.state.downloads.length?(0,a.Z)("tr",{},void 0,(0,a.Z)("td",{colSpan:"2"},void 0,gettext("You have no data downloads."))):null)),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isSubmiting,type:"button",onClick:this.handleRequestDataDownload},void 0,gettext("Request data download")))))}}]),u}(u().Component),P={verticalAlign:"middle"},O=function(e){var t=e.exportFile,n=e.status;return 0===n||1===n?(0,a.Z)(b.Z,{className:"btn-info btn-sm btn-block",disabled:!0,type:"button"},void 0,gettext("Download is being prepared")):t?(0,a.Z)("a",{className:"btn btn-success btn-sm btn-block",href:t},void 0,gettext("Download your data")):(0,a.Z)(b.Z,{className:"btn-default btn-sm btn-block",disabled:!0,type:"button"},void 0,gettext("Download is expired"))},T=n(43345),A=n(96359),B=n(60471),I=n(7227),j=n(35486);var D,U=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={isLoading:!1,is_hiding_presence:e.user.is_hiding_presence,limits_private_thread_invites_to:e.user.limits_private_thread_invites_to,subscribe_to_started_threads:e.user.subscribe_to_started_threads,subscribe_to_replied_threads:e.user.subscribe_to_replied_threads,errors:{}},t.privateThreadInvitesChoices=[{value:0,icon:"help_outline",label:gettext("Everybody")},{value:1,icon:"done_all",label:gettext("Users I follow")},{value:2,icon:"highlight_off",label:gettext("Nobody")}],t.subscribeToChoices=[{value:0,icon:"star_border",label:gettext("No")},{value:1,icon:"star_half",label:gettext("Notify")},{value:2,icon:"star",label:gettext("Notify with e-mail")}],t}return(0,i.Z)(u,[{key:"send",value:function(){return y.Z.post(this.props.user.api.options,{is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,subscribe_to_started_threads:this.state.subscribe_to_started_threads,subscribe_to_replied_threads:this.state.subscribe_to_replied_threads})}},{key:"handleSuccess",value:function(){k.Z.dispatch((0,j.r$)({is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,subscribe_to_started_threads:this.state.subscribe_to_started_threads,subscribe_to_replied_threads:this.state.subscribe_to_replied_threads})),N.Z.success(gettext("Your forum options have been changed."))}},{key:"handleError",value:function(e){400===e.status?N.Z.error(gettext("Please reload page and try again.")):N.Z.apiError(e)}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Forum options"),parent:gettext("Change your options")})}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change forum options"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,gettext("Privacy settings")),(0,a.Z)(A.Z,{label:gettext("Hide my presence"),helpText:gettext("If you hide your presence, only members with permission to see hidden users will see when you are online."),for:"id_is_hiding_presence"},void 0,(0,a.Z)(I.Z,{id:"id_is_hiding_presence",disabled:this.state.isLoading,iconOn:"visibility_off",iconOff:"visibility",labelOn:gettext("Hide my presence from other users"),labelOff:gettext("Show my presence to other users"),onChange:this.bindInput("is_hiding_presence"),value:this.state.is_hiding_presence})),(0,a.Z)(A.Z,{label:gettext("Private thread invitations"),for:"id_limits_private_thread_invites_to"},void 0,(0,a.Z)(B.Z,{id:"id_limits_private_thread_invites_to",disabled:this.state.isLoading,onChange:this.bindInput("limits_private_thread_invites_to"),value:this.state.limits_private_thread_invites_to,choices:this.privateThreadInvitesChoices}))),(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,gettext("Automatic subscriptions")),(0,a.Z)(A.Z,{label:gettext("Threads I start"),for:"id_subscribe_to_started_threads"},void 0,(0,a.Z)(B.Z,{id:"id_subscribe_to_started_threads",disabled:this.state.isLoading,onChange:this.bindInput("subscribe_to_started_threads"),value:this.state.subscribe_to_started_threads,choices:this.subscribeToChoices})),(0,a.Z)(A.Z,{label:gettext("Threads I reply to"),for:"id_subscribe_to_replied_threads"},void 0,(0,a.Z)(B.Z,{id:"id_subscribe_to_replied_threads",disabled:this.state.isLoading,onChange:this.bindInput("subscribe_to_replied_threads"),value:this.state.subscribe_to_replied_threads,choices:this.subscribeToChoices})))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes")))))}}]),u}(T.Z),M=n(95187);function z(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),D||(D=(0,a.Z)(M.Z,{})))}var H=n(33556);var F=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"getHelpText",value:function(){return this.props.options.next_on?interpolate(gettext("You will be able to change your username %(next_change)s."),{next_change:this.props.options.next_on.fromNow()},!0):gettext("You have used up available name changes.")}},{key:"render",value:function(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),(0,a.Z)(H.Z,{helpText:this.getHelpText(),message:gettext("You can't change your username at the moment.")}))}}]),u}(u().Component),q=n(55210);var Y,V=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={username:"",validators:{username:[q.lG(),q.HR(e.options.length_min),q.gS(e.options.length_max)]},isLoading:!1},t}return(0,i.Z)(u,[{key:"getHelpText",value:function(){var e=[];if(this.props.options.changes_left>0){var t=ngettext("You can change your username %(changes_left)s more time.","You can change your username %(changes_left)s more times.",this.props.options.changes_left);e.push(interpolate(t,{changes_left:this.props.options.changes_left},!0))}if(this.props.user.acl.name_changes_expire>0){var n=ngettext("Used changes become available again after %(name_changes_expire)s day.","Used changes become available again after %(name_changes_expire)s days.",this.props.user.acl.name_changes_expire);e.push(interpolate(n,{name_changes_expire:this.props.user.acl.name_changes_expire},!0))}return e.length?e.join(" "):null}},{key:"clean",value:function(){var e=this.validate();return e.username?(N.Z.error(e.username[0]),!1):this.state.username.trim()!==this.props.user.username||(N.Z.info(gettext("Your new username is same as current one.")),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.username,{username:this.state.username})}},{key:"handleSuccess",value:function(e){this.setState({username:""}),this.props.complete(e.username,e.slug,e.options)}},{key:"handleError",value:function(e){N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change username"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New username"),for:"id_username",helpText:this.getHelpText()},void 0,(0,a.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change username")))))}}]),u}(T.Z),$=n(7850),G=n(48927),W=n(6935);var K,J=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),t=c.call(this,e),(0,g.Z)((0,Z.Z)(t),"onComplete",(function(e,n,a){t.setState({options:a}),k.Z.dispatch((0,G.KP)({username:e,slug:n},t.props.user,t.props.user)),k.Z.dispatch((0,W._S)(t.props.user,e,n)),N.Z.success(gettext("Your username has been changed successfully."))})),t.state={isLoaded:!1,options:null},t}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){var e=this;_.Z.set({title:gettext("Change username"),parent:gettext("Change your options")}),Promise.all([y.Z.get(this.props.user.api.username),y.Z.get(x.Z.get("USERNAME_CHANGES_API"),{user:this.props.user.id})]).then((function(t){k.Z.dispatch((0,G.ZB)(t[1].results)),e.setState({isLoaded:!0,options:{changes_left:t[0].changes_left,length_min:t[0].length_min,length_max:t[0].length_max,next_on:t[0].next_on?E()(t[0].next_on):null}})}))}},{key:"getChangeForm",value:function(){return this.state.isLoaded?0===this.state.options.changes_left?(0,a.Z)(F,{options:this.state.options}):(0,a.Z)(V,{complete:this.onComplete,options:this.state.options,user:this.props.user}):Y||(Y=(0,a.Z)(z,{}))}},{key:"render",value:function(){return(0,a.Z)("div",{},void 0,this.getChangeForm(),(0,a.Z)($.Z,{changes:this.props["username-history"],isLoaded:this.state.isLoaded}))}}]),u}(u().Component);var Q,X=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={new_email:"",password:"",validators:{new_email:[q.Do()],password:[]},isLoading:!1},t}return(0,i.Z)(u,[{key:"clean",value:function(){var e=this.validate();return-1!==[this.state.new_email.trim().length,this.state.password.trim().length].indexOf(0)?(N.Z.error(gettext("Fill out all fields.")),!1):!e.new_email||(N.Z.error(e.new_email[0]),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.change_email,{new_email:this.state.new_email,password:this.state.password})}},{key:"handleSuccess",value:function(e){this.setState({new_email:"",password:""}),N.Z.success(e.detail)}},{key:"handleError",value:function(e){400===e.status?e.new_email?N.Z.error(e.new_email):N.Z.error(e.password):N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change e-mail address"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New e-mail"),for:"id_new_email"},void 0,(0,a.Z)("input",{type:"text",id:"id_new_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_email"),value:this.state.new_email})),K||(K=(0,a.Z)("hr",{})),(0,a.Z)(A.Z,{label:gettext("Your current password"),for:"id_confirm_email"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change e-mail")))))}}]),u}(T.Z);var ee,te,ne,ae=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(e){var t;return(0,s.Z)(this,u),(t=c.call(this,e)).state={new_password:"",repeat_password:"",password:"",validators:{new_password:[],repeat_password:[],password:[]},isLoading:!1},t}return(0,i.Z)(u,[{key:"clean",value:function(){var e=this.validate();return-1!==[this.state.new_password.trim().length,this.state.repeat_password.trim().length,this.state.password.trim().length].indexOf(0)?(N.Z.error(gettext("Fill out all fields.")),!1):e.new_password?(N.Z.error(e.new_password[0]),!1):this.state.new_password===this.state.repeat_password||(N.Z.error(gettext("New passwords are different.")),!1)}},{key:"send",value:function(){return y.Z.post(this.props.user.api.change_password,{new_password:this.state.new_password,password:this.state.password})}},{key:"handleSuccess",value:function(e){this.setState({new_password:"",repeat_password:"",password:""}),N.Z.success(e.detail)}},{key:"handleError",value:function(e){400===e.status?e.new_password?N.Z.error(e.new_password):N.Z.error(e.password):N.Z.apiError(e)}},{key:"render",value:function(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change password"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(A.Z,{label:gettext("New password"),for:"id_new_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_new_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_password"),value:this.state.new_password})),(0,a.Z)(A.Z,{label:gettext("Repeat password"),for:"id_repeat_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_repeat_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("repeat_password"),value:this.state.repeat_password})),Q||(Q=(0,a.Z)("hr",{})),(0,a.Z)(A.Z,{label:gettext("Your current password"),for:"id_confirm_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(b.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change password")))))}}]),u}(T.Z),se=function(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,gettext("Change email or password"))),(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,ee||(ee=(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,gettext("You need to set a password for your account to be able to change your username or email.")),(0,a.Z)("p",{className:"help-block"},void 0,(0,a.Z)("a",{className:"btn btn-primary",href:x.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Set password"))))))};var ie,oe=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Change email or password"),parent:gettext("Change your options")})}},{key:"render",value:function(){return this.props.user.has_usable_password?(0,a.Z)("div",{},void 0,(0,a.Z)(X,{user:this.props.user}),(0,a.Z)(ae,{user:this.props.user}),(0,a.Z)("p",{className:"message-line"},void 0,ne||(ne=(0,a.Z)("span",{className:"material-icon"},void 0,"warning")),(0,a.Z)("a",{href:x.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,gettext("Change forgotten password")))):te||(te=(0,a.Z)(se,{}))}}]),u}(u().Component),re=n(82125),le=n(98936),ce=n(59131),ue=n(99755);var de=function(e){(0,o.Z)(u,e);var t,n,c=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,l.Z)(t);if(n){var s=(0,l.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,s.Z)(this,u),c.apply(this,arguments)}return(0,i.Z)(u,[{key:"render",value:function(){var e=this,t=x.Z.get("USER_OPTIONS").filter((function(t){var n=x.Z.get("USERCP_URL")+t.component+"/";return e.props.location.pathname.substr(0,n.length)===n}))[0];return(0,a.Z)("div",{className:"page page-options"},void 0,(0,a.Z)(ue.sP,{},void 0,(0,a.Z)(ue.mr,{styleName:"options"},void 0,(0,a.Z)(ue.gC,{styleName:"options"},void 0,(0,a.Z)(le.gq,{},void 0,(0,a.Z)(le.kw,{auto:!0},void 0,(0,a.Z)(le.Z6,{auto:!0},void 0,(0,a.Z)("h1",{},void 0,gettext("Change your options"))),(0,a.Z)(le.Z6,{className:"hidden-xs hidden-md hidden-lg",shrink:!0},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Menu"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,ie||(ie=(0,a.Z)("span",{className:"material-icon"},void 0,"menu"))),(0,a.Z)(v,{className:"dropdown-menu dropdown-menu-right",baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})))),(0,a.Z)(le.kw,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,a.Z)(le.Z6,{},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-block dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,t.icon),t.name),(0,a.Z)(v,{className:"dropdown-menu",baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})))))))),(0,a.Z)(ce.Z,{},void 0,(0,a.Z)("div",{className:"row"},void 0,(0,a.Z)("div",{className:"col-md-3 hidden-xs hidden-sm"},void 0,(0,a.Z)(f,{baseUrl:x.Z.get("USERCP_URL"),options:x.Z.get("USER_OPTIONS")})),(0,a.Z)("div",{className:"col-md-9"},void 0,this.props.children))))}}]),u}(re.Z);function pe(e){return{tick:e.tick.tick,user:e.auth.user,"username-history":e["username-history"]}}function he(){var e=[{path:x.Z.get("USERCP_URL")+"forum-options/",component:(0,d.$j)(pe)(U)},{path:x.Z.get("USERCP_URL")+"edit-details/",component:(0,d.$j)(pe)(C)}],t=x.Z.get("SETTINGS").DELEGATE_AUTH;return t||(e.push({path:x.Z.get("USERCP_URL")+"change-username/",component:(0,d.$j)(pe)(J)}),e.push({path:x.Z.get("USERCP_URL")+"sign-in-credentials/",component:(0,d.$j)(pe)(oe)})),x.Z.get("ENABLE_DOWNLOAD_OWN_DATA")&&e.push({path:x.Z.get("USERCP_URL")+"download-data/",component:(0,d.$j)(pe)(L)}),!t&&x.Z.get("ENABLE_DELETE_OWN_ACCOUNT")&&e.push({path:x.Z.get("USERCP_URL")+"delete-account/",component:(0,d.$j)(pe)(w)}),e}var fe=n(39633);x.Z.addInitializer({name:"component:options",initializer:function(e){e.has("USER_OPTIONS")&&(0,fe.Z)({root:x.Z.get("USERCP_URL"),component:de,paths:he()})},after:"store"})},95563:function(e,t,n){"use strict";var a,s=n(37424),i=n(22928),o=n(15671),r=n(43144),l=n(97326),c=n(79340),u=n(6215),d=n(61120),p=n(4942),h=n(57588),f=n.n(h),v=n(30381),m=n.n(v),Z=n(95187),g=n(33556),b=n(32233),y=n(55547),_=n(53328);var N=function(e){(0,c.Z)(h,e);var t,n,s=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function h(e){var t;return(0,o.Z)(this,h),t=s.call(this,e),(0,p.Z)((0,l.Z)(t),"update",(function(e){e.expires_on&&(e.expires_on=m()(e.expires_on)),t.setState({isLoaded:!0,error:null,ban:e})})),(0,p.Z)((0,l.Z)(t),"error",(function(e){t.setState({isLoaded:!0,error:e.detail,ban:null})})),b.Z.has("PROFILE_BAN")?t.initWithPreloadedData(b.Z.pop("PROFILE_BAN")):t.initWithoutPreloadedData(),t.startPolling(e.profile.api.ban),t}return(0,r.Z)(h,[{key:"initWithPreloadedData",value:function(e){e.expires_on&&(e.expires_on=m()(e.expires_on)),this.state={isLoaded:!0,ban:e}}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(e){y.Z.start({poll:"ban-details",url:e,frequency:9e4,update:this.update,error:this.error})}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Ban details"),parent:this.props.profile.username})}},{key:"componentWillUnmount",value:function(){y.Z.stop("ban-details")}},{key:"getUserMessage",value:function(){return this.state.ban.user_message?(0,i.Z)("div",{className:"panel-body ban-message ban-user-message"},void 0,(0,i.Z)("h4",{},void 0,gettext("User-shown ban message")),(0,i.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.user_message.html}})):null}},{key:"getStaffMessage",value:function(){return this.state.ban.staff_message?(0,i.Z)("div",{className:"panel-body ban-message ban-staff-message"},void 0,(0,i.Z)("h4",{},void 0,gettext("Team-shown ban message")),(0,i.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.staff_message.html}})):null}},{key:"getExpirationMessage",value:function(){if(this.state.ban.expires_on){if(this.state.ban.expires_on.isAfter(m()())){var e=interpolate(gettext("This ban expires on %(expires_on)s."),{expires_on:this.state.ban.expires_on.format("LL, LT")},!0),t=interpolate(gettext("This ban expires %(expires_on)s."),{expires_on:this.state.ban.expires_on.fromNow()},!0);return(0,i.Z)("abbr",{title:e},void 0,t)}return gettext("This ban has expired.")}return interpolate(gettext("%(username)s's ban is permanent."),{username:this.props.profile.username},!0)}},{key:"getPanelBody",value:function(){return this.state.ban?Object.keys(this.state.ban).length?(0,i.Z)("div",{},void 0,this.getUserMessage(),this.getStaffMessage(),(0,i.Z)("div",{className:"panel-body ban-expires"},void 0,(0,i.Z)("h4",{},void 0,gettext("Ban expiration")),(0,i.Z)("p",{className:"lead"},void 0,this.getExpirationMessage()))):(0,i.Z)("div",{},void 0,(0,i.Z)(g.Z,{message:gettext("No ban is active at the moment.")})):this.state.error?(0,i.Z)("div",{},void 0,(0,i.Z)(g.Z,{icon:"error_outline",message:this.state.error})):a||(a=(0,i.Z)("div",{},void 0,(0,i.Z)(Z.Z,{})))}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-ban-details"},void 0,(0,i.Z)("div",{className:"panel panel-default"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Ban details"))),this.getPanelBody()))}}]),h}(f().Component),k=n(21688);function x(e){var t=e.api,n=e.display,a=e.onCancel,s=e.onSuccess;return n?(0,i.Z)(k.Z,{api:t,onCancel:a,onSuccess:s}):null}function w(e){var t,n=e.isAuthenticated,a=e.profile;return t=n?gettext("You are not sharing any details with others."):interpolate(gettext("%(username)s is not sharing any details with others."),{username:a.username},!0),(0,i.Z)("div",{className:"panel panel-default"},void 0,(0,i.Z)("div",{className:"panel-body text-center lead"},void 0,t))}function R(e){var t=e.html,n=e.text,a=e.url;return t?(0,i.Z)("div",{className:"form-control-static col-md-9",dangerouslySetInnerHTML:{__html:t}}):(0,i.Z)("div",{className:"form-control-static col-md-9"},void 0,(0,i.Z)(C,{text:n,url:a}))}function C(e){var t=e.text,n=e.url;return n?(0,i.Z)("p",{},void 0,(0,i.Z)("a",{href:n,target:"_blank",rel:"nofollow"},void 0,t||n)):t?(0,i.Z)("p",{},void 0,t):null}function S(e){return(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("strong",{className:"control-label col-md-3"},void 0,e.name,":"),f().createElement(R,e))}function E(e){var t=e.fields,n=e.name;return(0,i.Z)("div",{className:"panel panel-default panel-profile-details-group"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,n)),(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"form-horizontal"},void 0,t.map((function(e){var t=e.fieldname,n=e.html,a=e.name,s=e.text,o=e.url;return(0,i.Z)(S,{name:a,html:n,text:s,url:o},t)})))))}var L,P=n(37848);function O(e){var t=e.display,n=e.groups,a=e.isAuthenticated,s=e.loading,o=e.profile;return t?s?L||(L=(0,i.Z)(P.Z,{})):n.length?(0,i.Z)("div",{},void 0,n.map((function(e,t){return(0,i.Z)(E,{fields:e.fields,name:e.name},t)}))):(0,i.Z)(w,{isAuthenticated:a,profile:o}):null}var T=n(92490),A=function(e){var t=e.onEdit,n=e.showEditButton;return(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,gettext("Details")))),n&&(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)("button",{className:"btn btn-default btn-outline btn-block",onClick:t,type:"button"},void 0,gettext("Edit")))))},B=n(58598),I=n(78657),j=n(53904);var D=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this.props,t=e.data,n=e.dispatch,a=e.user;t&&t.id===a.id||I.Z.get(this.props.user.api.details).then((function(e){n((0,B.zD)(e))}),(function(e){j.Z.apiError(e)}))}},{key:"render",value:function(){return this.props.children}}]),s}(f().Component);var U=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"onCancel",(function(){t.setState({editing:!1})})),(0,p.Z)((0,l.Z)(t),"onEdit",(function(){t.setState({editing:!0})})),(0,p.Z)((0,l.Z)(t),"onSuccess",(function(e){var n,a=t.props,s=a.dispatch,i=a.isAuthenticated,o=a.profile;n=i?gettext("Your details have been updated."):interpolate(gettext("%(username)s's details have been updated."),{username:o.username},!0),j.Z.info(n),s((0,B.zD)(e)),t.setState({editing:!1})})),t.state={editing:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Details"),parent:this.props.profile.username})}},{key:"render",value:function(){var e=this.props,t=e.dispatch,n=e.isAuthenticated,a=e.profile,s=e.profileDetails,o=s.id!==a.id;return(0,i.Z)(D,{data:s,dispatch:t,user:a},void 0,(0,i.Z)("div",{className:"profile-details"},void 0,(0,i.Z)(A,{onEdit:this.onEdit,showEditButton:!!s.edit&&!this.state.editing}),(0,i.Z)(O,{display:!this.state.editing,groups:s.groups,isAuthenticated:n,loading:o,profile:a}),(0,i.Z)(x,{api:a.api.edit_details,dispatch:t,display:this.state.editing,onCancel:this.onCancel,onSuccess:this.onSuccess})))}}]),s}(f().Component),M=n(87462),z=n(11005),H=n(82211),F=n(21981),q=n(90287);var Y,V=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isLoading:!0}),t.loadItems(t.props.posts.next)})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"loadItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;I.Z.get(this.props.api,{start:t||0}).then((function(n){0===t?q.Z.dispatch(F.zD(n)):q.Z.dispatch(F.R3(n)),e.setState({isLoading:!1})}),(function(t){e.setState({isLoading:!1}),j.Z.apiError(t)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:this.props.title,parent:this.props.profile.username}),this.loadItems()}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-feed"},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.props.header)))),f().createElement($,(0,M.Z)({isLoading:this.state.isLoading,loadMore:this.loadMore},this.props)))}}]),s}(f().Component);function $(e){return e.posts.isLoaded&&!e.posts.results.length?(0,i.Z)("p",{className:"lead"},void 0,e.emptyMessage):(0,i.Z)("div",{},void 0,(0,i.Z)(z.Z,{isReady:e.posts.isLoaded,posts:e.posts.results,poster:e.profile}),(0,i.Z)(G,{isLoading:e.isLoading,loadMore:e.loadMore,next:e.posts.next}))}function G(e){return e.next?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:e.isLoading,onClick:e.loadMore},void 0,gettext("Show older activity"))):null}var W=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.className?"form-search "+this.props.className:"form-search"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName()},void 0,(0,i.Z)("input",{type:"text",className:"form-control",value:this.props.value,onChange:this.props.onChange,placeholder:this.props.placeholder||gettext("Search...")}),Y||(Y=(0,i.Z)("span",{className:"material-icon"},void 0,"search")))}}]),s}(f().Component),K=n(40429),J=n(6935);var Q=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadUsers(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadUsers(1,e.target.value)})),t.setSpecialProps(),b.Z.has(t.PRELOADED_DATA_KEY)?t.initWithPreloadedData(b.Z.pop(t.PRELOADED_DATA_KEY)):t.initWithoutPreloadedData(),t}return(0,r.Z)(s,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWERS",this.TITLE=gettext("Followers"),this.API_FILTER="followers"}},{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},q.Z.dispatch((0,J.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadUsers()}},{key:"loadUsers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=this.props.profile.api[this.API_FILTER];I.Z.get(a,{search:n,page:t||1},"user-"+this.API_FILTER).then((function(n){1===t?q.Z.dispatch((0,J.ZB)(n.results)):q.Z.dispatch((0,J.R3)(n.results)),e.setState({isLoaded:!0,isBusy:!1,count:n.count,more:n.more,page:n.page,pages:n.pages})}),(function(e){j.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:this.TITLE,parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("You have %(users)s follower.","You have %(users)s followers.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var n=ngettext("%(username)s has %(users)s follower.","%(username)s has %(users)s followers.",this.state.count);return interpolate(n,{username:this.props.profile.username,users:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("You have no followers."):interpolate(gettext("%(username)s has no followers."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(gettext("Show more (%(more)s)"),{more:this.state.more},!0))):null}},{key:"getListBody",value:function(){return this.state.isLoaded&&0===this.state.count?(0,i.Z)("p",{className:"lead"},void 0,this.getEmptyMessage()):(0,i.Z)("div",{},void 0,(0,i.Z)(K.Z,{cols:3,isReady:this.state.isLoaded,users:this.props.users}),this.getMoreButton())}},{key:"getClassName",value:function(){return"profile-"+this.API_FILTER}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName()},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.getLabel()))),(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)(W,{value:this.state.search,onChange:this.search,placeholder:gettext("Search users...")})))),this.getListBody())}}]),s}(f().Component);var X=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWS",this.TITLE=gettext("Follows"),this.API_FILTER="follows"}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("You are following %(users)s user.","You are following %(users)s users.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var n=ngettext("%(username)s is following %(users)s user.","%(username)s is following %(users)s users.",this.state.count);return interpolate(n,{username:this.props.profile.username,users:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("You are not following any users."):interpolate(gettext("%(username)s is not following any users."),{username:this.props.profile.username},!0)}}]),s}(Q),ee=n(7850),te=n(48927);var ne=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadChanges(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadChanges(1,e.target.value)})),b.Z.has("PROFILE_NAME_HISTORY")?t.initWithPreloadedData(b.Z.pop("PROFILE_NAME_HISTORY")):t.initWithoutPreloadedData(),t}return(0,r.Z)(s,[{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},q.Z.dispatch((0,te.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadChanges()}},{key:"loadChanges",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;I.Z.get(b.Z.get("USERNAME_CHANGES_API"),{user:this.props.profile.id,search:n,page:t||1},"search-username-history").then((function(n){1===t?q.Z.dispatch((0,te.ZB)(n.results)):q.Z.dispatch((0,te.R3)(n.results)),e.setState({isLoaded:!0,isBusy:!1,count:n.count,more:n.more,page:n.page,pages:n.pages})}),(function(e){j.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){_.Z.set({title:gettext("Username history"),parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=ngettext("Found %(changes)s username change.","Found %(changes)s username changes.",this.state.count);return interpolate(e,{changes:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=ngettext("Your username was changed %(changes)s time.","Your username was changed %(changes)s times.",this.state.count);return interpolate(t,{changes:this.state.count},!0)}var n=ngettext("%(username)s's username was changed %(changes)s time.","%(username)s's username was changed %(changes)s times.",this.state.count);return interpolate(n,{username:this.props.profile.username,changes:this.state.count},!0)}return gettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?gettext("Search returned no username changes matching specified criteria."):this.props.user.id===this.props.profile.id?gettext("No name changes have been recorded for your account."):interpolate(gettext("%(username)s's username was never changed."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(H.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(gettext("Show older (%(more)s)"),{more:this.state.more},!0))):null}},{key:"render",value:function(){return(0,i.Z)("div",{className:"profile-username-history"},void 0,(0,i.Z)(T.o8,{},void 0,(0,i.Z)(T.Z2,{auto:!0},void 0,(0,i.Z)(T.Eg,{auto:!0},void 0,(0,i.Z)("h3",{},void 0,this.getLabel()))),(0,i.Z)(T.Z2,{},void 0,(0,i.Z)(T.Eg,{},void 0,(0,i.Z)(W,{value:this.state.search,onChange:this.search,placeholder:gettext("Search history...")})))),(0,i.Z)(ee.Z,{isLoaded:this.state.isLoaded,emptyMessage:this.getEmptyMessage(),changes:this.props["username-history"]}),this.getMoreButton())}}]),s}(f().Component),ae=n(82125),se=n(27519),ie=n(59131),oe=n(19605),re=n(98936),le=n(99755);var ce,ue=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"action",(function(){t.setState({isLoading:!0}),t.props.profile.is_followed?q.Z.dispatch((0,se.r$)({is_followed:!1,followers:t.props.profile.followers-1})):q.Z.dispatch((0,se.r$)({is_followed:!0,followers:t.props.profile.followers+1})),I.Z.post(t.props.profile.api.follow).then((function(e){t.setState({isLoading:!1}),q.Z.dispatch((0,se.r$)(e))}),(function(e){t.setState({isLoading:!1}),j.Z.apiError(e)}))})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.profile.is_followed?this.props.className+" btn-default btn-following":this.props.className+" btn-default btn-follow"}},{key:"getIcon",value:function(){return this.props.profile.is_followed?"favorite":"favorite_border"}},{key:"getLabel",value:function(){return this.props.profile.is_followed?gettext("Following"):gettext("Follow")}},{key:"render",value:function(){return(0,i.Z)(H.Z,{className:this.getClassName(),disabled:this.state.isLoading,onClick:this.action},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,this.getIcon()),this.getLabel())}}]),s}(f().Component),de=n(27950);var pe,he,fe=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(){var e;(0,o.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,p.Z)((0,l.Z)(e),"onClick",(function(){de.Z.open({mode:"START_PRIVATE",submit:b.Z.get("PRIVATE_THREADS_API"),to:[e.props.profile]})})),e}return(0,r.Z)(s,[{key:"render",value:function(){var e=this.props.user.acl.can_start_private_threads,t=this.props.user.id===this.props.profile.id;return!e||t?null:(0,i.Z)("button",{className:this.props.className,onClick:this.onClick,type:"button"},void 0,ce||(ce=(0,i.Z)("span",{className:"material-icon"},void 0,"comment")),gettext("Message"))}}]),s}(f().Component),ve=n(43345),me=n(96359),Ze=n(3784),ge=n(7227),be=n(30337);var ye,_e,Ne=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e)).state={isLoaded:!1,isLoading:!1,error:null,is_avatar_locked:"",avatar_lock_user_message:"",avatar_lock_staff_message:""},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.moderate_avatar).then((function(t){e.setState({isLoaded:!0,is_avatar_locked:t.is_avatar_locked,avatar_lock_user_message:t.avatar_lock_user_message||"",avatar_lock_staff_message:t.avatar_lock_staff_message||""})}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"clean",value:function(){return!!this.isValid()||(j.Z.error(this.validate().username[0]),!1)}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.moderate_avatar,{is_avatar_locked:this.state.is_avatar_locked,avatar_lock_user_message:this.state.avatar_lock_user_message,avatar_lock_staff_message:this.state.avatar_lock_staff_message})}},{key:"handleSuccess",value:function(e){q.Z.dispatch((0,J.n1)(this.props.profile,e.avatar_hash)),j.Z.success(gettext("Avatar controls have been changed."))}},{key:"getFormBody",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("Lock avatar"),helpText:gettext("Locking user avatar will prohibit user from changing his avatar and will reset his/her avatar to default one."),for:"id_is_avatar_locked"},void 0,(0,i.Z)(ge.Z,{id:"id_is_avatar_locked",disabled:this.state.isLoading,iconOn:"lock_outline",iconOff:"lock_open",labelOn:gettext("Disallow user from changing avatar"),labelOff:gettext("Allow user to change avatar"),onChange:this.bindInput("is_avatar_locked"),value:this.state.is_avatar_locked})),(0,i.Z)(me.Z,{label:gettext("User message"),helpText:gettext("Optional message for user explaining why he/she is prohibited form changing avatar."),for:"id_avatar_lock_user_message"},void 0,(0,i.Z)("textarea",{id:"id_avatar_lock_user_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_user_message"),value:this.state.avatar_lock_user_message})),(0,i.Z)(me.Z,{label:gettext("Staff message"),helpText:gettext("Optional message for forum team members explaining why user is prohibited form changing avatar."),for:"id_avatar_lock_staff_message"},void 0,(0,i.Z)("textarea",{id:"id_avatar_lock_staff_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_staff_message"),value:this.state.avatar_lock_staff_message}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,gettext("Close")),(0,i.Z)(H.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Save changes"))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():pe||(pe=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error?"modal-dialog modal-message modal-avatar-controls":"modal-dialog modal-avatar-controls"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,he||(he=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Avatar controls"))),this.getModalBody()))}}]),s}(ve.Z),ke=n(55210);var xe,we,Re,Ce=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e)).state={isLoaded:!1,isLoading:!1,error:null,username:"",validators:{username:[ke.lG()]}},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.moderate_username).then((function(){e.setState({isLoaded:!0})}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"clean",value:function(){return!!this.isValid()||(j.Z.error(this.validate().username[0]),!1)}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.moderate_username,{username:this.state.username})}},{key:"handleSuccess",value:function(e){this.setState({username:""}),q.Z.dispatch((0,te.KP)(e,this.props.profile,this.props.user)),q.Z.dispatch((0,J._S)(this.props.profile,e.username,e.slug)),j.Z.success(gettext("Username has been changed."))}},{key:"getFormBody",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("New username"),for:"id_username"},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,i.Z)(H.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Change username"))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():ye||(ye=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error?"modal-dialog modal-message modal-rename-user":"modal-dialog modal-rename-user"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,_e||(_e=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Change username"))),this.getModalBody()))}}]),s}(ve.Z);var Se,Ee,Le,Pe=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"countdown",(function(){window.setTimeout((function(){t.state.countdown>1?(t.setState({countdown:t.state.countdown-1}),t.countdown()):t.state.confirm||t.setState({confirm:!0})}),1e3)})),t.state={isLoaded:!1,isLoading:!1,isDeleted:!1,error:null,countdown:5,confirm:!1,with_content:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;I.Z.get(this.props.profile.api.delete).then((function(){e.setState({isLoaded:!0}),e.countdown()}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"send",value:function(){return I.Z.post(this.props.profile.api.delete,{with_content:this.state.with_content})}},{key:"handleSuccess",value:function(){y.Z.stop("user-profile"),this.state.with_content?this.setState({isDeleted:interpolate(gettext("%(username)s's account, threads, posts and other content has been deleted."),{username:this.props.profile.username},!0)}):this.setState({isDeleted:interpolate(gettext("%(username)s's account has been deleted and other content has been hidden."),{username:this.props.profile.username},!0)})}},{key:"getButtonLabel",value:function(){return this.state.confirm?interpolate(gettext("Delete %(username)s"),{username:this.props.profile.username},!0):interpolate(gettext("Please wait... (%(countdown)ss)"),{countdown:this.state.countdown},!0)}},{key:"getForm",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(me.Z,{label:gettext("User content"),for:"id_with_content"},void 0,(0,i.Z)(ge.Z,{id:"id_with_content",disabled:this.state.isLoading,labelOn:gettext("Delete together with user's account"),labelOff:gettext("Hide after deleting user's account"),onChange:this.bindInput("with_content"),value:this.state.with_content}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,gettext("Cancel")),(0,i.Z)(H.Z,{className:"btn-danger",loading:this.state.isLoading,disabled:!this.state.confirm},void 0,this.getButtonLabel())))}},{key:"getDeletedBody",value:function(){return(0,i.Z)("div",{className:"modal-body"},void 0,xe||(xe=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.state.isDeleted),(0,i.Z)("p",{},void 0,(0,i.Z)("a",{href:b.Z.get("USERS_LIST_URL")},void 0,gettext("Return to users list")))))}},{key:"getModalBody",value:function(){return this.state.error?(0,i.Z)(be.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.state.isDeleted?this.getDeletedBody():this.getForm():we||(we=(0,i.Z)(Ze.Z,{}))}},{key:"getClassName",value:function(){return this.state.error||this.state.isDeleted?"modal-dialog modal-message modal-delete-account":"modal-dialog modal-delete-account"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,Re||(Re=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Delete user account"))),this.getModalBody()))}}]),s}(ve.Z),Oe=n(59801);var Te,Ae,Be,Ie,je,De=function(e){return{tick:e.tick,user:e.auth,profile:e.profile}},Ue=function(e){(0,c.Z)(h,e);var t,n,a=(t=h,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function h(){var e;(0,o.Z)(this,h);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,p.Z)((0,l.Z)(e),"showAvatarDialog",(function(){Oe.Z.show((0,s.$j)(De)(Ne))})),(0,p.Z)((0,l.Z)(e),"showRenameDialog",(function(){Oe.Z.show((0,s.$j)(De)(Ce))})),(0,p.Z)((0,l.Z)(e),"showDeleteDialog",(function(){Oe.Z.show((0,s.$j)(De)(Pe))})),e}return(0,r.Z)(h,[{key:"render",value:function(){var e=this.props.moderation;return(0,i.Z)("ul",{className:"dropdown-menu dropdown-menu-right",role:"menu"},void 0,!!e.avatar&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showAvatarDialog},void 0,Se||(Se=(0,i.Z)("span",{className:"material-icon"},void 0,"portrait")),gettext("Avatar controls"))),!!e.rename&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showRenameDialog},void 0,Ee||(Ee=(0,i.Z)("span",{className:"material-icon"},void 0,"credit_card")),gettext("Change username"))),!!e.delete&&(0,i.Z)("li",{},void 0,(0,i.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showDeleteDialog},void 0,Le||(Le=(0,i.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete account"))))}}]),h}(f().Component),Me=n(24678),ze=function(e){var t=e.profile;return(0,i.Z)("ul",{className:"profile-data-list"},void 0,!1===t.is_active&&(0,i.Z)("li",{className:"user-account-disabled"},void 0,(0,i.Z)("abbr",{title:gettext("This user's account has been disabled by administrator.")},void 0,gettext("Account disabled"))),(0,i.Z)("li",{className:"user-status-display"},void 0,(0,i.Z)(Me.ZP,{user:t,status:t.status},void 0,(0,i.Z)(Me.Jj,{user:t,status:t.status}),(0,i.Z)(Me.pg,{user:t,status:t.status,className:"status-label"}))),t.rank.is_tab?(0,i.Z)("li",{className:"user-rank"},void 0,(0,i.Z)("a",{href:t.rank.url,className:"item-title"},void 0,t.rank.name)):(0,i.Z)("li",{className:"user-rank"},void 0,(0,i.Z)("span",{className:"item-title"},void 0,t.rank.name)),(t.title||t.rank.title)&&(0,i.Z)("li",{className:"user-title"},void 0,t.title||t.rank.title),(0,i.Z)("li",{className:"user-joined-on"},void 0,(0,i.Z)("abbr",{title:interpolate(gettext("Joined on %(joined_on)s"),{joined_on:t.joined_on.format("LL, LT")},!0)},void 0,interpolate(gettext("Joined %(joined_on)s"),{joined_on:t.joined_on.fromNow()},!0))),t.email&&(0,i.Z)("li",{className:"user-email"},void 0,(0,i.Z)("a",{href:"mailto:"+t.email,className:"item-title"},void 0,t.email)))},He=function(){return(0,i.Z)("button",{className:"btn btn-default btn-icon btn-outline dropdown-toggle",type:"button",title:gettext("Options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,je||(je=(0,i.Z)("span",{className:"material-icon"},void 0,"settings")))},Fe=function(e){var t=e.profile,n=e.user,a=e.moderation,s=e.message,o=e.follow;return(0,i.Z)(le.sP,{},void 0,(0,i.Z)(le.mr,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,i.Z)(le.gC,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,i.Z)("div",{className:"profile-page-header"},void 0,(0,i.Z)("div",{className:"profile-page-header-avatar"},void 0,(0,i.Z)(oe.ZP,{className:"user-avatar hidden-sm hidden-md hidden-lg",user:t,size:200,size2x:400}),(0,i.Z)(oe.ZP,{className:"user-avatar hidden-xs hidden-md hidden-lg",user:t,size:64,size2x:128}),(0,i.Z)(oe.ZP,{className:"user-avatar hidden-xs hidden-sm",user:t,size:128,size2x:256})),(0,i.Z)("h1",{},void 0,t.username))),(0,i.Z)(le.eA,{className:"profile-page-header-details"},void 0,(0,i.Z)(re.gq,{},void 0,(0,i.Z)(re.kw,{auto:!0},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(ze,{profile:t}))),s&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(fe,{className:"btn btn-default btn-block btn-outline",profile:t,user:n})),a.available&&!o&&(0,i.Z)(re.Z6,{shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Te||(Te=(0,i.Z)(He,{})),(0,i.Z)(Ue,{profile:t,moderation:a})))),o&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{},void 0,(0,i.Z)(ue,{className:"btn btn-block btn-outline",profile:t})),a.available&&(0,i.Z)(re.Z6,{shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Ae||(Ae=(0,i.Z)(He,{})),(0,i.Z)(Ue,{profile:t,moderation:a})))),a.available&&!o&&!s&&(0,i.Z)(re.kw,{},void 0,(0,i.Z)(re.Z6,{className:"hidden-xs",shrink:!0},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,Be||(Be=(0,i.Z)(He,{})),(0,i.Z)(Ue,{profile:t,moderation:a}))),(0,i.Z)(re.Z6,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,i.Z)("div",{className:"dropdown"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,Ie||(Ie=(0,i.Z)("span",{className:"material-icon"},void 0,"settings")),gettext("Options")),(0,i.Z)(Ue,{profile:t,moderation:a}))))))))},qe=n(69987),Ye=n(94417),Ve=function(e){var t=e.baseUrl,n=e.page,a=e.pages;return(0,i.Z)("div",{className:"nav-container"},void 0,(0,i.Z)("div",{className:"dropdown hidden-sm hidden-md hidden-lg"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,n.icon),n.name),(0,i.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,a.map((function(e){return(0,i.Z)("li",{},e.component,(0,i.Z)(qe.rU,{to:t+e.component+"/"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))})))),(0,i.Z)("ul",{className:"nav nav-pills hidden-xs",role:"menu"},void 0,a.map((function(e){return(0,i.Z)(Ye.Z,{path:t+e.component+"/"},e.component,(0,i.Z)(qe.rU,{to:t+e.component+"/"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))}))))};var $e=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"update",(function(e){q.Z.dispatch((0,se.ZB)(e))})),t.startPolling(e.profile.api.index),t}return(0,r.Z)(s,[{key:"startPolling",value:function(e){y.Z.start({poll:"user-profile",url:e,frequency:9e4,update:this.update})}},{key:"render",value:function(){var e=this,t=b.Z.get("PROFILE").url,n=b.Z.get("PROFILE_PAGES"),a=n.filter((function(n){var a=t+n.component+"/";return e.props.location.pathname===a}))[0],s=this.props,o=s.profile,r=s.user,l=Ge(o,r),c=r.acl.can_start_private_threads&&o.id!==r.id,u=o.acl.can_follow&&o.id!==r.id;return(0,i.Z)("div",{className:"page page-user-profile"},void 0,(0,i.Z)(Fe,{profile:this.props.profile,user:this.props.user,moderation:l,message:c,follow:u}),(0,i.Z)(ie.Z,{},void 0,(0,i.Z)(Ve,{baseUrl:t,page:a,pages:n}),this.props.children))}}]),s}(ae.Z),Ge=function(e,t){var n={available:!1,rename:!1,avatar:!1,delete:!1};return t.is_anonumous||(n.rename=e.acl.can_rename,n.avatar=e.acl.can_moderate_avatar,n.delete=e.acl.can_delete,n.available=n.rename||n.avatar||n.delete),n};function We(e){return{isAuthenticated:e.auth.user.id===e.profile.id,tick:e.tick.tick,user:e.auth.user,users:e.users,posts:e.posts,profile:e.profile,profileDetails:e["profile-details"],"username-history":e["username-history"]}}var Ke={posts:function(e){var t;t=e.user.id===e.profile.id?gettext("You have posted no messages."):interpolate(gettext("%(username)s posted no messages."),{username:e.profile.username},!0);var n=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){var a=ngettext("You have posted %(posts)s message.","You have posted %(posts)s messages.",e.profile.posts);n=interpolate(a,{posts:e.profile.posts},!0)}else{var s=ngettext("%(username)s has posted %(posts)s message.","%(username)s has posted %(posts)s messages.",e.profile.posts);n=interpolate(s,{username:e.profile.username,posts:e.profile.posts},!0)}else n=gettext("Loading...");return f().createElement(V,(0,M.Z)({api:e.profile.api.posts,emptyMessage:t,header:n,title:gettext("Posts")},e))},threads:function(e){var t;t=e.user.id===e.profile.id?gettext("You have no started threads."):interpolate(gettext("%(username)s started no threads."),{username:e.profile.username},!0);var n=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){var a=ngettext("You have started %(threads)s thread.","You have started %(threads)s threads.",e.profile.threads);n=interpolate(a,{threads:e.profile.threads},!0)}else{var s=ngettext("%(username)s has started %(threads)s thread.","%(username)s has started %(threads)s threads.",e.profile.threads);n=interpolate(s,{username:e.profile.username,threads:e.profile.threads},!0)}else n=gettext("Loading...");return f().createElement(V,(0,M.Z)({api:e.profile.api.threads,emptyMessage:t,header:n,title:gettext("Threads")},e))},followers:Q,follows:X,details:U,"username-history":ne,"ban-details":N};function Je(){var e=[];return b.Z.get("PROFILE_PAGES").forEach((function(t){e.push(Object.assign({},t,{path:b.Z.get("PROFILE").url+t.component+"/",component:(0,s.$j)(We)(Ke[t.component])}))})),e}var Qe=n(39633);b.Z.addInitializer({name:"component:profile",initializer:function(e){e.has("PROFILE")&&e.has("PROFILE_PAGES")&&(0,Qe.Z)({root:b.Z.get("PROFILE").url,component:(0,s.$j)(We)($e),paths:Je()})},after:"reducer:profile-hydrate"})},32488:function(e,t,n){"use strict";var a,s=n(32233),i=n(97326),o=n(4942),r=n(22928),l=n(15671),c=n(43144),u=n(79340),d=n(6215),p=n(61120),h=n(57588),f=n.n(h),v=n(82211),m=n(43345),Z=n(78657),g=n(53904),b=n(55210),y=n(93051);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}var N=function(e){(0,u.Z)(n,e);var t=_(n);function n(e){var a;return(0,l.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[b.Do()]}},a}return(0,c.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(g.Z.error(gettext("Enter a valid email address.")),!1)}},{key:"send",value:function(){return Z.Z.post(s.Z.get("SEND_ACTIVATION_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["already_active","inactive_admin"].indexOf(e.code)>-1?g.Z.info(e.detail):403===e.status&&e.ban?(0,y.Z)(e.ban):g.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"text",className:"form-control",placeholder:gettext("Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,r.Z)(v.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Send link"))))}}]),n}(m.Z),k=function(e){(0,u.Z)(n,e);var t=_(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("Activation link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link well-done"},void 0,(0,r.Z)("div",{className:"done-message"},void 0,a||(a=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{},void 0,this.getMessage())),(0,r.Z)("button",{className:"btn btn-primary btn-block",type:"button",onClick:this.props.callback},void 0,gettext("Request another link"))))}}]),n}(f().Component),x=function(e){(0,u.Z)(n,e);var t=_(n);function n(e){var a;return(0,l.Z)(this,n),a=t.call(this,e),(0,o.Z)((0,i.Z)(a),"complete",(function(e){a.setState({complete:e})})),(0,o.Z)((0,i.Z)(a),"reset",(function(){a.setState({complete:!1})})),a.state={complete:!1},a}return(0,c.Z)(n,[{key:"render",value:function(){return this.state.complete?(0,r.Z)(k,{user:this.state.complete,callback:this.reset}):(0,r.Z)(N,{callback:this.complete})}}]),n}(f().Component),w=n(4869);s.Z.addInitializer({name:"component:request-activation-link",initializer:function(){document.getElementById("request-activation-link-mount")&&(0,w.Z)(x,"request-activation-link-mount",!1)},after:"store"})},11768:function(e,t,n){"use strict";var a,s,i=n(32233),o=n(97326),r=n(4942),l=n(22928),c=n(15671),u=n(43144),d=n(79340),p=n(6215),h=n(61120),f=n(57588),v=n.n(f),m=n(73935),Z=n.n(m),g=n(82211),b=n(43345),y=n(78657),_=n(53904),N=n(55210),k=n(93051);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,h.Z)(e);if(t){var s=(0,h.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,p.Z)(this,n)}}var w=function(e){(0,d.Z)(n,e);var t=x(n);function n(e){var a;return(0,c.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[N.Do()]}},a}return(0,u.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(_.Z.error(gettext("Enter a valid email address.")),!1)}},{key:"send",value:function(){return y.Z.post(i.Z.get("SEND_PASSWORD_RESET_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["inactive_user","inactive_admin"].indexOf(e.code)>-1?this.props.showInactivePage(e):403===e.status&&e.ban?(0,k.Z)(e.ban):_.Z.apiError(e)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset"},void 0,(0,l.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,l.Z)("div",{className:"form-group"},void 0,(0,l.Z)("div",{className:"control-input"},void 0,(0,l.Z)("input",{type:"text",className:"form-control",placeholder:gettext("Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,l.Z)(g.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Send link"))))}}]),n}(b.Z),R=function(e){(0,d.Z)(n,e);var t=x(n);function n(){return(0,c.Z)(this,n),t.apply(this,arguments)}return(0,u.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("Reset password link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset well-done"},void 0,(0,l.Z)("div",{className:"done-message"},void 0,a||(a=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"check"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{},void 0,this.getMessage())),(0,l.Z)("button",{type:"button",className:"btn btn-primary btn-block",onClick:this.props.callback},void 0,gettext("Request another link"))))}}]),n}(v().Component),C=function(e){(0,d.Z)(n,e);var t=x(n);function n(){return(0,c.Z)(this,n),t.apply(this,arguments)}return(0,u.Z)(n,[{key:"getActivateButton",value:function(){return"inactive_user"===this.props.activation?(0,l.Z)("p",{},void 0,(0,l.Z)("a",{href:i.Z.get("REQUEST_ACTIVATION_URL")},void 0,gettext("Activate your account."))):null}},{key:"render",value:function(){return(0,l.Z)("div",{className:"page page-message page-message-info page-forgotten-password-inactive"},void 0,(0,l.Z)("div",{className:"container"},void 0,(0,l.Z)("div",{className:"message-panel"},void 0,s||(s=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{className:"lead"},void 0,gettext("Your account is inactive.")),(0,l.Z)("p",{},void 0,this.props.message),this.getActivateButton()))))}}]),n}(v().Component),S=function(e){(0,d.Z)(n,e);var t=x(n);function n(e){var a;return(0,c.Z)(this,n),a=t.call(this,e),(0,r.Z)((0,o.Z)(a),"complete",(function(e){a.setState({complete:e})})),(0,r.Z)((0,o.Z)(a),"reset",(function(){a.setState({complete:!1})})),a.state={complete:!1},a}return(0,u.Z)(n,[{key:"showInactivePage",value:function(e){Z().render((0,l.Z)(C,{activation:e.code,message:e.detail}),document.getElementById("page-mount"))}},{key:"render",value:function(){return this.state.complete?(0,l.Z)(R,{callback:this.reset,user:this.state.complete}):(0,l.Z)(w,{callback:this.complete,showInactivePage:this.showInactivePage})}}]),n}(v().Component),E=n(4869);i.Z.addInitializer({name:"component:request-password-reset",initializer:function(){document.getElementById("request-password-reset-mount")&&(0,E.Z)(S,"request-password-reset-mount",!1)},after:"store"})},61323:function(e,t,n){"use strict";var a,s=n(32233),i=n(97326),o=n(4942),r=n(22928),l=n(15671),c=n(43144),u=n(79340),d=n(6215),p=n(61120),h=n(57588),f=n.n(h),v=n(73935),m=n.n(v),Z=n(82211),g=n(43345),b=n(14467),y=n(78657),_=n(98274),N=n(59801),k=n(53904),x=n(93051),w=n(19755);function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}var C=function(e){(0,u.Z)(n,e);var t=R(n);function n(e){var a;return(0,l.Z)(this,n),(a=t.call(this,e)).state={isLoading:!1,password:""},a}return(0,c.Z)(n,[{key:"clean",value:function(){return!!this.state.password.trim().length||(k.Z.error(gettext("Enter new password.")),!1)}},{key:"send",value:function(){return y.Z.post(s.Z.get("CHANGE_PASSWORD_API"),{password:this.state.password})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){403===e.status&&e.ban?(0,x.Z)(e.ban):k.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-reset-password"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"password",className:"form-control",placeholder:gettext("Enter new password"),disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,r.Z)(Z.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,gettext("Change password"))))}}]),n}(g.Z),S=function(e){(0,u.Z)(n,e);var t=R(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"getMessage",value:function(){return interpolate(gettext("%(username)s, your password has been changed successfully."),{username:this.props.user.username},!0)}},{key:"showSignIn",value:function(){N.Z.show(b.Z)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"page page-message page-message-success page-forgotten-password-changed"},void 0,(0,r.Z)("div",{className:"container"},void 0,(0,r.Z)("div",{className:"message-panel"},void 0,a||(a=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,r.Z)("p",{},void 0,gettext("You will have to sign in using new password before continuing.")),(0,r.Z)("p",{},void 0,(0,r.Z)("button",{type:"button",className:"btn btn-primary",onClick:this.showSignIn},void 0,gettext("Sign in")))))))}}]),n}(f().Component),E=function(e){(0,u.Z)(n,e);var t=R(n);function n(){var e;(0,l.Z)(this,n);for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return e=t.call.apply(t,[this].concat(s)),(0,o.Z)((0,i.Z)(e),"complete",(function(e){_.Z.softSignOut(),w('#hidden-login-form input[name="redirect_to"]').remove(),m().render((0,r.Z)(S,{user:e}),document.getElementById("page-mount"))})),e}return(0,c.Z)(n,[{key:"render",value:function(){return(0,r.Z)(C,{callback:this.complete})}}]),n}(f().Component),L=n(4869);s.Z.addInitializer({name:"component:reset-password-form",initializer:function(){document.getElementById("reset-password-form-mount")&&(0,L.Z)(E,"reset-password-form-mount",!1)},after:"store"})},15049:function(e,t,n){"use strict";var a,s=n(37424),i=n(22928),o=n(87462),r=n(57588),l=n.n(r),c=n(59131),u=n(15671),d=n(43144),p=n(97326),h=n(79340),f=n(6215),v=n(61120),m=n(4942),Z=n(32233),g=n(43345),b=n(21981),y=n(16427),_=n(6935),N=n(78657),k=n(53904),x=n(90287),w=n(98936),R=n(99755);var C=function(e){(0,h.Z)(o,e);var t,n,s=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function o(e){var t;return(0,u.Z)(this,o),t=s.call(this,e),(0,m.Z)((0,p.Z)(t),"onQueryChange",(function(e){t.changeValue("query",e.target.value)})),t.state={isLoading:!1,query:e.search.query},t}return(0,d.Z)(o,[{key:"componentDidMount",value:function(){this.state.query.length&&this.handleSubmit()}},{key:"clean",value:function(){return!!this.state.query.trim().length||(k.Z.error(gettext("You have to enter search query.")),!1)}},{key:"send",value:function(){x.Z.dispatch((0,y.Vx)({isLoading:!0}));var e=this.state.query.trim(),t=window.location.href,n=t.indexOf("?q=");return n>0&&(t=t.substring(0,n+3)),window.history.pushState({},"",t+encodeURIComponent(e)),N.Z.get(Z.Z.get("SEARCH_API"),{q:e})}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.Vx)({query:this.state.query.trim(),isLoading:!1,providers:e})),e.forEach((function(e){"users"===e.id?x.Z.dispatch((0,_.ZB)(e.results.results)):"threads"===e.id&&x.Z.dispatch((0,b.zD)(e.results))}))}},{key:"handleError",value:function(e){k.Z.apiError(e),x.Z.dispatch((0,y.Vx)({isLoading:!1}))}},{key:"render",value:function(){return(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)(R.sP,{},void 0,(0,i.Z)(R.mr,{styleName:"site-search"},void 0,(0,i.Z)(R.gC,{styleName:"site-search"},void 0,(0,i.Z)("h1",{},void 0,gettext("Search"))),(0,i.Z)(R.eA,{className:"page-header-search-form"},void 0,(0,i.Z)(w.gq,{},void 0,(0,i.Z)(w.kw,{auto:!0},void 0,(0,i.Z)(w.Z6,{},void 0,(0,i.Z)("input",{className:"form-control",disabled:this.state.isLoading,type:"text",value:this.state.query,placeholder:gettext("Search"),onChange:this.onQueryChange})),(0,i.Z)(w.Z6,{shrink:!0},void 0,(0,i.Z)("button",{className:"btn btn-secondary btn-icon btn-outline",disabled:this.state.isLoading},void 0,a||(a=(0,i.Z)("span",{className:"material-icon"},void 0,"search"))))))))))}}]),o}(g.Z),S=n(69987);function E(e){return(0,i.Z)("div",{className:"list-group nav-side"},void 0,e.providers.map((function(e){return(0,i.Z)(S.rU,{activeClassName:"active",className:"list-group-item",to:e.url},e.id,(0,i.Z)("span",{className:"material-icon"},void 0,e.icon),e.name,(0,i.Z)(L,{results:e.results}))})))}function L(e){if(!e.results)return null;var t=e.results.count;return t>1e6?t=Math.ceil(t/1e6)+"KK":t>1e3&&(t=Math.ceil(t/1e3)+"K"),(0,i.Z)("span",{className:"badge"},void 0,t)}function P(e){return(0,i.Z)("div",{className:"page page-search"},void 0,(0,i.Z)(C,{provider:e.provider,search:e.search}),(0,i.Z)(c.Z,{},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-3"},void 0,(0,i.Z)(E,{providers:e.search.providers})),(0,i.Z)("div",{className:"col-md-9"},void 0,e.children,(0,i.Z)(O,{provider:e.provider,search:e.search})))))}function O(e){var t=null;if(e.search.providers.forEach((function(n){n.id===e.provider.id&&(t=n.time)})),null===t)return null;var n=gettext("Search took %(time)s s to complete");return(0,i.Z)("footer",{className:"search-footer"},void 0,(0,i.Z)("p",{},void 0,interpolate(n,{time:t},!0)))}var T=n(11005),A=n(82211);function B(e){return(0,i.Z)("div",{},void 0,(0,i.Z)(T.Z,{isReady:!0,posts:e.results}),l().createElement(I,e))}n(69092);var I=function(e){(0,h.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function s(){var e;(0,u.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,m.Z)((0,p.Z)(e),"onClick",(function(){x.Z.dispatch((0,b.Vx)({isBusy:!0})),N.Z.get(e.props.provider.api,{q:e.props.query,page:e.props.next}).then((function(e){e.forEach((function(e){"threads"===e.id&&(x.Z.dispatch((0,b.R3)(e.results)),x.Z.dispatch((0,y.P0)(e)))})),x.Z.dispatch((0,b.Vx)({isBusy:!1}))}),(function(e){k.Z.apiError(e),x.Z.dispatch((0,b.Vx)({isBusy:!1}))}))})),e}return(0,d.Z)(s,[{key:"render",value:function(){return this.props.more?(0,i.Z)("div",{className:"pager-more"},void 0,(0,i.Z)(A.Z,{className:"btn btn-default btn-outline",loading:this.props.isBusy,onClick:this.onClick},void 0,gettext("Show more"))):null}}]),s}(l().Component);function j(e){var t=e.children,n=e.loading,a=e.posts,s=e.query;return a&&a.count?t:s.length?(0,i.Z)("p",{className:"lead"},void 0,n?gettext("Loading results..."):gettext("No threads matching search query have been found.")):(0,i.Z)("p",{className:"lead"},void 0,gettext("Enter at least two characters to search threads."))}var D=n(40429);function U(e){var t=e.children,n=e.loading,a=e.query;return e.users.length?t:a.length?(0,i.Z)("p",{className:"lead"},void 0,n?gettext("Loading results..."):gettext("No users matching search query have been found.")):(0,i.Z)("p",{className:"lead"},void 0,gettext("Enter at least two characters to search users."))}var M={threads:function(e){return(0,i.Z)(P,{provider:e.route.provider,search:e.search},void 0,(0,i.Z)(j,{loading:e.search.isLoading,query:e.search.query,posts:e.posts},void 0,l().createElement(B,(0,o.Z)({provider:e.route.provider,query:e.search.query},e.posts))))},users:function(e){return(0,i.Z)(P,{provider:e.route.provider,search:e.search},void 0,(0,i.Z)(U,{loading:e.search.isLoading,query:e.search.query,users:e.users},void 0,(0,i.Z)(D.Z,{cols:3,isReady:!e.search.isLoading,users:e.users})))}};function z(e){return{posts:e.posts,search:e.search,tick:e.tick.tick,user:e.auth.user,users:e.users}}var H=n(39633);Z.Z.addInitializer({name:"component:search",initializer:function(e){var t;"misago:search"===e.get("CURRENT_LINK")&&(0,H.Z)({paths:(t=Z.Z.get("SEARCH_PROVIDERS"),t.map((function(e){return{path:e.url,component:(0,s.$j)(z)(M[e.id]),provider:e}})))})},after:"store"})},61814:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588);var p={info:"alert-info",success:"alert-success",warning:"alert-warning",error:"alert-danger"},h=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(){return(0,o.Z)(this,s),a.apply(this,arguments)}return(0,r.Z)(s,[{key:"getSnackbarClass",value:function(){var e="alerts-snackbar";return this.props.isVisible?e+=" in":e+=" out",e}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getSnackbarClass()},void 0,(0,i.Z)("p",{className:"alert "+p[this.props.type]},void 0,this.props.message))}}]),s}(n.n(d)().Component);function f(e){return e.snackbar}var v=n(4869);s.Z.addInitializer({name:"component:snackbar",initializer:function(){(0,v.Z)((0,a.$j)(f)(h),"snackbar-mount")},after:"snackbar"})},95920:function(e,t,n){"use strict";var a=n(57588),s=n.n(a),i=n(22928),o=n(15671),r=n(43144),l=n(97326),c=n(79340),u=n(6215),d=n(61120),p=n(4942),h=n(32233),f=n(26106),v=n(82211),m=n(43345),Z=n(96359),g=n(78657),b=n(53904),y=n(55210),_=function(e){var t=e.backendName,n=gettext("Sign in with %(backend)s"),a=interpolate(n,{backend:t},!0);return(0,i.Z)("div",{className:"page-header-bg"},void 0,(0,i.Z)("div",{className:"page-header"},void 0,(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("h1",{},void 0,a))))};function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){(0,p.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var x=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"handlePrivacyPolicyChange",(function(e){var n=e.target.value;t.handleToggleAgreement("privacyPolicy",n)})),(0,p.Z)((0,l.Z)(t),"handleTermsOfServiceChange",(function(e){var n=e.target.value;t.handleToggleAgreement("termsOfService",n)})),(0,p.Z)((0,l.Z)(t),"handleToggleAgreement",(function(e,n){t.setState((function(a,s){if(null===a[e]){var i=k(k({},a.errors),{},(0,p.Z)({},e,null));return(0,p.Z)({errors:i},e,n)}var o=t.state.validators[e][0],r=k(k({},a.errors),{},(0,p.Z)({},e,[o(null)]));return(0,p.Z)({errors:r},e,null)}))}));var n={email:[y.Do()],username:[y.lG()]};return h.Z.get("TERMS_OF_SERVICE_ID")&&(n.termsOfService=[y.fT()]),h.Z.get("PRIVACY_POLICY_ID")&&(n.privacyPolicy=[y.jA()]),t.state={email:e.email||"",emailProtected:!!e.email,username:e.username||"",termsOfService:null,privacyPolicy:null,validators:n,errors:{},isLoading:!1},t}return(0,r.Z)(s,[{key:"clean",value:function(){if(this.validate(),-1!==[this.state.email.trim().length,this.state.username.trim().length].indexOf(0))return b.Z.error(gettext("Fill out all fields.")),!1;var e=this.state.validators;return h.Z.get("TERMS_OF_SERVICE_ID")&&null===this.state.termsOfService?(b.Z.error(e.termsOfService[0](null)),!1):!h.Z.get("PRIVACY_POLICY_ID")||null!==this.state.privacyPolicy||(b.Z.error(e.privacyPolicy[0](null)),b.Z.error(gettext("You need to accept the privacy policy.")),!1)}},{key:"send",value:function(){return g.Z.post(this.props.url,{email:this.state.email,username:this.state.username,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}},{key:"handleSuccess",value:function(e){(0,this.props.onRegistrationComplete)(e)}},{key:"handleError",value:function(e){if(200===e.status)(0,this.props.onRegistrationComplete)({activation:"active",step:"done",username:this.state.username});else if(400===e.status){var t={errors:e};e.email&&(t.emailProtected=!1),this.setState(t)}else b.Z.apiError(e)}},{key:"render",value:function(){var e=this.props.backend_name,t=this.state,n=t.email,a=t.emailProtected,s=t.username,o=t.isLoading,r=null;if(a){var l=gettext("Your e-mail address has been verified by %(backend)s.");r=interpolate(l,{backend:e},!0)}return(0,i.Z)("div",{className:"page page-social-auth page-social-sauth-register"},void 0,(0,i.Z)(_,{backendName:e}),(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Complete your details"))),(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)(Z.Z,{for:"id_username",label:gettext("Username"),validation:this.state.errors.username},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:o,onChange:this.bindInput("username"),value:s})),(0,i.Z)(Z.Z,{for:"id_email",label:gettext("E-mail address"),helpText:r,validation:a?null:this.state.errors.email},void 0,(0,i.Z)("input",{type:"email",id:"id_email",className:"form-control",disabled:o||a,onChange:this.bindInput("email"),value:n})),(0,i.Z)(f.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,i.Z)("div",{className:"panel-footer"},void 0,(0,i.Z)(v.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Sign in")))))))))}}]),s}(m.Z),w=function(e){var t,n,a=e.activation,s=e.backend_name,o=e.username;return n="user"===a?gettext("%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===a?gettext("%(username)s, your account has been created but board administrator will have to activate it before you will be able to sign in."):gettext("%(username)s, your account has been created and you have been signed in to it."),t="active"===a?"check":"info_outline",(0,i.Z)("div",{className:"page page-social-auth page-social-sauth-register"},void 0,(0,i.Z)(_,{backendName:s}),(0,i.Z)("div",{className:"container"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,i.Z)("div",{className:"panel-heading"},void 0,(0,i.Z)("h3",{className:"panel-title"},void 0,gettext("Registration completed!"))),(0,i.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,t)),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,interpolate(n,{username:o},!0)),(0,i.Z)("p",{className:"help-block"},void 0,(0,i.Z)("a",{className:"btn btn-default",href:h.Z.get("MISAGO_PATH")},void 0,gettext("Return to forum index"))))))))))};var R=function(e){(0,c.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,d.Z)(t);if(n){var s=(0,d.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,u.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,p.Z)((0,l.Z)(t),"handleRegistrationComplete",(function(e){var n=e.activation,a=e.email,s=e.step,i=e.username;t.setState({activation:n,email:a,step:s,username:i})})),t.state={step:e.step,activation:e.activation||"",email:e.email||"",username:e.username||""},t}return(0,r.Z)(s,[{key:"render",value:function(){var e=this.props,t=e.backend_name,n=e.url,a=this.state,s=a.activation,o=a.email,r=a.step,l=a.username;return"register"===r?(0,i.Z)(x,{backend_name:t,email:o,url:n,username:l,onRegistrationComplete:this.handleRegistrationComplete}):(0,i.Z)(w,{activation:s,backend_name:t,email:o,url:n,username:l})}}]),s}(s().Component),C=n(4869);h.Z.addInitializer({name:"component:social-auth",initializer:function(e){if("misago:social-complete"===e.get("CURRENT_LINK")){var t=e.get("SOCIAL_AUTH_FORM");(0,C.Z)(s().createElement(R,t),"page-mount")}},after:"store"})},59203:function(e,t,n){"use strict";var a,s,i=n(37424),o=n(22928),r=n(15671),l=n(43144),c=n(97326),u=n(79340),d=n(6215),p=n(61120),h=n(4942),f=n(57588),v=n.n(f),m=n(87462),Z=n(43345),g=n(96359),b=n(8154),y=n(7738),_=n(78657),N=n(59801),k=n(53904),x=n(90287);var w,R=function(e){(0,u.Z)(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=s.call(this,e),(0,h.Z)((0,c.Z)(t),"onUsernameChange",(function(e){t.changeValue("username",e.target.value)})),t.state={isLoading:!1,username:""},t}return(0,l.Z)(i,[{key:"clean",value:function(){return!!this.state.username.trim().length||(k.Z.error(gettext("You have to enter user name.")),!1)}},{key:"send",value:function(){return _.Z.patch(this.props.thread.api.index,[{op:"add",path:"participants",value:this.state.username},{op:"add",path:"acl",value:1}])}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants)),k.Z.success(gettext("New participant has been added to thread.")),N.Z.hide()}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog modal-sm",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,a||(a=(0,o.Z)(C,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_username",label:gettext("User to add")},void 0,(0,o.Z)("input",{id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.onUsernameChange,type:"text",value:this.state.username}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-block btn-primary",disabled:this.state.isLoading},void 0,gettext("Add participant")),(0,o.Z)("button",{className:"btn btn-block btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel"))))))}}]),i}(Z.Z);function C(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,s||(s=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Add participant")))}var S=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(R,{thread:e.props.thread}))})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.thread.acl.can_add_participants?(0,o.Z)("div",{className:"col-xs-12 col-sm-3"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-block",onClick:this.onClick,type:"button"},void 0,w||(w=(0,o.Z)("span",{className:"material-icon"},void 0,"person_add")),gettext("Add participant"))):null}}]),s}(v().Component),E=n(32233);var L=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onClick",(function(){var e,n,a=!1;if(t.isUser)a=window.confirm(gettext("Are you sure you want to take over this thread?"));else{var s=gettext("Are you sure you want to change thread owner to %(user)s?");a=window.confirm(interpolate(s,{user:t.props.participant.username},!0))}a&&(e=t.props.thread,n=t.props.participant,_.Z.patch(e.api.index,[{op:"replace",path:"owner",value:n.id},{op:"add",path:"acl",value:1}]).then((function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants));var t=gettext("%(user)s has been made new thread owner.");k.Z.success(interpolate(t,{user:n.username},!0))}),(function(e){k.Z.apiError(e)})))})),t.isUser=e.participant.id===e.user.id,t}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.participant.is_owner?null:this.props.thread.acl.can_change_owner?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,gettext("Make owner"))):null}}]),s}(v().Component);var P,O,T,A=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onClick",(function(){var e,n,a=!1;if(t.isUser)a=window.confirm(gettext("Are you sure you want to leave this thread?"));else{var s=gettext("Are you sure you want to remove %(user)s from this thread?");a=window.confirm(interpolate(s,{user:t.props.participant.username},!0))}a&&(t.isUser?(e=t.props.thread,n=t.props.participant,_.Z.patch(e.api.index,[{op:"remove",path:"participants",value:n.id}]).then((function(){k.Z.success(gettext("You have left this thread.")),window.setTimeout((function(){window.location=E.Z.get("PRIVATE_THREADS_URL")}),3e3)}),(function(e){k.Z.apiError(e)}))):function(e,t){_.Z.patch(e.api.index,[{op:"remove",path:"participants",value:t.id},{op:"add",path:"acl",value:1}]).then((function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants));var n=gettext("%(user)s has been removed from this thread.");k.Z.success(interpolate(n,{user:t.username},!0))}),(function(e){k.Z.apiError(e)}))}(t.props.thread,t.props.participant))})),t.isUser=e.participant.id===e.user.id,t}return(0,l.Z)(s,[{key:"render",value:function(){var e=this.props.user.acl.can_moderate_private_threads;return this.props.userIsOwner||this.isUser||e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,this.isUser?gettext("Leave thread"):gettext("Remove"))):null}}]),s}(v().Component),B=n(19605);function I(e){var t=e.participant,n="btn btn-default";return t.is_owner&&(n="btn btn-primary"),n+=" btn-user btn-block",(0,o.Z)("div",{className:"col-xs-12 col-sm-3 col-md-2 participant-card"},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{"aria-haspopup":"true","aria-expanded":"false",className:n,"data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)(B.ZP,{size:"34",user:t}),(0,o.Z)("span",{className:"btn-text"},void 0,t.username)),(0,o.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,(0,o.Z)(j,{isOwner:t.is_owner}),P||(P=(0,o.Z)("li",{className:"dropdown-header"})),(0,o.Z)("li",{},void 0,(0,o.Z)("a",{href:t.url},void 0,gettext("See profile"))),O||(O=(0,o.Z)("li",{role:"separator",className:"divider"})),v().createElement(L,e),v().createElement(A,e))))}function j(e){return e.isOwner?(0,o.Z)("li",{className:"dropdown-header dropdown-header-owner"},void 0,T||(T=(0,o.Z)("span",{className:"material-icon"},void 0,"start")),(0,o.Z)("span",{className:"icon-text"},void 0,gettext("Thread owner"))):null}function D(e){var t=e.participants,n=e.thread,a=e.user,s=e.userIsOwner;return(0,o.Z)("div",{className:"participants-cards"},void 0,(0,o.Z)("div",{className:"row"},void 0,t.map((function(e){return(0,o.Z)(I,{participant:e,thread:n,user:a,userIsOwner:s},e.id)}))))}function U(e){return e.participants.length?(0,o.Z)("div",{className:"panel panel-default panel-participants"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,v().createElement(D,(0,m.Z)({userIsOwner:M(e.user,e.participants)},e)),(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)(S,{thread:e.thread}),(0,o.Z)("div",{className:"col-xs-12 col-sm-9"},void 0,(0,o.Z)("p",{},void 0,function(e){var t=e.length,n=ngettext("This thread has %(users)s participant.","This thread has %(users)s participants.",t);return interpolate(n,{users:t},!0)}(e.participants)))))):null}function M(e,t){return t[0].id===e.id}var z=n(91876),H={changed_title:"edit",pinned_globally:"bookmark",pinned_locally:"bookmark_border",unpinned:"panorama_fish_eye",moved:"arrow_forward",merged:"call_merge",approved:"done",opened:"lock_open",closed:"lock_outline",unhid:"visibility",hid:"visibility_off",changed_owner:"grade",tookover:"grade",added_participant:"person_add",owner_left:"person_outline",participant_left:"person_outline",removed_participant:"remove_circle_outline"},F=function(e){return(0,o.Z)("span",{className:"event-icon-bg"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,H[e.post.event_type]))},q=n(89627),Y=n(30381),V=n.n(Y),$=n(92747);function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function W(e){return e.post.acl.can_hide?(0,o.Z)("li",{className:"event-controls"},void 0,v().createElement(K,e),v().createElement(J,e),v().createElement(Q,e)):null}var K=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){x.Z.dispatch($.r$(e.props.post,{is_hidden:!0,hidden_on:V()(),hidden_by_name:e.props.user.username,url:Object.assign(e.props.post.url,{hidden_by:e.props.user.url})})),_.Z.patch(e.props.post.api.index,[{op:"replace",path:"is-hidden",value:!0}]).then((function(t){x.Z.dispatch($.r$(e.props.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{is_hidden:!1}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.is_hidden?null:(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Hide"))}}]),n}(v().Component),J=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){x.Z.dispatch($.r$(e.props.post,{is_hidden:!1})),_.Z.patch(e.props.post.api.index,[{op:"replace",path:"is-hidden",value:!1}]).then((function(t){x.Z.dispatch($.r$(e.props.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{is_hidden:!0}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.is_hidden?(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Unhide")):null}}]),n}(v().Component),Q=function(e){(0,u.Z)(n,e);var t=G(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){window.confirm(gettext("Are you sure you wish to delete this event? This action is not reversible!"))&&e.delete()})),(0,h.Z)((0,c.Z)(e),"delete",(function(){x.Z.dispatch($.r$(e.props.post,{isDeleted:!0})),_.Z.delete(e.props.post.api.index).then((function(){k.Z.success(gettext("Event has been deleted."))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.props.post,{isDeleted:!1}))}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,gettext("Delete"))}}]),n}(v().Component),X='<span class="item-title">%(user)s</span>',ee='<a href="%(url)s" class="item-title">%(user)s</a>';function te(e){return(0,o.Z)("ul",{className:"list-inline event-info"},void 0,v().createElement(ne,e),v().createElement(ae,e),v().createElement(W,e))}function ne(e){if(e.post.is_hidden){var t;t=e.post.url.hidden_by?interpolate(ee,{url:(0,q.Z)(e.post.url.hidden_by),user:(0,q.Z)(e.post.hidden_by_name)},!0):interpolate(X,{user:(0,q.Z)(e.post.hidden_by_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.post.hidden_on.format("LLL")),relative:(0,q.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("Hidden by %(event_by)s %(event_on)s.")),{event_by:t,event_on:n},!0);return(0,o.Z)("li",{className:"event-hidden-message",dangerouslySetInnerHTML:{__html:a}})}return null}function ae(e){var t;t=e.post.poster?interpolate(ee,{url:(0,q.Z)(e.post.poster.url),user:(0,q.Z)(e.post.poster_name)},!0):interpolate(X,{user:(0,q.Z)(e.post.poster_name)},!0);var n=interpolate('<a href="%(url)s" title="%(absolute)s">%(relative)s</a>',{url:(0,q.Z)(e.post.url.index),absolute:(0,q.Z)(e.post.posted_on.format("LLL")),relative:(0,q.Z)(e.post.posted_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("By %(event_by)s %(event_on)s.")),{event_by:t,event_on:n},!0);return(0,o.Z)("li",{className:"event-posters",dangerouslySetInnerHTML:{__html:a}})}var se={pinned_globally:gettext("Thread has been pinned globally."),pinned_locally:gettext("Thread has been pinned locally."),unpinned:gettext("Thread has been unpinned."),approved:gettext("Thread has been approved."),opened:gettext("Thread has been opened."),closed:gettext("Thread has been closed."),unhid:gettext("Thread has been revealed."),hid:gettext("Thread has been made hidden."),tookover:gettext("Took thread over."),owner_left:gettext("Owner has left thread. This thread is now closed."),participant_left:gettext("Participant has left thread.")},ie='<a href="%(url)s" class="item-title">%(name)s</a>',oe='<span class="item-title">%(name)s</span>';function re(e){return se[e.post.event_type]?(0,o.Z)("p",{className:"event-message"},void 0,se[e.post.event_type]):"changed_title"===e.post.event_type?v().createElement(le,e):"moved"===e.post.event_type?v().createElement(ce,e):"merged"===e.post.event_type?v().createElement(ue,e):"changed_owner"===e.post.event_type?v().createElement(de,e):"added_participant"===e.post.event_type?v().createElement(pe,e):"removed_participant"===e.post.event_type?v().createElement(he,e):null}function le(e){var t=(0,q.Z)(gettext("Thread title has been changed from %(old_title)s.")),n=interpolate(oe,{name:(0,q.Z)(e.post.event_context.old_title)},!0),a=interpolate(t,{old_title:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function ce(e){var t=(0,q.Z)(gettext("Thread has been moved from %(from_category)s.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.from_category.url),name:(0,q.Z)(e.post.event_context.from_category.name)},!0),a=interpolate(t,{from_category:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function ue(e){var t=(0,q.Z)(gettext("The %(merged_thread)s thread has been merged into this thread.")),n=interpolate(oe,{name:(0,q.Z)(e.post.event_context.merged_thread)},!0),a=interpolate(t,{merged_thread:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function de(e){var t=(0,q.Z)(gettext("Changed thread owner to %(user)s.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function pe(e){var t=(0,q.Z)(gettext("Added %(user)s to thread.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function he(e){var t=(0,q.Z)(gettext("Removed %(user)s from thread.")),n=interpolate(ie,{url:(0,q.Z)(e.post.event_context.user.url),name:(0,q.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:n},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function fe(e){return e.post.is_read?null:(0,o.Z)("div",{className:"event-label"},void 0,(0,o.Z)("span",{className:"label label-unread"},void 0,gettext("New event")))}var ve=n(19755);var me=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){return(0,r.Z)(this,s),a.apply(this,arguments)}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;this.props.post.is_read||ve(this.element).waypoint({handler:function(t){"down"!==t||e.props.post.is_read||window.setTimeout((function(){var t=e.element.getBoundingClientRect(),n=t.height+t.top,a=document.documentElement.clientHeight;n<5||n>a||(x.Z.dispatch($.r$(e.props.post,{is_read:!0})),_.Z.post(e.props.post.api.read).then((function(t){x.Z.dispatch(y.Vx(e.props.thread,{is_read:t.thread_is_read}))}),(function(e){k.Z.apiError(e)})))}),1e3)},offset:"bottom-in-view"})}},{key:"render",value:function(){var e=this;return v().createElement("div",{className:this.props.className,ref:function(t){t&&(e.element=t)}},this.props.children)}}]),s}(v().Component);function Ze(e){var t="event";return e.post.isDeleted?t="hide":e.post.is_hidden&&(t="event post-hidden"),(0,o.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,o.Z)(fe,{post:e.post}),(0,o.Z)("div",{className:"event-body"},void 0,(0,o.Z)("div",{className:"event-icon"},void 0,v().createElement(F,e)),(0,o.Z)(me,{className:"event-content",post:e.post},void 0,v().createElement(re,e),v().createElement(te,e))))}var ge=n(69130),be=n(48772);function ye(e){return(0,o.Z)("div",{className:"col-xs-12 col-md-6"},void 0,v().createElement(_e,e),(0,o.Z)("div",{className:"post-attachment"},void 0,(0,o.Z)("a",{href:e.attachment.url.index,className:"attachment-name item-title"},void 0,e.attachment.filename),v().createElement(xe,e)))}function _e(e){return e.attachment.is_image?(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(ke,e)):(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(Ne,e))}function Ne(e){return(0,o.Z)("a",{href:e.attachment.url.index,className:"material-icon"},void 0,"insert_drive_file")}function ke(e){var t=e.attachment.url.thumb||e.attachment.url.index;return(0,o.Z)("a",{className:"post-thumbnail",href:e.attachment.url.index,style:{backgroundImage:'url("'+(0,q.Z)(t)+'")'}})}function xe(e){var t;t=e.attachment.url.uploader?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.attachment.url.uploader),user:(0,q.Z)(e.attachment.uploader_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.attachment.uploader_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.attachment.uploaded_on.format("LLL")),relative:(0,q.Z)(e.attachment.uploaded_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.attachment.filetype,size:(0,be.Z)(e.attachment.size),uploader:t,uploaded_on:n},!0);return(0,o.Z)("p",{className:"post-attachment-description",dangerouslySetInnerHTML:{__html:a}})}function we(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&e.attachments}(e.post)?(0,o.Z)("div",{className:"post-attachments"},void 0,(0,ge.Z)(e.post.attachments,2).map((function(e){var t=e.map((function(e){return e?e.id:0})).join("_");return(0,o.Z)(Re,{row:e},t)}))):null}function Re(e){return(0,o.Z)("div",{className:"row"},void 0,e.row.map((function(e){return(0,o.Z)(ye,{attachment:e},e?e.id:0)})))}var Ce,Se,Ee,Le,Pe=n(69092);function Oe(e){return e.post.is_hidden&&!e.post.acl.can_see_hidden?v().createElement(Ae,e):e.post.content?v().createElement(Te,e):v().createElement(Be,e)}function Te(e){return(0,o.Z)(me,{className:"post-body",post:e.post},void 0,(0,o.Z)(Pe.Z,{markup:e.post.content}))}function Ae(e){var t;t=e.post.hidden_by?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.post.url.hidden_by),user:(0,q.Z)(e.post.hidden_by_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.post.hidden_by_name)},!0);var n=interpolate('<abbr class="last-title" title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.post.hidden_on.format("LLL")),relative:(0,q.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("Hidden by %(hidden_by)s %(hidden_on)s.")),{hidden_by:t,hidden_on:n},!0);return(0,o.Z)(me,{className:"post-body post-body-hidden",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("This post is hidden. You cannot see its contents.")),(0,o.Z)("p",{className:"text-muted",dangerouslySetInnerHTML:{__html:a}}))}function Be(e){return(0,o.Z)(me,{className:"post-body post-body-invalid",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("This post's contents cannot be displayed.")),(0,o.Z)("p",{className:"text-muted"},void 0,gettext("This error is caused by invalid post content manipulation.")))}function Ie(e){var t=e.post,n=e.thread,a=e.user;if(!Me(t)||t.id!==n.best_answer)return null;var s;return s=a.id&&n.best_answer_marked_by===a.id?interpolate(gettext("Marked as best answer by you %(marked_on)s."),{marked_on:n.best_answer_marked_on.fromNow()},!0):interpolate(gettext("Marked as best answer by %(marked_by)s %(marked_on)s."),{marked_by:n.best_answer_marked_by_name,marked_on:n.best_answer_marked_on.fromNow()},!0),(0,o.Z)("div",{className:"post-status-message post-status-best-answer"},void 0,Ce||(Ce=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),(0,o.Z)("p",{},void 0,s))}function je(e){return Me(e.post)&&e.post.is_hidden?(0,o.Z)("div",{className:"post-status-message post-status-hidden"},void 0,Se||(Se=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),(0,o.Z)("p",{},void 0,gettext("This post is hidden. Only users with permission may see its contents."))):null}function De(e){return Me(e.post)&&e.post.is_unapproved?(0,o.Z)("div",{className:"post-status-message post-status-unapproved"},void 0,Ee||(Ee=(0,o.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline")),(0,o.Z)("p",{},void 0,gettext("This post is unapproved. Only users with permission to approve posts and its author may see its contents."))):null}function Ue(e){return Me(e.post)&&e.post.is_protected?(0,o.Z)("div",{className:"post-status-message post-status-protected visible-xs-block"},void 0,Le||(Le=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),(0,o.Z)("p",{},void 0,gettext("This post is protected. Only moderators may change it."))):null}function Me(e){return!e.is_hidden||e.acl.can_see_hidden}function ze(e){x.Z.dispatch($.r$(e.post,{is_unapproved:!1})),Ge(e,[{op:"replace",path:"is-unapproved",value:!1}],{is_unapproved:e.post.is_unapproved})}function He(e){x.Z.dispatch($.r$(e.post,{is_protected:!0})),Ge(e,[{op:"replace",path:"is-protected",value:!0}],{is_protected:e.post.is_protected})}function Fe(e){x.Z.dispatch($.r$(e.post,{is_protected:!1})),Ge(e,[{op:"replace",path:"is-protected",value:!1}],{is_protected:e.post.is_protected})}function qe(e){x.Z.dispatch($.r$(e.post,{is_hidden:!0,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(e.post.url,{hidden_by:e.user.url})})),Ge(e,[{op:"replace",path:"is-hidden",value:!0}],{is_hidden:e.post.is_hidden,hidden_on:e.post.hidden_on,hidden_by_name:e.post.hidden_by_name,url:e.post.url})}function Ye(e){x.Z.dispatch($.r$(e.post,{is_hidden:!1})),Ge(e,[{op:"replace",path:"is-hidden",value:!1}],{is_hidden:e.post.is_hidden})}function Ve(e){var t=e.post.last_likes||[],n=[e.user].concat(t),a=n.length>3?n.slice(0,-1):n;x.Z.dispatch($.r$(e.post,{is_liked:!0,likes:e.post.likes+1,last_likes:a})),Ge(e,[{op:"replace",path:"is-liked",value:!0}],{is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes})}function $e(e){x.Z.dispatch($.r$(e.post,{is_liked:!1,likes:e.post.likes-1,last_likes:e.post.last_likes.filter((function(t){return!t.id||t.id!==e.user.id}))}));var t={is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes};Ge(e,[{op:"replace",path:"is-liked",value:!1}],t)}function Ge(e,t,n){_.Z.patch(e.post.api.index,t).then((function(t){x.Z.dispatch($.r$(e.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch($.r$(e.post,n))}))}function We(e){window.confirm(gettext("Are you sure you want to delete this post? This action is not reversible!"))&&(x.Z.dispatch($.r$(e.post,{isDeleted:!0})),_.Z.delete(e.post.api.index).then((function(){k.Z.success(gettext("Post has been deleted."))}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),x.Z.dispatch($.r$(e.post,{isDeleted:!1}))})))}function Ke(e){var t=e.post,n=e.user;x.Z.dispatch(y.Vx({best_answer:t.id,best_answer_is_protected:t.is_protected,best_answer_marked_on:V()(),best_answer_marked_by:n.id,best_answer_marked_by_name:n.username,best_answer_marked_by_slug:n.slug})),Qe(e,[{op:"replace",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Je(e){var t=e.post;x.Z.dispatch(y.Vx({best_answer:null,best_answer_is_protected:!1,best_answer_marked_on:null,best_answer_marked_by:null,best_answer_marked_by_name:null,best_answer_marked_by_slug:null})),Qe(e,[{op:"remove",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Qe(e,t,n){_.Z.patch(e.thread.api.index,t).then((function(e){e.best_answer_marked_on&&(e.best_answer_marked_on=V()(e.best_answer_marked_on)),x.Z.dispatch(y.Vx(e))}),(function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e),x.Z.dispatch(y.Vx(n))}))}var Xe,et,tt,nt=n(30337),at=n(3784);var st=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),(t=a.call(this,e)).state={isReady:!1,error:null,likes:[]},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(this.props.post.api.likes).then((function(t){e.setState({isReady:!0,likes:t.map(it)})}),(function(t){e.setState({isReady:!0,error:t.detail})}))}},{key:"render",value:function(){return this.state.error?(0,o.Z)(ot,{className:"modal-message"},void 0,(0,o.Z)(nt.Z,{message:this.state.error})):this.state.isReady?this.state.likes.length?(0,o.Z)(ot,{className:"modal-sm",likes:this.state.likes},void 0,(0,o.Z)(rt,{likes:this.state.likes})):(0,o.Z)(ot,{className:"modal-message"},void 0,(0,o.Z)(nt.Z,{message:gettext("No users have liked this post.")})):Xe||(Xe=(0,o.Z)(ot,{className:"modal-sm"},void 0,(0,o.Z)(at.Z,{})))}}]),s}(v().Component);function it(e){return Object.assign({},e,{liked_on:V()(e.liked_on)})}function ot(e){var t=e.className,n=e.children,a=e.likes,s=gettext("Post Likes");if(a){var i=a.length,r=ngettext("%(likes)s like","%(likes)s likes",i);s=interpolate(r,{likes:i},!0)}return(0,o.Z)("div",{className:"modal-dialog "+(t||""),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,et||(et=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,s)),n))}function rt(e){return(0,o.Z)("div",{className:"modal-body modal-post-likers"},void 0,(0,o.Z)("ul",{className:"media-list"},void 0,e.likes.map((function(e){return v().createElement(lt,(0,m.Z)({key:e.id},e))}))))}function lt(e){if(e.url){var t={id:e.liker_id,avatars:e.avatars};return(0,o.Z)("li",{className:"media"},void 0,(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("a",{className:"user-avatar",href:e.url},void 0,(0,o.Z)(B.ZP,{size:"50",user:t}))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,o.Z)(ct,{likedOn:e.liked_on})))}return(0,o.Z)("li",{className:"media"},void 0,tt||(tt=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{className:"user-avatar"},void 0,(0,o.Z)(B.ZP,{size:"50"})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("strong",{},void 0,e.username)," ",(0,o.Z)(ct,{likedOn:e.liked_on})))}function ct(e){return(0,o.Z)("span",{className:"text-muted",title:e.likedOn.format("LLL")},void 0,e.likedOn.fromNow())}var ut,dt,pt,ht,ft=n(27950);function vt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function mt(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&(e.acl.can_reply||e.acl.can_edit||e.acl.can_see_likes&&(e.last_likes||[]).length||e.acl.can_like)}(e.post)?(0,o.Z)("div",{className:"post-footer"},void 0,v().createElement(Zt,e),v().createElement(gt,e),v().createElement(bt,e),v().createElement(yt,(0,m.Z)({lastLikes:e.post.last_likes,likes:e.post.likes},e)),v().createElement(_t,(0,m.Z)({likes:e.post.likes},e)),v().createElement(wt,e),v().createElement(Rt,e)):null}var Zt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||t.id===n.best_answer,onClick:this.onClick,type:"button"},void 0,ut||(ut=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Best answer")):null}}]),n}(v().Component),gt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("button",{className:"visible-xs-inline-block btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||t.id===n.best_answer,onClick:this.onClick,type:"button"},void 0,dt||(dt=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box"))):null}}]),n}(v().Component),bt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.post.is_liked?$e(e.props):Ve(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){if(!this.props.post.acl.can_like)return null;var e="btn btn-default btn-sm pull-left";return this.props.post.is_liked&&(e="btn btn-success btn-sm pull-left"),(0,o.Z)("button",{className:e,disabled:this.props.post.isBusy,onClick:this.onClick,type:"button"},void 0,this.props.post.is_liked?gettext("Liked"):gettext("Like"))}}]),n}(v().Component),yt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(st,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm pull-left hidden-xs",onClick:this.onClick,type:"button"},void 0,Nt(this.props.likes,this.props.lastLikes)):(0,o.Z)("p",{className:"pull-left hidden-xs"},void 0,Nt(this.props.likes,this.props.lastLikes)):null}}]),n}(v().Component),_t=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,l.Z)(n,[{key:"render",value:function(){var e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm likes-compact pull-left visible-xs-block",onClick:this.onClick,type:"button"},void 0,pt||(pt=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):(0,o.Z)("p",{className:"likes-compact pull-left visible-xs-block"},void 0,ht||(ht=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):null}}]),n}(yt);function Nt(e,t){var n=t.slice(0,3).map((function(e){return e.username}));if(1==n.length)return interpolate(gettext("%(user)s likes this."),{user:n[0]},!0);var a=e-n.length,s=n.slice(0,-1).join(", "),i=n.slice(-1)[0],o=interpolate(gettext("%(users)s and %(last_user)s"),{users:s,last_user:i},!0);if(0===a)return interpolate(gettext("%(users)s like this."),{users:o},!0);var r=ngettext("%(users)s and %(likes)s other user like this.","%(users)s and %(likes)s other users like this.",a);return interpolate(r,{users:n.join(", "),likes:a},!0)}var kt,xt,wt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"REPLY",config:e.props.thread.api.editor,submit:e.props.thread.api.posts.index,context:{reply:e.props.post.id}})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_reply?(0,o.Z)("button",{className:"btn btn-primary btn-sm pull-right",type:"button",onClick:this.onClick},void 0,gettext("Reply")):null}}]),n}(v().Component),Rt=function(e){(0,u.Z)(n,e);var t=vt(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"EDIT",config:e.props.post.api.editor,submit:e.props.post.api.index})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_edit?(0,o.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-right",type:"button",onClick:this.onClick},void 0,gettext("Edit")):null}}]),n}(v().Component),Ct=n(82211);var St=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.move,{new_thread:this.state.url,posts:[this.props.post.id]})}},{key:"handleSuccess",value:function(e){x.Z.dispatch($.r$(this.props.post,{isDeleted:!0})),N.Z.hide(),k.Z.success(gettext("Selected post was moved to the other thread."))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail):k.Z.apiError(e)}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,kt||(kt=(0,o.Z)(Et,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to move post to")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading},void 0,gettext("Move post"))))))}}]),s}(Z.Z);function Et(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,xt||(xt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move post")))}function Lt(e){return(0,o.Z)("div",{className:"modal-body post-changelog-diff"},void 0,(0,o.Z)("ul",{className:"list-unstyled"},void 0,e.diff.map((function(e,t){return(0,o.Z)(Pt,{item:e},t)}))))}function Pt(e){return"?"===e.item[0]?null:(0,o.Z)("li",{className:(t=e.item,n="diff-item","-"===t[0]?n+=" diff-item-sub":"+"===t[0]&&(n+=" diff-item-add"),n)},void 0,e.item.substr(2));var t,n}var Ot,Tt,At,Bt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.revertEdit(e.props.edit.id)})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.canRevert?(0,o.Z)("div",{className:"modal-footer visible-xs-block"},void 0,(0,o.Z)(Ct.Z,{className:"btn-default btn-sm btn-block",disabled:this.props.disabled,onClick:this.onClick,title:gettext("Revert post to state from before this edit.")},void 0,gettext("Revert"))):null}}]),s}(v().Component);var It,jt,Dt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"goLast",(function(){e.props.goToEdit()})),(0,h.Z)((0,c.Z)(e),"goForward",(function(){e.props.goToEdit(e.props.edit.next)})),(0,h.Z)((0,c.Z)(e),"goBack",(function(){e.props.goToEdit(e.props.edit.previous)})),(0,h.Z)((0,c.Z)(e),"revertEdit",(function(){e.props.revertEdit(e.props.edit.id)})),e}return(0,l.Z)(s,[{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-toolbar post-changelog-toolbar"},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-xs-12 col-sm-4"},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(Ut,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goBack})),(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(Mt,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goForward})),(0,o.Z)("div",{className:"col-xs-4"},void 0,(0,o.Z)(zt,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goLast})))),(0,o.Z)("div",{className:"col-xs-12 col-sm-5 xs-margin-top-half post-change-label"},void 0,(0,o.Z)(Ft,{edit:this.props.edit})),(0,o.Z)(Ht,{canRevert:this.props.canRevert,disabled:this.props.disabled,onClick:this.revertEdit})))}}]),s}(v().Component);function Ut(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.previous,onClick:e.onClick,title:gettext("See previous change")},void 0,Ot||(Ot=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left")))}function Mt(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:gettext("See next change")},void 0,Tt||(Tt=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function zt(e){return(0,o.Z)(Ct.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:gettext("See previous change")},void 0,At||(At=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page")))}function Ht(e){return e.canRevert?(0,o.Z)("div",{className:"col-sm-3 hidden-xs"},void 0,(0,o.Z)(Ct.Z,{className:"btn-default btn-sm btn-block",disabled:e.disabled,onClick:e.onClick,title:gettext("Revert post to state from before this edit.")},void 0,gettext("Revert"))):null}function Ft(e){var t;t=e.edit.url.editor?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,q.Z)(e.edit.url.editor),user:(0,q.Z)(e.edit.editor_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,q.Z)(e.edit.editor_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,q.Z)(e.edit.edited_on.format("LLL")),relative:(0,q.Z)(e.edit.edited_on.fromNow())},!0),a=interpolate((0,q.Z)(gettext("By %(edited_by)s %(edited_on)s.")),{edited_by:t,edited_on:n},!0);return(0,o.Z)("p",{dangerouslySetInnerHTML:{__html:a}})}function qt(e){return Object.assign({},e,{edited_on:V()(e.edited_on)})}var Yt=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"goToEdit",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t.setState({isBusy:!0});var n=t.props.post.api.edits;null!==e&&(n+="?edit="+e),_.Z.get(n).then((function(e){t.setState({isReady:!0,isBusy:!1,edit:qt(e)})}),(function(e){t.setState({isReady:!0,isBusy:!1,error:e.detail})}))})),(0,h.Z)((0,c.Z)(t),"revertEdit",(function(e){if(!t.state.isBusy&&window.confirm(gettext("Are you sure you with to revert this post to the state from before this edit?"))){t.setState({isBusy:!0});var n=t.props.post.api.edits+"?edit="+e;_.Z.post(n).then((function(e){var t=$.ZB(e);x.Z.dispatch($.r$(e,t)),k.Z.success(gettext("Post has been reverted to previous state.")),N.Z.hide()}),(function(e){k.Z.apiError(e),t.setState({isBusy:!1})}))}})),t.state={isReady:!1,isBusy:!0,canRevert:e.post.acl.can_edit,error:null,edit:null},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){this.goToEdit()}},{key:"render",value:function(){return this.state.error?(0,o.Z)(Vt,{className:"modal-dialog modal-message"},void 0,(0,o.Z)(nt.Z,{message:this.state.error})):this.state.isReady?(0,o.Z)(Vt,{},void 0,(0,o.Z)(Dt,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,goToEdit:this.goToEdit,revertEdit:this.revertEdit}),(0,o.Z)(Lt,{diff:this.state.edit.diff}),(0,o.Z)(Bt,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,revertEdit:this.revertEdit})):It||(It=(0,o.Z)(Vt,{},void 0,(0,o.Z)(at.Z,{})))}}]),s}(v().Component);function Vt(e){return(0,o.Z)("div",{className:e.className||"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,jt||(jt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Post edits history"))),e.children))}var $t,Gt,Wt,Kt,Jt,Qt,Xt=n(57026),en=n(60471),tn=n(55210);function nn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function an(e){return v().createElement(gn,(0,m.Z)({},e,{Form:bn}))}var sn,on,rn,ln,cn,un,dn,pn,hn,fn,vn,mn,Zn,gn=function(e){(0,u.Z)(n,e);var t=nn(n);function n(e){var a;return(0,r.Z)(this,n),(a=t.call(this,e)).state={isLoaded:!1,isError:!1,categories:[]},a}return(0,l.Z)(n,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(misago.get("THREAD_EDITOR_API")).then((function(t){var n=t.map((function(e){return Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})}));e.setState({isLoaded:!0,categories:n})}),(function(t){e.setState({isError:t.detail})}))}},{key:"render",value:function(){return this.state.isError?(0,o.Z)(_n,{message:this.state.isError}):this.state.isLoaded?v().createElement(bn,(0,m.Z)({},this.props,{categories:this.state.categories})):$t||($t=(0,o.Z)(yn,{}))}}]),n}(v().Component),bn=function(e){(0,u.Z)(n,e);var t=nn(n);function n(e){var a;return(0,r.Z)(this,n),a=t.call(this,e),(0,h.Z)((0,c.Z)(a),"onCategoryChange",(function(e){var t=e.target.value,n={category:t};a.acl[t].can_pin_threads<n.weight&&(n.weight=0),a.acl[t].can_hide_threads||(n.is_hidden=0),a.acl[t].can_close_threads||(n.is_closed=!1),a.setState(n)})),a.state={isLoading:!1,title:"",category:null,categories:e.categories,weight:0,is_hidden:0,is_closed:!1,validators:{title:[tn.C1()]},errors:{}},a.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],a.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],a.acl={},a.props.categories.forEach((function(e){e.post&&(a.state.category||(a.state.category=e.id),a.acl[e.id]={can_pin_threads:e.post.pin,can_close_threads:e.post.close,can_hide_threads:e.post.hide})})),a}return(0,l.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(k.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.split,{title:this.state.title,category:this.state.category,weight:this.state.weight,is_hidden:this.state.is_hidden,is_closed:this.state.is_closed,posts:[this.props.post.id]})}},{key:"handleSuccess",value:function(e){x.Z.dispatch($.r$(this.props.post,{isDeleted:!0})),N.Z.hide(),k.Z.success(gettext("Selected post was split into new thread."))}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),k.Z.error(gettext("Form contains errors."))):k.Z.apiError(e)}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,o.Z)(g.Z,{label:gettext("Thread weight"),for:"id_weight",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,o.Z)(g.Z,{label:gettext("Hide thread"),for:"id_is_hidden",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,o.Z)(g.Z,{label:gettext("Close thread"),for:"id_is_closed",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"render",value:function(){return(0,o.Z)(Nn,{className:"modal-dialog"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{label:gettext("Thread title"),for:"id_title",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.title},void 0,(0,o.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),Gt||(Gt=(0,o.Z)("div",{className:"clearfix"})),(0,o.Z)(g.Z,{label:gettext("Category"),for:"id_category",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.category},void 0,(0,o.Z)(Xt.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.state.categories})),Wt||(Wt=(0,o.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)(Ct.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Split post")))))}}]),n}(Z.Z);function yn(){return Kt||(Kt=(0,o.Z)(Nn,{className:"modal-dialog"},void 0,(0,o.Z)(at.Z,{})))}function _n(e){return(0,o.Z)(Nn,{className:"modal-dialog modal-message"},void 0,Jt||(Jt=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move this post at the moment.")),(0,o.Z)("p",{},void 0,e.message)))}function Nn(e){return(0,o.Z)("div",{className:e.className,role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Qt||(Qt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Split post into new thread"))),e.children))}function kn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function xn(e){return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,v().createElement(Rn,e),v().createElement(Cn,e),v().createElement(Sn,e),v().createElement(En,e),v().createElement(Ln,e),v().createElement(Pn,e),v().createElement(On,e),v().createElement(Tn,e),v().createElement(An,e),v().createElement(Bn,e),v().createElement(In,e),v().createElement(jn,e),v().createElement(Dn,e))}var wn,Rn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){var t=window.location.protocol+"//";t+=window.location.host,t+=e.props.post.url.index,prompt(gettext("Permament link to this post:"),t)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,sn||(sn=(0,o.Z)("span",{className:"material-icon"},void 0,"link")),gettext("Permament link")))}}]),n}(v().Component),Cn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ft.Z.open({mode:"EDIT",config:e.props.post.api.editor,submit:e.props.post.api.index})})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_edit?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,on||(on=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Edit"))):null}}]),n}(v().Component),Sn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ke(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return n.acl.can_mark_best_answer&&t.acl.can_mark_as_best_answer?t.id===n.best_answer||n.best_answer&&!n.acl.can_change_best_answer?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,rn||(rn=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Mark as best answer"))):null}}]),n}(v().Component),En=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Je(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id!==n.best_answer?null:n.acl.can_unmark_best_answer?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,ln||(ln=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box_outline_blank")),gettext("Unmark best answer"))):null}}]),n}(v().Component),Ln=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(Yt,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("This post was edited %(edits)s time.","This post was edited %(edits)s times.",this.props.post.edits);return interpolate(n,{edits:this.props.post.edits},!0),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,cn||(cn=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Changes history")))}}]),n}(v().Component),Pn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){ze(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_approve&&this.props.post.is_unapproved?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,un||(un=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))):null}}]),n}(v().Component),On=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(St,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_move?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,dn||(dn=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))):null}}]),n}(v().Component),Tn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(an,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_move?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,pn||(pn=(0,o.Z)("span",{className:"material-icon"},void 0,"call_split")),gettext("Split"))):null}}]),n}(v().Component),An=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){He(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_protect?this.props.post.is_protected?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,hn||(hn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Protect"))):null}}]),n}(v().Component),Bn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Fe(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_protect&&this.props.post.is_protected?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,fn||(fn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Remove protection"))):null}}]),n}(v().Component),In=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){qe(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id===n.best_answer?null:t.acl.can_hide?t.is_hidden?null:(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,vn||(vn=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))):null}}]),n}(v().Component),jn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ye(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){return this.props.post.acl.can_unhide&&this.props.post.is_hidden?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,mn||(mn=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))):null}}]),n}(v().Component),Dn=function(e){(0,u.Z)(n,e);var t=kn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){We(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props,t=e.post,n=e.thread;return t.id===n.best_answer?null:t.acl.can_delete?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,Zn||(Zn=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))):null}}]),n}(v().Component);function Un(e){return(0,o.Z)("div",{className:"pull-right dropdown"},void 0,wn||(wn=(0,o.Z)("button",{"aria-expanded":"true","aria-haspopup":"true",className:"btn btn-default btn-icon dropdown-toggle","data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"expand_more"))),v().createElement(xn,e))}var Mn=n(21981);var zn,Hn=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){e.props.post.isSelected?x.Z.dispatch(Mn._H(e.props.post)):x.Z.dispatch(Mn.Ys(e.props.post))})),e}return(0,l.Z)(s,[{key:"render",value:function(){return this.props.thread.acl.can_merge_posts||(e=this.props.post.acl).can_approve||e.can_hide||e.can_protect||e.can_unhide||e.can_delete||e.can_move?(0,o.Z)("div",{className:"pull-right"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-icon",onClick:this.onClick,type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,this.props.post.isSelected?"check_box":"check_box_outline_blank"))):null;var e}}]),s}(v().Component),Fn=n(24678);function qn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function Yn(e){return(0,o.Z)("div",{className:"post-heading"},void 0,v().createElement(Vn,e),v().createElement($n,e),v().createElement(Gn,e),v().createElement(Wn,e),v().createElement(Qn,e),v().createElement(Xn,e),v().createElement(ea,e),v().createElement(Hn,e),v().createElement(Un,e))}function Vn(e){return e.post.is_read?null:(0,o.Z)("span",{className:"label label-unread hidden-xs"},void 0,gettext("New post"))}function $n(e){return e.post.is_read?null:(0,o.Z)("span",{className:"label label-unread visible-xs-inline-block"},void 0,gettext("New"))}function Gn(e){var t=interpolate(gettext("posted %(posted_on)s"),{posted_on:e.post.posted_on.format("LL, LT")},!0);return(0,o.Z)("a",{href:e.post.url.index,className:"btn btn-link posted-on hidden-xs",title:t},void 0,e.post.posted_on.fromNow())}function Wn(e){return(0,o.Z)("a",{href:e.post.url.index,className:"btn btn-link posted-on visible-xs-inline-block"},void 0,e.post.posted_on.fromNow())}var Kn,Jn,Qn=function(e){(0,u.Z)(n,e);var t=qn(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show((0,o.Z)(Yt,{post:e.props.post}))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("This post was edited %(edits)s time.","This post was edited %(edits)s times.",this.props.post.edits),a=interpolate(n,{edits:this.props.post.edits},!0),s=ngettext("edited %(edits)s time","edited %(edits)s times",this.props.post.edits);return(0,o.Z)("button",{className:"btn btn-link btn-see-edits hidden-xs",onClick:this.onClick,title:a,type:"button"},void 0,interpolate(s,{edits:this.props.post.edits},!0))}}]),n}(v().Component),Xn=function(e){(0,u.Z)(n,e);var t=qn(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.post.is_hidden&&!this.props.post.acl.can_see_hidden,t=0===this.props.post.edits;if(e||t)return null;var n=ngettext("%(edits)s edit","%(edits)s edits",this.props.post.edits);return(0,o.Z)("button",{className:"btn btn-link btn-see-edits visible-xs-inline-block",onClick:this.onClick,type:"button"},void 0,interpolate(n,{edits:this.props.post.edits},!0))}}]),n}(Qn);function ea(e){var t=e.post.poster&&e.post.poster.id===e.user.id,n=e.post.acl.can_protect;return e.user.id&&e.post.is_protected&&(t||n)?(0,o.Z)("span",{className:"label label-protected hidden-xs",title:gettext("This post is protected and may not be edited.")},void 0,zn||(zn=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("protected")):null}function ta(e){var t=e.post,n=e.thread;return(0,o.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,o.Z)(Hn,{post:t,thread:n}),(0,o.Z)(Un,{post:t,thread:n}),(0,o.Z)("div",{className:"media"},void 0,Kn||(Kn=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:100})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("span",{className:"media-heading item-title"},void 0,t.poster_name),(0,o.Z)("span",{className:"user-title user-title-anonymous"},void 0,gettext("Removed user")))))}function na(e){var t=e.title,n=e.rank;return n.is_tab||!!t||!!n.title}function aa(e){var t=e.poster,n=ngettext("%(posts)s post","%(posts)s posts",t.posts),a="user-postcount";return na(t)&&(a+=" hidden-xs hidden-sm"),(0,o.Z)("span",{className:a},void 0,interpolate(n,{posts:t.posts},!0))}function sa(e){var t=e.poster,n="hidden-xs";return na(t)&&(n+=" hidden-sm"),(0,o.Z)("span",{className:n},void 0,(0,o.Z)(Fn.ZP,{status:t.status},void 0,(0,o.Z)(Fn.pg,{status:t.status,user:t})))}function ia(e){var t=e.rank,n=e.title||t.title;if(!n&&t.is_tab&&(n=t.name),!n)return null;var a="user-title";return t.css_class&&(a+=" user-title-"+t.css_class),t.is_tab?(0,o.Z)("div",{className:a},void 0,(0,o.Z)("a",{href:t.url},void 0,n)):(0,o.Z)("div",{className:a},void 0,n)}function oa(e){var t=e.post,n=e.thread,a=t.poster;return(0,o.Z)("div",{className:"post-side post-side-registered"},void 0,(0,o.Z)(Hn,{post:t,thread:n}),(0,o.Z)(Un,{post:t,thread:n}),(0,o.Z)("div",{className:"media"},void 0,(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("a",{href:a.url},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:100,user:a}))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("div",{className:"media-heading"},void 0,(0,o.Z)("a",{className:"item-title",href:a.url},void 0,a.username),(0,o.Z)(Fn.ZP,{status:a.status},void 0,(0,o.Z)(Fn.Jj,{status:a.status}))),(0,o.Z)(ia,{rank:a.rank,title:a.title}),(0,o.Z)(sa,{poster:a}),(0,o.Z)(aa,{poster:a}))))}function ra(e){return e.post.poster?v().createElement(oa,e):v().createElement(ta,e)}function la(e){var t="post";return e.post.isDeleted?t="hide":e.post.is_hidden&&!e.post.acl.can_see_hidden&&(t="post post-hidden"),e.post.poster&&e.post.poster.rank.css_class&&(t+=" post-"+e.post.poster.rank.css_class),e.post.is_read||(t+=" post-new"),(0,o.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,o.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,v().createElement(ra,e),(0,o.Z)("div",{className:"panel-content"},void 0,v().createElement(Yn,e),v().createElement(Ie,e),v().createElement(De,e),v().createElement(Ue,e),v().createElement(je,e),v().createElement(Oe,e),v().createElement(we,e),v().createElement(mt,e)))))}var ca,ua=function(){return(0,o.Z)("li",{className:"post"},void 0,(0,o.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,(0,o.Z)("div",{className:"post-side post-side-registered"},void 0,(0,o.Z)("div",{className:"media"},void 0,Jn||(Jn=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{},void 0,(0,o.Z)(B.ZP,{className:"poster-avatar",size:"100"})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("span",{className:"media-heading item-title"},void 0,(0,o.Z)("span",{className:"ui-preview-text",style:{width:"80px"}},void 0," ")),(0,o.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,o.Z)("span",{className:"ui-preview-text",style:{width:"60px"}},void 0," "))))),(0,o.Z)("div",{className:"panel-content"},void 0,(0,o.Z)("div",{className:"post-body"},void 0,(0,o.Z)("article",{className:"misago-markup"},void 0,(0,o.Z)("p",{className:"ui-preview-text",style:{width:"100%"}},void 0," "),(0,o.Z)("p",{className:"ui-preview-text",style:{width:"70%"}},void 0," "),(0,o.Z)("p",{className:"ui-preview-text hidden-xs hidden-sm",style:{width:"85%"}},void 0," ")))))))};function da(e){return e.posts.isLoaded?(0,o.Z)("ul",{className:"posts-list ui-ready"},void 0,e.posts.results.map((function(t){return v().createElement(pa,(0,m.Z)({key:t.id,post:t},e))}))):ca||(ca=(0,o.Z)("ul",{className:"posts-list ui-preview"},void 0,(0,o.Z)(ua,{})))}function pa(e){return e.post.is_event?v().createElement(Ze,e):v().createElement(la,e)}var ha,fa,va,ma=n(59752),Za=n(55547),ga=n(53328),ba=n(59131),ya=n(98936),_a=n(50366),Na=n(16768),ka=function(e){var t=e.thread;return(0,o.Z)("div",{className:"thread-user-card"},void 0,(0,o.Z)("div",{className:"thread-user-card-media"},void 0,t.starter?(0,o.Z)("a",{href:t.url.starter},void 0,(0,o.Z)(B.ZP,{size:40,user:t.starter})):ha||(ha=(0,o.Z)(B.ZP,{size:40}))),(0,o.Z)("div",{className:"thread-user-card-body"},void 0,(0,o.Z)("div",{className:"thread-user-card-header"},void 0,t.starter?(0,o.Z)("a",{className:"item-title",href:t.url.starter,title:gettext("Thread author")},void 0,t.starter.username):(0,o.Z)("span",{className:"item-title",title:gettext("Thread author")},void 0,t.starter_name)),(0,o.Z)("div",{},void 0,(0,o.Z)("span",{className:"text-muted",title:interpolate(gettext("Started on: %(timestamp)s"),{timestamp:t.started_on.format("LLL")},!0)},void 0,t.started_on.fromNow()))))},xa=n(99755),wa=n(12891);var Ra=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSuccess",(function(e){t.handleSuccessUnmounted(e),t.setState({isLoading:!0}),N.Z.hide()})),(0,h.Z)((0,c.Z)(t),"handleSuccessUnmounted",(function(e){x.Z.dispatch(y.Ar()),x.Z.dispatch(y.Vx(e))})),(0,h.Z)((0,c.Z)(t),"handleError",(function(e){x.Z.dispatch(y.Ar()),400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)})),(0,h.Z)((0,c.Z)(t),"onChange",(function(e){t.changeValue("title",e.target.value)})),t.state={isLoading:!1,title:e.thread.title,validators:{title:(0,wa.jn)()},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){if(!this.state.title.trim().length)return k.Z.error(gettext("You have to enter thread title.")),!1;var e=this.validate();return!e.title||(k.Z.error(e.title[0]),!1)}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.patch(this.props.thread.api.index,[{op:"replace",path:"title",value:this.state.title}])}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,fa||(fa=(0,o.Z)(Ca,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_modal_title",label:gettext("Thread title")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_modal_title",onChange:this.onChange,value:this.state.title}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Change title"))))))}}]),s}(Z.Z);function Ca(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,va||(va=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Change title")))}var Sa,Ea,La=n(52753);var Pa,Oa,Ta,Aa,Ba,Ia,ja=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSuccess",(function(e){t.handleSuccessUnmounted(e),t.setState({isLoading:!0})})),(0,h.Z)((0,c.Z)(t),"handleSuccessUnmounted",(function(e){k.Z.success(gettext("Thread has been merged with other one.")),window.location=e.url})),(0,h.Z)((0,c.Z)(t),"handleError",(function(e){x.Z.dispatch(y.Ar()),400===e.status?e.best_answers||e.polls?N.Z.show((0,o.Z)(La.ZP,{api:t.props.thread.api.merge,bestAnswers:e.best_answers,data:{other_thread:t.state.url},polls:e.polls,onError:t.handleError,onSuccess:t.handleSuccessUnmounted})):e.best_answer?k.Z.error(e.best_answer[0]):e.poll?k.Z.error(e.poll[0]):k.Z.error(e.detail):k.Z.apiError(e)})),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.post(this.props.thread.api.merge,{other_thread:this.state.url})}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Sa||(Sa=(0,o.Z)(Da,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to merge with"),help_text:gettext("Merge will delete current thread and move its contents to the thread specified here.")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Merge thread"))))))}}]),s}(Z.Z);function Da(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ea||(Ea=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Merge thread")))}var Ua,Ma,za,Ha,Fa,qa,Ya,Va,$a,Ga,Wa,Ka,Ja=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onCategoryChange",(function(e){t.changeValue("category",e.target.value)})),t.state={isReady:!1,isLoading:!1,isError:!1,category:null,categories:[]},t}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(E.Z.get("THREAD_EDITOR_API")).then((function(t){var n=null,a=t.map((function(e){return!1===e.post||n||(n=e.id),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id})}));e.setState({isReady:!0,category:n,categories:a})}),(function(t){e.setState({isError:t.detail})}))}},{key:"send",value:function(){return x.Z.dispatch(y.n6()),_.Z.patch(this.props.thread.api.index,[{op:"replace",path:"category",value:this.state.category}])}},{key:"handleSuccess",value:function(){_.Z.get(this.props.thread.api.posts.index,{page:this.props.posts.page}).then((function(e){x.Z.dispatch(y.gx(e)),x.Z.dispatch(Mn.zD(e.post_set)),x.Z.dispatch(y.Ar()),k.Z.success(gettext("Thread has been moved.")),N.Z.hide()}),(function(e){x.Z.dispatch(y.Ar()),k.Z.apiError(e)}))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Pa||(Pa=(0,o.Z)(Qa,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_category",label:gettext("New category")},void 0,(0,o.Z)(Xt.Z,{choices:this.state.categories,disabled:this.state.isLoading||this.props.thread.isBusy,id:"id_category",onChange:this.onCategoryChange,value:this.state.category}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading||this.props.thread.isBusy},void 0,gettext("Move thread")))))):this.state.isError?(0,o.Z)(es,{message:this.state.isError}):Oa||(Oa=(0,o.Z)(Xa,{}))}}]),s}(Z.Z);function Qa(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ta||(Ta=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move thread")))}function Xa(e){return Aa||(Aa=(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)(Qa,{}),(0,o.Z)(at.Z,{}))))}function es(e){return(0,o.Z)("div",{className:"modal-dialog modal-message",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Ba||(Ba=(0,o.Z)(Qa,{})),Ia||(Ia=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move this thread at the moment.")),(0,o.Z)("p",{},void 0,e.message),(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok")))))}var ts,ns,as,ss,is=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"callApi",(function(t,n){x.Z.dispatch(y.n6()),t.push({op:"add",path:"acl",value:!0}),_.Z.patch(e.props.thread.api.index,t).then((function(e){x.Z.dispatch(y.Vx(e)),x.Z.dispatch(y.Ar()),k.Z.success(n)}),(function(e){x.Z.dispatch(y.Ar()),400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e)}))})),(0,h.Z)((0,c.Z)(e),"changeTitle",(function(){N.Z.show((0,o.Z)(Ra,{thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"pinGlobally",(function(){e.callApi([{op:"replace",path:"weight",value:2}],gettext("Thread has been pinned globally."))})),(0,h.Z)((0,c.Z)(e),"pinLocally",(function(){e.callApi([{op:"replace",path:"weight",value:1}],gettext("Thread has been pinned locally."))})),(0,h.Z)((0,c.Z)(e),"unpin",(function(){e.callApi([{op:"replace",path:"weight",value:0}],gettext("Thread has been unpinned."))})),(0,h.Z)((0,c.Z)(e),"approve",(function(){e.callApi([{op:"replace",path:"is-unapproved",value:!1}],gettext("Thread has been approved."))})),(0,h.Z)((0,c.Z)(e),"open",(function(){e.callApi([{op:"replace",path:"is-closed",value:!1}],gettext("Thread has been opened."))})),(0,h.Z)((0,c.Z)(e),"close",(function(){e.callApi([{op:"replace",path:"is-closed",value:!0}],gettext("Thread has been closed."))})),(0,h.Z)((0,c.Z)(e),"unhide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!1}],gettext("Thread has been made visible."))})),(0,h.Z)((0,c.Z)(e),"hide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!0}],gettext("Thread has been made hidden."))})),(0,h.Z)((0,c.Z)(e),"move",(function(){N.Z.show((0,o.Z)(Ja,{posts:e.props.posts,thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"merge",(function(){N.Z.show((0,o.Z)(ja,{thread:e.props.thread}))})),(0,h.Z)((0,c.Z)(e),"delete",(function(){window.confirm(gettext("Are you sure you want to delete this thread?"))&&(x.Z.dispatch(y.n6()),_.Z.delete(e.props.thread.api.index).then((function(t){k.Z.success(gettext("Thread has been deleted.")),window.location=e.props.thread.category.url.index}),(function(e){x.Z.dispatch(y.Ar()),k.Z.apiError(e)})))})),e}return(0,l.Z)(s,[{key:"render",value:function(){var e=this.props.moderation;return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,!!e.edit&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.changeTitle,type:"button"},void 0,Ua||(Ua=(0,o.Z)("span",{className:"material-icon"},void 0,"edit")),gettext("Change title"))),!!e.pinGlobally&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.pinGlobally,type:"button"},void 0,Ma||(Ma=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark")),gettext("Pin globally"))),!!e.pinLocally&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.pinLocally,type:"button"},void 0,za||(za=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark_border")),gettext("Pin locally"))),!!e.unpin&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.unpin,type:"button"},void 0,Ha||(Ha=(0,o.Z)("span",{className:"material-icon"},void 0,"panorama_fish_eye")),gettext("Unpin"))),!!e.move&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.move,type:"button"},void 0,Fa||(Fa=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))),!!e.merge&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.merge,type:"button"},void 0,qa||(qa=(0,o.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge"))),!!e.approve&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.approve,type:"button"},void 0,Ya||(Ya=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))),!!e.open&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.open,type:"button"},void 0,Va||(Va=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Open"))),!!e.close&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.close,type:"button"},void 0,$a||($a=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Close"))),!!e.unhide&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.unhide,type:"button"},void 0,Ga||(Ga=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))),!!e.hide&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.hide,type:"button"},void 0,Wa||(Wa=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))),!!e.delete&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:this.delete,type:"button"},void 0,Ka||(Ka=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))))}}]),s}(v().Component),os=is,rs=function(e){var t=e.thread,n=e.posts,a=e.moderation;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Thread options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:t.isBusy},void 0,ts||(ts=(0,o.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,o.Z)(os,{thread:t,posts:n,moderation:a}))},ls=n(94184),cs=n.n(ls);function us(e,t,n){var a={subscription:e.subscription};x.Z.dispatch(y.Vx({subscription:t})),_.Z.patch(e.api.index,[{op:"replace",path:"subscription",value:n}]).then((function(e){x.Z.dispatch(y.Vx(e))}),(function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e),x.Z.dispatch(y.Vx(a))}))}var ds,ps,hs,fs,vs,ms,Zs,gs,bs,ys,_s,Ns,ks,xs=function(e){var t,n=e.stickToBottom,a=e.thread;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-block","aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,!0===(t=a.subscription)?"star":!1===t?"star_half":"star_border"),function(e){return!0===e?gettext("E-mail"):!1===e?gettext("Enabled"):gettext("Disabled")}(a.subscription)),(0,o.Z)("ul",{className:cs()("dropdown-menu dropdown-menu-right",{"stick-to-bottom":n})},void 0,(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){null!==e.subscription&&us(e,null,"unsubscribe")}(a)}},void 0,ns||(ns=(0,o.Z)("span",{className:"material-icon"},void 0,"star_border")),gettext("Unsubscribe"))),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){!1!==e.subscription&&us(e,!1,"notify")}(a)}},void 0,as||(as=(0,o.Z)("span",{className:"material-icon"},void 0,"star_half")),gettext("Subscribe"))),(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:function(){return function(e){!0!==e.subscription&&us(e,!0,"email")}(a)}},void 0,ss||(ss=(0,o.Z)("span",{className:"material-icon"},void 0,"star")),gettext("Subscribe with e-mail")))))},ws=function(e){var t=e.children,n=e.className;return(0,o.Z)("ul",{className:cs()("breadcrumbs",n)},void 0,t)},Rs=function(e){var t=e.category,n=e.className;return(0,o.Z)("li",{className:cs()("breadcrumbs-item",n)},void 0,(0,o.Z)("a",{href:t.url.index},void 0,(0,o.Z)("span",{className:"material-icon",style:{color:t.color||"inherit"}},void 0,"label"),!!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name hidden-sm hidden-md hidden-lg",title:t.name},void 0,t.short_name),!!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name hidden-xs"},void 0,t.name),!t.short_name&&(0,o.Z)("span",{className:"breadcrumbs-item-name"},void 0,t.name)))},Cs=function(e){var t=e.category,n=e.className;return(0,o.Z)("li",{className:cs()("breadcrumbs-item",n)},void 0,(0,o.Z)("a",{href:t.url.index},void 0,ds||(ds=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right")),(0,o.Z)("span",{className:"breadcrumbs-item-name"},void 0,"root_category"===t.special_role?gettext("Threads"):gettext("Private threads"))))},Ss=function(e){var t=e.breadcrumbs;return(0,o.Z)(ws,{},void 0,t.map((function(e){return e.special_role?(0,o.Z)(Cs,{category:e},e.id):(0,o.Z)(Rs,{category:e},e.id)})))},Es=function(e){var t=e.styleName,n=e.thread,a=e.posts,s=e.user,i=e.moderation;return(0,o.Z)(xa.sP,{},void 0,(0,o.Z)(xa.mr,{styleName:t},void 0,(0,o.Z)(xa.gC,{styleName:t},void 0,(0,o.Z)(Ss,{breadcrumbs:n.path}),(0,o.Z)("h1",{},void 0,n.title)),(0,o.Z)(xa.eA,{className:"page-header-thread-details"},void 0,(0,o.Z)(ya.gq,{},void 0,(0,o.Z)(ya.kw,{auto:!0},void 0,(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(ka,{thread:n})),ps||(ps=(0,o.Z)(ya.Z6,{auto:!0})),n.replies>0&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(Na.Z,{thread:n})),function(e){return e.is_closed||e.is_hidden||e.is_unapproved||e.weight>0||e.best_answer||e.has_poll||e.has_unapproved_posts}(n)&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(_a.Z,{thread:n}))),s.is_authenticated&&(0,o.Z)(ya.kw,{},void 0,(0,o.Z)(ya.Z6,{},void 0,(0,o.Z)(xs,{thread:n})),i.enabled&&(0,o.Z)(ya.Z6,{shrink:!0},void 0,(0,o.Z)(rs,{thread:n,posts:a,moderation:i})))))))},Ls=n(92490),Ps=n(69987),Os=function(e){var t=e.baseUrl,n=e.posts;return(0,o.Z)("div",{className:"misago-pagination"},void 0,n.isLoaded&&n.first?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t,title:gettext("Go to first page")},void 0,hs||(hs=(0,o.Z)("span",{className:"material-icon"},void 0,"first_page"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to first page"),type:"button",disabled:!0},void 0,fs||(fs=(0,o.Z)("span",{className:"material-icon"},void 0,"first_page"))),n.isLoaded&&n.previous?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+(n.previous>1?n.previous+"/":""),title:gettext("Go to previous page")},void 0,vs||(vs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to previous page"),type:"button",disabled:!0},void 0,ms||(ms=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_left"))),n.isLoaded&&n.next?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.next+"/",title:gettext("Go to next page")},void 0,Zs||(Zs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to next page"),type:"button",disabled:!0},void 0,gs||(gs=(0,o.Z)("span",{className:"material-icon"},void 0,"chevron_right"))),n.isLoaded&&n.last?(0,o.Z)(Ps.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.last+"/",title:gettext("Go to last page")},void 0,bs||(bs=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page"))):(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to last page"),type:"button",disabled:!0},void 0,ys||(ys=(0,o.Z)("span",{className:"material-icon"},void 0,"last_page"))))},Ts=function(e){var t=e.posts;return t.more?(0,o.Z)("p",{},void 0,interpolate(ngettext("There is %(more)s more post in this thread.","There are %(more)s more posts in this thread.",t.more),{more:t.more},!0)):(0,o.Z)("p",{},void 0,gettext("There are no more posts in this thread."))};function As(e){var t=e.errors,n=e.posts;return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,_s||(_s=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Moderation"))),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("One or more posts could not be changed:")),(0,o.Z)("ul",{className:"list-unstyled list-errored-items"},void 0,t.map((function(e){return(0,o.Z)(Bs,{errors:e.detail,post:n[e.id]},e.id)}))))))}function Bs(e){var t=e.errors,n=e.post,a=interpolate(gettext("%(username)s on %(posted_on)s"),{posted_on:n.posted_on.format("LL, LT"),username:n.poster_name},!0);return(0,o.Z)("li",{},void 0,(0,o.Z)("h5",{},void 0,a,":"),t.map((function(e,t){return(0,o.Z)("p",{},t,e)})))}function Is(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_unapproved:!1}})),a=t.map((function(e){return{id:e.id,is_unapproved:e.is_unapproved}}));zs(e,[{op:"replace",path:"is-unapproved",value:!1}],n,a)}function js(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_protected:!0}})),a=t.map((function(e){return{id:e.id,is_protected:e.is_protected}}));zs(e,[{op:"replace",path:"is-protected",value:!0}],n,a)}function Ds(e){var t=e.selection,n=t.map((function(e){return{id:e.id,is_protected:!1}})),a=t.map((function(e){return{id:e.id,is_protected:e.is_protected}}));zs(e,[{op:"replace",path:"is-protected",value:!1}],n,a)}function Us(e){var t=e.selection,n=t.map((function(t){return{id:t.id,is_hidden:!0,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(t.url,{hidden_by:e.user.url})}})),a=t.map((function(e){return{id:e.id,is_hidden:e.is_hidden,hidden_on:e.hidden_on,hidden_by_name:e.hidden_by_name,url:e.url}}));zs(e,[{op:"replace",path:"is-hidden",value:!0}],n,a)}function Ms(e){var t=e.selection,n=t.map((function(t){return{id:t.id,is_hidden:!1,hidden_on:V()(),hidden_by_name:e.user.username,url:Object.assign(t.url,{hidden_by:e.user.url})}})),a=t.map((function(e){return{id:e.id,is_hidden:e.is_hidden,hidden_on:e.hidden_on,hidden_by_name:e.hidden_by_name,url:e.url}}));zs(e,[{op:"replace",path:"is-hidden",value:!1}],n,a)}function zs(e,t,n,a){var s=e.selection,i=e.thread;n.forEach((function(e){$.r$(e,e)})),x.Z.dispatch(Mn.kR());var r={ops:t,ids:s.map((function(e){return e.id}))};_.Z.patch(i.api.posts.index,r).then((function(e){e.forEach((function(e){x.Z.dispatch($.r$(e,e))}))}),(function(e){if(400!==e.status)return a.forEach((function(e){x.Z.dispatch($.r$(e,e))})),k.Z.apiError(e);var t=[],n=[];e.forEach((function(e){e.detail?(t.push(e),n.push(e.id)):x.Z.dispatch($.r$(e,e)),a.forEach((function(e){-1!==n.indexOf(e)&&x.Z.dispatch($.r$(e,e))}))}));var i={};s.forEach((function(e){i[e.id]=e})),N.Z.show((0,o.Z)(As,{errors:t,posts:i}))}))}function Hs(e){window.confirm(gettext("Are you sure you want to merge selected posts? This action is not reversible!"))&&(e.selection.slice(1).map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),_.Z.post(e.thread.api.posts.merge,{posts:e.selection.map((function(e){return e.id}))}).then((function(e){x.Z.dispatch($.r$(e,$.ZB(e)))}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),e.selection.slice(1).map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!1}))}))})),x.Z.dispatch(Mn.kR()))}function Fs(e){if(window.confirm(gettext("Are you sure you want to delete selected posts? This action is not reversible!"))){e.selection.map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))}));var t=e.selection.map((function(e){return e.id}));_.Z.delete(e.thread.api.posts.index,t).then((function(){}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),e.selection.map((function(e){x.Z.dispatch($.r$(e,{isDeleted:!1}))}))})),x.Z.dispatch(Mn.kR())}}var qs,Ys,Vs,$s,Gs,Ws,Ks=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=a.call(this,e),(0,h.Z)((0,c.Z)(t),"onUrlChange",(function(e){t.changeValue("url",e.target.value)})),t.state={isLoading:!1,url:"",validators:{url:[]},errors:{}},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.url.trim().length||(k.Z.error(gettext("You have to enter link to the other thread.")),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.move,{new_thread:this.state.url,posts:this.props.selection.map((function(e){return e.id}))})}},{key:"handleSuccess",value:function(e){this.props.selection.forEach((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),N.Z.hide(),k.Z.success(gettext("Selected posts were moved to the other thread."))}},{key:"handleError",value:function(e){400===e.status?k.Z.error(e.detail):k.Z.apiError(e)}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,Ns||(Ns=(0,o.Z)(Js,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_url",label:gettext("Link to thread you want to move posts to")},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading},void 0,gettext("Move posts"))))))}}]),s}(Z.Z);function Js(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,ks||(ks=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Move posts")))}function Qs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function Xs(e){return v().createElement(ci,(0,m.Z)({},e,{Form:ui}))}var ei,ti,ni,ai,si,ii,oi,ri,li,ci=function(e){(0,u.Z)(n,e);var t=Qs(n);function n(e){var a;return(0,r.Z)(this,n),(a=t.call(this,e)).state={isLoaded:!1,isError:!1,categories:[]},a}return(0,l.Z)(n,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(misago.get("THREAD_EDITOR_API")).then((function(t){var n=t.map((function(e){return Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})}));e.setState({isLoaded:!0,categories:n})}),(function(t){e.setState({isError:t.detail})}))}},{key:"render",value:function(){return this.state.isError?(0,o.Z)(pi,{message:this.state.isError}):this.state.isLoaded?v().createElement(ui,(0,m.Z)({},this.props,{categories:this.state.categories})):qs||(qs=(0,o.Z)(di,{}))}}]),n}(v().Component),ui=function(e){(0,u.Z)(n,e);var t=Qs(n);function n(e){var a;return(0,r.Z)(this,n),a=t.call(this,e),(0,h.Z)((0,c.Z)(a),"onCategoryChange",(function(e){var t=e.target.value,n={category:t};a.acl[t].can_pin_threads<n.weight&&(n.weight=0),a.acl[t].can_hide_threads||(n.is_hidden=0),a.acl[t].can_close_threads||(n.is_closed=!1),a.setState(n)})),a.state={isLoading:!1,title:"",category:null,categories:e.categories,weight:0,is_hidden:0,is_closed:!1,validators:{title:[tn.C1()]},errors:{}},a.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],a.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],a.acl={},a.props.categories.forEach((function(e){e.post&&(a.state.category||(a.state.category=e.id),a.acl[e.id]={can_pin_threads:e.post.pin,can_close_threads:e.post.close,can_hide_threads:e.post.hide})})),a}return(0,l.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(k.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return _.Z.post(this.props.thread.api.posts.split,{title:this.state.title,category:this.state.category,weight:this.state.weight,is_hidden:this.state.is_hidden,is_closed:this.state.is_closed,posts:this.props.selection.map((function(e){return e.id}))})}},{key:"handleSuccess",value:function(e){this.props.selection.forEach((function(e){x.Z.dispatch($.r$(e,{isDeleted:!0}))})),N.Z.hide(),k.Z.success(gettext("Selected posts were split into new thread."))}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),k.Z.error(gettext("Form contains errors."))):403===e.status&&Array.isArray(e)?N.Z.show((0,o.Z)(As,{errors:e})):k.Z.apiError(e)}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,o.Z)(g.Z,{label:gettext("Thread weight"),for:"id_weight",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,o.Z)(g.Z,{label:gettext("Hide thread"),for:"id_is_hidden",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,o.Z)(g.Z,{label:gettext("Close thread"),for:"id_is_closed",labelClass:"col-sm-4",controlClass:"col-sm-8"},void 0,(0,o.Z)(en.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"render",value:function(){return(0,o.Z)(hi,{className:"modal-dialog"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{label:gettext("Thread title"),for:"id_title",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.title},void 0,(0,o.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),Ys||(Ys=(0,o.Z)("div",{className:"clearfix"})),(0,o.Z)(g.Z,{label:gettext("Category"),for:"id_category",labelClass:"col-sm-4",controlClass:"col-sm-8",validation:this.state.errors.category},void 0,(0,o.Z)(Xt.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.state.categories})),Vs||(Vs=(0,o.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,o.Z)(Ct.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Split posts")))))}}]),n}(Z.Z);function di(){return $s||($s=(0,o.Z)(hi,{className:"modal-dialog"},void 0,(0,o.Z)(at.Z,{})))}function pi(e){return(0,o.Z)(hi,{className:"modal-dialog modal-message"},void 0,Gs||(Gs=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,gettext("You can't move selected posts at the moment.")),(0,o.Z)("p",{},void 0,e.message),(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}function hi(e){return(0,o.Z)("div",{className:e.className,role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Ws||(Ws=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,gettext("Split posts into new thread"))),e.children))}function fi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,p.Z)(e);if(t){var s=(0,p.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,d.Z)(this,n)}}function vi(e){return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,v().createElement(Ri,e),v().createElement(Ci,e),v().createElement(Si,e),v().createElement(Ei,e),v().createElement(Li,e),v().createElement(Pi,e),v().createElement(Ti,e),v().createElement(Oi,e),v().createElement(Ai,e))}var mi,Zi,gi,bi,yi,_i,Ni,ki,xi,wi,Ri=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Is(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_approve&&e.is_unapproved}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ei||(ei=(0,o.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve"))):null}}]),n}(v().Component),Ci=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Hs(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.length>1&&this.props.selection.find((function(e){return e.acl.can_merge}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ti||(ti=(0,o.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge"))):null}}]),n}(v().Component),Si=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(Ks,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_move}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ni||(ni=(0,o.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move"))):null}}]),n}(v().Component),Ei=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){N.Z.show(v().createElement(Xs,e.props))})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_move}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ai||(ai=(0,o.Z)("span",{className:"material-icon"},void 0,"call_split")),gettext("Split"))):null}}]),n}(v().Component),Li=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){js(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return!e.is_protected&&e.acl.can_protect}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,si||(si=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Protect"))):null}}]),n}(v().Component),Pi=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ds(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.is_protected&&e.acl.can_protect}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ii||(ii=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Unprotect"))):null}}]),n}(v().Component),Oi=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Us(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_hide&&!e.is_hidden}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,oi||(oi=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide"))):null}}]),n}(v().Component),Ti=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Ms(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_unhide&&e.is_hidden}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,ri||(ri=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide"))):null}}]),n}(v().Component),Ai=function(e){(0,u.Z)(n,e);var t=fi(n);function n(){var e;(0,r.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,h.Z)((0,c.Z)(e),"onClick",(function(){Fs(e.props)})),e}return(0,l.Z)(n,[{key:"render",value:function(){var e=this.props.selection.find((function(e){return e.acl.can_delete}));return e?(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,li||(li=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete"))):null}}]),n}(v().Component),Bi=function(e){var t=e.thread,n=e.user,a=e.selection,s=e.dropup;return(0,o.Z)("div",{className:s?"dropup":"dropdown"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Posts options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:0===a.length},void 0,mi||(mi=(0,o.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,o.Z)(vi,{thread:t,user:n,selection:a}))},Ii=function(e){var t=e.onClick;return(0,o.Z)("button",{className:"btn btn-primary btn-outline btn-block",type:"button",onClick:t},void 0,Zi||(Zi=(0,o.Z)("span",{className:"material-icon"},void 0,"chat")),gettext("Reply"))},ji=function(e){var t=e.thread,n=e.posts,a=e.user,s=e.selection,i=e.moderation,r=e.onReply;return(0,o.Z)(Ls.o8,{},void 0,(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Os,{baseUrl:t.url.index,posts:n})),(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s,dropup:!0}))),(0,o.Z)(Ls.Z2,{className:"hidden-xs hidden-sm",auto:!0},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ts,{posts:n}))),gi||(gi=(0,o.Z)(Ls.tw,{className:"hidden-md hidden-lg"})),a.is_authenticated&&(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(xs,{thread:t})),t.acl.can_reply&&(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ii,{onClick:r})),i.enabled&&(0,o.Z)(Ls.Eg,{className:"hidden-xs",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s,dropup:!0}))))},Di=function(e){var t=e.compact,n=e.onClick;return(0,o.Z)("button",{className:cs()("btn btn-default btn-outline",{"btn-block":!t,"btn-icon":t}),type:"button",title:t?gettext("Add poll"):null,onClick:n},void 0,bi||(bi=(0,o.Z)("span",{className:"material-icon"},void 0,"poll")),!t&&gettext("Add poll"))},Ui=function(e){var t=e.user,n=e.thread;return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Shortcuts"),"aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button"},void 0,yi||(yi=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark"))),(0,o.Z)("ul",{className:"dropdown-menu"},void 0,t.is_authenticated&&n.is_new&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.new_post},void 0,_i||(_i=(0,o.Z)("span",{className:"material-icon"},void 0,"comment")),gettext("Go to new post"))),n.best_answer&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.best_answer},void 0,Ni||(Ni=(0,o.Z)("span",{className:"material-icon"},void 0,"check_circle")),gettext("Go to best answer"))),n.has_unapproved_posts&&n.acl.can_approve&&(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.unapproved_post},void 0,ki||(ki=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Go to unapproved post"))),(0,o.Z)("li",{},void 0,(0,o.Z)("a",{className:"btn btn-link",href:n.url.last_post},void 0,xi||(xi=(0,o.Z)("span",{className:"material-icon"},void 0,"reply")),gettext("Go to last post")))))},Mi=function(e){var t=e.thread,n=e.posts,a=e.user,s=e.selection,i=e.moderation,r=e.onPoll,l=e.onReply;return(0,o.Z)(Ls.o8,{},void 0,(0,o.Z)(Ls.Z2,{className:"hidden-xs"},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ui,{thread:t,user:a})),(0,o.Z)(Ls.Eg,{className:"hidden-xs hidden-sm"},void 0,(0,o.Z)(Os,{baseUrl:t.url.index,posts:n}))),wi||(wi=(0,o.Z)(Ls.tw,{})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Z2,{className:"hidden-xs"},void 0,(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Di,{onClick:r}))),t.acl.can_reply?(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Ui,{thread:t,user:a})),(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Ii,{onClick:l})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Di,{onClick:r,compact:!0})),i.enabled&&(0,o.Z)(Ls.Eg,{className:"hidden-xs",shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s}))):(0,o.Z)(Ls.Z2,{},void 0,(0,o.Z)(Ls.Eg,{className:"hidden-sm hidden-md hidden-lg",shrink:!0},void 0,(0,o.Z)(Ui,{thread:t,user:a})),t.acl.can_start_poll&&!t.poll&&(0,o.Z)(Ls.Eg,{},void 0,(0,o.Z)(Di,{onClick:r})),i.enabled&&(0,o.Z)(Ls.Eg,{shrink:!0},void 0,(0,o.Z)(Bi,{thread:t,user:a,selection:s}))))};var zi=function(e){(0,u.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,p.Z)(t);if(n){var s=(0,p.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,d.Z)(this,e)});function s(){var e;(0,r.Z)(this,s);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e=a.call.apply(a,[this].concat(n)),(0,h.Z)((0,c.Z)(e),"update",(function(t){x.Z.dispatch(y.gx(t)),x.Z.dispatch(Mn.zD(t.post_set)),t.participants&&x.Z.dispatch(b.gx(t.participants)),t.poll&&x.Z.dispatch(ma.gx(t.poll)),e.setPageTitle()})),(0,h.Z)((0,c.Z)(e),"openPollForm",(function(){ft.Z.open({mode:"POLL",submit:e.props.thread.api.poll,thread:e.props.thread,poll:null})})),(0,h.Z)((0,c.Z)(e),"openReplyForm",(function(){ft.Z.open({mode:"REPLY",config:e.props.thread.api.editor,submit:e.props.thread.api.posts.index})})),e}return(0,l.Z)(s,[{key:"componentDidMount",value:function(){this.shouldFetchData()&&(this.fetchData(),this.setPageTitle()),this.startPollingApi()}},{key:"componentDidUpdate",value:function(){this.shouldFetchData()&&(this.fetchData(),this.startPollingApi(),this.setPageTitle())}},{key:"componentWillUnmount",value:function(){this.stopPollingApi()}},{key:"shouldFetchData",value:function(){return!!this.props.posts.isLoaded&&1*(this.props.params.page||1)!=this.props.posts.page}},{key:"fetchData",value:function(){var e=this;x.Z.dispatch(Mn.Rz()),_.Z.get(this.props.thread.api.posts.index,{page:this.props.params.page||1},"posts").then((function(t){e.update(t)}),(function(e){k.Z.apiError(e)}))}},{key:"startPollingApi",value:function(){Za.Z.start({poll:"thread-posts",url:this.props.thread.api.posts.index,data:{page:this.props.params.page||1},update:this.update,frequency:12e4,delayed:!0})}},{key:"stopPollingApi",value:function(){Za.Z.stop("thread-posts")}},{key:"setPageTitle",value:function(){ga.Z.set({title:this.props.thread.title,parent:this.props.thread.category.name,page:1*(this.props.params.page||1)})}},{key:"render",value:function(){var e=this.props.thread.category,t="page page-thread";e.css_class&&(t+=" page-thread-"+e.css_class);var n="private_threads"===e.special_role?"private-threads":e.css_class||"category-threads",a=Hi(this.props.thread,this.props.user),s=Fi(this.props.posts.results,this.props.user),i=this.props.posts.results.filter((function(e){return e.isSelected}));return(0,o.Z)("div",{className:t},void 0,(0,o.Z)(Es,{styleName:n,thread:this.props.thread,posts:this.props.posts,user:this.props.user,moderation:a}),(0,o.Z)(ba.Z,{},void 0,(0,o.Z)(U,{participants:this.props.participants,thread:this.props.thread,user:this.props.user}),(0,o.Z)(Mi,{thread:this.props.thread,posts:this.props.posts,user:this.props.user,selection:i,moderation:s,onPoll:this.openPollForm,onReply:this.openReplyForm}),(0,o.Z)(z.n,{poll:this.props.poll,thread:this.props.thread,user:this.props.user}),v().createElement(da,this.props),(0,o.Z)(ji,{thread:this.props.thread,posts:this.props.posts,user:this.props.user,selection:i,moderation:s,onReply:this.openReplyForm})))}}]),s}(v().Component),Hi=function(e,t){var n={enabled:!1,edit:!1,approve:!1,close:!1,open:!1,hide:!1,unhide:!1,move:!1,merge:!1,pinGlobally:!1,pinLocally:!1,unpin:!1,delete:!1};return t.is_authenticated?(n.edit=e.acl.can_edit,n.approve=e.acl.can_approve&&e.is_unapproved,n.close=e.acl.can_close&&!e.is_closed,n.open=e.acl.can_close&&e.is_closed,n.hide=e.acl.can_hide&&!e.is_hidden,n.unhide=e.acl.can_unhide&&e.is_hidden,n.move=e.acl.can_move,n.merge=e.acl.can_merge,n.pinGlobally=e.acl.can_pin_globally&&e.weight<2,n.pinLocally=e.acl.can_pin&&1!==e.weight,n.unpin=e.acl.can_pin&&1===e.weight||e.acl.can_pin_globally&&2===e.weight,n.delete=e.acl.can_delete,n.enabled=n.edit||n.approve||n.close||n.open||n.hide||n.unhide||n.move||n.merge||n.pinGlobally||n.pinLocally||n.unpin||n.delete,n):n},Fi=function(e,t){var n={enabled:!1,approve:!1,move:!1,merge:!1,protect:!1,hide:!1,delete:!1};return t.is_authenticated?(e.forEach((function(e){e.is_event||(e.acl.can_approve&&e.is_unapproved&&(n.approve=!0),e.acl.can_move&&(n.move=!0),e.acl.can_merge&&(n.merge=!0),(e.acl.can_protect||e.acl.can_unprotect)&&(n.protect=!0),(e.acl.can_hide||e.acl.can_unhide)&&(n.hide=!0),e.acl.can_delete&&(n.delete=!0),(n.approve||n.move||n.merge||n.protect||n.hide||n.delete)&&(n.enabled=!0))})),n):n};function qi(e){return{participants:e.participants,poll:e.poll,posts:e.posts,thread:e.thread,tick:e.tick.tick,user:e.auth.user}}var Yi=n(39633);E.Z.addInitializer({name:"component:thread",initializer:function(e){var t,n;e.has("THREAD")&&e.has("POSTS")&&(0,Yi.Z)({paths:(t=E.Z.get("THREAD"),n=t.url.index.replace(t.slug+"-"+t.pk,":slug"),[{path:n,component:(0,i.$j)(qi)(zi)},{path:n+":page/",component:(0,i.$j)(qi)(zi)}])})},after:"store"})},72168:function(e,t,n){"use strict";var a=n(37424),s=n(22928),i=n(15671),o=n(43144),r=n(97326),l=n(79340),c=n(6215),u=n(61120),d=n(4942),p=n(57588),h=n.n(p),f=n(82211);function v(e,t){return e.last_post>t.last_post?-1:e.last_post<t.last_post?1:0}function m(e,t){return 2===e.weight&&e.weight>t.weight?-1:2===t.weight&&e.weight<t.weight?1:v(e,t)}function Z(e,t){return e.weight>t.weight?-1:e.weight<t.weight?1:v(e,t)}var g,b,y=n(59131),_=n(27950),N=n(92490),k=n(69987),x=function(e){var t=e.allItems,n=e.parentUrl,a=e.category,i=e.categories,o=e.list;return(0,s.Z)("div",{className:"dropdown threads-category-picker"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline dropdown-toggle btn-block text-ellipsis","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,a&&(0,s.Z)("span",{className:"material-icon",style:{color:a.color||"inherit"}},void 0,"label"),a&&a.short_name&&(0,s.Z)("span",{className:a.short_name&&"hidden-md hidden-lg"},void 0,a.short_name),a?(0,s.Z)("span",{className:a.short_name&&"hidden-xs hidden-sm"},void 0,a.name):t),(0,s.Z)("ul",{className:"dropdown-menu"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)(k.rU,{to:n+o.path},void 0,t)),g||(g=(0,s.Z)("li",{role:"separator",className:"divider"})),i.map((function(e){return(0,s.Z)("li",{},e.id,(0,s.Z)(k.rU,{to:e.url.index+o.path},void 0,(0,s.Z)("span",{className:"material-icon",style:{color:e.color||"inherit"}},void 0,"label"),e.name))}))))},w=function(e){var t=e.baseUrl,n=e.list,a=e.lists;return(0,s.Z)("div",{className:"dropdown threads-list-picker"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline dropdown-toggle btn-block","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,n.longName),(0,s.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,a.map((function(e){return(0,s.Z)("li",{},e.type,(0,s.Z)(k.rU,{to:t+e.path},void 0,e.longName))}))))};var R=function(e){(0,l.Z)(r,e);var t,n,a=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function r(){return(0,i.Z)(this,r),a.apply(this,arguments)}return(0,o.Z)(r,[{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,b||(b=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Threads moderation"))),(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("One or more threads could not be deleted:")),(0,s.Z)("ul",{className:"list-unstyled list-errored-items"},void 0,this.props.errors.map((function(e){return(0,s.Z)(C,{errors:e.errors,thread:e.thread},e.thread.id)}))))))}}]),r}(h().Component);function C(e){var t=e.errors,n=e.thread;return(0,s.Z)("li",{},void 0,(0,s.Z)("h5",{},void 0,n.title),t.map((function(e,t){return(0,s.Z)("p",{},void 0,e)})))}var S,E,L,P,O=n(43345),T=n(96359),A=n(57026),B=n(60471),I=n(32233),j=n(61340),D=n(77751),U=n(52753),M=n(78657),z=n(59801),H=n(53904),F=n(90287),q=n(55210);var Y,V,$=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;for(var n in(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"getFormdata",(function(){return{threads:t.props.threads.map((function(e){return e.id})),title:t.state.title,category:t.state.category,weight:t.state.weight,is_hidden:t.state.is_hidden,is_closed:t.state.is_closed}})),(0,d.Z)((0,r.Z)(t),"handleSuccess",(function(e){t.props.threads.forEach((function(e){t.props.freezeThread(e.id),t.props.deleteThread(e)})),F.Z.dispatch(D.YP()),t.props.addThreads([e]),F.Z.dispatch((0,j.V8)(t.props.route.category,t.props.categoriesMap)),z.Z.hide()})),(0,d.Z)((0,r.Z)(t),"handleError",(function(e){400===e.status?e.best_answers||e.polls?z.Z.show((0,s.Z)(U.ZP,{api:I.Z.get("MERGE_THREADS_API"),bestAnswers:e.best_answers,data:t.getFormdata(),polls:e.polls,onError:t.handleError,onSuccess:t.handleSuccess})):(t.setState({errors:Object.assign({},t.state.errors,e)}),H.Z.error(gettext("Form contains errors."))):403===e.status&&Array.isArray(e)?z.Z.show((0,s.Z)(R,{errors:e})):e.best_answer?H.Z.error(e.best_answer[0]):e.poll?H.Z.error(e.poll[0]):H.Z.apiError(e)})),(0,d.Z)((0,r.Z)(t),"onCategoryChange",(function(e){var n=e.target.value,a={category:n};t.acl[n].can_pin_threads<a.weight&&(a.weight=0),t.acl[n].can_hide_threads||(a.is_hidden=0),t.acl[n].can_close_threads||(a.is_closed=!1),t.setState(a)})),t.state={isLoading:!1,title:"",category:null,weight:0,is_hidden:0,is_closed:!1,validators:{title:[q.C1()]},errors:{}},t.acl={},e.user.acl.categories)if(e.user.acl.categories.hasOwnProperty(n)){var o=e.user.acl.categories[n];t.acl[o.id]=o}return t.categoryChoices=[],e.categories.forEach((function(e){if(e.level>0){var n=t.acl[e.id],a=!n.can_start_threads||e.is_closed&&!n.can_close_threads;t.categoryChoices.push({value:e.id,disabled:a,level:e.level-1,label:e.name}),a||t.state.category||(t.state.category=e.id)}})),t.isHiddenChoices=[{value:0,icon:"visibility",label:gettext("No")},{value:1,icon:"visibility_off",label:gettext("Yes")}],t.isClosedChoices=[{value:!1,icon:"lock_outline",label:gettext("No")},{value:!0,icon:"lock",label:gettext("Yes")}],t}return(0,o.Z)(p,[{key:"clean",value:function(){return!!this.isValid()||(H.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return M.Z.post(I.Z.get("MERGE_THREADS_API"),this.getFormdata())}},{key:"getWeightChoices",value:function(){var e=[{value:0,icon:"remove",label:gettext("Not pinned")},{value:1,icon:"bookmark_border",label:gettext("Pinned locally")}];return 2==this.acl[this.state.category].can_pin_threads&&e.push({value:2,icon:"bookmark",label:gettext("Pinned globally")}),e}},{key:"renderWeightField",value:function(){return this.acl[this.state.category].can_pin_threads?(0,s.Z)(T.Z,{label:gettext("Thread weight"),for:"id_weight"},void 0,(0,s.Z)(B.Z,{id:"id_weight",onChange:this.bindInput("weight"),value:this.state.weight,choices:this.getWeightChoices()})):null}},{key:"renderHiddenField",value:function(){return this.acl[this.state.category].can_hide_threads?(0,s.Z)(T.Z,{label:gettext("Hide thread"),for:"id_is_hidden"},void 0,(0,s.Z)(B.Z,{id:"id_is_closed",onChange:this.bindInput("is_hidden"),value:this.state.is_hidden,choices:this.isHiddenChoices})):null}},{key:"renderClosedField",value:function(){return this.acl[this.state.category].can_close_threads?(0,s.Z)(T.Z,{label:gettext("Close thread"),for:"id_is_closed"},void 0,(0,s.Z)(B.Z,{id:"id_is_closed",onChange:this.bindInput("is_closed"),value:this.state.is_closed,choices:this.isClosedChoices})):null}},{key:"renderForm",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(T.Z,{label:gettext("Thread title"),for:"id_title",validation:this.state.errors.title},void 0,(0,s.Z)("input",{id:"id_title",className:"form-control",type:"text",onChange:this.bindInput("title"),value:this.state.title})),S||(S=(0,s.Z)("div",{className:"clearfix"})),(0,s.Z)(T.Z,{label:gettext("Category"),for:"id_category",validation:this.state.errors.category},void 0,(0,s.Z)(A.Z,{id:"id_category",onChange:this.onCategoryChange,value:this.state.category,choices:this.categoryChoices})),E||(E=(0,s.Z)("div",{className:"clearfix"})),this.renderWeightField(),this.renderHiddenField(),this.renderClosedField()),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)(f.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Merge threads"))))}},{key:"renderCantMergeMessage",value:function(){return(0,s.Z)("div",{className:"modal-body"},void 0,L||(L=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"message-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("You can't move threads because there are no categories you are allowed to move them to.")),(0,s.Z)("p",{},void 0,gettext("You need permission to start threads in category to be able to merge threads to it.")),(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}},{key:"getClassName",value:function(){return this.state.category?"modal-dialog":"modal-dialog modal-message"}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,P||(P=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Merge threads"))),this.state.category?this.renderForm():this.renderCantMergeMessage()))}}]),p}(O.Z);var G,W,K,J,Q,X,ee,te,ne,ae,se,ie,oe,re,le=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"handleSubmit",(function(e){e.preventDefault(),z.Z.hide(),t.props.callApi([{op:"replace",path:"category",value:t.state.category},{op:"replace",path:"flatten-categories",value:null},{op:"add",path:"acl",value:!0}],gettext("Selected threads were moved."),(function(){F.Z.dispatch((0,j.V8)(t.props.route.category,t.props.categoriesMap));var e=F.Z.getState(),n=e.threads.map((function(e){return e.id}));F.Z.dispatch(D.$6(e.selection.filter((function(e){return-1!==n.indexOf(e)}))))}))})),t.state={category:null};var n={};for(var s in e.user.acl.categories)if(e.user.acl.categories.hasOwnProperty(s)){var o=e.user.acl.categories[s];n[o.id]=o}return t.categoryChoices=[],e.categories.forEach((function(e){if(e.level>0){var a=n[e.id],s=!a.can_start_threads||e.is_closed&&!a.can_close_threads;t.categoryChoices.push({value:e.id,disabled:s,level:e.level-1,label:e.name}),s||t.state.category||(t.state.category=e.id)}})),t}return(0,o.Z)(p,[{key:"getClassName",value:function(){return this.state.category?"modal-dialog":"modal-dialog modal-message"}},{key:"renderForm",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(T.Z,{label:gettext("New category"),for:"id_new_category"},void 0,(0,s.Z)(A.Z,{id:"id_new_category",onChange:this.bindInput("category"),value:this.state.category,choices:this.categoryChoices}))),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,s.Z)("button",{className:"btn btn-primary"},void 0,gettext("Move threads"))))}},{key:"renderCantMoveMessage",value:function(){return(0,s.Z)("div",{className:"modal-body"},void 0,Y||(Y=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"message-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("You can't move threads because there are no categories you are allowed to move them to.")),(0,s.Z)("p",{},void 0,gettext("You need permission to start threads in category to be able to move threads to it.")),(0,s.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,V||(V=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,gettext("Move threads"))),this.state.category?this.renderForm():this.renderCantMoveMessage()))}}]),p}(O.Z);var ce,ue,de,pe=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(){var e;(0,i.Z)(this,p);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,d.Z)((0,r.Z)(e),"callApi",(function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.props.threads.forEach((function(t){e.props.freezeThread(t.id)}));var i=e.props.threads.map((function(e){return e.id}));t.push({op:"add",path:"acl",value:!0}),M.Z.patch(e.props.api,{ids:i,ops:t}).then((function(t){e.props.threads.forEach((function(t){e.props.freezeThread(t.id)})),t.forEach((function(t){e.props.updateThread(t)})),H.Z.success(n),a&&a()}),(function(t){if(e.props.threads.forEach((function(t){e.props.freezeThread(t.id)})),400!==t.status)return H.Z.apiError(t);var n=[],a={};e.props.threads.forEach((function(e){a[e.id]=e})),t.forEach((function(e){var t=e.id,s=e.detail;void 0!==a[t]&&n.push({errors:s,thread:a[t]})})),z.Z.show((0,s.Z)(R,{errors:n}))}))})),(0,d.Z)((0,r.Z)(e),"pinGlobally",(function(){e.callApi([{op:"replace",path:"weight",value:2}],gettext("Selected threads were pinned globally."))})),(0,d.Z)((0,r.Z)(e),"pinLocally",(function(){e.callApi([{op:"replace",path:"weight",value:1}],gettext("Selected threads were pinned locally."))})),(0,d.Z)((0,r.Z)(e),"unpin",(function(){e.callApi([{op:"replace",path:"weight",value:0}],gettext("Selected threads were unpinned."))})),(0,d.Z)((0,r.Z)(e),"approve",(function(){e.callApi([{op:"replace",path:"is-unapproved",value:!1}],gettext("Selected threads were approved."))})),(0,d.Z)((0,r.Z)(e),"open",(function(){e.callApi([{op:"replace",path:"is-closed",value:!1}],gettext("Selected threads were opened."))})),(0,d.Z)((0,r.Z)(e),"close",(function(){e.callApi([{op:"replace",path:"is-closed",value:!0}],gettext("Selected threads were closed."))})),(0,d.Z)((0,r.Z)(e),"unhide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!1}],gettext("Selected threads were unhidden."))})),(0,d.Z)((0,r.Z)(e),"hide",(function(){e.callApi([{op:"replace",path:"is-hidden",value:!0}],gettext("Selected threads were hidden."))})),(0,d.Z)((0,r.Z)(e),"move",(function(){z.Z.show((0,s.Z)(le,{callApi:e.callApi,categories:e.props.categories,categoriesMap:e.props.categoriesMap,route:e.props.route,user:e.props.user}))})),(0,d.Z)((0,r.Z)(e),"merge",(function(){var t=[];if(e.props.threads.forEach((function(e){e.acl.can_merge||t.append({id:e.id,title:e.title,errors:[gettext("You don't have permission to merge this thread with others.")]})})),e.props.threads.length<2)H.Z.info(gettext("You have to select at least two threads to merge."));else{if(t.length)return void z.Z.show((0,s.Z)(R,{errors:t}));z.Z.show(h().createElement($,e.props))}})),(0,d.Z)((0,r.Z)(e),"delete",(function(){if(window.confirm(gettext("Are you sure you want to delete selected threads?"))){e.props.threads.map((function(t){e.props.freezeThread(t.id)}));var t=e.props.threads.map((function(e){return e.id}));M.Z.delete(e.props.api,t).then((function(){e.props.threads.map((function(t){e.props.freezeThread(t.id),e.props.deleteThread(t)})),H.Z.success(gettext("Selected threads were deleted."))}),(function(t){if(400===t.status){var n=t.map((function(e){return e.id}));e.props.threads.map((function(t){e.props.freezeThread(t.id),-1===n.indexOf(t.id)&&e.props.deleteThread(t)})),z.Z.show((0,s.Z)(R,{errors:t}))}else H.Z.apiError(t)}))}})),e}return(0,o.Z)(p,[{key:"render",value:function(){var e=this.props,t=e.moderation,n=e.threads,a=0==this.props.selection.length;return(0,s.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",onClick:function(){return F.Z.dispatch(D.$6(n.map((function(e){return e.id}))))}},void 0,G||(G=(0,s.Z)("span",{className:"material-icon"},void 0,"check_box")),gettext("Select all"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:function(){return F.Z.dispatch(D.YP())}},void 0,W||(W=(0,s.Z)("span",{className:"material-icon"},void 0,"check_box_outline_blank")),gettext("Select none"))),K||(K=(0,s.Z)("li",{role:"separator",className:"divider"})),!!t.can_pin_globally&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.pinGlobally},void 0,J||(J=(0,s.Z)("span",{className:"material-icon"},void 0,"bookmark")),gettext("Pin threads globally"))),!!t.can_pin&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.pinLocally},void 0,Q||(Q=(0,s.Z)("span",{className:"material-icon"},void 0,"bookmark_border")),gettext("Pin threads locally"))),!!t.can_pin&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.unpin},void 0,X||(X=(0,s.Z)("span",{className:"material-icon"},void 0,"panorama_fish_eye")),gettext("Unpin threads"))),!!t.can_move&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.move},void 0,ee||(ee=(0,s.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),gettext("Move threads"))),!!t.can_merge&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.merge},void 0,te||(te=(0,s.Z)("span",{className:"material-icon"},void 0,"call_merge")),gettext("Merge threads"))),!!t.can_approve&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.approve},void 0,ne||(ne=(0,s.Z)("span",{className:"material-icon"},void 0,"done")),gettext("Approve threads"))),!!t.can_close&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.open},void 0,ae||(ae=(0,s.Z)("span",{className:"material-icon"},void 0,"lock_open")),gettext("Open threads"))),!!t.can_close&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.close},void 0,se||(se=(0,s.Z)("span",{className:"material-icon"},void 0,"lock_outline")),gettext("Close threads"))),!!t.can_unhide&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.unhide},void 0,ie||(ie=(0,s.Z)("span",{className:"material-icon"},void 0,"visibility")),gettext("Unhide threads"))),!!t.can_hide&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.hide},void 0,oe||(oe=(0,s.Z)("span",{className:"material-icon"},void 0,"visibility_off")),gettext("Hide threads"))),!!t.can_delete&&(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn btn-link",type:"button",disabled:a,onClick:this.delete},void 0,re||(re=(0,s.Z)("span",{className:"material-icon"},void 0,"clear")),gettext("Delete threads"))))}}]),p}(h().Component),he=function(e){var t=e.api,n=e.categoriesMap,a=e.categories,i=e.threads,o=e.addThreads,r=e.freezeThread,l=e.updateThread,c=e.deleteThread,u=e.selection,d=e.moderation,p=e.route,h=e.user,f=e.disabled;return(0,s.Z)("div",{className:"dropdown threads-moderation"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:gettext("Moderation"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:f},void 0,ce||(ce=(0,s.Z)("span",{className:"material-icon"},void 0,"settings"))),(0,s.Z)(pe,{api:t,categories:a,categoriesMap:n,threads:i,addThreads:o,freezeThread:r,updateThread:l,deleteThread:c,selection:u,moderation:d,route:p,user:h,disabled:f}))},fe=function(e){var t=e.api,n=e.baseUrl,a=e.category,i=e.categories,o=e.categoriesMap,r=e.topCategory,l=e.topCategories,c=e.subCategory,u=e.subCategories,d=e.list,p=e.lists,h=e.threads,v=e.addThreads,m=e.startThread,Z=e.freezeThread,g=e.updateThread,b=e.deleteThread,y=e.selection,k=e.moderation,R=e.route,C=e.user,S=e.disabled;return(0,s.Z)(N.o8,{},void 0,l.length>0&&(0,s.Z)(N.Z2,{},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(x,{allItems:gettext("All categories"),parentUrl:d.path,category:r,categories:l,list:d})),r&&u.length>0&&(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(x,{allItems:gettext("All subcategories"),parentUrl:r.url.index,category:c,categories:u,list:d}))),p.length>1&&(0,s.Z)(N.Z2,{className:"hidden-xs"},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(w,{baseUrl:n,list:d,lists:p}))),ue||(ue=(0,s.Z)(N.tw,{})),!!C.id&&(0,s.Z)(N.Z2,{},void 0,(0,s.Z)(N.Eg,{},void 0,(0,s.Z)(f.Z,{className:"btn-primary btn-outline btn-block",disabled:S,onClick:function(){_.Z.open(m||{mode:"START",config:misago.get("THREAD_EDITOR_API"),submit:misago.get("THREADS_API"),category:a.id})}},void 0,de||(de=(0,s.Z)("span",{className:"material-icon"},void 0,"chat")),gettext("Start thread"))),!!k.allow&&(0,s.Z)(N.Eg,{shrink:!0},void 0,(0,s.Z)(he,{api:t,categories:i,categoriesMap:o,threads:h.filter((function(e){return-1!==y.indexOf(e.id)})),addThreads:v,freezeThread:Z,updateThread:g,deleteThread:b,selection:y,moderation:k,route:R,user:C,disabled:S}))))};var ve=function(e){(0,l.Z)(r,e);var t,n,a=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function r(){return(0,i.Z)(this,r),a.apply(this,arguments)}return(0,o.Z)(r,[{key:"render",value:function(){var e=this.props.root,t=this.props.route,n=t.category,a=t.categories,i=t.categoriesMap,o=me(e,n,i);return(0,s.Z)(y.Z,{},void 0,(0,s.Z)(fe,{api:this.props.api,baseUrl:n.url.index,category:n,categories:a,categoriesMap:i,topCategory:o,topCategories:a.filter((function(t){return t.parent===e.id})),subCategories:o?a.filter((function(e){return e.parent===o.id})):[],subCategory:2===n.level?n:null,subcategories:this.props.subcategories,list:this.props.route.list,lists:this.props.route.lists,threads:this.props.threads,addThreads:this.props.addThreads,startThread:this.props.startThread,freezeThread:this.props.freezeThread,deleteThread:this.props.deleteThread,updateThread:this.props.updateThread,selection:this.props.selection,moderation:this.props.moderation,route:this.props.route,user:this.props.user,disabled:!this.props.isLoaded||this.props.isBusy||this.props.busyThreads.length}),this.props.children)}}]),r}(h().Component),me=function(e,t,n){return t.parent?t.parent===e.id?t:n[t.parent]:null};function Ze(e){var t={allow:!1,can_approve:0,can_close:0,can_delete:0,can_hide:0,can_merge:0,can_move:0,can_pin:0,can_pin_globally:0,can_unhide:0};return e.forEach((function(e){e.is_unapproved&&e.acl.can_approve>t.can_approve&&(t.can_approve=e.acl.can_approve),e.acl.can_close>t.can_close&&(t.can_close=e.acl.can_close),e.acl.can_delete>t.can_delete&&(t.can_delete=e.acl.can_delete),e.acl.can_hide>t.can_hide&&(t.can_hide=e.acl.can_hide),e.acl.can_merge>t.can_merge&&(t.can_merge=e.acl.can_merge),e.acl.can_move>t.can_move&&(t.can_move=e.acl.can_move),e.acl.can_pin>t.can_pin&&(t.can_pin=e.acl.can_pin),e.acl.can_pin_globally>t.can_pin_globally&&(t.can_pin_globally=e.acl.can_pin_globally),e.is_hidden&&e.acl.can_unhide>t.can_unhide&&(t.can_unhide=e.acl.can_unhide),t.allow=t.can_approve||t.can_close||t.can_delete||t.can_hide||t.can_merge||t.can_move||t.can_pin||t.can_pin_globally||t.can_unhide})),t}var ge,be,ye,_e,Ne=function(e){var t=e.category,n=e.list,a=e.message;return"all"===n.type?a?(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,a),(0,s.Z)("p",{},void 0,gettext("Why not start one yourself?"))):(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,t.special_role?gettext("There are no threads on this forum... yet!"):gettext("There are no threads in this category.")),(0,s.Z)("p",{},void 0,gettext("Why not start one yourself?"))):(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,(0,s.Z)("p",{className:"lead"},void 0,gettext("No threads matching specified criteria were found.")))},ke=n(50366),xe=n(16768),we=function(e){var t=e.thread;return(0,s.Z)("a",{href:t.url.last_post,className:"threads-list-item-last-activity",title:interpolate(gettext("Last activity: %(timestamp)s"),{timestamp:t.last_post_on.format("LLL")},!0)},void 0,t.last_post_on.fromNow(!0))},Re=function(e){var t="threads-list-item-category threads-list-category-label";return e.color&&(t+=" threads-list-category-label-color"),t},Ce=function(e){var t=e.parent,n=e.category;return(0,s.Z)("span",{},void 0,t&&(0,s.Z)("a",{href:t.url.index,className:Re(t)+" threads-list-item-parent-category",style:t.color?{"--label-color":t.color}:null,title:t.short_name?t.name:null},void 0,t.short_name||t.name),(0,s.Z)("a",{href:n.url.index,className:Re(n),style:n.color?{"--label-color":n.color}:null,title:n.short_name?n.name:null},void 0,n.short_name||n.name))},Se=function(e){var t=e.checked,n=e.disabled,a=e.thread;return(0,s.Z)("button",{className:"btn btn-default btn-icon",type:"button",disabled:n,onClick:function(){return F.Z.dispatch(D.wc(a.id))}},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,t?"check_box":"check_box_outline_blank"))},Ee=function(e){var t=e.thread,n="threads-list-icon";return t.is_read||(n+=" threads-list-icon-new"),(0,s.Z)("a",{title:t.is_read?gettext("No new posts"):gettext("New posts"),href:t.is_read?t.url.last_post:t.url.new_post,className:n},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,t.is_read?"chat_bubble_outline":"chat_bubble"))},Le=n(19605),Pe=function(e){var t=e.thread;return t.last_poster?(0,s.Z)("a",{href:t.url.last_poster,className:"threads-list-item-last-poster",title:interpolate(gettext("Last post by: %(poster)s"),{poster:t.last_poster.username},!0)},void 0,(0,s.Z)(Le.ZP,{size:32,user:t.last_poster})):(0,s.Z)("span",{className:"threads-list-item-last-poster",title:interpolate(gettext("Last post by: %(poster)s"),{poster:t.last_poster_name},!0)},void 0,ge||(ge=(0,s.Z)(Le.ZP,{size:32})))};var Oe,Te,Ae,Be,Ie,je,De,Ue,Me,ze,He={unsubscribe:null,notify:!1,email:!0},Fe=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;return(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"update",(function(e){var n=t.props.thread;t.setState({loading:!0}),F.Z.dispatch((0,j.r$)(n,{subscription:He[e]})),M.Z.patch(n.api.index,[{op:"replace",path:"subscription",value:e}]).then((function(){}),(function(e){F.Z.dispatch((0,j.r$)(n,{subscription:He[n.subscription]})),H.Z.apiError(e)})).then((function(){return t.setState({loading:!1})}))})),(0,d.Z)((0,r.Z)(t),"render",(function(){var e=t.state.loading,n=t.props,a=n.disabled,i=n.thread;return(0,s.Z)("ul",{className:"dropdown-menu dropdown-menu-right"},void 0,(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||null===i.subscription,onClick:function(){return t.update("unsubscribe")}},void 0,be||(be=(0,s.Z)("span",{className:"material-icon"},void 0,"star_border")),gettext("Unsubscribe"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||!1===i.subscription,onClick:function(){return t.update("notify")}},void 0,ye||(ye=(0,s.Z)("span",{className:"material-icon"},void 0,"star_half")),gettext("Subscribe with alert"))),(0,s.Z)("li",{},void 0,(0,s.Z)("button",{className:"btn-link",disabled:a||e||!0===i.subscription,onClick:function(){return t.update("email")}},void 0,_e||(_e=(0,s.Z)("span",{className:"material-icon"},void 0,"star")),gettext("Subscribe with e-mail"))))})),t.state={loading:!1},t}return(0,o.Z)(p)}(h().Component),qe=function(e){var t,n=e.disabled,a=e.thread;return(0,s.Z)("div",{className:"dropdown"},void 0,(0,s.Z)("button",{className:"btn btn-default btn-icon",type:"button",title:(t=a.subscription,!0===t?gettext("Subscribed to e-mails"):!1===t?gettext("Subscribed to alerts"):gettext("Not subscribed")),disabled:n,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,function(e){return!0===e?"star":!1===e?"star_half":"star_border"}(a.subscription))),(0,s.Z)(Fe,{disabled:n,thread:a}))},Ye=function(e){var t=e.activeCategory,n=e.categories,a=e.showOptions,i=e.showSubscription,o=e.thread,r=e.isBusy,l=e.isSelected,c=null,u=null;t.id!==o.category&&(u=n[o.category]).parent&&u.parent!==t.id&&n[u.parent]&&!n[u.parent].special_role&&(c=n[u.parent]);var d=o.is_closed||o.is_hidden||o.is_unapproved||o.weight>0||o.best_answer||o.has_poll||o.has_unapproved_posts,p=!a||o.is_new;return(0,s.Z)("li",{className:"list-group-item threads-list-item"+(r?" threads-list-item-is-busy":"")},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,a&&(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)(Ee,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("a",{href:o.url.index,className:"threads-list-item-title"},void 0,o.title),(0,s.Z)("a",{href:p?o.url.new_post:o.url.index,className:"threads-list-item-title-sm"+(p?" threads-list-item-title-new":"")},void 0,o.title)),a&&o.moderation.length>0&&(0,s.Z)("div",{className:"threads-list-item-col-checkbox-sm"},void 0,(0,s.Z)(Se,{checked:l,disabled:r,thread:o}))),(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,d&&(0,s.Z)("div",{className:"threads-list-item-col-flags"},void 0,(0,s.Z)(ke.Z,{thread:o})),!!u&&(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ce,{parent:c,category:u})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(xe.Z,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)(Pe,{thread:o})),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)(we,{thread:o})),a&&i&&(0,s.Z)("div",{className:"threads-list-item-col-subscription"},void 0,(0,s.Z)(qe,{disabled:r,thread:o})),a&&o.moderation.length>0&&(0,s.Z)("div",{className:"threads-list-item-col-checkbox"},void 0,(0,s.Z)(Se,{checked:l,disabled:r,thread:o}))))},Ve=function(e){var t=e.width;return(0,s.Z)("span",{className:"ui-preview-text",style:{width:t+"px"}},void 0," ")},$e=function(e){var t=e.showOptions;return(0,s.Z)("div",{className:"threads-list threads-list-loader"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(Oe||(Oe=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Te||(Te=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"90"})," ",(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"90"})," ",(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"}))))),Ae||(Ae=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"70"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"50"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"50"})))))),(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(Be||(Be=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Ie||(Ie=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"30"})," ",(0,s.Z)(Ve,{width:"60"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"30"})," ",(0,s.Z)(Ve,{width:"60"}))))),je||(je=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"55"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"60"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"70"})))))),(0,s.Z)("li",{className:"list-group-item threads-list-item"},void 0,(0,s.Z)("div",{className:"threads-list-item-top-row"},void 0,t&&(De||(De=(0,s.Z)("div",{className:"threads-list-item-col-icon"},void 0,(0,s.Z)("span",{className:"threads-list-icon ui-preview-img"})))),Ue||(Ue=(0,s.Z)("div",{className:"threads-list-item-col-title"},void 0,(0,s.Z)("span",{className:"threads-list-item-title"},void 0,(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"80"})),(0,s.Z)("span",{className:"threads-list-item-title-sm"},void 0,(0,s.Z)(Ve,{width:"40"})," ",(0,s.Z)(Ve,{width:"120"})," ",(0,s.Z)(Ve,{width:"80"}))))),Me||(Me=(0,s.Z)("div",{className:"threads-list-item-bottom-row"},void 0,(0,s.Z)("div",{className:"threads-list-item-col-category"},void 0,(0,s.Z)(Ve,{width:"75"})),(0,s.Z)("div",{className:"threads-list-item-col-replies"},void 0,(0,s.Z)(Ve,{width:"40"})),(0,s.Z)("div",{className:"threads-list-item-col-last-poster"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-poster"},void 0,(0,s.Z)(Le.ZP,{size:32}))),(0,s.Z)("div",{className:"threads-list-item-col-last-activity"},void 0,(0,s.Z)("span",{className:"threads-list-item-last-activity"},void 0,(0,s.Z)(Ve,{width:"60"}))))))))},Ge=function(e){var t=e.threads,n=e.onClick;return(0,s.Z)("li",{className:"list-group-item threads-list-update-prompt"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-block threads-list-update-prompt-btn",onClick:n},void 0,ze||(ze=(0,s.Z)("span",{className:"material-icon"},void 0,"cached")),(0,s.Z)("span",{className:"threads-list-update-prompt-message"},void 0,interpolate(ngettext("There is %(threads)s new or updated thread. Click here to show it.","There are %(threads)s new or updated threads. Click here to show them.",t),{threads:t},!0))))},We=function(e){var t=e.list,n=e.categories,a=e.category,i=e.threads,o=e.busyThreads,r=e.selection,l=e.isLoaded,c=e.showOptions,u=e.updatedThreads,d=e.applyUpdate,p=e.emptyMessage;return l?(0,s.Z)("div",{className:"threads-list"},void 0,i.length>0?(0,s.Z)("ul",{className:"list-group"},void 0,u>0&&(0,s.Z)(Ge,{threads:u,onClick:d}),i.map((function(e){return(0,s.Z)(Ye,{activeCategory:a,categories:n,thread:e,showOptions:c,showSubscription:c&&"subscribed"===t.type,isBusy:o.indexOf(e.id)>=0,isSelected:r.indexOf(e.id)>=0},e.id)}))):(0,s.Z)("ul",{className:"list-group"},void 0,u>0&&(0,s.Z)(Ge,{threads:u,onClick:d}),(0,s.Z)(Ne,{category:a,list:t,message:p}))):(0,s.Z)($e,{showOptions:c})},Ke=n(82125),Je=n(55547),Qe=n(53328),Xe=n(20370),et=n(99755);var tt=function(e){(0,l.Z)(p,e);var t,n,a=(t=p,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function p(e){var t;(0,i.Z)(this,p),t=a.call(this,e),(0,d.Z)((0,r.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadThreads(t.getCategory(),t.state.next)})),(0,d.Z)((0,r.Z)(t),"pollResponse",(function(e){var n,a,s;t.setState({diff:Object.assign({},e,{results:(n=t.props.threads,a=e.results,s={},n.forEach((function(e){s[e.id]=e})),a.filter((function(e){return!s[e.id]||function(e,t){return[e.title===t.title,e.weight===t.weight,e.category===t.category,e.last_post===t.last_post,e.last_poster_name===t.last_poster_name].indexOf(!1)>=0}(s[e.id],e)})))})})})),(0,d.Z)((0,r.Z)(t),"addThreads",(function(e){F.Z.dispatch((0,j.R3)(e,t.getSorting()))})),(0,d.Z)((0,r.Z)(t),"applyDiff",(function(){t.addThreads(t.state.diff.results),t.setState(Object.assign({},t.state.diff,{moderation:Ze(F.Z.getState().threads),diff:{results:[]}}))})),(0,d.Z)((0,r.Z)(t),"freezeThread",(function(e){t.setState((function(t){return{busyThreads:Xe.ZN(t.busyThreads,e)}}))})),(0,d.Z)((0,r.Z)(t),"updateThread",(function(e){F.Z.dispatch((0,j.r$)(e,e,t.getSorting()))})),(0,d.Z)((0,r.Z)(t),"deleteThread",(function(e){F.Z.dispatch((0,j.l8)(e))})),t.state={isMounted:!0,isLoaded:!1,isBusy:!1,diff:{results:[]},moderation:[],busyThreads:[],dropdown:!1,subcategories:[],next:0};var n=t.getCategory();return I.Z.has("THREADS")?t.initWithPreloadedData(n,I.Z.get("THREADS")):t.initWithoutPreloadedData(n),t}return(0,o.Z)(p,[{key:"getCategory",value:function(){return this.props.route.category.special_role?null:this.props.route.category.id}},{key:"initWithPreloadedData",value:function(e,t){this.state=Object.assign(this.state,{moderation:Ze(t.results),subcategories:t.subcategories,next:t.next}),this.startPolling(e)}},{key:"initWithoutPreloadedData",value:function(e){this.loadThreads(e)}},{key:"loadThreads",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;M.Z.get(this.props.options.api,{category:e,list:this.props.route.list.type,start:n||0},"threads").then((function(a){t.state.isMounted&&(0===n?F.Z.dispatch((0,j.ZB)(a.results)):F.Z.dispatch((0,j.R3)(a.results,t.getSorting())),t.setState({isLoaded:!0,isBusy:!1,moderation:Ze(F.Z.getState().threads),subcategories:a.subcategories,next:a.next}),t.startPolling(e))}),(function(e){H.Z.apiError(e)}))}},{key:"startPolling",value:function(e){Je.Z.start({poll:"threads",url:this.props.options.api,data:{category:e,list:this.props.route.list.type},frequency:12e4,update:this.pollResponse})}},{key:"componentDidMount",value:function(){this.setPageTitle(),I.Z.has("THREADS")&&(F.Z.dispatch((0,j.ZB)(I.Z.pop("THREADS").results)),this.setState({isLoaded:!0})),F.Z.dispatch(D.YP())}},{key:"componentWillUnmount",value:function(){this.state.isMounted=!1,Je.Z.stop("threads")}},{key:"getTitle",value:function(){return this.props.options.title?this.props.options.title:(e=this.props.route).category.level?e.category.name:I.Z.get("THREADS_ON_INDEX")?I.Z.get("SETTINGS").index_header?I.Z.get("SETTINGS").index_header:I.Z.get("SETTINGS").forum_name:gettext("Threads");var e}},{key:"setPageTitle",value:function(){var e;this.props.route.category.level||!I.Z.get("THREADS_ON_INDEX")?Qe.Z.set((e=this.props.route).category.level?e.list.path?{title:e.list.longName,parent:e.category.name}:{title:e.category.name}:I.Z.get("THREADS_ON_INDEX")?e.list.path?{title:e.list.longName}:null:e.list.path?{title:e.list.longName,parent:gettext("Threads")}:{title:gettext("Threads")}):this.props.options.title?Qe.Z.set(this.props.options.title):I.Z.get("SETTINGS").index_title?document.title=I.Z.get("SETTINGS").index_title:document.title=I.Z.get("SETTINGS").forum_name}},{key:"getSorting",value:function(){return this.props.route.category.level?Z:m}},{key:"getMoreButton",value:function(){return this.state.next?(0,s.Z)("div",{className:"pager-more"},void 0,(0,s.Z)(f.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy||this.state.busyThreads.length,onClick:this.loadMore},void 0,gettext("Show more"))):null}},{key:"getClassName",value:function(){var e,t="page page-threads";return t+=" page-threads-"+this.props.route.list.type,(e=this.props).route.category.level||!I.Z.get("THREADS_ON_INDEX")||e.options.title||(t+=" page-threads-index"),this.props.route.category.css_class&&(t+=" page-threads-"+this.props.route.category.css_class),t}},{key:"render",value:function(){var e=this.props.route.categories[0],t=this.props.route,n=t.category,a=t.list,i=n.special_role;return(0,s.Z)("div",{className:this.getClassName()},void 0,"root_category"==i&&I.Z.get("THREADS_ON_INDEX")&&I.Z.get("SETTINGS").index_header&&(0,s.Z)(et.Iv,{header:I.Z.get("SETTINGS").index_header,message:n.description&&(0,s.Z)(et.Ql,{message:n.description.html}),styleName:"forum-index"}),"root_category"==i&&!I.Z.get("THREADS_ON_INDEX")&&(0,s.Z)(et.Iv,{header:gettext("Threads"),styleName:"threads"}),"private_threads"==i&&(0,s.Z)(et.Iv,{header:this.props.options.title,message:this.props.options.pageLead&&(0,s.Z)(et.bM,{},void 0,(0,s.Z)("p",{},void 0,this.props.options.pageLead)),styleName:"private-threads"}),!i&&(0,s.Z)(et.Iv,{header:n.name,message:n.description&&(0,s.Z)(et.Ql,{message:n.description.html}),styleName:n.css_class||"category-threads"}),(0,s.Z)(ve,{api:this.props.options.api,root:e,route:this.props.route,user:this.props.user,pageLead:this.props.options.pageLead,threads:this.props.threads,threadsCount:this.state.count,moderation:this.state.moderation,selection:this.props.selection,busyThreads:this.state.busyThreads,addThreads:this.addThreads,startThread:this.props.options.startThread,freezeThread:this.freezeThread,deleteThread:this.deleteThread,updateThread:this.updateThread,isLoaded:this.state.isLoaded,isBusy:this.state.isBusy},void 0,(0,s.Z)(We,{category:n,categories:this.props.route.categoriesMap,list:a,selection:this.props.selection,threads:this.props.threads,updatedThreads:this.state.diff.results.length,applyUpdate:this.applyDiff,showOptions:!!this.props.user.id,isLoaded:this.state.isLoaded,busyThreads:this.state.busyThreads,emptyMessage:this.props.options.emptyMessage}),this.getMoreButton()))}}]),p}(Ke.Z);var nt=n(39633),at="misago:private-threads";function st(e){return e.get("CURRENT_LINK").substr(0,at.length)===at?{api:e.get("PRIVATE_THREADS_API"),startThread:{mode:"START_PRIVATE",submit:I.Z.get("PRIVATE_THREADS_API")},title:gettext("Private threads"),pageLead:gettext("Private threads are threads which only those that started them and those they have invited may see and participate in."),emptyMessage:gettext("You aren't participating in any private threads.")}:{api:e.get("THREADS_API")}}I.Z.addInitializer({name:"component:threads",initializer:function(e){var t,n,s,i,o;e.has("THREADS")&&e.has("CATEGORIES")&&(0,nt.Z)({paths:(t=e.get("user"),n=st(e),s=function(e){var t=[{type:"all",path:"",name:gettext("All"),longName:gettext("All threads")}];return e.id&&(t.push({type:"my",path:"my/",name:gettext("My"),longName:gettext("My threads")}),t.push({type:"new",path:"new/",name:gettext("New"),longName:gettext("New threads")}),t.push({type:"unread",path:"unread/",name:gettext("Unread"),longName:gettext("Unread threads")}),t.push({type:"subscribed",path:"subscribed/",name:gettext("Subscribed"),longName:gettext("Subscribed threads")}),e.acl.can_see_unapproved_content_lists&&t.push({type:"unapproved",path:"unapproved/",name:gettext("Unapproved"),longName:gettext("Unapproved content")})),t}(t),i=[],o={},I.Z.get("CATEGORIES").forEach((function(e){s.forEach((function(t){var r;o[e.id]=e,i.push({path:e.url.index+t.path,component:(0,a.$j)((r=n,function(e){return{options:r,selection:e.selection,threads:e.threads,tick:e.tick.tick,user:e.auth.user}}))(tt),categories:I.Z.get("CATEGORIES"),categoriesMap:o,category:e,lists:s,list:t})}))})),i)})},after:"store"})},47806:function(e,t,n){"use strict";var a=n(37424),s=n(32233),i=n(22928),o=n(15671),r=n(43144),l=n(79340),c=n(6215),u=n(61120),d=n(57588),p=n.n(d),h=n(19605),f=n(97326),v=n(4942),m=n(78657),Z=n(53904);function g(e){return e.filter((function(e){return e.results.count>0})).map((function(e){return Object.assign({},e,{count:e.results.count,results:e.results.results.slice(0,5)})}))}var b=n(87462),y="HEADER",_="RESULT",N="FOOTER";function k(e){var t=e.value,n=e.onChange;return(0,i.Z)("input",{"aria-haspopup":"true","aria-expanded":"false","aria-controls":"dropdown-menu dropdown-search-results",autoComplete:"off",className:"form-control",value:t,onChange:n,placeholder:gettext("Search"),role:"combobox",type:"text"})}function x(e){var t=e.children,n=e.onChange,a=e.query;return(0,i.Z)("ul",{className:"dropdown-menu dropdown-search-results",role:"menu"},void 0,(0,i.Z)("li",{className:"form-group"},void 0,(0,i.Z)(k,{value:a,onChange:n})),t)}function w(){return(0,i.Z)("li",{className:"dropdown-search-message"},void 0,gettext("Search returned no results."))}var R,C=n(37848);function S(e){return e.message,R||(R=(0,i.Z)("li",{className:"dropdown-search-loader"},void 0,(0,i.Z)(C.Z,{})))}function E(e){var t=e.provider,n=e.query,a=t.url+"?q="+encodeURI(n),s=ngettext('See full "%(provider)s" results page with %(count)s result.','See full "%(provider)s" results page with %(count)s results.',t.count);return(0,i.Z)("li",{className:"dropdown-search-footer"},void 0,(0,i.Z)("a",{href:a},void 0,interpolate(s,{count:t.count,provider:t.name},!0)))}function L(e){var t=e.provider;return(0,i.Z)("li",{className:"dropdown-search-header"},void 0,t.name)}var P,O,T,A=n(30381),B=n.n(A),I=n(19755);function j(e){var t=e.result,n=(t.poster,t.thread),a=gettext("Posted by %(poster)s on %(posted_on)s in %(category)s.");return(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:t.url.index,className:"dropdown-search-thread"},void 0,(0,i.Z)("h5",{},void 0,n.title),(0,i.Z)("small",{className:"dropdown-search-post-content"},void 0,I(t.content).text()),(0,i.Z)("small",{className:"dropdown-search-post-footer"},void 0,interpolate(a,{category:t.category.name,posted_on:B()(t.posted_on).format("LL"),poster:t.poster_name},!0))))}function D(e){var t=e.result,n=t.rank,a=gettext("%(title)s, joined on %(joined_on)s"),s=t.title||n.title||n.name;return(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:t.url,className:"dropdown-search-user"},void 0,(0,i.Z)("div",{className:"media"},void 0,(0,i.Z)("div",{className:"media-left"},void 0,(0,i.Z)(h.ZP,{size:38,user:t})),(0,i.Z)("div",{className:"media-body"},void 0,(0,i.Z)("h5",{className:"media-heading"},void 0,t.username),(0,i.Z)("small",{},void 0,interpolate(a,{title:s,joined_on:B()(t.joined_on).format("LL")},!0))))))}function U(e){var t=e.provider,n=e.result;return"threads"===t.id?(0,i.Z)(j,{result:n}):(0,i.Z)(D,{result:n})}function M(e){var t=e.provider,n=e.result,a=e.type,s=e.query;return a===y?(0,i.Z)(L,{provider:t}):a===N?(0,i.Z)(E,{provider:t,query:s}):(0,i.Z)(U,{provider:t,result:n})}function z(e,t){for(var n=e.results.length,a=0;a<n;a++){var s=e.results[a];t.push({provider:e,result:s,type:_})}t.push({provider:e,type:N})}function H(e){var t=e.isLoading,n=e.onChange,a=e.results,s=e.query;if(!s.trim().length)return(0,i.Z)(x,{onChange:n,query:s});if(a.length){var o=function(e){var t=[];return function(e,t){for(var n=e.length,a=0;a<n;a++){var s=e[a];t.push({provider:s,type:y}),z(s,t)}}(e,t),t}(a);return(0,i.Z)(x,{onChange:n,query:s},void 0,o.map((function(e){var t=e.type,n=e.provider,a=e.result;return t===_?p().createElement(M,(0,b.Z)({key:[n.id,t,a.id].join("_")},e)):p().createElement(M,(0,b.Z)({key:[n.id,t].join("_"),query:s},e))})))}return t?(0,i.Z)(x,{onChange:n,query:s},void 0,P||(P=(0,i.Z)(S,{}))):(0,i.Z)(x,{onChange:n,query:s},void 0,O||(O=(0,i.Z)(w,{})))}var F=function(e){(0,l.Z)(d,e);var t,n,a=(t=d,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function d(){var e;return(0,o.Z)(this,d),e=a.call(this),(0,v.Z)((0,f.Z)(e),"onToggle",(function(t){e.setState((function(t,n){return t.isOpen||window.setTimeout((function(){e.container.querySelector("input").focus()}),100),{isOpen:!t.isOpen}}))})),(0,v.Z)((0,f.Z)(e),"onDocumentMouseDown",(function(t){for(var n=!0,a=t.target;null!==a&&a!==document;){if(a===e.container)return void(n=!1);a=a.parentNode}n&&e.setState({isOpen:!1})})),(0,v.Z)((0,f.Z)(e),"onEscape",(function(t){"Escape"===t.key&&e.setState({isOpen:!1})})),(0,v.Z)((0,f.Z)(e),"onChange",(function(t){var n=t.target.value;e.setState({query:n}),e.loadResults(n.trim())})),e.state={isLoading:!1,isOpen:!1,query:"",results:[]},e.intervalId=null,e}return(0,r.Z)(d,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("keydown",this.onEscape)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("keydown",this.onEscape)}},{key:"loadResults",value:function(e){var t=this;if(e.length){var n=300+300*Math.random();this.intervalId&&window.clearTimeout(this.intervalId),this.setState({isLoading:!0}),this.intervalId=window.setTimeout((function(){m.Z.get(s.Z.get("SEARCH_API"),{q:e}).then((function(e){t.setState({intervalId:null,isLoading:!1,results:g(e)})}),(function(e){Z.Z.apiError(e),t.setState({intervalId:null,isLoading:!1,results:[]})}))}),n)}}},{key:"render",value:function(){var e=this,t="navbar-search dropdown";return this.state.isOpen&&(t+=" open"),p().createElement("div",{className:t,ref:function(t){return e.container=t}},(0,i.Z)("a",{"aria-haspopup":"true","aria-expanded":"false",className:"navbar-icon","data-toggle":"dropdown",href:s.Z.get("SEARCH_URL"),onClick:this.onToggle},void 0,T||(T=(0,i.Z)("i",{className:"material-icon"},void 0,"search"))),(0,i.Z)(H,{isLoading:this.state.isLoading,onChange:this.onChange,results:this.state.results,query:this.state.query}))}}]),d}(p().Component),q=n(82211),Y=n(43345),V=n(96359),$=n(59940);var G,W,K,J=["progress-bar-danger","progress-bar-warning","progress-bar-warning","progress-bar-primary","progress-bar-success"],Q=[gettext("Entered password is very weak."),gettext("Entered password is weak."),gettext("Entered password is average."),gettext("Entered password is strong."),gettext("Entered password is very strong.")],X=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=a.call(this,e))._score=0,t._password=null,t._inputs=[],t.state={loaded:!1},t}return(0,r.Z)(s,[{key:"componentDidMount",value:function(){var e=this;$.Z.load().then((function(){e.setState({loaded:!0})}))}},{key:"getScore",value:function(e,t){var n=this,a=!1;return e!==this._password&&(a=!0),t.length!==this._inputs.length?a=!0:t.map((function(e,t){e.trim()!==n._inputs[t]&&(a=!0)})),a&&(this._score=$.Z.scorePassword(e,t),this._password=e,this._inputs=t.map((function(e){return e.trim()}))),this._score}},{key:"render",value:function(){if(!this.state.loaded)return null;var e=this.getScore(this.props.password,this.props.inputs);return(0,i.Z)("div",{className:"help-block password-strength"},void 0,(0,i.Z)("div",{className:"progress"},void 0,(0,i.Z)("div",{className:"progress-bar "+J[e],style:{width:20+20*e+"%"},role:"progress-bar","aria-valuenow":e,"aria-valuemin":"0","aria-valuemax":"4"},void 0,(0,i.Z)("span",{className:"sr-only"},void 0,Q[e]))),(0,i.Z)("p",{className:"text-small"},void 0,Q[e]))}}]),s}(p().Component),ee=n(26106),te=n(47235),ne=n(98274),ae=n(93825),se=n(59801),ie=n(93051),oe=n(55210);function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach((function(t){(0,v.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var ue,de=function(e){(0,l.Z)(n,e);var t=ce(n);function n(e){var a;(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"handlePrivacyPolicyChange",(function(e){var t=e.target.value;a.handleToggleAgreement("privacyPolicy",t)})),(0,v.Z)((0,f.Z)(a),"handleTermsOfServiceChange",(function(e){var t=e.target.value;a.handleToggleAgreement("termsOfService",t)})),(0,v.Z)((0,f.Z)(a),"handleToggleAgreement",(function(e,t){a.setState((function(n,s){if(null===n[e]){var i=le(le({},n.errors),{},(0,v.Z)({},e,null));return(0,v.Z)({errors:i},e,t)}var o=a.state.validators[e][0],r=le(le({},n.errors),{},(0,v.Z)({},e,[o(null)]));return(0,v.Z)({errors:r},e,null)}))}));var i=a.props.criteria,r=i.username,l=i.password,c=0;l.forEach((function(e){"MinimumLengthValidator"===e.name&&(c=e.min_length)}));var u={username:[oe.lG(),oe.HR(r.min_length),oe.gS(r.max_length)],email:[oe.Do()],password:[oe.Vb(c)],captcha:ae.ZP.validator()};return s.Z.get("TERMS_OF_SERVICE_ID")&&(u.termsOfService=[oe.fT()]),s.Z.get("PRIVACY_POLICY_ID")&&(u.privacyPolicy=[oe.jA()]),a.state={isLoading:!1,username:"",email:"",password:"",captcha:"",termsOfService:null,privacyPolicy:null,validators:u,errors:{}},a}return(0,r.Z)(n,[{key:"clean",value:function(){return!!this.isValid()||(Z.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}},{key:"send",value:function(){return m.Z.post(s.Z.get("USERS_API"),{username:this.state.username,email:this.state.email,password:this.state.password,captcha:this.state.captcha,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),e.__all__&&e.__all__.length>0?Z.Z.error(e.__all__[0]):Z.Z.error(gettext("Form contains errors."))):403===e.status&&e.ban?((0,ie.Z)(e.ban),se.Z.hide()):Z.Z.apiError(e)}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog modal-register",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,G||(G=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Register"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("input",{type:"type",style:{display:"none"}}),(0,i.Z)("input",{type:"password",style:{display:"none"}}),(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(te.Z,{buttonClassName:"col-xs-12 col-sm-6",buttonLabel:gettext("Join with %(site)s"),formLabel:gettext("Or create forum account:")}),(0,i.Z)(V.Z,{label:gettext("Username"),for:"id_username",validation:this.state.errors.username},void 0,(0,i.Z)("input",{type:"text",id:"id_username",className:"form-control","aria-describedby":"id_username_status",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username})),(0,i.Z)(V.Z,{label:gettext("E-mail"),for:"id_email",validation:this.state.errors.email},void 0,(0,i.Z)("input",{type:"text",id:"id_email",className:"form-control","aria-describedby":"id_email_status",disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email})),(0,i.Z)(V.Z,{label:gettext("Password"),for:"id_password",validation:this.state.errors.password,extra:(0,i.Z)(X,{password:this.state.password,inputs:[this.state.username,this.state.email]})},void 0,(0,i.Z)("input",{type:"password",id:"id_password",className:"form-control","aria-describedby":"id_password_status",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password})),ae.ZP.component({form:this}),(0,i.Z)(ee.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,gettext("Cancel")),(0,i.Z)(q.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,gettext("Register account"))))))}}]),n}(Y.Z),pe=function(e){(0,l.Z)(n,e);var t=ce(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"getLead",value:function(){return"user"===this.props.activation?gettext("%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===this.props.activation?gettext("%(username)s, your account has been created but board administrator will have to activate it before you will be able to sign in."):void 0}},{key:"getSubscript",value:function(){return"user"===this.props.activation?gettext("We have sent an e-mail to %(email)s with link that you have to click to activate your account."):"admin"===this.props.activation?gettext("We will send an e-mail to %(email)s when this takes place."):void 0}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog modal-message modal-register",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,W||(W=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Registration complete"))),(0,i.Z)("div",{className:"modal-body"},void 0,K||(K=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,interpolate(this.getLead(),{username:this.props.username},!0)),(0,i.Z)("p",{},void 0,interpolate(this.getSubscript(),{email:this.props.email},!0)),(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))))}}]),n}(p().Component),he=function(e){(0,l.Z)(n,e);var t=ce(n);function n(e){var a;return(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"completeRegistration",(function(e){"active"===e.activation?(se.Z.hide(),ne.Z.signIn(e)):a.setState({complete:e})})),a.state={complete:!1},a}return(0,r.Z)(n,[{key:"render",value:function(){return this.state.complete?(0,i.Z)(pe,{activation:this.state.complete.activation,email:this.state.complete.email,username:this.state.complete.username}):p().createElement(de,(0,b.Z)({callback:this.completeRegistration},this.props))}}]),n}(p().Component);var fe,ve,me,Ze=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"showRegisterForm",(function(){"closed"===misago.get("SETTINGS").account_activation?Z.Z.info(gettext("New registrations are currently disabled.")):t.state.isLoaded?se.Z.show((0,i.Z)(he,{criteria:t.state.criteria})):(t.setState({isLoading:!0}),Promise.all([ae.ZP.load(),m.Z.get(misago.get("AUTH_CRITERIA_API"))]).then((function(e){t.setState({isLoading:!1,isLoaded:!0,criteria:e[1]}),se.Z.show((0,i.Z)(he,{criteria:e[1]}))}),(function(){t.setState({isLoading:!1}),Z.Z.error(gettext("Registration is currently unavailable due to an error."))})))})),t.state={isLoading:!1,isLoaded:!1,criteria:null},t}return(0,r.Z)(s,[{key:"getClassName",value:function(){return this.props.className+(this.state.isLoading?" btn-loading":"")}},{key:"render",value:function(){return(0,i.Z)("button",{className:"btn "+this.getClassName(),disabled:this.state.isLoading,onClick:this.showRegisterForm,type:"button"},void 0,gettext("Register"),this.state.isLoading?ue||(ue=(0,i.Z)(C.Z,{})):null)}}]),s}(p().Component),ge=n(14467),be=n(8621);function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var _e,Ne=function(e){(0,l.Z)(n,e);var t=ye(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showSignInModal",value:function(){se.Z.show(ge.Z)}},{key:"render",value:function(){var e=s.Z.get("SETTINGS").DELEGATE_AUTH;return(0,i.Z)("ul",{className:"dropdown-menu user-dropdown dropdown-menu-right",role:"menu"},void 0,(0,i.Z)("li",{className:"guest-preview"},void 0,(0,i.Z)("h4",{},void 0,gettext("You are browsing as guest.")),(0,i.Z)("p",{},void 0,gettext("Sign in or register to start and participate in discussions.")),e?(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-xs-12"},void 0,(0,i.Z)("a",{className:"btn btn-default btn-sign-in btn-block",href:s.Z.get("SETTINGS").LOGIN_URL},void 0,gettext("Sign in")))):(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-xs-6"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-sign-in btn-block",onClick:this.showSignInModal,type:"button"},void 0,gettext("Sign in"))),(0,i.Z)("div",{className:"col-xs-6"},void 0,(0,i.Z)(Ze,{className:"btn-primary btn-register btn-block"},void 0,gettext("Register"))))))}}]),n}(p().Component),ke=function(e){(0,l.Z)(n,e);var t=ye(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return s.Z.get("SETTINGS").DELEGATE_AUTH?(0,i.Z)("div",{className:"nav nav-guest"},void 0,(0,i.Z)("a",{className:"btn navbar-btn btn-default btn-sign-in",href:s.Z.get("SETTINGS").LOGIN_URL},void 0,gettext("Sign in")),fe||(fe=(0,i.Z)("div",{className:"navbar-left"},void 0,(0,i.Z)(F,{})))):(0,i.Z)("div",{className:"nav nav-guest"},void 0,(0,i.Z)("button",{className:"btn navbar-btn btn-default btn-sign-in",onClick:this.showSignInModal,type:"button"},void 0,gettext("Sign in")),(0,i.Z)(Ze,{className:"navbar-btn btn-primary btn-register"},void 0,gettext("Register")),ve||(ve=(0,i.Z)("div",{className:"navbar-left"},void 0,(0,i.Z)(F,{}))))}}]),n}(Ne),xe=function(e){(0,l.Z)(n,e);var t=ye(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showGuestMenu",value:function(){be.Z.show(Ne)}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",onClick:this.showGuestMenu},void 0,me||(me=(0,i.Z)(h.ZP,{size:"64"})))}}]),n}(p().Component);var we,Re=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"setGravatar",(function(){t.callApi("gravatar")})),(0,v.Z)((0,f.Z)(t),"setGenerated",(function(){t.callApi("generated")})),t.state={isLoading:!1},t}return(0,r.Z)(s,[{key:"callApi",value:function(e){var t=this;if(this.state.isLoading)return!1;this.setState({isLoading:!0}),m.Z.post(this.props.user.api.avatar,{avatar:e}).then((function(e){t.setState({isLoading:!1}),Z.Z.success(e.detail),t.props.onComplete(e)}),(function(e){400===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))}},{key:"getGravatarButton",value:function(){return this.props.options.gravatar?(0,i.Z)(q.Z,{onClick:this.setGravatar,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-gravatar"},void 0,gettext("Download my Gravatar")):null}},{key:"getCropButton",value:function(){return this.props.options.crop_src?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-crop",disabled:this.state.isLoading,onClick:this.props.showCrop},void 0,gettext("Re-crop uploaded image")):null}},{key:"getUploadButton",value:function(){return this.props.options.upload?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-upload",disabled:this.state.isLoading,onClick:this.props.showUpload},void 0,gettext("Upload new image")):null}},{key:"getGalleryButton",value:function(){return this.props.options.galleries?(0,i.Z)(q.Z,{className:"btn-default btn-block btn-avatar-gallery",disabled:this.state.isLoading,onClick:this.props.showGallery},void 0,gettext("Pick avatar from gallery")):null}},{key:"getAvatarPreview",value:function(){var e={id:this.props.user.id,avatars:this.props.options.avatars};return this.state.isLoading?(0,i.Z)("div",{className:"avatar-preview preview-loading"},void 0,(0,i.Z)(h.ZP,{size:"200",user:e}),_e||(_e=(0,i.Z)(C.Z,{}))):(0,i.Z)("div",{className:"avatar-preview"},void 0,(0,i.Z)(h.ZP,{size:"200",user:e}))}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-index"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-5"},void 0,this.getAvatarPreview()),(0,i.Z)("div",{className:"col-md-7"},void 0,this.getGravatarButton(),(0,i.Z)(q.Z,{onClick:this.setGenerated,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-generate"},void 0,gettext("Generate my individual avatar")),this.getCropButton(),this.getUploadButton(),this.getGalleryButton())))}}]),s}(p().Component),Ce=n(19755);var Se,Ee=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"cropAvatar",(function(){if(t.state.isLoading)return!1;t.setState({isLoading:!0});var e=t.props.upload?"crop_tmp":"crop_src",n=Ce(".crop-form"),a=n.cropit("exportZoom"),s=n.cropit("offset");m.Z.post(t.props.user.api.avatar,{avatar:e,crop:{offset:{x:s.x*a,y:s.y*a},zoom:n.cropit("zoom")*a}}).then((function(e){t.props.onComplete(e),Z.Z.success(e.detail)}),(function(e){400===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))})),t.state={isLoading:!1,deviceRatio:1},t}return(0,r.Z)(s,[{key:"getAvatarSize",value:function(){return this.props.upload?this.props.options.crop_tmp.size:this.props.options.crop_src.size}},{key:"getImagePath",value:function(){return this.props.upload?this.props.dataUrl:this.props.options.crop_src.url}},{key:"componentDidMount",value:function(){for(var e=this,t=Ce(".crop-form"),n=this.getAvatarSize(),a=t.width();a<n;)n/=2;var s=this.getAvatarSize()/n;t.width(n),t.cropit({width:n,height:n,exportZoom:s,imageState:{src:this.getImagePath()},onImageLoaded:function(){if(e.props.upload){var n=t.cropit("zoom"),a=t.cropit("imageSize");if(a.width>a.height){var s=(a.width*n-e.getAvatarSize())/-2;t.cropit("offset",{x:s,y:0})}else if(a.width<a.height){var i=(a.height*n-e.getAvatarSize())/-2;t.cropit("offset",{x:0,y:i})}else t.cropit("offset",{x:0,y:0})}else{var o=e.props.options.crop_src.crop;o&&(t.cropit("zoom",o.zoom),t.cropit("offset",{x:o.x,y:o.y}))}}})}},{key:"componentWillUnmount",value:function(){Ce(".crop-form").cropit("disable")}},{key:"render",value:function(){return(0,i.Z)("div",{},void 0,we||(we=(0,i.Z)("div",{className:"modal-body modal-avatar-crop"},void 0,(0,i.Z)("div",{className:"crop-form"},void 0,(0,i.Z)("div",{className:"cropit-preview"}),(0,i.Z)("input",{type:"range",className:"cropit-image-zoom-input"})))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.cropAvatar,loading:this.state.isLoading,className:"btn-primary btn-block"},void 0,this.props.upload?gettext("Set avatar"):gettext("Crop image")),(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:this.state.isLoading,className:"btn-default btn-block"},void 0,gettext("Cancel")))))}}]),s}(p().Component),Le=n(48772);var Pe,Oe=function(e){(0,l.Z)(s,e);var t,n,a=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,u.Z)(t);if(n){var s=(0,u.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),t=a.call(this,e),(0,v.Z)((0,f.Z)(t),"pickFile",(function(){document.getElementById("avatar-hidden-upload").click()})),(0,v.Z)((0,f.Z)(t),"uploadFile",(function(){var e=document.getElementById("avatar-hidden-upload").files[0];if(e){var n=t.validateFile(e);if(n)Z.Z.error(n);else{t.setState({image:e,preview:URL.createObjectURL(e),progress:0});var a=new FormData;a.append("avatar","upload"),a.append("image",e),m.Z.upload(t.props.user.api.avatar,a,(function(e){t.setState({progress:e})})).then((function(e){t.setState({options:e,uploaded:e.detail}),Z.Z.info(gettext("Your image has been uploaded and you may now crop it."))}),(function(e){400===e.status||413===e.status?(Z.Z.error(e.detail),t.setState({isLoading:!1,image:null,progress:0})):t.props.showError(e)}))}}})),t.state={image:null,preview:null,progress:0,uploaded:null,dataUrl:null},t}return(0,r.Z)(s,[{key:"validateFile",value:function(e){if(e.size>this.props.options.upload.limit)return interpolate(gettext("Selected file is too big. (%(filesize)s)"),{filesize:(0,Le.Z)(e.size)},!0);var t=gettext("Selected file type is not supported.");if(-1===this.props.options.upload.allowed_mime_types.indexOf(e.type))return t;var n=!1,a=e.name.toLowerCase();return this.props.options.upload.allowed_extensions.map((function(e){a.substr(-1*e.length)===e&&(n=!0)})),!n&&t}},{key:"getUploadRequirements",value:function(e){var t=e.allowed_extensions.map((function(e){return e.substr(1)}));return interpolate(gettext("%(files)s files smaller than %(limit)s"),{files:t.join(", "),limit:(0,Le.Z)(e.limit)},!0)}},{key:"getUploadButton",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,i.Z)(q.Z,{className:"btn-pick-file",onClick:this.pickFile},void 0,Se||(Se=(0,i.Z)("div",{className:"material-icon"},void 0,"input")),gettext("Select file")),(0,i.Z)("p",{className:"text-muted"},void 0,this.getUploadRequirements(this.props.options.upload)))}},{key:"getUploadProgressLabel",value:function(){return interpolate(gettext("%(progress)s % complete"),{progress:this.state.progress},!0)}},{key:"getUploadProgress",value:function(){return(0,i.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,i.Z)("div",{className:"upload-progress"},void 0,(0,i.Z)("img",{src:this.state.preview}),(0,i.Z)("div",{className:"progress"},void 0,(0,i.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":"{this.state.progress}","aria-valuemin":"0","aria-valuemax":"100",style:{width:this.state.progress+"%"}},void 0,(0,i.Z)("span",{className:"sr-only"},void 0,this.getUploadProgressLabel())))))}},{key:"renderUpload",value:function(){return(0,i.Z)("div",{},void 0,(0,i.Z)("input",{type:"file",id:"avatar-hidden-upload",className:"hidden-file-upload",onChange:this.uploadFile}),this.state.image?this.getUploadProgress():this.getUploadButton(),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:!!this.state.image,className:"btn-default btn-block"},void 0,gettext("Cancel")))))}},{key:"renderCrop",value:function(){return(0,i.Z)(Ee,{options:this.state.options,user:this.props.user,upload:this.state.uploaded,dataUrl:this.state.preview,onComplete:this.props.onComplete,showError:this.props.showError,showIndex:this.props.showIndex})}},{key:"render",value:function(){return this.state.uploaded?this.renderCrop():this.renderUpload()}}]),s}(p().Component),Te=n(69130);function Ae(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var Be,Ie,je,De=function(e){(0,l.Z)(n,e);var t=Ae(n);function n(){var e;(0,o.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,v.Z)((0,f.Z)(e),"select",(function(){e.props.select(e.props.id)})),e}return(0,r.Z)(n,[{key:"getClassName",value:function(){return this.props.selection===this.props.id?this.props.disabled?"btn btn-avatar btn-disabled avatar-selected":"btn btn-avatar avatar-selected":this.props.disabled?"btn btn-avatar btn-disabled":"btn btn-avatar"}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",className:this.getClassName(),disabled:this.props.disabled,onClick:this.select},void 0,(0,i.Z)("img",{src:this.props.url}))}}]),n}(p().Component),Ue=function(e){(0,l.Z)(n,e);var t=Ae(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){var e=this;return(0,i.Z)("div",{className:"avatars-gallery"},void 0,(0,i.Z)("h3",{},void 0,this.props.name),(0,i.Z)("div",{className:"avatars-gallery-images"},void 0,(0,Te.Z)(this.props.images,4,null).map((function(t,n){return(0,i.Z)("div",{className:"row"},n,t.map((function(t,n){return(0,i.Z)("div",{className:"col-xs-3"},n,t?p().createElement(De,(0,b.Z)({disabled:e.props.disabled,select:e.props.select,selection:e.props.selection},t)):Pe||(Pe=(0,i.Z)("div",{className:"blank-avatar"})))})))}))))}}]),n}(p().Component),Me=function(e){(0,l.Z)(n,e);var t=Ae(n);function n(e){var a;return(0,o.Z)(this,n),a=t.call(this,e),(0,v.Z)((0,f.Z)(a),"select",(function(e){a.setState({selection:e})})),(0,v.Z)((0,f.Z)(a),"save",(function(){if(a.state.isLoading)return!1;a.setState({isLoading:!0}),m.Z.post(a.props.user.api.avatar,{avatar:"galleries",image:a.state.selection}).then((function(e){a.setState({isLoading:!1}),Z.Z.success(e.detail),a.props.onComplete(e),a.props.showIndex()}),(function(e){400===e.status?(Z.Z.error(e.detail),a.setState({isLoading:!1})):a.props.showError(e)}))})),a.state={selection:null,isLoading:!1},a}return(0,r.Z)(n,[{key:"render",value:function(){var e=this;return(0,i.Z)("div",{},void 0,(0,i.Z)("div",{className:"modal-body modal-avatar-gallery"},void 0,this.props.options.galleries.map((function(t,n){return(0,i.Z)(Ue,{name:t.name,images:t.images,selection:e.state.selection,disabled:e.state.isLoading,select:e.select},n)}))),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,i.Z)(q.Z,{onClick:this.save,loading:this.state.isLoading,disabled:!this.state.selection,className:"btn-primary btn-block"},void 0,this.state.selection?gettext("Save choice"):gettext("Select avatar")),(0,i.Z)(q.Z,{onClick:this.props.showIndex,disabled:this.state.isLoading,className:"btn-default btn-block"},void 0,gettext("Cancel"))))))}}]),n}(p().Component),ze=n(3784),He=n(6935),Fe=n(90287);function qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var Ye,Ve,$e,Ge,We,Ke,Je,Qe,Xe,et,tt,nt,at=function(e){(0,l.Z)(n,e);var t=qe(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"getErrorReason",value:function(){return this.props.reason?(0,i.Z)("p",{dangerouslySetInnerHTML:{__html:this.props.reason}}):null}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-body"},void 0,Be||(Be=(0,i.Z)("div",{className:"message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline"))),(0,i.Z)("div",{className:"message-body"},void 0,(0,i.Z)("p",{className:"lead"},void 0,this.props.message),this.getErrorReason(),(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,gettext("Ok"))))}}]),n}(p().Component),st=function(e){(0,l.Z)(n,e);var t=qe(n);function n(){var e;(0,o.Z)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return e=t.call.apply(t,[this].concat(s)),(0,v.Z)((0,f.Z)(e),"showError",(function(t){e.setState({error:t})})),(0,v.Z)((0,f.Z)(e),"showIndex",(function(){e.setState({component:Re})})),(0,v.Z)((0,f.Z)(e),"showUpload",(function(){e.setState({component:Oe})})),(0,v.Z)((0,f.Z)(e),"showCrop",(function(){e.setState({component:Ee})})),(0,v.Z)((0,f.Z)(e),"showGallery",(function(){e.setState({component:Me})})),(0,v.Z)((0,f.Z)(e),"completeFlow",(function(t){Fe.Z.dispatch((0,He.n1)(e.props.user,t.avatars)),e.setState({component:Re,options:t})})),e}return(0,r.Z)(n,[{key:"componentDidMount",value:function(){var e=this;m.Z.get(this.props.user.api.avatar).then((function(t){e.setState({component:Re,options:t,error:null})}),(function(t){e.showError(t)}))}},{key:"getBody",value:function(){return this.state?this.state.error?(0,i.Z)(at,{message:this.state.error.detail,reason:this.state.error.reason}):(0,i.Z)(this.state.component,{options:this.state.options,user:this.props.user,onComplete:this.completeFlow,showError:this.showError,showIndex:this.showIndex,showCrop:this.showCrop,showUpload:this.showUpload,showGallery:this.showGallery}):Ie||(Ie=(0,i.Z)(ze.Z,{}))}},{key:"getClassName",value:function(){return this.state&&this.state.error?"modal-dialog modal-message modal-change-avatar":"modal-dialog modal-change-avatar"}},{key:"render",value:function(){return(0,i.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":gettext("Close")},void 0,je||(je=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,gettext("Change your avatar"))),this.getBody()))}}]),n}(p().Component);function it(e){return{user:e.auth.user}}function ot(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var rt=function(e){(0,l.Z)(n,e);var t=ot(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"changeAvatar",value:function(){se.Z.show((0,a.$j)(it)(st))}},{key:"render",value:function(){var e=this.props.user;return(0,i.Z)("ul",{className:"dropdown-menu user-dropdown dropdown-menu-right",role:"menu"},void 0,(0,i.Z)("li",{className:"dropdown-header"},void 0,(0,i.Z)("strong",{},void 0,e.username),(0,i.Z)("div",{className:"row user-stats"},void 0,(0,i.Z)("div",{className:"col-sm-3"},void 0,Ye||(Ye=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),e.posts),(0,i.Z)("div",{className:"col-sm-3"},void 0,Ve||(Ve=(0,i.Z)("span",{className:"material-icon"},void 0,"forum")),e.threads),(0,i.Z)("div",{className:"col-sm-3"},void 0,$e||($e=(0,i.Z)("span",{className:"material-icon"},void 0,"favorite")),e.followers),(0,i.Z)("div",{className:"col-sm-3"},void 0,Ge||(Ge=(0,i.Z)("span",{className:"material-icon"},void 0,"favorite_outline")),e.following))),We||(We=(0,i.Z)("li",{className:"divider"})),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:e.url},void 0,Ke||(Ke=(0,i.Z)("span",{className:"material-icon"},void 0,"account_circle")),gettext("See your profile"))),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:s.Z.get("USERCP_URL")},void 0,Je||(Je=(0,i.Z)("span",{className:"material-icon"},void 0,"done_all")),gettext("Change options"))),(0,i.Z)("li",{},void 0,(0,i.Z)("button",{className:"btn-link",onClick:this.changeAvatar,type:"button"},void 0,Qe||(Qe=(0,i.Z)("span",{className:"material-icon"},void 0,"portrait")),gettext("Change avatar"))),!!e.acl.can_use_private_threads&&(0,i.Z)("li",{},void 0,(0,i.Z)("a",{href:s.Z.get("PRIVATE_THREADS_URL")},void 0,Xe||(Xe=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),gettext("Private threads"),(0,i.Z)(lt,{user:e}))),et||(et=(0,i.Z)("li",{className:"divider"})),(0,i.Z)("li",{className:"dropdown-buttons"},void 0,(0,i.Z)("button",{className:"btn btn-default btn-block",onClick:function(){return document.getElementById("hidden-logout-form").submit()},type:"button"},void 0,gettext("Log out"))))}}]),n}(p().Component);function lt(e){var t=e.user;return t.unread_private_threads?(0,i.Z)("span",{className:"badge"},void 0,t.unread_private_threads):null}function ct(e){var t=e.user;return(0,i.Z)("ul",{className:"ul nav navbar-nav nav-user"},void 0,tt||(tt=(0,i.Z)("li",{},void 0,(0,i.Z)(F,{}))),(0,i.Z)(ut,{user:t}),(0,i.Z)("li",{className:"dropdown"},void 0,(0,i.Z)("a",{"aria-haspopup":"true","aria-expanded":"false",className:"dropdown-toggle","data-toggle":"dropdown",href:t.url,role:"button"},void 0,(0,i.Z)(h.ZP,{user:t,size:"64"})),(0,i.Z)(rt,{user:t})))}function ut(e){var t=e.user;if(!t.acl.can_use_private_threads)return null;var n;return n=t.unread_private_threads?gettext("You have unread private threads!"):gettext("Private threads"),(0,i.Z)("li",{},void 0,(0,i.Z)("a",{className:"navbar-icon",href:s.Z.get("PRIVATE_THREADS_URL"),title:n},void 0,nt||(nt=(0,i.Z)("span",{className:"material-icon"},void 0,"message")),t.unread_private_threads>0&&(0,i.Z)("span",{className:"badge"},void 0,t.unread_private_threads)))}function dt(e){return{user:e.auth.user}}var pt,ht,ft=function(e){(0,l.Z)(n,e);var t=ot(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"showUserMenu",value:function(){be.Z.showConnected("user-menu",(0,a.$j)(dt)(rt))}},{key:"render",value:function(){return(0,i.Z)("button",{type:"button",onClick:this.showUserMenu},void 0,(0,i.Z)(h.ZP,{user:this.props.user,size:"50"}))}}]),n}(p().Component);function vt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,u.Z)(e);if(t){var s=(0,u.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,c.Z)(this,n)}}var mt=function(e){(0,l.Z)(n,e);var t=vt(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return this.props.isAuthenticated?(0,i.Z)(ct,{user:this.props.user}):pt||(pt=(0,i.Z)(ke,{}))}}]),n}(p().Component),Zt=function(e){(0,l.Z)(n,e);var t=vt(n);function n(){return(0,o.Z)(this,n),t.apply(this,arguments)}return(0,r.Z)(n,[{key:"render",value:function(){return this.props.isAuthenticated?(0,i.Z)(ft,{user:this.props.user}):ht||(ht=(0,i.Z)(xe,{}))}}]),n}(p().Component);function gt(e){return e.auth}var bt=n(4869);s.Z.addInitializer({name:"component:user-menu",initializer:function(){(0,bt.Z)((0,a.$j)(gt)(mt),"user-menu-mount"),(0,bt.Z)((0,a.$j)(gt)(Zt),"user-menu-compact-mount")},after:"store"})},77031:function(e,t,n){"use strict";var a,s=n(22928),i=n(15671),o=n(43144),r=n(79340),l=n(6215),c=n(61120),u=n(57588),d=n.n(u),p=n(37424),h=n(97326),f=n(4942),v=n(59131),m=n(69987),Z=n(94417),g=function(e,t){var n=e;return"rank"===t.component?n+=t.slug:n+=t.component,n+"/"},b=function(e){var t=e.baseUrl,n=e.page,i=e.pages;return(0,s.Z)("div",{className:"nav-container"},void 0,(0,s.Z)("div",{className:"dropdown hidden-sm hidden-md hidden-lg"},void 0,(0,s.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,a||(a=(0,s.Z)("span",{className:"material-icon"},void 0,"menu")),n.name),(0,s.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,i.map((function(e){var n=g(t,e);return(0,s.Z)("li",{},n,(0,s.Z)(m.rU,{to:n},void 0,e.name))})))),(0,s.Z)("ul",{className:"nav nav-pills hidden-xs",role:"menu"},void 0,i.map((function(e){var n=g(t,e);return(0,s.Z)(Z.Z,{path:n},n,(0,s.Z)(m.rU,{to:n},void 0,e.name))}))))};var y,_,N=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getEmptyMessage",value:function(){return interpolate(gettext("No users have posted any new messages during last %(days)s days."),{days:this.props.trackedPeriod},!0)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead"},void 0,this.getEmptyMessage())))}}]),u}(d().Component),k=n(19605),x=n(44039);var w=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getClassName",value:function(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}},{key:"render",value:function(){return(0,s.Z)("li",{className:this.getClassName()},void 0,y||(y=(0,s.Z)("div",{className:"rank-user-avatar"},void 0,(0,s.Z)("span",{},void 0,(0,s.Z)(k.ZP,{size:"50"})))),(0,s.Z)("div",{className:"rank-user"},void 0,(0,s.Z)("div",{className:"user-name"},void 0,(0,s.Z)("span",{className:"item-title"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,80)+"px"}},void 0," "))),(0,s.Z)("div",{className:"user-details"},void 0,(0,s.Z)("span",{className:"user-status"},void 0,_||(_=(0,s.Z)("span",{className:"status-icon ui-preview-text"},void 0," ")),(0,s.Z)("span",{className:"status-label ui-preview-text hidden-xs hidden-sm",style:{width:x.e(30,50)+"px"}},void 0," ")),(0,s.Z)("span",{className:"rank-name"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,50)+"px"}},void 0," ")),(0,s.Z)("span",{className:"user-title hidden-xs hidden-sm"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,50)+"px"}},void 0," "))),(0,s.Z)("div",{className:"user-compact-stats visible-xs-block"},void 0,(0,s.Z)("span",{className:"rank-position"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("span",{className:"rank-posts-counted"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))))),(0,s.Z)("div",{className:"rank-position hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("div",{className:"rank-posts-counted hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))),(0,s.Z)("div",{className:"rank-posts-total hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(20,30)+"px"}},void 0," ")),(0,s.Z)("small",{},void 0,gettext("Total posts"))))}}]),u}(d().Component);var R,C=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead ui-preview"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:x.e(50,220)+"px"}},void 0," ")),(0,s.Z)("div",{className:"active-posters ui-preview"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((function(e){return(0,s.Z)(w,{hiddenOnMobile:e>0},e)}))))))}}]),u}(d().Component),S=n(24678),E=n(32233);var L=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getClassName",value:function(){return this.props.rank.css_class?"list-group-item list-group-rank-"+this.props.rank.css_class:"list-group-item"}},{key:"getUserStatus",value:function(){return this.props.user.status?(0,s.Z)(S.ZP,{user:this.props.user,status:this.props.user.status},void 0,(0,s.Z)(S.Jj,{user:this.props.user,status:this.props.user.status}),(0,s.Z)(S.pg,{user:this.props.user,status:this.props.user.status,className:"status-label hidden-xs hidden-sm"})):(0,s.Z)("span",{className:"user-status"},void 0,R||(R=(0,s.Z)("span",{className:"status-icon ui-preview-text"},void 0," ")),(0,s.Z)("span",{className:"status-label ui-preview-text hidden-xs hidden-sm",style:{width:x.e(30,50)+"px"}},void 0," "))}},{key:"getRankName",value:function(){if(!this.props.rank.is_tab)return(0,s.Z)("span",{className:"rank-name item-title"},void 0,this.props.rank.name);var e=E.Z.get("USERS_LIST_URL")+this.props.rank.slug+"/";return(0,s.Z)(m.rU,{to:e,className:"rank-name item-title"},void 0,this.props.rank.name)}},{key:"getUserTitle",value:function(){return this.props.user.title?(0,s.Z)("span",{className:"user-title hidden-xs hidden-sm"},void 0,this.props.user.title):null}},{key:"render",value:function(){return(0,s.Z)("li",{className:this.getClassName()},void 0,(0,s.Z)("div",{className:"rank-user-avatar"},void 0,(0,s.Z)("a",{href:this.props.user.url},void 0,(0,s.Z)(k.ZP,{user:this.props.user,size:50,size2x:64}))),(0,s.Z)("div",{className:"rank-user"},void 0,(0,s.Z)("div",{className:"user-name"},void 0,(0,s.Z)("a",{href:this.props.user.url,className:"item-title"},void 0,this.props.user.username)),(0,s.Z)("div",{className:"user-details"},void 0,this.getUserStatus(),this.getRankName(),this.getUserTitle()),(0,s.Z)("div",{className:"user-compact-stats visible-xs-block"},void 0,(0,s.Z)("span",{className:"rank-position"},void 0,(0,s.Z)("strong",{},void 0,"#",this.props.counter),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("span",{className:"rank-posts-counted"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.meta.score),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))))),(0,s.Z)("div",{className:"rank-position hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,"#",this.props.counter),(0,s.Z)("small",{},void 0,gettext("Rank"))),(0,s.Z)("div",{className:"rank-posts-counted hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.meta.score),(0,s.Z)("small",{},void 0,gettext("Ranked posts"))),(0,s.Z)("div",{className:"rank-posts-total hidden-xs"},void 0,(0,s.Z)("strong",{},void 0,this.props.user.posts),(0,s.Z)("small",{},void 0,gettext("Total posts"))))}}]),u}(d().Component);var P=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getLeadMessage",value:function(){var e=ngettext("%(posters)s top poster from last %(days)s days.","%(posters)s top posters from last %(days)s days.",this.props.count);return interpolate(e,{posters:this.props.count,days:this.props.trackedPeriod},!0)}},{key:"render",value:function(){return(0,s.Z)("div",{className:"active-posters-list"},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:misago.get("USERS_LIST_URL"),page:this.props.page,pages:misago.get("USERS_LISTS")}),(0,s.Z)("p",{className:"lead"},void 0,this.getLeadMessage()),(0,s.Z)("div",{className:"active-posters ui-ready"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,this.props.users.map((function(e,t){return(0,s.Z)(L,{user:e,rank:e.rank,counter:t+1},e.id)}))))))}}]),u}(d().Component),O=n(6935),T=n(55547),A=n(90287),B=n(53328);var I=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(e){var t;return(0,i.Z)(this,u),t=a.call(this,e),(0,f.Z)((0,h.Z)(t),"update",(function(e){A.Z.dispatch((0,O.ZB)(e.results)),t.setState({isLoaded:!0,trackedPeriod:e.tracked_period,count:e.count})})),E.Z.has("USERS")?t.initWithPreloadedData(E.Z.pop("USERS")):t.initWithoutPreloadedData(),t.startPolling(),t}return(0,o.Z)(u,[{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,trackedPeriod:e.tracked_period,count:e.count},A.Z.dispatch((0,O.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(){T.Z.start({poll:"active-posters",url:E.Z.get("USERS_API"),data:{list:"active"},frequency:9e4,update:this.update})}},{key:"componentDidMount",value:function(){B.Z.set({title:this.props.route.extra.name,parent:gettext("Users")})}},{key:"componentWillUnmount",value:function(){T.Z.stop("active-posters")}},{key:"render",value:function(){var e={name:this.props.route.extra.name};return this.state.isLoaded?this.state.count>0?(0,s.Z)(P,{page:e,users:this.props.users,trackedPeriod:this.state.trackedPeriod,count:this.state.count}):(0,s.Z)(N,{page:e,trackedPeriod:this.state.trackedPeriod}):(0,s.Z)(C,{page:e})}}]),u}(d().Component);var j,D=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"getClassName",value:function(){return this.props.copy&&this.props.copy.length&&1===function(e,t){if(e=(e+"").toLowerCase(),(t=(t+"").toLowerCase()).length<=0)return 0;for(var n=0,a=0,s=t.length;(a=e.indexOf(t,a))>=0;)n+=1,a+=s;return n}(this.props.copy,"<p")&&-1===this.props.copy.indexOf("<br")?"page-lead lead":"page-lead"}},{key:"render",value:function(){return this.props.copy&&this.props.copy.length?(0,s.Z)("div",{className:this.getClassName(),dangerouslySetInnerHTML:{__html:this.props.copy}}):null}}]),u}(d().Component),U=n(40429),M=function(e){var t=e.users;return(0,s.Z)(U.Z,{cols:4,isReady:!0,showStatus:!0,users:t})};var z,H,F,q,Y,V,$,G,W,K=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){var e;(0,i.Z)(this,u);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e=a.call.apply(a,[this].concat(n)),(0,f.Z)((0,h.Z)(e),"render",(function(){return j||(j=(0,s.Z)(U.Z,{cols:4,isReady:!1}))})),e}return(0,o.Z)(u,[{key:"shouldComponentUpdate",value:function(){return!1}}]),u}(d().Component),J=K,Q=n(92490),X=function(e){var t=e.users;return t.more?(0,s.Z)("p",{},void 0,interpolate(ngettext("There is %(more)s more member with this role.","There are %(more)s more members with this role.",t.more),{more:t.more},!0)):(0,s.Z)("p",{},void 0,gettext("There are no more members with this role."))},ee=function(e){var t=e.baseUrl,n=e.users;return(0,s.Z)("div",{className:"misago-pagination"},void 0,n.isLoaded&&n.first?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t,title:gettext("Go to first page")},void 0,z||(z=(0,s.Z)("span",{className:"material-icon"},void 0,"first_page"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to first page"),type:"button",disabled:!0},void 0,H||(H=(0,s.Z)("span",{className:"material-icon"},void 0,"first_page"))),n.isLoaded&&n.previous?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+(n.previous>1?n.previous+"/":""),title:gettext("Go to previous page")},void 0,F||(F=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_left"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to previous page"),type:"button",disabled:!0},void 0,q||(q=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_left"))),n.isLoaded&&n.next?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.next+"/",title:gettext("Go to next page")},void 0,Y||(Y=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_right"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to next page"),type:"button",disabled:!0},void 0,V||(V=(0,s.Z)("span",{className:"material-icon"},void 0,"chevron_right"))),n.isLoaded&&n.last?(0,s.Z)(m.rU,{className:"btn btn-default btn-outline btn-icon",to:t+n.last+"/",title:gettext("Go to last page")},void 0,$||($=(0,s.Z)("span",{className:"material-icon"},void 0,"last_page"))):(0,s.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:gettext("Go to last page"),type:"button",disabled:!0},void 0,G||(G=(0,s.Z)("span",{className:"material-icon"},void 0,"last_page"))))},te=function(e){var t=e.baseUrl,n=e.users;return(0,s.Z)(Q.o8,{},void 0,(0,s.Z)(Q.Z2,{},void 0,(0,s.Z)(Q.Eg,{},void 0,(0,s.Z)(ee,{baseUrl:t,users:n}))),(0,s.Z)(Q.Z2,{auto:!0},void 0,(0,s.Z)(Q.Eg,{},void 0,(0,s.Z)(X,{users:n}))))};var ne=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(e){var t;return(0,i.Z)(this,u),t=a.call(this,e),(0,f.Z)((0,h.Z)(t),"update",(function(e){A.Z.dispatch((0,O.ZB)(e.results)),e.isLoaded=!0,t.setState(e)})),E.Z.has("USERS")?t.initWithPreloadedData(E.Z.pop("USERS")):t.initWithoutPreloadedData(),t.startPolling(e.params.page||1),t}return(0,o.Z)(u,[{key:"initWithPreloadedData",value:function(e){this.state=Object.assign(e,{isLoaded:!0}),A.Z.dispatch((0,O.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(e){T.Z.start({poll:"rank-users",url:E.Z.get("USERS_API"),data:{rank:this.props.route.rank.id,page:e},frequency:9e4,update:this.update})}},{key:"componentDidMount",value:function(){B.Z.set({title:this.props.route.rank.name,page:this.props.params.page||null,parent:gettext("Users")})}},{key:"componentWillUnmount",value:function(){T.Z.stop("rank-users")}},{key:"componentWillReceiveProps",value:function(e){this.props.params.page!==e.params.page&&(B.Z.set({title:this.props.route.rank.name,page:e.params.page||null,parent:gettext("Users")}),this.setState({isLoaded:!1}),T.Z.stop("rank-users"),this.startPolling(e.params.page))}},{key:"getClassName",value:function(){return this.props.route.rank.css_class?"rank-users-list rank-users-"+this.props.route.rank.css_class:"rank-users-list"}},{key:"getRankDescription",value:function(){return this.props.route.rank.description?(0,s.Z)("div",{className:"rank-description"},void 0,(0,s.Z)(D,{copy:this.props.route.rank.description.html})):null}},{key:"getComponent",value:function(){return this.state.isLoaded?this.state.count>0?(0,s.Z)(M,{users:this.props.users}):(0,s.Z)("p",{className:"lead"},void 0,gettext("There are no users with this rank at the moment.")):W||(W=(0,s.Z)(J,{}))}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName()},void 0,(0,s.Z)(v.Z,{},void 0,(0,s.Z)(b,{baseUrl:E.Z.get("USERS_LIST_URL"),page:{name:this.props.route.rank.name},pages:E.Z.get("USERS_LISTS")}),this.getRankDescription(),this.getComponent(),(0,s.Z)(te,{baseUrl:E.Z.get("USERS_LIST_URL")+this.props.route.rank.slug+"/",users:this.state})))}}]),u}(d().Component),ae=n(82125),se=n(99755);var ie=function(e){(0,r.Z)(u,e);var t,n,a=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,c.Z)(t);if(n){var s=(0,c.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,l.Z)(this,e)});function u(){return(0,i.Z)(this,u),a.apply(this,arguments)}return(0,o.Z)(u,[{key:"render",value:function(){return(0,s.Z)("div",{className:"page page-users-lists"},void 0,(0,s.Z)(se.sP,{},void 0,(0,s.Z)(se.mr,{styleName:"users-lists"},void 0,(0,s.Z)(se.gC,{styleName:"users-lists"},void 0,(0,s.Z)("h1",{},void 0,gettext("Users"))))),this.props.children)}}]),u}(ae.Z);function oe(e){return{tick:e.tick.tick,user:e.auth.user,users:e.users}}function re(){var e=[];return E.Z.get("USERS_LISTS").forEach((function(t){"rank"===t.component?(e.push({path:E.Z.get("USERS_LIST_URL")+t.slug+"/:page/",component:(0,p.$j)(oe)(ne),rank:t}),e.push({path:E.Z.get("USERS_LIST_URL")+t.slug+"/",component:(0,p.$j)(oe)(ne),rank:t})):"active-posters"===t.component&&e.push({path:E.Z.get("USERS_LIST_URL")+t.component+"/",component:(0,p.$j)(oe)(I),extra:{name:t.name}})})),e}var le=n(39633);E.Z.addInitializer({name:"component:users",initializer:function(e){e.has("USERS_LISTS")&&(0,le.Z)({root:E.Z.get("USERS_LIST_URL"),component:ie,paths:re()})},after:"store"})},97751:function(e,t,n){"use strict";var a=n(32233),s=n(96142);a.Z.addInitializer({name:"include",initializer:function(e){s.Z.init(e.get("STATIC_URL"))}})},76093:function(e,t,n){"use strict";var a=n(32233),s=n(62833);a.Z.addInitializer({name:"local-storage",initializer:function(){s.Z.init("misago_")}})},19764:function(e,t,n){"use strict";var a=n(32233),s=n(8621);a.Z.addInitializer({name:"dropdown",initializer:function(){var e=document.getElementById("mobile-navbar-dropdown-mount");e&&s.Z.init(e)},before:"store"})},47549:function(e,t,n){"use strict";var a=n(32233),s=n(59801);a.Z.addInitializer({name:"modal",initializer:function(){var e=document.getElementById("modal-mount");e&&s.Z.init(e)},before:"store"})},22331:function(e,t,n){"use strict";var a=n(30381),s=n.n(a),i=n(32233),o=n(19755);i.Z.addInitializer({name:"moment",initializer:function(){s().locale(o("html").attr("lang"))}})},21513:function(e,t,n){"use strict";var a=n(32233),s=n(53328);a.Z.addInitializer({name:"page-title",initializer:function(e){s.Z.init(e.get("SETTINGS").forum_index_title,e.get("SETTINGS").forum_name)}})},98749:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(53904),o=n(55547);a.Z.addInitializer({name:"polls",initializer:function(){o.Z.init(s.Z,i.Z)}})},98251:function(e,t,n){"use strict";var a=n(32233),s=n(78657),i=n(27950),o=n(53904);a.Z.addInitializer({name:"posting",initializer:function(){i.Z.init(s.Z,o.Z,document.getElementById("posting-placeholder"))}})},6720:function(e,t,n){"use strict";var a=n(32233),s=n(35486),i=n(90287);a.Z.addInitializer({name:"reducer:auth",initializer:function(e){i.Z.addReducer("auth",s.ZP,Object.assign({isAuthenticated:e.get("isAuthenticated"),isAnonymous:!e.get("isAuthenticated"),user:e.get("user")},s.E3))},before:"store"})},10846:function(e,t,n){"use strict";var a=n(32233),s=n(8154),i=n(90287);a.Z.addInitializer({name:"reducer:participants",initializer:function(){var e=null;a.Z.has("THREAD")&&(e=a.Z.get("THREAD").participants),i.Z.addReducer("participants",s.ZP,e||[])},before:"store"})},18255:function(e,t,n){"use strict";var a=n(32233),s=n(59752),i=n(90287);a.Z.addInitializer({name:"reducer:poll",initializer:function(){var e;e=a.Z.has("THREAD")&&a.Z.get("THREAD").poll?(0,s.ZB)(a.Z.get("THREAD").poll):{isBusy:!1},i.Z.addReducer("poll",s.ZP,e)},before:"store"})},14113:function(e,t,n){"use strict";var a=n(32233),s=n(21981),i=n(90287);a.Z.addInitializer({name:"reducer:posts",initializer:function(){var e;e=a.Z.has("POSTS")?(0,s.ZB)(a.Z.get("POSTS")):{isLoaded:!1,isBusy:!1},i.Z.addReducer("posts",s.ZP,e)},before:"store"})},24444:function(e,t,n){"use strict";var a=n(32233),s=n(58598),i=n(90287);a.Z.addInitializer({name:"reducer:profile-details",initializer:function(){var e=null;a.Z.has("PROFILE_DETAILS")&&(e=a.Z.get("PROFILE_DETAILS")),i.Z.addReducer("profile-details",s.ZP,e||{})},before:"store"})},1764:function(e,t,n){"use strict";var a=n(32233),s=n(27519),i=n(90287);a.Z.addInitializer({name:"reducer:profile-hydrate",initializer:function(){a.Z.has("PROFILE")&&i.Z.dispatch((0,s.ZB)(a.Z.get("PROFILE")))},after:"store"})},68351:function(e,t,n){"use strict";var a=n(32233),s=n(27519),i=n(90287);a.Z.addInitializer({name:"reducer:profile",initializer:function(){i.Z.addReducer("profile",s.ZP,{})},before:"store"})},81521:function(e,t,n){"use strict";var a=n(32233),s=n(16427),i=n(90287);a.Z.addInitializer({name:"reducer:search",initializer:function(){i.Z.addReducer("search",s.ZP,Object.assign({},s.E3,{providers:a.Z.get("SEARCH_PROVIDERS")||[],query:a.Z.get("SEARCH_QUERY")||""}))},before:"store"})},19984:function(e,t,n){"use strict";var a=n(32233),s=n(77751),i=n(90287);a.Z.addInitializer({name:"reducer:selection",initializer:function(){i.Z.addReducer("selection",s.ZP,[])},before:"store"})},41229:function(e,t,n){"use strict";var a=n(32233),s=n(27346),i=n(90287);a.Z.addInitializer({name:"reducer:snackbar",initializer:function(){i.Z.addReducer("snackbar",s.ZP,s.E3)},before:"store"})},43589:function(e,t,n){"use strict";var a=n(32233),s=n(7738),i=n(90287);a.Z.addInitializer({name:"reducer:thread",initializer:function(){var e;e=a.Z.has("THREAD")?(0,s.ZB)(a.Z.get("THREAD")):{isBusy:!1},i.Z.addReducer("thread",s.ZP,e)},before:"store"})},24108:function(e,t,n){"use strict";var a=n(32233),s=n(61340),i=n(90287);a.Z.addInitializer({name:"reducer:threads",initializer:function(){i.Z.addReducer("threads",s.ZP,[])},before:"store"})},33934:function(e,t,n){"use strict";var a=n(32233),s=n(85586),i=n(90287);a.Z.addInitializer({name:"reducer:tick",initializer:function(){i.Z.addReducer("tick",s.ZP,s.E3)},before:"store"})},85577:function(e,t,n){"use strict";var a=n(32233),s=n(48927),i=n(90287);a.Z.addInitializer({name:"reducer:username-history",initializer:function(){i.Z.addReducer("username-history",s.ZP,[])},before:"store"})},83526:function(e,t,n){"use strict";var a=n(32233),s=n(6935),i=n(90287);a.Z.addInitializer({name:"reducer:users",initializer:function(){i.Z.addReducer("users",s.ZP,[])},before:"store"})},43060:function(e,t,n){"use strict";var a=n(32233),s=n(53904),i=n(90287);a.Z.addInitializer({name:"snackbar",initializer:function(){s.Z.init(i.Z)},after:"store"})},92292:function(e,t,n){"use strict";var a=n(32233),s=n(90287);a.Z.addInitializer({name:"store",initializer:function(){s.Z.init()},before:"_end"})},33409:function(e,t,n){"use strict";var a=n(32233),s=n(85586),i=n(90287);a.Z.addInitializer({name:"tick-start",initializer:function(){window.setInterval((function(){i.Z.dispatch((0,s.bq)())}),5e4)},after:"store"})},31341:function(e,t,n){"use strict";var a=n(32233),s=n(96142),i=n(59940);a.Z.addInitializer({name:"zxcvbn",initializer:function(){i.Z.init(s.Z)}})},35486:function(e,t,n){"use strict";n.d(t,{E3:function(){return s},ZP:function(){return d},r$:function(){return l},w7:function(){return u},zB:function(){return c}});var a=n(6935),s={signedIn:!1,signedOut:!1},i="PATCH_USER",o="SIGN_IN",r="SIGN_OUT";function l(e){return{type:i,patch:e}}function c(e){return{type:o,user:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:r,soft:e}}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:var n=Object.assign({},e);return n.user=Object.assign({},e.user,t.patch),n;case o:return Object.assign({},e,{signedIn:t.user});case r:return Object.assign({},e,{isAuthenticated:!1,isAnonymous:!0,signedOut:!t.soft});case a.oB:if(e.isAuthenticated&&e.user.id===t.userId){var l=Object.assign({},e);return l.user=Object.assign({},e.user,{avatars:t.avatars}),l}return e;case a.D9:if(e.isAuthenticated&&e.user.id===t.userId){var c=Object.assign({},e);return c.user=Object.assign({},e.user,{username:t.username,slug:t.slug}),c}return e;default:return e}}},8154:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i},gx:function(){return s}});var a="REPLACE_PARTICIPANTS";function s(e){return{type:a,state:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===a?t.state:e}},59752:function(e,t,n){"use strict";n.d(t,{Ar:function(){return p},Od:function(){return f},ZB:function(){return u},ZH:function(){return r},ZP:function(){return v},b9:function(){return l},gx:function(){return h},n6:function(){return d}});var a=n(30381),s=n.n(a),i="BUSY_POLL",o="RELEASE_POLL",r="REMOVE_POLL",l="REPLACE_POLL",c="UPDATE_POLL";function u(e){var t=!1;for(var n in e.choices)if(e.choices[n].selected){t=!0;break}return Object.assign({},e,{posted_on:s()(e.posted_on),hasSelectedChoices:t,endsOn:e.length?s()(e.posted_on).add(e.length,"days"):null,isBusy:!1})}function d(){return{type:i}}function p(){return{type:o}}function h(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:u(e)}}function f(){return{type:r}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:return Object.assign({},e,{isBusy:!0});case o:return Object.assign({},e,{isBusy:!1});case r:return{isBusy:!1};case l:return t.state;case c:return Object.assign({},e,t.data);default:return e}}},92747:function(e,t,n){"use strict";n.d(t,{Qu:function(){return o},ZB:function(){return r},ZP:function(){return u},r$:function(){return c}});var a=n(30381),s=n.n(a),i=n(6935),o="PATCH_POST";function r(e){return Object.assign({},e,{posted_on:s()(e.posted_on),updated_on:s()(e.updated_on),hidden_on:s()(e.hidden_on),attachments:e.attachments?e.attachments.map(l):null,poster:e.poster?(0,i.Ru)(e.poster):null,isSelected:!1,isBusy:!1,isDeleted:!1})}function l(e){return Object.assign({},e,{uploaded_on:s()(e.uploaded_on)})}function c(e,t){return{type:o,post:e,patch:t}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===o&&e.id==t.post.id?Object.assign({},e,t.patch):e}},21981:function(e,t,n){"use strict";n.d(t,{R3:function(){return m},Rz:function(){return Z},Vx:function(){return g},Ys:function(){return d},ZB:function(){return f},ZP:function(){return b},_H:function(){return p},kR:function(){return h},zD:function(){return v}});var a=n(92747),s="APPEND_POSTS",i="SELECT_POST",o="DESELECT_POST",r="DESELECT_POSTS",l="LOAD_POSTS",c="UNLOAD_POSTS",u="UPDATE_POSTS";function d(e){return{type:i,post:e}}function p(e){return{type:o,post:e}}function h(){return{type:r}}function f(e){return Object.assign({},e,{results:e.results.map(a.ZB),isLoaded:!0,isBusy:!1,isSelected:!1})}function v(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:f(e)}}function m(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:s,state:t?e:f(e)}}function Z(){return{type:c}}function g(e){return{type:u,update:e}}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case i:var n=e.results.map((function(e){return e.id==t.post.id?Object.assign({},e,{isSelected:!0}):e}));return Object.assign({},e,{results:n});case o:var d=e.results.map((function(e){return e.id==t.post.id?Object.assign({},e,{isSelected:!1}):e}));return Object.assign({},e,{results:d});case r:var p=e.results.map((function(e){return Object.assign({},e,{isSelected:!1})}));return Object.assign({},e,{results:p});case s:var h=e.results.slice(),f=e.results.map((function(e){return e.id}));return t.state.results.map((function(e){-1===f.indexOf(e.id)&&h.push(e)})),Object.assign({},t.state,{results:h});case l:return t.state;case c:return Object.assign({},e,{isLoaded:!1});case u:return Object.assign({},e,t.update);case a.Qu:var v=e.results.map((function(e){return(0,a.ZP)(e,t)}));return Object.assign({},e,{results:v});default:return e}}},58598:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i},zD:function(){return s}});var a="LOAD_DETAILS";function s(e){return{type:a,newState:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===a?t.newState:e}},27519:function(e,t,n){"use strict";n.d(t,{ZB:function(){return l},ZP:function(){return u},r$:function(){return c}});var a=n(30381),s=n.n(a),i=n(6935),o="HYDRATE_PROFILE",r="PATCH_PROFILE";function l(e){return{type:o,profile:e}}function c(e){return{type:r,patch:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return Object.assign({},t.profile,{joined_on:s()(t.profile.joined_on),status:(0,i.$q)(t.profile.status)});case r:return Object.assign({},e,t.patch);case i.oB:return e.id===t.userId?Object.assign({},e,{avatars:t.avatars}):e;case i.D9:return e.id===t.userId?Object.assign({},e,{username:t.username,slug:t.slug}):e;default:return e}}},16427:function(e,t,n){"use strict";n.d(t,{E3:function(){return o},P0:function(){return l},Vx:function(){return r},ZP:function(){return c}});var a="REPLACE_SEARCH",s="UPDATE_SEARCH",i="UPDATE_SEARCH_PROVIDER",o={isLoading:!1,query:"",providers:[]};function r(e){return{type:s,update:e}}function l(e){return{type:i,provider:e}}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case a:return t.state;case s:return Object.assign({},e,t.update);case i:return Object.assign({},e,{providers:e.providers.map((function(e){return e.id===t.provider.id?t.provider:e}))});default:return e}}},77751:function(e,t,n){"use strict";n.d(t,{$6:function(){return r},YP:function(){return l},ZP:function(){return u},wc:function(){return c}});var a=n(20370),s="SELECT_ALL",i="SELECT_NONE",o="SELECT_ITEM";function r(e){return{type:s,items:e}}function l(){return{type:i}}function c(e){return{type:o,item:e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case s:return t.items;case i:return[];case o:return(0,a.ZN)(e,t.item);default:return e}}},27346:function(e,t,n){"use strict";n.d(t,{E3:function(){return a},OV:function(){return o},ZP:function(){return l},p2:function(){return r}});var a={type:"info",message:"",isVisible:!1},s="SHOW_SNACKBAR",i="HIDE_SNACKBAR";function o(e,t){return{type:s,message:e,messageType:t}}function r(){return{type:i}}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===s?{type:t.messageType,message:t.message,isVisible:!0}:t.type===i?Object.assign({},e,{isVisible:!1}):e}},7738:function(e,t,n){"use strict";n.d(t,{Ar:function(){return h},Vx:function(){return v},ZB:function(){return d},ZP:function(){return Z},gx:function(){return f},n6:function(){return p},y8:function(){return m}});var a=n(30381),s=n.n(a),i=n(59752),o="BUSY_THREAD",r="RELEASE_THREAD",l="REPLACE_THREAD",c="UPDATE_THREAD",u="UPDATE_THREAD_ACL";function d(e){return Object.assign({},e,{started_on:s()(e.started_on),last_post_on:s()(e.last_post_on),best_answer_marked_on:e.best_answer_marked_on?s()(e.best_answer_marked_on):null,isBusy:!1})}function p(){return{type:o}}function h(){return{type:r}}function f(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:l,state:t?e:d(e)}}function v(e){return{type:c,data:e}}function m(e){return{type:u,data:e}}function Z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return Object.assign({},e,{isBusy:!0});case r:return Object.assign({},e,{isBusy:!1});case i.ZH:return Object.assign({},e,{poll:null});case i.b9:return Object.assign({},e,{poll:t.state});case l:return t.state;case c:return Object.assign({},e,t.data);case u:var n=Object.assign({},e.acl,t.data);return Object.assign({},e,{acl:n});default:return e}}},61340:function(e,t,n){"use strict";n.d(t,{R3:function(){return h},V8:function(){return v},ZB:function(){return m},ZP:function(){return b},l8:function(){return f},r$:function(){return Z}});var a=n(30381),s=n.n(a),i=n(89759),o="APPEND_THREADS",r="DELETE_THREAD",l="FILTER_THREADS",c="HYDRATE_THREADS",u="PATCH_THREAD",d="SORT_THREADS",p=["can_announce","can_approve","can_close","can_hide","can_move","can_merge","can_pin","can_review"];function h(e,t){return{type:o,items:e,sorting:t}}function f(e){return{type:r,thread:e}}function v(e,t){return{type:l,category:e,categoriesMap:t}}function m(e){return{type:c,items:e}}function Z(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return{type:u,thread:e,patch:t,sorting:n}}function g(e){return Object.assign({},e,{started_on:s()(e.started_on),last_post_on:s()(e.last_post_on),moderation:(t=e.acl,n=[],p.forEach((function(e){t[e]&&n.push(e)})),n)});var t,n}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:var n=(0,i.Z)(t.items.map(g),e);return n.sort(t.sorting);case r:return e.filter((function(e){return e.id!==t.thread.id}));case l:return e.filter((function(e){var n=t.categoriesMap[e.category];return n.lft>=t.category.lft&&n.rght<=t.category.rght||2==e.weight}));case c:return t.items.map(g);case u:var a=e.map((function(e){return e.id===t.thread.id?Object.assign({},e,t.patch):e}));return t.sorting?a.sort(t.sorting):a;case d:return e.sort(t.sorting);default:return e}}},85586:function(e,t,n){"use strict";n.d(t,{E3:function(){return a},ZP:function(){return o},bq:function(){return i}});var a={tick:0},s="TICK";function i(){return{type:s}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.type===s?Object.assign({},e,{tick:e.tick+1}):e}},48927:function(e,t,n){"use strict";n.d(t,{KP:function(){return u},R3:function(){return d},ZB:function(){return p},ZP:function(){return f}});var a=n(30381),s=n.n(a),i=n(6935),o=n(89759),r="ADD_NAME_CHANGE",l="APPEND_HISTORY",c="HYDRATE_HISTORY";function u(e,t,n){return{type:r,change:e,user:t,changedBy:n}}function d(e){return{type:l,items:e}}function p(e){return{type:c,items:e}}function h(e){return Object.assign({},e,{changed_on:s()(e.changed_on)})}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case r:var n=e.slice();return n.unshift({id:Math.floor(Date.now()/1e3),changed_by:t.changedBy,changed_by_username:t.changedBy.username,changed_on:s()(),new_username:t.change.username,old_username:t.user.username}),n;case l:return(0,o.Z)(e,t.items.map(h));case c:return t.items.map(h);case i.oB:return e.map((function(e){return(e=Object.assign({},e)).changed_by&&e.changed_by.id===t.userId&&(e.changed_by=Object.assign({},e.changed_by,{avatars:t.avatars})),e}));case i.D9:return e.map((function(e){return(e=Object.assign({},e)).changed_by&&e.changed_by.id===t.userId&&(e.changed_by=Object.assign({},e.changed_by,{username:t.username,slug:t.slug})),Object.assign({},e)}));default:return e}}},6935:function(e,t,n){"use strict";n.d(t,{$q:function(){return p},D9:function(){return c},R3:function(){return u},Ru:function(){return h},ZB:function(){return d},ZP:function(){return m},_S:function(){return v},n1:function(){return f},oB:function(){return l}});var a=n(30381),s=n.n(a),i=n(89759),o="APPEND_USERS",r="HYDRATE_USERS",l="UPDATE_AVATAR",c="UPDATE_USERNAME";function u(e){return{type:o,items:e}}function d(e){return{type:r,items:e}}function p(e){return e?Object.assign({},e,{last_click:e.last_click?s()(e.last_click):null,banned_until:e.banned_until?s()(e.banned_until):null}):null}function h(e){return Object.assign({},e,{joined_on:s()(e.joined_on),status:p(e.status)})}function f(e,t){return{type:l,userId:e.id,avatars:t}}function v(e,t,n){return{type:c,userId:e.id,username:t,slug:n}}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(t.type){case o:return(0,i.Z)(e,t.items.map(h));case r:return t.items.map(h);case l:return e.map((function(e){return(e=Object.assign({},e)).id===t.userId&&(e.avatars=t.avatars),e}));default:return e}}},78657:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(19755),o=function(){function e(){(0,a.Z)(this,e),this._cookieName=null,this._csrfToken=null,this._locks={}}return(0,s.Z)(e,[{key:"init",value:function(e){this._cookieName=e}},{key:"getCsrfToken",value:function(){if(-1!==document.cookie.indexOf(this._cookieName)){var e=new RegExp(this._cookieName+"=([^;]*)"),t=document.cookie.match(e)[0];return t?t.split("=")[1]:null}return null}},{key:"request",value:function(e,t,n){var a=this;return new Promise((function(s,o){var r={url:t,method:e,headers:{"X-CSRFToken":a.getCsrfToken()},data:n?JSON.stringify(n):null,contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){s(e)},error:function(e){var t=e.responseJSON||{};t.status=e.status,0===t.status&&(t.detail=gettext("Lost connection with application.")),404===t.status&&(t.detail&&"NOT FOUND"!==t.detail||(t.detail=gettext("Action link is invalid."))),500!==t.status||t.detail||(t.detail=gettext("Unknown error has occured.")),t.statusText=e.statusText,o(t)}};i.ajax(r)}))}},{key:"get",value:function(e,t,n){if(t&&(e+="?"+i.param(t)),n){var a=this;return this._locks[n]&&(this._locks[n].url=e),this._locks[n]&&this._locks[n].waiter?{then:function(){}}:this._locks[n]&&this._locks[n].wait?(this._locks[n].waiter=!0,new Promise((function(t,s){var i=function e(i){a._locks[n].wait?window.setTimeout((function(){e(i)}),300):a._locks[n].url!==i?e(a._locks[n].url):(a._locks[n].waiter=!1,a.request("GET",a._locks[n].url).then((function(s){a._locks[n].url===i?t(s):(a._locks[n].waiter=!0,e(a._locks[n].url))}),(function(t){a._locks[n].url===i?s(t):(a._locks[n].waiter=!0,e(a._locks[n].url))})))};window.setTimeout((function(){i(e)}),300)}))):(this._locks[n]={url:e,wait:!0,waiter:!1},new Promise((function(t,s){a.request("GET",e).then((function(s){a._locks[n].wait=!1,a._locks[n].url===e&&t(s)}),(function(t){a._locks[n].wait=!1,a._locks[n].url===e&&s(t)}))})))}return this.request("GET",e)}},{key:"post",value:function(e,t){return this.request("POST",e,t)}},{key:"patch",value:function(e,t){return this.request("PATCH",e,t)}},{key:"put",value:function(e,t){return this.request("PUT",e,t)}},{key:"delete",value:function(e,t){return this.request("DELETE",e,t)}},{key:"upload",value:function(e,t,n){var a=this;return new Promise((function(s,o){var r={url:e,method:"POST",headers:{"X-CSRFToken":a.getCsrfToken()},data:t,contentType:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",(function(e){e.lengthComputable&&n(Math.round(e.loaded/e.total*100))}),!1),e},success:function(e){s(e)},error:function(e){var t=e.responseJSON||{};t.status=e.status,0===t.status&&(t.detail=gettext("Lost connection with application.")),413!==t.status||t.detail||(t.detail=gettext("Upload was rejected by server as too large.")),404===t.status&&(t.detail&&"NOT FOUND"!==t.detail||(t.detail=gettext("Action link is invalid."))),500!==t.status||t.detail||(t.detail=gettext("Unknown error has occured.")),t.statusText=e.statusText,o(t)}};i.ajax(r)}))}}]),e}();t.Z=new o},98274:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(35486),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t,n){this._store=e,this._local=t,this._modal=n,this.syncSession(),this.watchState()}},{key:"syncSession",value:function(){var e=this._store.getState().auth;e.isAuthenticated?this._local.set("auth",{isAuthenticated:!0,username:e.user.username}):this._local.set("auth",{isAuthenticated:!1})}},{key:"watchState",value:function(){var e=this,t=this._store.getState().auth;this._local.watch("auth",(function(n){n.isAuthenticated?e._store.dispatch((0,i.zB)({username:n.username})):t.isAuthenticated&&e._store.dispatch((0,i.w7)())})),this._modal.hide()}},{key:"signIn",value:function(e){this._store.dispatch((0,i.zB)(e)),this._local.set("auth",{isAuthenticated:!0,username:e.username}),this._modal.hide()}},{key:"signOut",value:function(){this._store.dispatch((0,i.w7)()),this._local.set("auth",{isAuthenticated:!1}),this._modal.hide()}},{key:"softSignOut",value:function(){this._store.dispatch((0,i.w7)(!0)),this._local.set("auth",{isAuthenticated:!1}),this._modal.hide()}}]),e}();t.Z=new o},93825:function(e,t,n){"use strict";var a,s=n(22928),i=n(79340),o=n(6215),r=n(61120),l=n(15671),c=n(43144),u=n(57588),d=n.n(u),p=n(96359);function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=(0,r.Z)(e);if(t){var s=(0,r.Z)(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return(0,o.Z)(this,n)}}var f=function(){function e(){(0,l.Z)(this,e)}return(0,c.Z)(e,[{key:"init",value:function(e,t,n,a){this._context=e,this._ajax=t,this._include=n,this._snackbar=a}}]),e}(),v=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){return new Promise((function(e){e()}))}},{key:"validator",value:function(){return null}},{key:"component",value:function(){return null}}]),n}(f),m=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){var e=this;return new Promise((function(t,n){e._ajax.get(e._context.get("CAPTCHA_API")).then((function(n){e.question=n.question,e.helpText=n.help_text,t()}),(function(){e._snackbar.error(gettext("Failed to load CAPTCHA.")),n()}))}))}},{key:"validator",value:function(){return[]}},{key:"component",value:function(e){return(0,s.Z)(p.Z,{label:this.question,for:"id_captcha",labelClass:e.labelClass||"",controlClass:e.controlClass||"",validation:e.form.state.errors.captcha,helpText:this.helpText||null},void 0,(0,s.Z)("input",{"aria-describedby":"id_captcha_status",className:"form-control",disabled:e.form.state.isLoading,id:"id_captcha",onChange:e.form.bindInput("captcha"),type:"text",value:e.form.state.captcha}))}}]),n}(f),Z=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"componentDidMount",value:function(){var e=this;grecaptcha.render("recaptcha",{sitekey:this.props.siteKey,callback:function(t){e.props.binding({target:{value:t}})}})}},{key:"render",value:function(){return a||(a=(0,s.Z)("div",{id:"recaptcha"}))}}]),n}(d().Component),g=function(e){(0,i.Z)(n,e);var t=h(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,c.Z)(n,[{key:"load",value:function(){return this._include.include("https://www.google.com/recaptcha/api.js",!0),new Promise((function(e){!function t(){"undefined"==typeof grecaptcha?window.setTimeout((function(){t()}),200):e()}()}))}},{key:"validator",value:function(){return[]}},{key:"component",value:function(e){return(0,s.Z)(p.Z,{label:gettext("Please solve the quick test"),for:"id_captcha",labelClass:e.labelClass||"",controlClass:e.controlClass||"",validation:e.form.state.errors.captcha,helpText:gettext("This test helps us prevent automated spam registrations on our site.")},void 0,(0,s.Z)(Z,{binding:e.form.bindInput("captcha"),siteKey:this._context.get("SETTINGS").recaptcha_site_key}))}}]),n}(f),b=function(){function e(){(0,l.Z)(this,e)}return(0,c.Z)(e,[{key:"init",value:function(e,t,n,a){switch(e.get("SETTINGS").captcha_type){case"no":this._captcha=new v;break;case"qa":this._captcha=new m;break;case"re":this._captcha=new g}this._captcha.init(e,t,n,a)}},{key:"load",value:function(){return this._captcha.load()}},{key:"validator",value:function(){return this._captcha.validator()}},{key:"component",value:function(e){return this._captcha.component(e)}}]),e}();t.ZP=new b},96142:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(19755),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._staticUrl=e,this._included=[]}},{key:"include",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];-1===this._included.indexOf(e)&&(this._included.push(e),this._include(e,t))}},{key:"_include",value:function(e,t){i.ajax({url:(t?"":this._staticUrl)+e,cache:!0,dataType:"script"})}}]),e}();t.Z=new o},62833:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=window.localStorage,o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){var t=this;this._prefix=e,this._watchers=[],window.addEventListener("storage",(function(e){var n=JSON.parse(e.newValue);t._watchers.forEach((function(t){t.key===e.key&&e.oldValue!==e.newValue&&t.callback(n)}))}))}},{key:"set",value:function(e,t){i.setItem(this._prefix+e,JSON.stringify(t))}},{key:"get",value:function(e){var t=i.getItem(this._prefix+e);return t?JSON.parse(t):null}},{key:"watch",value:function(e,t){this._watchers.push({key:this._prefix+e,callback:t})}}]),e}();t.Z=new o},8621:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(4869),o=n(19755),r=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._element=e,this._component=null}},{key:"show",value:function(e){this._component===e?this.hide():(this._component=e,(0,i.Z)(e,this._element.id),o(this._element).addClass("open"))}},{key:"showConnected",value:function(e,t){this._component===e?this.hide():(this._component=e,(0,i.Z)(t,this._element.id,!0),o(this._element).addClass("open"))}},{key:"hide",value:function(){o(this._element).removeClass("open"),this._component=null}}]),e}();t.Z=new r},59801:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(73935),o=n.n(i),r=n(4869),l=n(19755),c=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){var t=this;this._element=e,this._modal=l(e).modal({show:!1}),this._modal.on("hidden.bs.modal",(function(){o().unmountComponentAtNode(t._element)}))}},{key:"show",value:function(e){(0,r.Z)(e,this._element.id),this._modal.modal("show")}},{key:"hide",value:function(){this._modal.modal("hide")}}]),e}();t.Z=new c},53328:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t){this._indexTitle=e,this._forumName=t}},{key:"set",value:function(e){if(e){"string"==typeof e&&(e={title:e});var t=e.title;e.page>1&&(t+=" ("+interpolate(gettext("page: %(page)s"),{page:e.page},!0)+")"),e.parent&&(t+=" | "+e.parent),document.title=t+" | "+this._forumName}else document.title=this._indexTitle||this._forumName}}]),e}();t.Z=new i},55547:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e,t){this._ajax=e,this._snackbar=t,this._polls={}}},{key:"start",value:function(e){var t=this;this.stop(e.poll);var n=function n(){t._polls[e.poll]=e,t._ajax.get(e.url,e.data||null).then((function(a){t._polls[e.poll]._stopped||(e.update(a),t._polls[e.poll].timeout=window.setTimeout(n,e.frequency))}),(function(n){t._polls[e.poll]._stopped||(e.error?e.error(n):t._snackbar.apiError(n))}))};e.delayed?this._polls[e.poll]={timeout:window.setTimeout(n,e.frequency)}:n()}},{key:"stop",value:function(e){this._polls[e]&&(window.clearTimeout(this._polls[e].timeout),this._polls[e]._stopped=!0)}}]),e}();t.Z=new i},27950:function(e,t,n){"use strict";n.d(t,{Z:function(){return ft}});var a=n(15671),s=n(43144),i=n(4942),o=n(57588),r=n.n(o),l=n(73935),c=n.n(l),u=n(91876),d=n(22928),p=n(97326),h=n(79340),f=n(6215),v=n(61120),m=n(57026),Z=n(87462);var g,b,y,_=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){e.props.replaceSelection(e.props.execAction)})),e}return(0,s.Z)(r,[{key:"render",value:function(){return(0,d.Z)("button",{className:"btn btn-icon "+this.props.className,disabled:this.props.disabled,onClick:this.onClick,title:this.props.title,type:"button"},void 0,this.props.children)}}]),r}(r().Component),N=n(19755);function k(e){return r().createElement(_,(0,Z.Z)({execAction:x,title:gettext("Insert code")},e),g||(g=(0,d.Z)("span",{className:"material-icon"},void 0,"functions")))}function x(e,t){t("\n\n```"+N.trim(prompt(gettext("Enter name of syntax of your code (optional)")+":"))+"\n"+e+"\n```\n\n")}function w(e){return r().createElement(_,(0,Z.Z)({execAction:R,title:gettext("Emphase selection")},e),b||(b=(0,d.Z)("span",{className:"material-icon"},void 0,"format_italic")))}function R(e,t){e.length&&t("*"+e+"*")}function C(e){return r().createElement(_,(0,Z.Z)({execAction:S,title:gettext("Insert horizontal ruler")},e),y||(y=(0,d.Z)("span",{className:"material-icon"},void 0,"remove")))}function S(e,t){t("\n\n- - - - -\n\n")}var E=n(19755),L=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");function P(e){return L.test(E.trim(e))}var O,T=n(19755);function A(e){return r().createElement(_,(0,Z.Z)({execAction:B,title:gettext("Insert image")},e),O||(O=(0,d.Z)("span",{className:"material-icon"},void 0,"insert_photo")))}function B(e,t){var n="",a="";e.length&&(P(e)?n=e:a=e),(n=T.trim(prompt(gettext("Enter link to image")+":",n))).length&&((a=T.trim(prompt(gettext("Enter image label (optional)")+":",a))).length>0?t("!["+a+"]("+n+")"):t("!("+n+")"))}var I,j,D,U,M=n(19755);function z(e){return r().createElement(_,(0,Z.Z)({execAction:H,title:gettext("Insert link")},e),I||(I=(0,d.Z)("span",{className:"material-icon"},void 0,"insert_link")))}function H(e,t){var n="",a="";if(e.length&&(P(e)?n=e:a=e),0===(n=M.trim(prompt(gettext("Enter link address")+":",n)||"")).length)return!1;a=M.trim(prompt(gettext("Enter link label (optional)")+":",a)),n.length&&(a.length>0?t("["+a+"]("+n+")"):t(n))}function F(e){return r().createElement(_,(0,Z.Z)({execAction:q,title:gettext("Insert spoiler")},e),j||(j=(0,d.Z)("span",{className:"material-icon"},void 0,"not_interested")))}function q(e,t){t("\n\n[spoiler]\n"+e+"\n[/spoiler]\n\n")}function Y(e){return r().createElement(_,(0,Z.Z)({execAction:V,title:gettext("Strikethrough selection")},e),D||(D=(0,d.Z)("span",{className:"material-icon"},void 0,"format_strikethrough")))}function V(e,t){e.length&&t("~~"+e+"~~")}function $(e){return r().createElement(_,(0,Z.Z)({execAction:G,title:gettext("Bolder selection")},e),U||(U=(0,d.Z)("span",{className:"material-icon"},void 0,"format_bold")))}function G(e,t){e.length&&t("**"+e+"**")}var W,K=n(19755);function J(e){return r().createElement(_,(0,Z.Z)({execAction:Q,title:gettext("Insert quote")},e),W||(W=(0,d.Z)("span",{className:"material-icon"},void 0,"format_quote")))}function Q(e,t){var n=K.trim(prompt(gettext("Enter quote autor, prefix usernames with @")+":",n));t(n?'\n\n[quote="'+n+'"]\n'+e+"\n[/quote]\n\n":"\n\n[quote]\n"+e+"\n[/quote]\n\n")}var X,ee=n(32233),te=n(89627),ne=n(48772);var ae,se=function(e){(0,h.Z)(l,e);var t,n,o=(t=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function l(){var e;(0,a.Z)(this,l);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onInsert",(function(){e.props.replaceSelection(e.insertAttachment)})),(0,i.Z)((0,p.Z)(e),"insertAttachment",(function(t,n){var a=e.props.item;a.is_image?a.url.thumb?n("[!["+a.filename+"]("+a.url.thumb+")]("+a.url.index+")"):n("[!["+a.filename+"]("+a.url.index+")]("+a.url.index+")"):n("["+a.filename+"]("+a.url.index+")")})),(0,i.Z)((0,p.Z)(e),"onRemove",(function(){e.updateItem({isRemoved:!0})})),(0,i.Z)((0,p.Z)(e),"onUndo",(function(){e.updateItem({isRemoved:!1})})),(0,i.Z)((0,p.Z)(e),"updateItem",(function(t){var n=e.props.attachments.map((function(n){return n.id===e.props.item.id?Object.assign({},n,t):n}));e.props.onAttachmentsChange(n)})),e}return(0,s.Z)(l,[{key:"render",value:function(){return(0,d.Z)("li",{className:"editor-attachment-complete"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-xs-12 col-sm-8 col-md-9"},void 0,r().createElement(ie,this.props),(0,d.Z)("div",{className:"editor-attachment-details"},void 0,r().createElement(le,this.props),r().createElement(ce,this.props))),(0,d.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3 xs-margin-top-half"},void 0,r().createElement(ue,(0,Z.Z)({onInsert:this.onInsert,onRemove:this.onRemove,onUndo:this.onUndo},this.props)))))}}]),l}(r().Component);function ie(e){return e.item.is_image?r().createElement(oe,e):r().createElement(re,e)}function oe(e){var t=e.item.url.thumb||e.item.url.index;return(0,d.Z)("div",{className:"editor-attachment-image"},void 0,(0,d.Z)("a",{href:e.item.url.index+"?shva=1",style:{backgroundImage:"url('"+t+"?shva=1')"},target:"_blank"}))}function re(e){return X||(X=(0,d.Z)("div",{className:"editor-attachment-icon"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,"insert_drive_file")))}function le(e){return(0,d.Z)("h4",{},void 0,(0,d.Z)("a",{className:"item-title",href:e.item.url.index+"?shva=1",target:"_blank"},void 0,e.item.filename))}function ce(e){var t;t=e.item.url.uploader?interpolate('<a href="%(url)s" class="item-title">%(user)s</a>',{url:(0,te.Z)(e.item.url.uploader),user:(0,te.Z)(e.item.uploader_name)},!0):interpolate('<span class="item-title">%(user)s</span>',{user:(0,te.Z)(e.item.uploader_name)},!0);var n=interpolate('<abbr title="%(absolute)s">%(relative)s</abbr>',{absolute:(0,te.Z)(e.item.uploaded_on.format("LLL")),relative:(0,te.Z)(e.item.uploaded_on.fromNow())},!0),a=interpolate((0,te.Z)(gettext("%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.item.filetype,size:(0,ne.Z)(e.item.size),uploader:t,uploaded_on:n},!0);return(0,d.Z)("p",{dangerouslySetInnerHTML:{__html:a}})}function ue(e){return(0,d.Z)("div",{className:"editor-attachment-actions"},void 0,(0,d.Z)("div",{className:"row"},void 0,r().createElement(de,e),r().createElement(pe,e),r().createElement(he,e)))}function de(e){return e.item.isRemoved?null:(0,d.Z)("div",{className:"col-xs-6"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onInsert,type:"button"},void 0,gettext("Insert")))}function pe(e){return e.item.isRemoved&&e.item.acl.can_delete?null:(0,d.Z)("div",{className:"col-xs-6"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onRemove,type:"button"},void 0,gettext("Remove")))}function he(e){return e.item.isRemoved?(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("button",{className:"btn btn-default btn-sm btn-block",onClick:e.onUndo,type:"button"},void 0,gettext("Undo removal"))):null}var fe=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){var t=e.props.attachments.filter((function(t){return t.key!==e.props.item.key}));e.props.onAttachmentsChange(t)})),e}return(0,s.Z)(r,[{key:"render",value:function(){var e=interpolate("<strong>%(name)s</strong>",{name:(0,te.Z)(this.props.item.filename)},!0),t=interpolate(gettext("Error uploading %(filename)s"),{filename:e,progress:this.props.item.progress+"%"},!0);return(0,d.Z)("li",{className:"editor-attachment-error"},void 0,ae||(ae=(0,d.Z)("div",{className:"editor-attachment-error-icon"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,"warning"))),(0,d.Z)("div",{className:"editor-attachment-error-message"},void 0,(0,d.Z)("h4",{dangerouslySetInnerHTML:{__html:t+":"}}),(0,d.Z)("p",{},void 0,this.props.item.error),(0,d.Z)("button",{className:"btn btn-default btn-sm",onClick:this.onClick,type:"button"},void 0,gettext("Dismiss"))))}}]),r}(r().Component);function ve(e){var t=interpolate("<strong>%(name)s</strong>",{name:(0,te.Z)(e.item.filename)},!0),n=interpolate(gettext("Uploading %(filename)s... %(progress)s"),{filename:t,progress:e.item.progress+"%"},!0);return(0,d.Z)("li",{className:"editor-attachment-upload"},void 0,(0,d.Z)("div",{className:"editor-attachment-progress-bar"},void 0,(0,d.Z)("div",{className:"editor-attachment-progress",style:{width:e.item.progress+"%"}})),(0,d.Z)("p",{className:"editor-attachment-upload-message",dangerouslySetInnerHTML:{__html:n}}))}function me(e){return e.item.id?r().createElement(se,e):e.item.error?r().createElement(fe,e):r().createElement(ve,e)}function Ze(e){return(0,d.Z)("ul",{className:"list-unstyled editor-attachments-list"},void 0,e.attachments.map((function(t){return r().createElement(me,(0,Z.Z)({item:t,key:t.id||t.key},e))})))}var ge=n(30381),be=n.n(ge),ye=n(78657),_e=n(53904);var Ne,ke=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onChange",(function(t){var n=t.target.files[0];if(n){var a={id:null,key:xe(),progress:0,error:null,filename:n.name};e.props.onAttachmentsChange([a].concat(e.props.attachments));var s=new FormData;s.append("upload",n),ye.Z.upload(ee.Z.get("ATTACHMENTS_API"),s,(function(t){a.progress=t,e.props.onAttachmentsChange(e.props.attachments.concat())})).then((function(t){t.uploaded_on=be()(t.uploaded_on),Object.assign(a,t),e.props.onAttachmentsChange(e.props.attachments.concat())}),(function(t){400===t.status||413===t.status?(a.error=t.detail,e.props.onAttachmentsChange(e.props.attachments.concat())):_e.Z.apiError(t)}))}})),e}return(0,s.Z)(r,[{key:"render",value:function(){return(0,d.Z)("input",{id:"editor-upload-field",onChange:this.onChange,type:"file"})}}]),r}(r().Component);function xe(){return"upld-"+Math.round((new Date).getTime())}function we(e){return ee.Z.get("user").acl.max_attachment_size?(0,d.Z)("div",{className:"editor-attachments"},void 0,r().createElement(Ze,e),r().createElement(ke,e)):null}var Re,Ce=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(){var e;(0,a.Z)(this,r);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e=o.call.apply(o,[this].concat(n)),(0,i.Z)((0,p.Z)(e),"onClick",(function(){document.getElementById("editor-upload-field").click()})),e}return(0,s.Z)(r,[{key:"render",value:function(){return ee.Z.get("user").acl.max_attachment_size?(0,d.Z)("button",{className:"btn btn-icon "+this.props.className,disabled:this.props.disabled,onClick:this.onClick,title:gettext("Upload file"),type:"button"},void 0,Ne||(Ne=(0,d.Z)("span",{className:"material-icon"},void 0,"file_upload"))):null}}]),r}(r().Component),Se=n(69092);function Ee(e){return(0,d.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,d.Z)("div",{className:"modal-content"},void 0,(0,d.Z)("div",{className:"modal-header"},void 0,(0,d.Z)("button",{"aria-label":gettext("Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Re||(Re=(0,d.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,d.Z)("h4",{className:"modal-title"},void 0,gettext("Preview message"))),(0,d.Z)("div",{className:"modal-body markup-preview"},void 0,(0,d.Z)(Se.Z,{markup:e.markup}))))}var Le=n(19755),Pe="editor-textarea";function Oe(){return document.getElementById(Pe)}function Te(e,t){return{start:e,end:t}}function Ae(){var e=Oe();if(document.selection){e.focus();var t=document.selection.createRange(),n=t.text.length;return t.moveStart("character",-e.value.length),Te(t.text.length-n,t.text.length)}if(e.selectionStart||"0"==e.selectionStart)return Te(e.selectionStart,e.selectionEnd)}function Be(e,t){var n=Oe(),a=n.value,s=a.substring(0,e.start);return n.value=a.substring(0,e.start)+t+a.substring(e.end),function(e){var t=Oe();if(t.setSelectionRange)t.focus(),t.setSelectionRange(e.start,e.end);else if(t.createTextRange){var n=t.createTextRange();n.collapse(!0),n.moveStart("character",e.start),n.moveEnd("character",e.end),n.select()}}(Te(s.length+t.length,s.length+t.length)),n.value}var Ie,je=n(82211),De=n(59801),Ue=n(19755);var Me=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"onPreviewClick",(function(){t.state.isPreviewLoading||(t.setState({isPreviewLoading:!0}),ye.Z.post(ee.Z.get("PARSE_MARKUP_API"),{post:t.props.value}).then((function(e){De.Z.show((0,d.Z)(Ee,{markup:e.parsed})),t.setState({isPreviewLoading:!1})}),(function(e){400===e.status?_e.Z.error(e.detail):_e.Z.apiError(e),t.setState({isPreviewLoading:!1})})))})),(0,i.Z)((0,p.Z)(t),"replaceSelection",(function(e){var n;e((n=Ae(),Le.trim(document.getElementById(Pe).value.substring(n.start,n.end))),t._replaceSelection)})),(0,i.Z)((0,p.Z)(t),"_replaceSelection",(function(e){var n;t.props.onChange({target:{value:(n=e,Be(Ae(),n))}})})),t.state={isPreviewLoading:!1},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){var e=this;Ue("#editor-textarea").atwho({at:"@",displayTpl:'<li><img src="${avatar}" alt="">${username}</li>',insertTpl:"@${username}",searchKey:"username",callbacks:{remoteFilter:function(e,t){Ue.getJSON(ee.Z.get("MENTION_API"),{q:e},t)}}}),Ue("#editor-textarea").on("inserted.atwho",(function(t,n,a){e.props.onChange(t)}))}},{key:"render",value:function(){return(0,d.Z)("div",{className:"editor-border"},void 0,(0,d.Z)("textarea",{className:"form-control",value:this.props.value,disabled:this.props.loading,id:"editor-textarea",onChange:this.props.onChange,rows:"9"}),(0,d.Z)("div",{className:"editor-footer"},void 0,(0,d.Z)("div",{className:"buttons-list pull-left"},void 0,(0,d.Z)($,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(w,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(Y,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(C,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(z,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(A,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(J,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(F,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(k,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,replaceSelection:this.replaceSelection}),(0,d.Z)(Ce,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading})),(0,d.Z)(je.Z,{className:"btn-default btn-sm pull-left",disabled:this.props.loading||this.state.isPreviewLoading,onClick:this.onPreviewClick,type:"button"},void 0,gettext("Preview")),(0,d.Z)(je.Z,{className:"btn-primary btn-sm pull-right",loading:this.props.loading},void 0,this.props.submitLabel||gettext("Post")),(0,d.Z)("button",{className:"btn btn-default btn-sm pull-right",disabled:this.props.loading,onClick:this.props.onCancel,type:"button"},void 0,gettext("Cancel")),Ie||(Ie=(0,d.Z)("div",{className:"clearfix visible-xs-block"})),(0,d.Z)(ze,{canProtect:this.props.canProtect,disabled:this.props.loading,onProtect:this.props.onProtect,onUnprotect:this.props.onUnprotect,protect:this.props.protect})),(0,d.Z)(we,{attachments:this.props.attachments,onAttachmentsChange:this.props.onAttachmentsChange,placeholder:this.props.placeholder,replaceSelection:this.replaceSelection}))}}]),r}(r().Component);function ze(e){if(!e.canProtect)return null;var t=e.protect?gettext("Protected"):gettext("Protect");return(0,d.Z)("button",{className:"btn btn-icon btn-default btn-protect btn-sm pull-right",disabled:e.disabled,onClick:e.protect?e.onUnprotect:e.onProtect,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.protect?"lock":"lock_outline"),(0,d.Z)("span",{className:"btn-text hidden-md hidden-lg"},void 0,t))}var He=n(43345);function Fe(e){return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("div",{className:"container"},void 0,e.children))}var qe,Ye,Ve=n(37848);function $e(e){return qe||(qe=(0,d.Z)(Fe,{className:"posting-loader"},void 0,(0,d.Z)(Ve.Z,{})))}function Ge(e){return(0,d.Z)(Fe,{className:"posting-message"},void 0,(0,d.Z)("div",{className:"message-body"},void 0,(0,d.Z)("p",{},void 0,Ye||(Ye=(0,d.Z)("span",{className:"material-icon"},void 0,"error_outline")),e.message),(0,d.Z)("button",{type:"button",className:"btn btn-default",onClick:ft.close},void 0,gettext("Dismiss"))))}function We(e){if(!e.showOptions)return null;var t=e.columns,n="col-xs-12 xs-margin-top";n+=1===t?" col-sm-2":" sm-margin-top",n+=3===t?" col-md-3":" col-md-2",n+=" posting-options";var a="col-xs-"+12/t,s="btn-text";return s+=3===t?" visible-sm-inline-block":2===t?" hidden-md hidden-lg":" hidden-sm",(0,d.Z)("div",{className:n},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)(Qe,{className:a,disabled:e.disabled,onPinGlobally:e.onPinGlobally,onPinLocally:e.onPinLocally,onUnpin:e.onUnpin,pin:e.pin,show:e.options.pin,textClassName:s}),(0,d.Z)(Je,{className:a,disabled:e.disabled,hide:e.hide,onHide:e.onHide,onUnhide:e.onUnhide,show:e.options.hide,textClassName:s}),(0,d.Z)(Ke,{className:a,close:e.close,disabled:e.disabled,onClose:e.onClose,onOpen:e.onOpen,show:e.options.close,textClassName:s})))}function Ke(e){if(!e.show)return null;var t=e.close?gettext("Closed"):gettext("Open");return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:e.close?e.onOpen:e.onClose,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.close?"lock":"lock_outline"),(0,d.Z)("span",{className:e.textClassName},void 0,t)))}function Je(e){if(!e.show)return null;var t=e.hide?gettext("Hidden"):gettext("Not hidden");return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:e.hide?e.onUnhide:e.onHide,title:t,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,e.hide?"visibility_off":"visibility"),(0,d.Z)("span",{className:e.textClassName},void 0,t)))}function Qe(e){if(!e.show)return null;var t=null,n=null,a=null;switch(e.pin){case 0:t="radio_button_unchecked",n=e.onPinLocally,a=gettext("Unpinned");break;case 1:t="bookmark_outline",n=e.onPinGlobally,a=gettext("Pinned locally"),n=2==e.show?e.onPinGlobally:e.onUnpin;break;case 2:t="bookmark",n=e.onUnpin,a=gettext("Pinned globally")}return(0,d.Z)("div",{className:e.className},void 0,(0,d.Z)("button",{className:"btn btn-default btn-block",disabled:e.disabled,onClick:n,title:a,type:"button"},void 0,(0,d.Z)("span",{className:"material-icon"},void 0,t),(0,d.Z)("span",{className:e.textClassName},void 0,a)))}function Xe(e){var t=e.filter((function(e){return e.id&&!e.isRemoved}));return t.map((function(e){return e.id}))}function et(e){return e.map((function(e){return Object.assign({},e,{uploaded_on:be()(e.uploaded_on)})}))}var tt,nt=n(12891);var at=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){var n=null,a=!1,s=null,i=e.map((function(e){return!1===e.post||n&&e.id!=t.state.category||(n=e.id,s=e.post),e.post&&(e.post.close||e.post.hide||e.post.pin)&&(a=!0),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id})}));t.setState({isReady:!0,showOptions:a,categories:i,category:n,categoryOptions:s})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard thread?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onCategoryChange",(function(e){var n=t.state.categories.find((function(t){return e.target.value==t.value})),a=t.state.pin;n.post.pin&&n.post.pin<a&&(a=n.post.pin),t.setState({category:n.id,categoryOptions:n.post,pin:a})})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),(0,i.Z)((0,p.Z)(t),"onClose",(function(){t.changeValue("close",!0)})),(0,i.Z)((0,p.Z)(t),"onOpen",(function(){t.changeValue("close",!1)})),(0,i.Z)((0,p.Z)(t),"onPinGlobally",(function(){t.changeValue("pin",2)})),(0,i.Z)((0,p.Z)(t),"onPinLocally",(function(){t.changeValue("pin",1)})),(0,i.Z)((0,p.Z)(t),"onUnpin",(function(){t.changeValue("pin",0)})),(0,i.Z)((0,p.Z)(t),"onHide",(function(){t.changeValue("hide",!0)})),(0,i.Z)((0,p.Z)(t),"onUnhide",(function(){t.changeValue("hide",!1)})),t.state={isReady:!1,isLoading:!1,isErrored:!1,showOptions:!1,categoryOptions:null,title:"",category:e.category||null,categories:[],post:"",attachments:[],close:!1,hide:!1,pin:0,validators:{title:(0,nt.jn)(),post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config).then(this.loadSuccess,this.loadError)}},{key:"clean",value:function(){if(!this.state.title.trim().length)return _e.Z.error(gettext("You have to enter thread title.")),!1;if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return e.title?(_e.Z.error(e.title[0]),!1):!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{title:this.state.title,category:this.state.category,post:this.state.post,attachments:Xe(this.state.attachments),close:this.state.close,hide:this.state.hide,pin:this.state.pin})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your thread has been posted.")),window.location=e.url,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){if(this.state.isErrored)return(0,d.Z)(Ge,{message:this.state.isErrored});if(!this.state.isReady)return tt||(tt=(0,d.Z)($e,{}));var e=0;this.state.categoryOptions.close&&(e+=1),this.state.categoryOptions.hide&&(e+=1),this.state.categoryOptions.pin&&(e+=1);var t=null;return t=1===e?"col-sm-6":"col-sm-8",t+=3===e?" col-md-6":e?" col-md-7":" col-md-9",(0,d.Z)(Fe,{className:"posting-form",withFirstRow:!0},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:t},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:gettext("Thread title"),type:"text",value:this.state.title})),(0,d.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3 xs-margin-top"},void 0,(0,d.Z)(m.Z,{choices:this.state.categories,disabled:this.state.isLoading,onChange:this.onCategoryChange,value:this.state.category})),(0,d.Z)(We,{close:this.state.close,columns:e,disabled:this.state.isLoading,hide:this.state.hide,onClose:this.onClose,onHide:this.onHide,onOpen:this.onOpen,onPinGlobally:this.onPinGlobally,onPinLocally:this.onPinLocally,onUnhide:this.onUnhide,onUnpin:this.onUnpin,options:this.state.categoryOptions,pin:this.state.pin,showOptions:this.state.showOptions})),(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Me,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post thread"),value:this.state.post})))))}}]),r}(He.Z);function st(e){var t=e.split(",").map((function(e){return e.trim().toLowerCase()})).filter((function(e){return e.length>0}));return t.filter((function(e,n){return t.indexOf(e)==n}))}var it,ot=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard private thread?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onToChange",(function(e){t.changeValue("to",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})}));var n=(e.to||[]).map((function(e){return e.username})).join(", ");return t.state={isLoading:!1,to:n,title:"",post:"",attachments:[],validators:{title:(0,nt.jn)(),post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"clean",value:function(){if(!st(this.state.to).length)return _e.Z.error(gettext("You have to enter at least one recipient.")),!1;if(!this.state.title.trim().length)return _e.Z.error(gettext("You have to enter thread title.")),!1;if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return e.title?(_e.Z.error(e.title[0]),!1):!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{to:st(this.state.to),title:this.state.title,post:this.state.post,attachments:Xe(this.state.attachments)})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your thread has been posted.")),window.location=e.url,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.to||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return(0,d.Z)(Fe,{className:"posting-form",withFirstRow:!0},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onToChange,placeholder:gettext("Comma separated list of user names, eg.: Danny, Lisa"),type:"text",value:this.state.to}))),(0,d.Z)("div",{className:"row first-row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:gettext("Thread title"),type:"text",value:this.state.title}))),(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-xs-12"},void 0,(0,d.Z)(Me,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post thread"),value:this.state.post})))))}}]),r}(He.Z);var rt,lt=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){t.setState({isReady:!0,post:e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":""})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"appendData",(function(e){var n=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";t.setState((function(e,t){return e.post.length>0?{post:e.post+"\n\n"+n}:{post:n}}))})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard your reply?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),t.state={isReady:!1,isLoading:!1,isErrored:!1,post:"",attachments:[],validators:{post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config,this.props.context||null).then(this.loadSuccess,this.loadError)}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.context,n=e.context;t&&n&&t.reply===n.reply||ye.Z.get(e.config,e.context||null).then(this.appendData,_e.Z.apiError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.post(this.props.submit,{post:this.state.post,attachments:Xe(this.state.attachments)})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Your reply has been posted.")),window.location=e.url.index,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,d.Z)(Fe,{className:"posting-form"},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit,method:"POST"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Me,{attachments:this.state.attachments,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,submitLabel:gettext("Post reply"),value:this.state.post}))))):this.state.isErrored?(0,d.Z)(Ge,{message:this.state.isErrored}):it||(it=(0,d.Z)($e,{}))}}]),r}(He.Z);var ct=function(e){(0,h.Z)(r,e);var t,n,o=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,v.Z)(t);if(n){var s=(0,v.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,f.Z)(this,e)});function r(e){var t;return(0,a.Z)(this,r),t=o.call(this,e),(0,i.Z)((0,p.Z)(t),"loadSuccess",(function(e){t.setState({isReady:!0,post:e.post,attachments:et(e.attachments),protect:e.is_protected,canProtect:e.can_protect})})),(0,i.Z)((0,p.Z)(t),"loadError",(function(e){t.setState({isErrored:e.detail})})),(0,i.Z)((0,p.Z)(t),"onCancel",(function(){window.confirm(gettext("Are you sure you want to discard changes?"))&&ft.close()})),(0,i.Z)((0,p.Z)(t),"onProtect",(function(){t.setState({protect:!0})})),(0,i.Z)((0,p.Z)(t),"onUnprotect",(function(){t.setState({protect:!1})})),(0,i.Z)((0,p.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,i.Z)((0,p.Z)(t),"onAttachmentsChange",(function(e){t.setState({attachments:e})})),t.state={isReady:!1,isLoading:!1,isErrored:!1,post:"",attachments:[],protect:!1,canProtect:!1,validators:{post:(0,nt.Jh)()},errors:{}},t}return(0,s.Z)(r,[{key:"componentDidMount",value:function(){ye.Z.get(this.props.config).then(this.loadSuccess,this.loadError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return _e.Z.error(gettext("You have to enter a message.")),!1;var e=this.validate();return!e.post||(_e.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return ye.Z.put(this.props.submit,{post:this.state.post,attachments:Xe(this.state.attachments),protect:this.state.protect})}},{key:"handleSuccess",value:function(e){_e.Z.success(gettext("Reply has been edited.")),window.location=e.url.index,this.setState({isLoading:!0})}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);_e.Z.error(t[0])}else _e.Z.apiError(e)}},{key:"render",value:function(){return this.state.isReady?(0,d.Z)(Fe,{className:"posting-form"},void 0,(0,d.Z)("form",{onSubmit:this.handleSubmit,method:"POST"},void 0,(0,d.Z)("div",{className:"row"},void 0,(0,d.Z)("div",{className:"col-md-12"},void 0,(0,d.Z)(Me,{attachments:this.state.attachments,canProtect:this.state.canProtect,loading:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onCancel:this.onCancel,onChange:this.onPostChange,onProtect:this.onProtect,onUnprotect:this.onUnprotect,protect:this.state.protect,submitLabel:gettext("Edit reply"),value:this.state.post}))))):this.state.isErrored?(0,d.Z)(Ge,{message:this.state.isErrored}):rt||(rt=(0,d.Z)($e,{}))}}]),r}(He.Z);function ut(e){return"START"===e.mode?r().createElement(at,e):"START_PRIVATE"===e.mode?r().createElement(ot,e):"REPLY"===e.mode?r().createElement(lt,e):"EDIT"===e.mode?r().createElement(ct,e):null}var dt=n(4869),pt=n(19755),ht=function(){function e(){var t=this;(0,a.Z)(this,e),(0,i.Z)(this,"close",(function(){t._isOpen&&!t._isClosing&&(t._isClosing=!0,t._placeholder.removeClass("slide-in"),window.setTimeout((function(){c().unmountComponentAtNode(document.getElementById("posting-mount")),t._isClosing=!1,t._isOpen=!1}),300))}))}return(0,s.Z)(e,[{key:"init",value:function(e,t,n){this._ajax=e,this._snackbar=t,this._placeholder=pt(n),this._mode=null,this._isOpen=!1,this._isClosing=!1}},{key:"open",value:function(e){if(!1===this._isOpen)this._mode=e.mode,this._isOpen=e.submit,this._realOpen(e);else if(this._isOpen!==e.submit){var t=gettext("You are already working on other message. Do you want to discard it?");"POLL"==this._mode&&(t=gettext("You are already working on a poll. Do you want to discard it?")),window.confirm(t)&&(this._mode=e.mode,this._isOpen=e.submit,this._realOpen(e))}else"REPLY"==this._mode&&"REPLY"==e.mode&&this._realOpen(e)}},{key:"_realOpen",value:function(e){"POLL"==e.mode?(0,dt.Z)(r().createElement(u.y,e),"posting-mount"):(0,dt.Z)(r().createElement(ut,e),"posting-mount"),this._placeholder.addClass("slide-in"),pt("html, body").animate({scrollTop:this._placeholder.offset().top},1e3)}}]),e}(),ft=new ht},53904:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(27346),o=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._store=e,this._timeout=null}},{key:"alert",value:function(e,t){var n=this;this._timeout?(window.clearTimeout(this._timeout),this._store.dispatch((0,i.p2)()),this._timeout=window.setTimeout((function(){n._timeout=null,n.alert(e,t)}),300)):(this._store.dispatch((0,i.OV)(e,t)),this._timeout=window.setTimeout((function(){n._store.dispatch((0,i.p2)()),n._timeout=null}),5e3))}},{key:"info",value:function(e){this.alert(e,"info")}},{key:"success",value:function(e){this.alert(e,"success")}},{key:"warning",value:function(e){this.alert(e,"warning")}},{key:"error",value:function(e){this.alert(e,"error")}},{key:"apiError",value:function(e){var t=e.detail;t||(t=404===e.status?gettext("Action link is invalid."):gettext("Unknown error has occured.")),403===e.status&&"Permission denied"===t&&(t=gettext("You don't have permission to perform this action.")),this.error(t)}}]),e}();t.Z=new o},90287:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=n(41438),o=function(){function e(){(0,a.Z)(this,e),this._store=null,this._reducers={},this._initialState={}}return(0,s.Z)(e,[{key:"addReducer",value:function(e,t,n){this._reducers[e]=t,this._initialState[e]=n}},{key:"init",value:function(){this._store=(0,i.createStore)((0,i.combineReducers)(this._reducers),this._initialState)}},{key:"getStore",value:function(){return this._store}},{key:"getState",value:function(){return this._store.getState()}},{key:"dispatch",value:function(e){return this._store.dispatch(e)}}]),e}();t.Z=new o},59940:function(e,t,n){"use strict";var a=n(15671),s=n(43144),i=function(){function e(){(0,a.Z)(this,e)}return(0,s.Z)(e,[{key:"init",value:function(e){this._include=e,this._isLoaded=!1}},{key:"scorePassword",value:function(e,t){return this._isLoaded?zxcvbn(e,t).score:0}},{key:"load",value:function(){return this._isLoaded?this._loadedPromise():(this._include.include("misago/js/zxcvbn.js"),this._loadingPromise())}},{key:"_loadingPromise",value:function(){var e=this;return new Promise((function(t,n){!function a(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(s+=1)>200?n():"undefined"==typeof zxcvbn?window.setTimeout((function(){a(s)}),200):(e._isLoaded=!0,t())}()}))}},{key:"_loadedPromise",value:function(){return new Promise((function(e){e()}))}}]),e}();t.Z=new i},93051:function(e,t,n){"use strict";n.d(t,{Z:function(){return _}});var a,s=n(22928),i=n(30381),o=n.n(i),r=n(57588),l=n.n(r),c=n(73935),u=n.n(c),d=n(37424),p=n(15671),h=n(43144),f=n(79340),v=n(6215),m=n(61120);var Z=function(e){(0,f.Z)(r,e);var t,n,i=(t=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,a=(0,m.Z)(t);if(n){var s=(0,m.Z)(this).constructor;e=Reflect.construct(a,arguments,s)}else e=a.apply(this,arguments);return(0,v.Z)(this,e)});function r(){return(0,p.Z)(this,r),i.apply(this,arguments)}return(0,h.Z)(r,[{key:"getReasonMessage",value:function(){return this.props.message.html?(0,s.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.props.message.html}}):(0,s.Z)("p",{className:"lead"},void 0,this.props.message.plain)}},{key:"getExpirationMessage",value:function(){if(this.props.expires){if(this.props.expires.isAfter(o()())){var e=interpolate(gettext("This ban expires on %(expires_on)s."),{expires_on:this.props.expires.format("LL, LT")},!0),t=interpolate(gettext("This ban expires %(expires_on)s."),{expires_on:this.props.expires.fromNow()},!0);return(0,s.Z)("abbr",{title:e},void 0,t)}return gettext("This ban has expired.")}return gettext("This ban is permanent.")}},{key:"render",value:function(){return(0,s.Z)("div",{className:"page page-error page-error-banned"},void 0,(0,s.Z)("div",{className:"container"},void 0,(0,s.Z)("div",{className:"message-panel"},void 0,a||(a=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"highlight_off"))),(0,s.Z)("div",{className:"message-body"},void 0,this.getReasonMessage(),(0,s.Z)("p",{className:"message-footnote"},void 0,this.getExpirationMessage())))))}}]),r}(l().Component),g=n(32233),b=n(90287),y=(0,d.$j)((function(e){return e.tick}))(Z);function _(e,t){if(u().render((0,s.Z)(d.zt,{store:b.Z.getStore()},void 0,(0,s.Z)(y,{message:e.message,expires:e.expires_on?o()(e.expires_on):null})),document.getElementById("page-mount")),void 0===t||t){var n=g.Z.get("SETTINGS").forum_name;document.title=gettext("You are banned")+" | "+n,window.history.pushState({},"",g.Z.get("BANNED_URL"))}}},69130:function(e,t,n){"use strict";function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=[],s=[];if(e.forEach((function(e){s.push(e),s.length===t&&(a.push(s),s=[])})),!1!==n&&s.length>0&&s.length<t)for(var i=s.length;i<t;i++)s.push(n);return s.length&&a.push(s),a}n.d(t,{Z:function(){return a}})},89759:function(e,t,n){"use strict";function a(e,t){var n=[];return e.concat(t).filter((function(e){return-1===n.indexOf(e.id)&&(n.push(e.id),!0)}))}n.d(t,{Z:function(){return a}})},89627:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function s(e){return e.replace(/[&<>"']/g,(function(e){return a[e]}))}},48772:function(e,t,n){"use strict";function a(e){return e>1073741824?s(e/1073741824)+" GB":e>1048576?s(e/1048576)+" MB":e>1024?s(e/1024)+" KB":s(e)+" B"}function s(e){return e.toFixed(1)}n.d(t,{Z:function(){return a}})},4869:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var a=n(22928),s=(n(57588),n(73935)),i=n.n(s),o=n(37424),r=n(90287);function l(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=document.getElementById(t),l=e.props?e:(0,a.Z)(e,{});s&&(n?i().render((0,a.Z)(o.zt,{store:r.Z.getStore()},void 0,l),s):i().render(l,s))}},44039:function(e,t,n){"use strict";function a(e,t){return Math.floor(Math.random()*(t-e+1))+e}n.d(t,{e:function(){return a}})},39633:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(22928),s=(n(57588),n(73935)),i=n.n(s),o=n(37424),r=n(69987),l=n(90287),c=document.getElementById("page-mount");function u(e){var t={component:e.component||null,childRoutes:[]};e.root?t.childRoutes=[{path:e.root,onEnter:function(t,n){n(null,e.paths[0].path)}}].concat(e.paths):t.childRoutes=e.paths,i().render((0,a.Z)(o.zt,{store:l.Z.getStore()},void 0,(0,a.Z)(r.F0,{routes:t,history:r.mW})),c)}},20370:function(e,t,n){"use strict";function a(e,t){if(-1===e.indexOf(t)){var n=e.slice();return n.push(t),n}return e.filter((function(e){return e!==t}))}n.d(t,{ZN:function(){return a}})},55210:function(e,t,n){"use strict";n.d(t,{BS:function(){return d},C1:function(){return o},Do:function(){return c},Ei:function(){return u},HR:function(){return p},Vb:function(){return v},fT:function(){return r},gS:function(){return h},jA:function(){return l},lG:function(){return f}});var a=n(19755),s=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,i=new RegExp("^[0-9a-z]+$","i");function o(e){return function(t){if(!1===t||null===t||0===a.trim(t).length)return e||gettext("This field is required.")}}function r(e){var t=gettext("You have to accept the terms of service.");return o(e||t)}function l(e){var t=gettext("You have to accept the privacy policy.");return o(e||t)}function c(e){return function(t){if(!s.test(t))return e||gettext("Enter a valid email address.")}}function u(e,t){return function(n){var s="",i=a.trim(n).length;if(i<e)return s=t?t(e,i):ngettext("Ensure this value has at least %(limit_value)s character (it has %(show_value)s).","Ensure this value has at least %(limit_value)s characters (it has %(show_value)s).",e),interpolate(s,{limit_value:e,show_value:i},!0)}}function d(e,t){return function(n){var s="",i=a.trim(n).length;if(i>e)return s=t?t(e,i):ngettext("Ensure this value has at most %(limit_value)s character (it has %(show_value)s).","Ensure this value has at most %(limit_value)s characters (it has %(show_value)s).",e),interpolate(s,{limit_value:e,show_value:i},!0)}}function p(e){return u(e,(function(e){return ngettext("Username must be at least %(limit_value)s character long.","Username must be at least %(limit_value)s characters long.",e)}))}function h(e){return d(e,(function(e){return ngettext("Username cannot be longer than %(limit_value)s character.","Username cannot be longer than %(limit_value)s characters.",e)}))}function f(){return function(e){if(!i.test(a.trim(e)))return gettext("Username can only contain latin alphabet letters and digits.")}}function v(e){return function(t){var n=t.length;if(n<e){var a=ngettext("Valid password must be at least %(limit_value)s character long.","Valid password must be at least %(limit_value)s characters long.",e);return interpolate(a,{limit_value:e,show_value:n},!0)}}}},46700:function(e,t,n){var a={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function s(e){var t=i(e);return n(t)}function i(e){if(!n.o(a,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return a[e]}s.keys=function(){return Object.keys(a)},s.resolve=i,e.exports=s,s.id=46700}},n={};function a(e){var s=n[e];if(void 0!==s)return s.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}a.m=t,e=[],a.O=function(t,n,s,i){if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],s=e[u][1],i=e[u][2];for(var r=!0,l=0;l<n.length;l++)(!1&i||o>=i)&&Object.keys(a.O).every((function(e){return a.O[e](n[l])}))?n.splice(l--,1):(r=!1,i<o&&(o=i));if(r){e.splice(u--,1);var c=s();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,s,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},function(){var e={174:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var s,i,o=n[0],r=n[1],l=n[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(s in r)a.o(r,s)&&(a.m[s]=r[s]);if(l)var u=l(a)}for(t&&t(n);c<o.length;c++)i=o[c],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(u)},n=self.webpackChunkmisago=self.webpackChunkmisago||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}(),a.O(void 0,[736],(function(){return a(32233)})),a.O(void 0,[736],(function(){return a(58339)})),a.O(void 0,[736],(function(){return a(64109)})),a.O(void 0,[736],(function(){return a(46226)})),a.O(void 0,[736],(function(){return a(93240)})),a.O(void 0,[736],(function(){return a(75147)})),a.O(void 0,[736],(function(){return a(4894)})),a.O(void 0,[736],(function(){return a(29223)})),a.O(void 0,[736],(function(){return a(3026)})),a.O(void 0,[736],(function(){return a(94795)})),a.O(void 0,[736],(function(){return a(95563)})),a.O(void 0,[736],(function(){return a(32488)})),a.O(void 0,[736],(function(){return a(11768)})),a.O(void 0,[736],(function(){return a(61323)})),a.O(void 0,[736],(function(){return a(15049)})),a.O(void 0,[736],(function(){return a(61814)})),a.O(void 0,[736],(function(){return a(95920)})),a.O(void 0,[736],(function(){return a(59203)})),a.O(void 0,[736],(function(){return a(72168)})),a.O(void 0,[736],(function(){return a(47806)})),a.O(void 0,[736],(function(){return a(77031)})),a.O(void 0,[736],(function(){return a(97751)})),a.O(void 0,[736],(function(){return a(76093)})),a.O(void 0,[736],(function(){return a(19764)})),a.O(void 0,[736],(function(){return a(47549)})),a.O(void 0,[736],(function(){return a(22331)})),a.O(void 0,[736],(function(){return a(21513)})),a.O(void 0,[736],(function(){return a(98749)})),a.O(void 0,[736],(function(){return a(98251)})),a.O(void 0,[736],(function(){return a(6720)})),a.O(void 0,[736],(function(){return a(10846)})),a.O(void 0,[736],(function(){return a(18255)})),a.O(void 0,[736],(function(){return a(14113)})),a.O(void 0,[736],(function(){return a(24444)})),a.O(void 0,[736],(function(){return a(1764)})),a.O(void 0,[736],(function(){return a(68351)})),a.O(void 0,[736],(function(){return a(81521)})),a.O(void 0,[736],(function(){return a(19984)})),a.O(void 0,[736],(function(){return a(41229)})),a.O(void 0,[736],(function(){return a(43589)})),a.O(void 0,[736],(function(){return a(24108)})),a.O(void 0,[736],(function(){return a(33934)})),a.O(void 0,[736],(function(){return a(85577)})),a.O(void 0,[736],(function(){return a(83526)})),a.O(void 0,[736],(function(){return a(43060)})),a.O(void 0,[736],(function(){return a(92292)})),a.O(void 0,[736],(function(){return a(33409)}));var s=a.O(void 0,[736],(function(){return a(31341)}));s=a.O(s)}();
 //# sourceMappingURL=misago.js.map

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
misago/static/misago/js/misago.js.map


+ 100 - 0
misago/templates/misago/admin/conf/oauth2_settings.html

@@ -0,0 +1,100 @@
+{% extends "misago/admin/conf/form.html" %}
+{% load i18n misago_admin_form %}
+
+
+{% block form-body %}
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "Basic settings" %}</legend>
+
+    {% form_row form.enable_oauth2_client %}
+    {% form_row form.oauth2_provider %}
+    {% form_row form.oauth2_client_id %}
+    {% form_row form.oauth2_client_secret %}
+
+  </fieldset>
+</div>
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "Initializing login" %}</legend>
+
+    {% form_row form.oauth2_login_url %}
+    {% form_row form.oauth2_scopes %}
+
+  </fieldset>
+</div>
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "Retrieving access token" %}</legend>
+
+    {% form_row form.oauth2_token_url %}
+    {% form_row form.oauth2_token_method %}
+    {% form_row form.oauth2_token_extra_headers %}
+    {% form_row form.oauth2_json_token_path %}
+
+  </fieldset>
+</div>
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "Retrieving user data" %}</legend>
+
+    {% form_row form.oauth2_user_url %}
+    {% form_row form.oauth2_user_method %}
+    {% form_row form.oauth2_user_token_location %}
+    {% form_row form.oauth2_user_token_name %}
+    {% form_row form.oauth2_user_extra_headers %}
+    
+  </fieldset>
+</div>
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "New user sign-ons" %}</legend>
+
+    {% form_row form.oauth2_send_welcome_email %}
+
+  </fieldset>
+</div>
+<div class="form-fieldset">
+  <fieldset>
+    <legend>{% trans "User JSON mappings" %}</legend>
+
+    <p>
+      {% blocktrans trimmed %}
+        Path to value is a key under which it can be found in the JSON with user data returned by the provider. If this key is nested under other key, use full path and separate keys with periods ("<code>.</code>").
+      {% endblocktrans %}
+    </p>
+    <p>
+      {% trans "For example, for given JSON with user data:" %}
+    </p>
+    <p>
+      <code>
+        {<br />
+          &nbsp;&nbsp;"id": "380422",<br />
+          &nbsp;&nbsp;"name": "Bob",<br />
+          &nbsp;&nbsp;"email": "bob@example.com",<br />
+          &nbsp;&nbsp;"picture": {<br />
+          &nbsp;&nbsp;&nbsp;&nbsp;"url": "http://exmaple.com/users/avatars/f7s6a8d68sa68sa.jpg"<br />
+          &nbsp;&nbsp;}<br />
+        }
+      </code>
+    </p>
+    <p>
+      {% blocktrans trimmed %}
+        Those paths should be used:
+      {% endblocktrans %}
+    </p>
+    <ul class="list-unstyled">
+      <li>{% trans "User ID" %}: <code>id</code></li>
+      <li>{% trans "User name" %}: <code>name</code></li>
+      <li>{% trans "User e-mail" %}: <code>email</code></li>
+      <li>{% trans "User avatar" %}: <code>picture.url</code></li>
+    </ul>
+
+    {% form_row form.oauth2_json_id_path %}
+    {% form_row form.oauth2_json_name_path %}
+    {% form_row form.oauth2_json_email_path %}
+    {% form_row form.oauth2_json_avatar_path %}
+
+  </fieldset>
+</div>
+{% endblock form-body %}

+ 7 - 0
misago/templates/misago/admin/conf/users_settings.html

@@ -4,6 +4,13 @@
 
 {% block form-body %}
 <div class="form-fieldset">
+  {% if settings.enable_oauth2_client %}  
+    <div class="alert alert-warning" role="alert">
+      <strong>{% trans "Note" %}:</strong> {% blocktrans trimmed with provider=settings.oauth2_provider %}
+      OAuth2 client is enabled. On site registration, password and account deletion features have been disabled and delegated to the {{ provider }}.
+      {% endblocktrans %}
+    </div>
+  {% endif %}
   <fieldset>
     <legend>{% trans "New accounts" %}</legend>
 

+ 8 - 0
misago/templates/misago/admin/socialauth/list.html

@@ -92,6 +92,14 @@
 
 
 {% block view %}
+{% if settings.enable_oauth2_client %}  
+  <div class="alert alert-warning" role="alert">
+    <strong>{% trans "Note" %}:</strong> {% blocktrans trimmed with provider=settings.oauth2_provider %}
+    OAuth2 client is enabled. Social authentication has been disabled with login and registration delegated to the {{ provider }}.
+    {% endblocktrans %}
+  </div>
+{% endif %}
+
 {{ block.super }}
 
 <div class="card card-admin-table mt-3">

+ 56 - 0
misago/templates/misago/errorpages/oauth2.html

@@ -0,0 +1,56 @@
+{% extends "misago/base.html" %}
+{% load i18n %}
+
+
+{% block title %}{% blocktrans trimmed with provider=settings.oauth2_provider %}
+Could not sign in with {{ provider }}
+{% endblocktrans %} | {{ block.super }}{% endblock %}
+
+
+{% block meta-description %}{{ message }}{% endblock %}
+
+
+{% block og-title %}{% blocktrans trimmed with provider=settings.oauth2_provider %}
+Could not sign in with {{ provider }}
+{% endblocktrans %}{% endblock %}
+{% block twitter-title %}{% blocktrans trimmed with provider=settings.oauth2_provider %}
+Could not sign in with {{ provider }}
+{% endblocktrans %}{% endblock %}
+
+
+{% block og-description %}{{ message }}{% endblock %}
+{% block twitter-description %}{{ message }}{% endblock %}
+
+
+{% block content %}
+<div class="page page-error page-error-social">
+  <div class="container page-container">
+    <div class="message-panel">
+
+      <div class="message-icon">
+        <span class="material-icon">sync_problem</span>
+      </div>
+
+      <div class="message-body">
+          <p class="lead">
+            {% blocktrans trimmed with provider=settings.oauth2_provider %}
+              Could not sign in with {{ provider }}
+            {% endblocktrans %}
+          </p>
+          {% if error.message %}
+            <p>{{ error.message }}</p>
+          {% endif %}
+          {% if error.recoverable %}
+            <p>
+              {% trans "Please try again." %}
+            </p>
+            <p>
+              <a class="btn btn-primary" href="{% url 'misago:oauth2-login' %}">{% trans "Sign in" %}</a>
+            </p>
+          {% endif %}
+      </div>
+
+    </div>
+  </div>
+</div>
+{% endblock content %}

+ 32 - 0
misago/templates/misago/errorpages/oauth2_profile.html

@@ -0,0 +1,32 @@
+{% extends "misago/errorpages/oauth2.html" %}
+{% load i18n %}
+
+
+{% block content %}
+<div class="page page-error page-error-social">
+  <div class="container page-container">
+    <div class="message-panel">
+
+      <div class="message-icon">
+        <span class="material-icon">sync_problem</span>
+      </div>
+
+      <div class="message-body">
+          <p class="lead">
+            {% blocktrans trimmed with provider=settings.oauth2_provider %}
+              Could not sign in with {{ provider }}
+            {% endblocktrans %}
+          </p>
+          {% if error.message %}
+            <p>{{ error.message }}</p>
+          {% endif %}
+          <p>{% trans "Found problems:" %}</p>
+          {% for validation_error in error_list %}
+            <p>&mdash; {{ validation_error }}</p>
+          {% endfor %}
+      </div>
+
+    </div>
+  </div>
+</div>
+{% endblock content %}

+ 1 - 0
misago/urls.py

@@ -15,6 +15,7 @@ urlpatterns = hooks.urlpatterns + [
     path("", include("misago.categories.urls")),
     path("", include("misago.threads.urls")),
     path("", include("misago.search.urls")),
+    path("", include("misago.oauth2.urls")),
     path("", include("misago.socialauth.urls")),
     path("", include("misago.healthcheck.urls")),
     # default robots.txt

+ 23 - 0
misago/users/api/auth.py

@@ -1,3 +1,5 @@
+from functools import wraps
+
 from django.contrib import auth
 from django.contrib.auth.password_validation import validate_password
 from django.core.exceptions import PermissionDenied, ValidationError
@@ -29,8 +31,26 @@ def gateway(request):
     return session_user(request)
 
 
+def check_delegated_auth(f):
+    @wraps(f)
+    def view_disabled_if_auth_is_delegated(request, *args, **kwargs):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to sign in."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
+        return f(request, *args, **kwargs)
+
+    return view_disabled_if_auth_is_delegated
+
+
 @api_view(["POST"])
 @permission_classes((UnbannedAnonOnly,))
+@check_delegated_auth
 @csrf_protect
 @require_dict_data
 def login(request):
@@ -78,6 +98,7 @@ def get_criteria(request):
 
 @api_view(["POST"])
 @permission_classes((UnbannedAnonOnly,))
+@check_delegated_auth
 @csrf_protect
 @require_dict_data
 def send_activation(request):
@@ -113,6 +134,7 @@ def send_activation(request):
 
 @api_view(["POST"])
 @permission_classes((UnbannedOnly,))
+@check_delegated_auth
 @csrf_protect
 @require_dict_data
 def send_password_form(request):
@@ -154,6 +176,7 @@ class PasswordChangeFailed(Exception):
 
 @api_view(["POST"])
 @permission_classes((UnbannedOnly,))
+@check_delegated_auth
 @csrf_protect
 @require_dict_data
 def change_forgotten_password(request, pk, token):

+ 45 - 0
misago/users/api/users.py

@@ -86,6 +86,15 @@ class UserViewSet(viewsets.GenericViewSet):
         return list_endpoint(request)
 
     def create(self, request):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to sign in."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         return create_endpoint(request)
 
     def retrieve(self, request, pk=None):
@@ -129,6 +138,15 @@ class UserViewSet(viewsets.GenericViewSet):
 
     @action(methods=["get", "post"], detail=True)
     def username(self, request, pk=None):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to change your name."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         get_int_or_404(pk)
         allow_self_only(request.user, pk, _("You can't change other users names."))
 
@@ -148,6 +166,15 @@ class UserViewSet(viewsets.GenericViewSet):
         url_name="change-password",
     )
     def change_password(self, request, pk=None):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to change your password."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         get_int_or_404(pk)
         allow_self_only(request.user, pk, _("You can't change other users passwords."))
 
@@ -157,6 +184,15 @@ class UserViewSet(viewsets.GenericViewSet):
         methods=["post"], detail=True, url_path="change-email", url_name="change-email"
     )
     def change_email(self, request, pk=None):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to change your e-mail."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         get_int_or_404(pk)
         allow_self_only(
             request.user, pk, _("You can't change other users e-mail addresses.")
@@ -188,6 +224,15 @@ class UserViewSet(viewsets.GenericViewSet):
         url_name="delete-own-account",
     )
     def delete_own_account(self, request, pk=None):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _(
+                    "This feature has been disabled. "
+                    "Please use %(provider)s to delete your account."
+                )
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         serializer = DeleteOwnAccountSerializer(
             data=request.data, context={"user": request.user}
         )

+ 8 - 0
misago/users/apps.py

@@ -19,6 +19,9 @@ class MisagoUsersConfig(AppConfig):
         self.register_default_user_profile_pages()
 
     def register_default_usercp_pages(self):
+        def auth_is_not_delegated(request):
+            return not request.settings.enable_oauth2_client
+
         usercp.add_section(
             link="misago:usercp-change-forum-options",
             name=_("Forum options"),
@@ -36,12 +39,14 @@ class MisagoUsersConfig(AppConfig):
             name=_("Change username"),
             component="change-username",
             icon="card_membership",
+            visible_if=auth_is_not_delegated,
         )
         usercp.add_section(
             link="misago:usercp-change-email-password",
             name=_("Change email or password"),
             component="sign-in-credentials",
             icon="vpn_key",
+            visible_if=auth_is_not_delegated,
         )
 
         def can_download_own_data(request):
@@ -56,6 +61,9 @@ class MisagoUsersConfig(AppConfig):
         )
 
         def can_delete_own_account(request):
+            if not auth_is_not_delegated(request):
+                return False
+
             return request.settings.allow_delete_own_account
 
         usercp.add_section(

+ 15 - 19
misago/users/avatars/__init__.py

@@ -1,23 +1,19 @@
-from ...conf import settings
-from . import store, gravatar, dynamic, gallery, uploaded
-
-AVATAR_TYPES = ("gravatar", "dynamic", "gallery", "uploaded")
-
-SET_DEFAULT_AVATAR = {
-    "gravatar": gravatar.set_avatar,
-    "dynamic": dynamic.set_avatar,
-    "gallery": gallery.set_random_avatar,
-}
+from . import store, gravatar, downloaded, dynamic, gallery, uploaded
+from .default import set_default_avatar, set_default_avatar_from_url
 
+__all__ = [
+    "AVATAR_TYPES",
+    "delete_avatar",
+    "downloaded",
+    "dynamic",
+    "gallery",
+    "gravatar",
+    "set_default_avatar",
+    "set_default_avatar_from_url",
+    "store",
+    "uploaded",
+]
 
-def set_default_avatar(user, default_avatar, gravatar_fallback):
-    try:
-        SET_DEFAULT_AVATAR[default_avatar](user)
-    except RuntimeError:
-        if gallery.galleries_exist():
-            SET_DEFAULT_AVATAR[gravatar_fallback](user)
-        else:
-            dynamic.set_avatar(user)
-
+AVATAR_TYPES = ("gravatar", "dynamic", "gallery", "uploaded")
 
 delete_avatar = store.delete_avatar

+ 24 - 0
misago/users/avatars/default.py

@@ -0,0 +1,24 @@
+from . import downloaded, dynamic, gallery, gravatar
+
+SET_DEFAULT_AVATAR = {
+    "gravatar": gravatar.set_avatar,
+    "dynamic": dynamic.set_avatar,
+    "gallery": gallery.set_random_avatar,
+}
+
+
+def set_default_avatar(user, default_avatar, gravatar_fallback):
+    try:
+        SET_DEFAULT_AVATAR[default_avatar](user)
+    except RuntimeError:
+        if gallery.galleries_exist():
+            SET_DEFAULT_AVATAR[gravatar_fallback](user)
+        else:
+            dynamic.set_avatar(user)
+
+
+def set_default_avatar_from_url(user, avatar_url):
+    try:
+        downloaded.set_avatar(user, avatar_url)
+    except RuntimeError:
+        dynamic.set_avatar(user)

+ 33 - 0
misago/users/avatars/downloaded.py

@@ -0,0 +1,33 @@
+from io import BytesIO
+
+import requests
+from PIL import Image
+
+from . import store
+
+
+class AvatarDownloadError(RuntimeError):
+    pass
+
+
+def set_avatar(user, avatar_url):
+    try:
+        r = requests.get(avatar_url, timeout=5)
+        if r.status_code != 200:
+            raise AvatarDownloadError("could not retrieve avatar from the server")
+
+        image = Image.open(BytesIO(r.content))
+
+        # Crop avatar into square
+        width, height = image.size
+
+        if width > height:
+            left = int((width - height) / 2)
+            image = image.crop((left, 0, width + left, height))
+        elif height > width:
+            top = int((height - width) / 2)
+            image = image.crop((0, top, width, top + height))
+
+        store.store_new_avatar(user, image)
+    except requests.exceptions.RequestException:
+        raise AvatarDownloadError("failed to connect to avatar server")

+ 1 - 1
misago/users/bans.py

@@ -40,7 +40,7 @@ def get_user_ban(user, cache_versions):
     """
     This function checks if user is banned
 
-    When user model is available, this is preffered to calling
+    When user model is available, this is preferred to calling
     get_email_ban(user.email) and get_username_ban(user.username)
     because it sets ban cache on user model
     """

+ 5 - 0
misago/users/decorators.py

@@ -1,3 +1,5 @@
+from functools import wraps
+
 from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.shortcuts import redirect
@@ -9,6 +11,7 @@ from .models import Ban
 
 
 def deny_authenticated(f):
+    @wraps(f)
     def decorator(request, *args, **kwargs):
         if request.user.is_authenticated:
             raise PermissionDenied(_("This page is not available to signed in users."))
@@ -19,6 +22,7 @@ def deny_authenticated(f):
 
 
 def deny_guests(f):
+    @wraps(f)
     def decorator(request, *args, **kwargs):
         if request.user.is_anonymous:
             if request.GET.get("ref") == "login":
@@ -31,6 +35,7 @@ def deny_guests(f):
 
 
 def deny_banned_ips(f):
+    @wraps(f)
     def decorator(request, *args, **kwargs):
         ban = get_request_ip_ban(request)
         if ban:

+ 2 - 1
misago/users/migrations/0023_remove_user_sso_id.py

@@ -1,4 +1,4 @@
-# Generated by Django 3.2.15 on 2022-09-27 18:44
+# Generated by Django 3.2.15 on 2023-01-04 12:38
 
 from django.db import migrations
 
@@ -7,6 +7,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         ("misago_users", "0022_deleteduser"),
+        ("misago_oauth2", "0002_copy_sso_subjects"),
     ]
 
     operations = [

+ 8 - 5
misago/users/setupnewuser.py

@@ -1,14 +1,17 @@
 from .audittrail import create_user_audit_trail
-from .avatars import set_default_avatar
+from .avatars import set_default_avatar, set_default_avatar_from_url
 from .models import User
 
 
-def setup_new_user(settings, user):
+def setup_new_user(settings, user, *, avatar_url=None):
     set_default_subscription_options(settings, user)
 
-    set_default_avatar(
-        user, settings.default_avatar, settings.default_gravatar_fallback
-    )
+    if avatar_url:
+        set_default_avatar_from_url(user, avatar_url)
+    else:
+        set_default_avatar(
+            user, settings.default_avatar, settings.default_gravatar_fallback
+        )
 
     if user.joined_from_ip:
         create_user_audit_trail(user, user.joined_from_ip, user)

+ 26 - 0
misago/users/tests/test_activation_views.py

@@ -98,3 +98,29 @@ class ActivationViewsTests(TestCase):
 
         user = User.objects.get(pk=user.pk)
         self.assertEqual(user.requires_activation, 0)
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_request_activatiom_view_returns_403_if_oauth_is_enabled(db, client):
+    response = client.get(reverse("misago:request-activation"))
+    assert response.status_code == 403
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_activate_with_token_view_returns_403_if_oauth_is_enabled(db, client):
+    user = create_test_user("User", "user@example.com", requires_activation=1)
+    activation_token = make_activation_token(user)
+
+    response = client.post(
+        reverse(
+            "misago:activate-by-token",
+            kwargs={"pk": user.pk, "token": activation_token},
+        )
+    )
+    assert response.status_code == 403

+ 60 - 0
misago/users/tests/test_auth_api.py

@@ -1,5 +1,6 @@
 from django.core import mail
 from django.test import TestCase
+from django.urls import reverse
 
 from ...conf.test import override_dynamic_settings
 from ..models import Ban
@@ -228,6 +229,27 @@ class GatewayTests(TestCase):
         self.assertIsNone(user_json["id"])
 
 
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_login_api_returns_403_if_oauth_is_enabled(user, user_password, client):
+    response = client.post(
+        reverse("misago:api:auth"),
+        {"username": user.username, "password": user_password},
+    )
+    assert response.status_code == 403
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_auth_api_returns_user_if_oauth_is_enabled(user_client):
+    response = user_client.get(reverse("misago:api:auth"))
+    assert response.status_code == 200
+
+
 class UserCredentialsTests(TestCase):
     def test_edge_returns_response(self):
         """api edge has no showstoppers"""
@@ -353,6 +375,18 @@ class SendActivationApiTests(TestCase):
         self.assertTrue(mail.outbox)
 
 
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_send_activation_api_returns_403_if_oauth_is_enabled(user, client):
+    response = client.post(
+        reverse("misago:api:send-activation"),
+        {"email": user.email},
+    )
+    assert response.status_code == 403
+
+
 class SendPasswordFormApiTests(TestCase):
     def setUp(self):
         self.user = create_test_user("User", "user@example.com", "password")
@@ -464,6 +498,18 @@ class SendPasswordFormApiTests(TestCase):
         self.assertTrue(not mail.outbox)
 
 
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_send_password_reset_api_returns_403_if_oauth_is_enabled(user, client):
+    response = client.post(
+        reverse("misago:api:send-password-form"),
+        {"email": user.email},
+    )
+    assert response.status_code == 403
+
+
 class ChangePasswordApiTests(TestCase):
     def setUp(self):
         self.user = create_test_user("User", "user@example.com", "password")
@@ -587,3 +633,17 @@ class ChangePasswordApiTests(TestCase):
                 )
             },
         )
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_reset_password_api_returns_403_if_oauth_is_enabled(user, client):
+    token = make_password_change_token(user)
+
+    response = client.post(
+        reverse("misago:api:change-forgotten-password", args=[user.pk, token]),
+        {"password": "n33wP4SSW00ird!!"},
+    )
+    assert response.status_code == 403

+ 11 - 0
misago/users/tests/test_auth_views.py

@@ -1,6 +1,8 @@
 from django.test import TestCase
 from django.urls import reverse
 
+from ...conf.test import override_dynamic_settings
+
 
 class AuthViewsTests(TestCase):
     def test_auth_views_return_302(self):
@@ -84,3 +86,12 @@ class AuthViewsTests(TestCase):
 
         user_json = response.json()
         self.assertIsNone(user_json["id"])
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_login_view_returns_403_if_oauth_is_enabled(db, client):
+    response = client.get(reverse("misago:login"))
+    assert response.status_code == 403

+ 41 - 2
misago/users/tests/test_avatars.py

@@ -7,7 +7,16 @@ from django.utils.crypto import get_random_string
 from PIL import Image
 
 from ...conf import settings
-from ..avatars import dynamic, gallery, gravatar, set_default_avatar, store, uploaded
+from ..avatars import (
+    downloaded,
+    dynamic,
+    gallery,
+    gravatar,
+    set_default_avatar,
+    set_default_avatar_from_url,
+    store,
+    uploaded,
+)
 from ..models import Avatar, AvatarGallery
 from ..test import create_test_user
 
@@ -137,8 +146,38 @@ class AvatarSetterTests(TestCase):
         gallery.set_avatar(self.user, test_avatar)
         self.assertAvatarWasSet()
 
+    def test_downloaded(self):
+        """specific image is downloaded"""
+        self.assertNoAvatarIsSet()
+        downloaded.set_avatar(self.user, "http://placekitten.com/500/500")
+        self.assertAvatarWasSet()
+
+    def test_downloaded_width_greater_than_height(self):
+        """specific image is downloaded and cropped into square"""
+        self.assertNoAvatarIsSet()
+        downloaded.set_avatar(self.user, "http://placekitten.com/700/500")
+        self.assertAvatarWasSet()
+
+    def test_downloaded_height_greater_than_width(self):
+        """specific image is downloaded and cropped into square"""
+        self.assertNoAvatarIsSet()
+        downloaded.set_avatar(self.user, "http://placekitten.com/500/700")
+        self.assertAvatarWasSet()
+
+    def test_default_avatar_downloaded(self):
+        """default downloaded avatar is set"""
+        self.assertNoAvatarIsSet()
+        set_default_avatar_from_url(self.user, "http://placekitten.com/500/500")
+        self.assertAvatarWasSet()
+
+    def test_default_avatar_downloaded(self):
+        """default download fails but fallback dynamic works"""
+        self.assertNoAvatarIsSet()
+        set_default_avatar_from_url(self.user, "https://example.com/404")
+        self.assertAvatarWasSet()
+
     def test_gravatar(self):
-        """dynamic avatar gets created"""
+        """gravatar is downloaded"""
         self.assertNoAvatarIsSet()
         self.user.set_email("rafio.xudb@gmail.com")
         gravatar.set_avatar(self.user)

+ 16 - 0
misago/users/tests/test_forgottenpassword_views.py

@@ -115,3 +115,19 @@ class ForgottenPasswordViewsTests(UserTestCase):
             )
         )
         self.assertContains(response, password_token)
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_forgotten_password_view_returns_403_if_oauth_is_enabled(user, client):
+    password_token = make_password_change_token(user)
+
+    response = client.get(
+        reverse(
+            "misago:forgotten-password-change-form",
+            kwargs={"pk": user.pk, "token": password_token},
+        )
+    )
+    assert response.status_code == 403

+ 6 - 0
misago/users/tests/test_new_user_setup.py

@@ -16,6 +16,12 @@ def test_default_avatar_is_set_for_user(dynamic_settings, user):
     assert user.avatar_set.exists()
 
 
+def test_avatar_from_url_is_set_for_user(dynamic_settings, user):
+    setup_new_user(dynamic_settings, user, avatar_url="https://placekitten.com/600/500")
+    assert user.avatars
+    assert user.avatar_set.exists()
+
+
 def test_default_started_threads_subscription_option_is_set_for_user(
     dynamic_settings, user
 ):

+ 16 - 0
misago/users/tests/test_options_views.py

@@ -55,6 +55,14 @@ class ConfirmChangeEmailTests(AuthenticatedUserTestCase):
         self.reload_user()
         self.assertEqual(self.user.email, "n3w@email.com")
 
+    @override_dynamic_settings(
+        enable_oauth2_client=True,
+        oauth2_provider="Lorem",
+    )
+    def test_change_email_view_returns_403_if_oauth_is_enabled(self):
+        response = self.client.get(self.link)
+        self.assertEqual(response.status_code, 403)
+
 
 class ConfirmChangePasswordTests(AuthenticatedUserTestCase):
     def setUp(self):
@@ -94,3 +102,11 @@ class ConfirmChangePasswordTests(AuthenticatedUserTestCase):
         self.reload_user()
         self.assertFalse(self.user.check_password(self.USER_PASSWORD))
         self.assertTrue(self.user.check_password("n3wp4ssword"))
+
+    @override_dynamic_settings(
+        enable_oauth2_client=True,
+        oauth2_provider="Lorem",
+    )
+    def test_change_password_view_returns_403_if_oauth_is_enabled(self):
+        response = self.client.get(self.link)
+        self.assertEqual(response.status_code, 403)

+ 43 - 0
misago/users/tests/test_user_changeemail_api.py

@@ -132,3 +132,46 @@ class UserChangeEmailTests(AuthenticatedUserTestCase):
 
         self.reload_user()
         self.assertEqual(self.user.email, new_email)
+
+    @override_dynamic_settings(
+        enable_oauth2_client=True,
+        oauth2_provider="Lorem",
+    )
+    def test_change_email_api_returns_403_if_oauth_is_enabled(self):
+        new_email = "new@email.com"
+
+        self.login_user(self.user)
+
+        response = self.client.post(
+            self.link, data={"new_email": new_email, "password": self.USER_PASSWORD}
+        )
+        self.assertEqual(response.status_code, 403)
+        self.assertEqual(len(mail.outbox), 0)
+
+    @override_dynamic_settings(forum_address="http://test.com/")
+    def test_confirm_change_email_view_returns_403_if_oauth_is_enabled(self):
+        new_email = "new@email.com"
+
+        self.login_user(self.user)
+
+        response = self.client.post(
+            self.link, data={"new_email": new_email, "password": self.USER_PASSWORD}
+        )
+        self.assertEqual(response.status_code, 200)
+
+        self.assertIn("Confirm e-mail change", mail.outbox[0].subject)
+        for line in [l.strip() for l in mail.outbox[0].body.splitlines()]:
+            if line.startswith("http://"):
+                token = line.rstrip("/").split("/")[-1]
+                break
+        else:
+            self.fail("E-mail sent didn't contain confirmation url")
+
+        with override_dynamic_settings(
+            enable_oauth2_client=True, oauth2_provider="Lorem"
+        ):
+            response = self.client.get(
+                reverse("misago:options-confirm-email-change", kwargs={"token": token})
+            )
+
+            self.assertEqual(response.status_code, 403)

+ 47 - 0
misago/users/tests/test_user_changepassword_api.py

@@ -128,3 +128,50 @@ class UserChangePasswordTests(AuthenticatedUserTestCase):
 
         self.reload_user()
         self.assertTrue(self.user.check_password(new_password))
+
+    @override_dynamic_settings(
+        enable_oauth2_client=True,
+        oauth2_provider="Lorem",
+    )
+    def test_change_password_api_returns_403_if_oauth_is_enabled(self):
+        new_password = " N3wP@55w0rd "
+
+        self.login_user(self.user)
+
+        response = self.client.post(
+            self.link,
+            data={"new_password": new_password, "password": self.USER_PASSWORD},
+        )
+        self.assertEqual(response.status_code, 403)
+        self.assertEqual(len(mail.outbox), 0)
+
+    @override_dynamic_settings(forum_address="http://test.com/")
+    def test_confirm_change_password_view_returns_403_if_oauth_is_enabled(self):
+        new_password = " N3wP@55w0rd "
+
+        self.login_user(self.user)
+
+        response = self.client.post(
+            self.link,
+            data={"new_password": new_password, "password": self.USER_PASSWORD},
+        )
+        self.assertEqual(response.status_code, 200)
+
+        self.assertIn("Confirm password change", mail.outbox[0].subject)
+        for line in [l.strip() for l in mail.outbox[0].body.splitlines()]:
+            if line.startswith("http://"):
+                token = line.rstrip("/").split("/")[-1]
+                break
+        else:
+            self.fail("E-mail sent didn't contain confirmation url")
+
+        with override_dynamic_settings(
+            enable_oauth2_client=True, oauth2_provider="Lorem"
+        ):
+            response = self.client.get(
+                reverse(
+                    "misago:options-confirm-password-change", kwargs={"token": token}
+                )
+            )
+
+            self.assertEqual(response.status_code, 403)

+ 22 - 2
misago/users/tests/test_user_create_api.py

@@ -555,9 +555,29 @@ def test_new_registrations_validators_hook_is_used_by_registration_api(
     )
 
     response = client.post(
-        "/api/users/",
-        {"username": "User", "email": "user@example.com", "password": "PASSW0RD123"},
+        reverse("misago:api:user-list"),
+        {
+            "username": "User",
+            "email": "user@example.com",
+            "password": "PASSW0RD123",
+        },
     )
 
     assert response.status_code == 400
     assert response.json() == {"username": ["ERROR FROM PLUGIN"]}
+
+
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_registration_api_returns_403_if_oauth_is_enabled(db, client):
+    response = client.post(
+        reverse("misago:api:user-list"),
+        {
+            "username": "totallyNew",
+            "email": "loremipsum@dolor.met",
+            "password": "PASSW0RD123",
+        },
+    )
+    assert response.status_code == 403

+ 16 - 0
misago/users/tests/test_user_username_api.py

@@ -1,5 +1,7 @@
 import json
 
+from django.urls import reverse
+
 from ...acl.test import patch_user_acl
 from ...conf.test import override_dynamic_settings
 from ..test import AuthenticatedUserTestCase, create_test_user
@@ -89,6 +91,20 @@ class UserUsernameTests(AuthenticatedUserTestCase):
         self.assertEqual(self.user.namechanges.last().new_username, new_username)
 
 
+@override_dynamic_settings(
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_change_username_api_returns_403_if_oauth_is_enabled(user, user_client):
+    response = user_client.post(
+        reverse("misago:api:user-username", kwargs={"pk": user.pk}),
+        {
+            "username": "totallyNew",
+        },
+    )
+    assert response.status_code == 403
+
+
 class UserUsernameModerationTests(AuthenticatedUserTestCase):
     """tests for moderate username RPC (/api/users/1/moderate-username/)"""
 

+ 17 - 0
misago/users/tests/test_users_api.py

@@ -545,6 +545,23 @@ class UserDeleteOwnAccountTests(AuthenticatedUserTestCase):
         self.assertTrue(self.user.is_deleting_account)
 
 
+@override_dynamic_settings(
+    allow_delete_own_account=True,
+    enable_oauth2_client=True,
+    oauth2_provider="Lorem",
+)
+def test_delete_own_account_api_returns_403_if_oauth_is_enabled(
+    user, user_password, user_client
+):
+    response = user_client.post(
+        reverse("misago:api:user-delete-own-account", kwargs={"pk": user.pk}),
+        {
+            "password": user_password,
+        },
+    )
+    assert response.status_code == 403
+
+
 class UserDeleteTests(AuthenticatedUserTestCase):
     """tests for user delete RPC (POST to /api/users/1/delete/)"""
 

+ 3 - 0
misago/users/tests/test_validators.py

@@ -60,8 +60,11 @@ class ValidateUsernameTests(TestCase):
         """validate_username has no crashes"""
         settings = Mock(username_length_min=1, username_length_max=5)
         validate_username(settings, "LeBob")
+        validate_username(settings, "LeB_b")
         with self.assertRaises(ValidationError):
             validate_username(settings, "*")
+        with self.assertRaises(ValidationError):
+            validate_username(settings, "___")
 
 
 class ValidateUsernameAvailableTests(TestCase):

+ 2 - 3
misago/users/validators.py

@@ -8,8 +8,7 @@ from django.core.exceptions import ValidationError
 from django.core.validators import validate_email as validate_email_content
 from django.utils.encoding import force_str
 from django.utils.module_loading import import_string
-from django.utils.translation import gettext_lazy as _
-from django.utils.translation import ngettext
+from django.utils.translation import gettext_lazy as _, ngettext
 from requests.exceptions import RequestException
 
 from .. import hooks
@@ -81,7 +80,7 @@ def validate_username_banned(value):
 
 
 def validate_username_content(value):
-    if not USERNAME_RE.match(value):
+    if not USERNAME_RE.match(value.replace("_", "")):
         raise ValidationError(
             _("Username can only contain latin alphabet letters and digits.")
         )

+ 6 - 0
misago/users/views/activation.py

@@ -16,6 +16,12 @@ def activation_view(f):
     @deny_authenticated
     @deny_banned_ips
     def decorator(request, *args, **kwargs):
+        if request.settings.enable_oauth2_client:
+            raise PermissionDenied(
+                _("Please use %(provider)s to activatee your account.")
+                % {"provider": request.settings.oauth2_provider}
+            )
+
         return f(request, *args, **kwargs)
 
     return decorator

+ 8 - 0
misago/users/views/auth.py

@@ -2,9 +2,11 @@ from urllib.parse import urlparse
 
 from django.conf import settings
 from django.contrib import auth
+from django.core.exceptions import PermissionDenied
 from django.shortcuts import redirect
 from django.urls import NoReverseMatch
 from django.utils.http import url_has_allowed_host_and_scheme
+from django.utils.translation import gettext as _
 from django.views.decorators.cache import never_cache
 from django.views.decorators.csrf import csrf_protect
 from django.views.decorators.debug import sensitive_post_parameters
@@ -14,6 +16,12 @@ from django.views.decorators.debug import sensitive_post_parameters
 @never_cache
 @csrf_protect
 def login(request):
+    if request.settings.enable_oauth2_client:
+        raise PermissionDenied(
+            _("Please use %(provider)s to sign in.")
+            % {"provider": request.settings.oauth2_provider}
+        )
+
     if request.method == "POST":
         redirect_to = request.POST.get("redirect_to")
         if redirect_to:

+ 13 - 0
misago/users/views/forgottenpassword.py

@@ -1,4 +1,5 @@
 from django.contrib.auth import get_user_model
+from django.core.exceptions import PermissionDenied
 from django.shortcuts import get_object_or_404, render
 from django.urls import reverse
 from django.utils.translation import gettext as _
@@ -11,6 +12,12 @@ from ..tokens import is_password_change_token_valid
 
 @deny_banned_ips
 def request_reset(request):
+    if request.settings.enable_oauth2_client:
+        raise PermissionDenied(
+            _("Please use %(provider)s to reset your password.")
+            % {"provider": request.settings.oauth2_provider}
+        )
+
     request.frontend_context.update(
         {"SEND_PASSWORD_RESET_API": reverse("misago:api:send-password-form")}
     )
@@ -23,6 +30,12 @@ class ResetError(Exception):
 
 @deny_banned_ips
 def reset_password_form(request, pk, token):
+    if request.settings.enable_oauth2_client:
+        raise PermissionDenied(
+            _("Please use %(provider)s to reset your password.")
+            % {"provider": request.settings.oauth2_provider}
+        )
+
     requesting_user = get_object_or_404(get_user_model(), pk=pk)
 
     try:

+ 12 - 0
misago/users/views/options.py

@@ -43,6 +43,12 @@ def confirm_change_view(f):
 
 @confirm_change_view
 def confirm_email_change(request, token):
+    if request.settings.enable_oauth2_client:
+        raise PermissionDenied(
+            _("Please use %(provider)s to change your e-mail.")
+            % {"provider": request.settings.oauth2_provider}
+        )
+
     new_credential = read_new_credential(request, "email", token)
     if not new_credential:
         raise ChangeError()
@@ -63,6 +69,12 @@ def confirm_email_change(request, token):
 
 @confirm_change_view
 def confirm_password_change(request, token):
+    if request.settings.enable_oauth2_client:
+        raise PermissionDenied(
+            _("Please use %(provider)s to change your password.")
+            % {"provider": request.settings.oauth2_provider}
+        )
+
     new_credential = read_new_credential(request, "password", token)
     if not new_credential:
         raise ChangeError()

Некоторые файлы не были показаны из-за большого количества измененных файлов