/* CustomEmojiChooserV2.c generated by valac 0.56.19, the Vala compiler
 * generated from CustomEmojiChooserV2.vala, do not modify */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.h>
#include <adwaita.h>

#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY "tuba_recent_emojis_category"
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_MAX_RECENTS 12
#define BUILD_RESOURCES "/dev/geopjr/Tuba/"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2 (tuba_widgets_custom_emoji_chooser_v2_get_type ())
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2Class))
#define TUBA_WIDGETS_IS_CUSTOM_EMOJI_CHOOSER_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2))
#define TUBA_WIDGETS_IS_CUSTOM_EMOJI_CHOOSER_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2Class))

typedef struct _TubaWidgetsCustomEmojiChooserV2 TubaWidgetsCustomEmojiChooserV2;
typedef struct _TubaWidgetsCustomEmojiChooserV2Class TubaWidgetsCustomEmojiChooserV2Class;
typedef struct _TubaWidgetsCustomEmojiChooserV2Private TubaWidgetsCustomEmojiChooserV2Private;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_EMOJI (tuba_api_emoji_get_type ())
#define TUBA_API_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_EMOJI, TubaAPIEmoji))
#define TUBA_API_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_EMOJI, TubaAPIEmojiClass))
#define TUBA_API_IS_EMOJI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_EMOJI))
#define TUBA_API_IS_EMOJI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_EMOJI))
#define TUBA_API_EMOJI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_EMOJI, TubaAPIEmojiClass))

typedef struct _TubaAPIEmoji TubaAPIEmoji;
typedef struct _TubaAPIEmojiClass TubaAPIEmojiClass;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_0_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_custom_emoji_chooser_v2_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block91Data Block91Data;

#define TUBA_TYPE_ACCOUNT_STORE (tuba_account_store_get_type ())
#define TUBA_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStore))
#define TUBA_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))
#define TUBA_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_IS_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_ACCOUNT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))

typedef struct _TubaAccountStore TubaAccountStore;
typedef struct _TubaAccountStoreClass TubaAccountStoreClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;

#define TUBA_TYPE_SETTINGS (tuba_settings_get_type ())
#define TUBA_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_SETTINGS, TubaSettings))
#define TUBA_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_SETTINGS, TubaSettingsClass))
#define TUBA_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_SETTINGS))
#define TUBA_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_SETTINGS))
#define TUBA_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_SETTINGS, TubaSettingsClass))

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;

#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY (tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type ())
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_IS_EMOJI_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_IS_EMOJI_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY))
#define TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass))

typedef struct _TubaWidgetsCustomEmojiChooserV2EmojiCategory TubaWidgetsCustomEmojiChooserV2EmojiCategory;
typedef struct _TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _TubaWidgetsCustomEmojiChooserV2EmojiCategoryPrivate TubaWidgetsCustomEmojiChooserV2EmojiCategoryPrivate;
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_0_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_FACE_PROPERTY,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NUM_PROPERTIES];
enum  {
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_PICKED_SIGNAL,
	TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_NUM_SIGNALS
};
static guint tuba_widgets_custom_emoji_chooser_v2_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_NUM_SIGNALS] = {0};

struct _TubaWidgetsCustomEmojiChooserV2 {
	GtkPopover parent_instance;
	TubaWidgetsCustomEmojiChooserV2Private * priv;
};

struct _TubaWidgetsCustomEmojiChooserV2Class {
	GtkPopoverClass parent_class;
};

struct _TubaWidgetsCustomEmojiChooserV2Private {
	gchar* _query;
	gboolean _search_active;
	GeeHashMap* instance_emoji_map;
	GtkSearchEntry* entry;
	GtkStack* main_stack;
	GListStore* cat_model;
	GListStore* moji_grid_model;
	GtkLabel* cat_label;
	GtkBox* bottom_bar;
	GtkStringFilter* in_category_string_filter;
	GtkFilterListModel* filter_list_model;
	gboolean has_been_constructed;
};

struct _Block91Data {
	int _ref_count_;
	TubaWidgetsCustomEmojiChooserV2* self;
	GeeHashMap* res;
};

struct _TubaWidgetsCustomEmojiChooserV2EmojiCategory {
	GObject parent_instance;
	TubaWidgetsCustomEmojiChooserV2EmojiCategoryPrivate * priv;
};

struct _TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass {
	GObjectClass parent_class;
};

struct _TubaWidgetsCustomEmojiChooserV2EmojiCategoryPrivate {
	gchar* _name;
	gchar* _emoji_shortcode;
	gchar* _emoji_url;
	gchar* _real_category_name;
};

static gint TubaWidgetsCustomEmojiChooserV2_private_offset;
static gpointer tuba_widgets_custom_emoji_chooser_v2_parent_class = NULL;
VALA_EXTERN TubaAccountStore* tuba_accounts;
VALA_EXTERN TubaSettings* tuba_settings;
VALA_EXTERN gboolean tuba_is_rtl;
static gint TubaWidgetsCustomEmojiChooserV2EmojiCategory_private_offset;
static gpointer tuba_widgets_custom_emoji_chooser_v2_emoji_category_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_custom_emoji_chooser_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCustomEmojiChooserV2, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_emoji_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIEmoji, g_object_unref)
static GeeHashMap* tuba_widgets_custom_emoji_chooser_v2_gen_emojis_cat_map (TubaWidgetsCustomEmojiChooserV2* self);
static Block91Data* block91_data_ref (Block91Data* _data91_);
static void block91_data_unref (void * _userdata_);
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_account_store_get_active (TubaAccountStore* self);
VALA_EXTERN GeeArrayList* tuba_instance_account_get_instance_emojis (TubaInstanceAccount* self);
static gboolean ___lambda74_ (Block91Data* _data91_,
                       TubaAPIEmoji* e);
VALA_EXTERN gboolean tuba_api_emoji_get_visible_in_picker (TubaAPIEmoji* self);
VALA_EXTERN const gchar* tuba_api_emoji_get_category (TubaAPIEmoji* self);
VALA_EXTERN const gchar* tuba_api_emoji_get_shortcode (TubaAPIEmoji* self);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gchar** tuba_settings_get_recently_used_custom_emojis (TubaSettings* self,
                                                       gint* result_length1);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static gboolean ____lambda74__gee_forall_func (gpointer g,
                                        gpointer self);
static gboolean ___lambda75_ (TubaWidgetsCustomEmojiChooserV2* self,
                       GeeMapEntry* e);
static gint tuba_widgets_custom_emoji_chooser_v2_sort_emojis (TubaWidgetsCustomEmojiChooserV2* self,
                                                       TubaAPIEmoji* a,
                                                       TubaAPIEmoji* b);
static gint _tuba_widgets_custom_emoji_chooser_v2_sort_emojis_gcompare_data_func (gconstpointer a,
                                                                           gconstpointer b,
                                                                           gpointer self);
static gboolean ____lambda75__gee_forall_func (gpointer g,
                                        gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_initial_construct (TubaWidgetsCustomEmojiChooserV2* self);
VALA_EXTERN GType tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCustomEmojiChooserV2EmojiCategory, g_object_unref)
static void tuba_widgets_custom_emoji_chooser_v2_on_cat_activated (TubaWidgetsCustomEmojiChooserV2* self,
                                                            guint pos);
static void _tuba_widgets_custom_emoji_chooser_v2_on_cat_activated_gtk_list_view_activate (GtkListView* _sender,
                                                                                    guint position,
                                                                                    gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked (TubaWidgetsCustomEmojiChooserV2* self,
                                                           guint pos);
static void _tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked_gtk_grid_view_activate (GtkGridView* _sender,
                                                                                   guint position,
                                                                                   gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_on_stack_changed (TubaWidgetsCustomEmojiChooserV2* self);
static void _tuba_widgets_custom_emoji_chooser_v2_on_stack_changed_g_object_notify (GObject* _sender,
                                                                             GParamSpec* pspec,
                                                                             gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_on_back_clicked (TubaWidgetsCustomEmojiChooserV2* self);
static void _tuba_widgets_custom_emoji_chooser_v2_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_v2_get_query (TubaWidgetsCustomEmojiChooserV2* self);
static void tuba_widgets_custom_emoji_chooser_v2_search (TubaWidgetsCustomEmojiChooserV2* self);
static void _tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                             gpointer self);
static void _tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                   gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_on_close (TubaWidgetsCustomEmojiChooserV2* self);
static void _tuba_widgets_custom_emoji_chooser_v2_on_close_gtk_search_entry_stop_search (GtkSearchEntry* _sender,
                                                                                  gpointer self);
static void tuba_widgets_custom_emoji_chooser_v2_populate_chooser (TubaWidgetsCustomEmojiChooserV2* self);
static void tuba_widgets_custom_emoji_chooser_v2_update_recents (TubaWidgetsCustomEmojiChooserV2* self,
                                                          TubaAPIEmoji* api_emoji);
static void _vala_array_add135 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void _vala_array_add136 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void _vala_array_add137 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
VALA_EXTERN void tuba_settings_set_recently_used_custom_emojis (TubaSettings* self,
                                                    gchar** value,
                                                    gint value_length1);
static void tuba_widgets_custom_emoji_chooser_v2_setup_recents_emoji_category (TubaWidgetsCustomEmojiChooserV2* self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                         TubaAPIEmoji* value);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_set_query (TubaWidgetsCustomEmojiChooserV2* self,
                                                     const gchar* value);
static void tuba_widgets_custom_emoji_chooser_v2_setup_search (TubaWidgetsCustomEmojiChooserV2* self);
static void tuba_widgets_custom_emoji_chooser_v2_set_search_active (TubaWidgetsCustomEmojiChooserV2* self,
                                                             gboolean value);
static gboolean tuba_widgets_custom_emoji_chooser_v2_get_search_active (TubaWidgetsCustomEmojiChooserV2* self);
static void tuba_widgets_custom_emoji_chooser_v2_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserV2* self,
                                                                  TubaAPIEmoji* emoji);
static void tuba_widgets_custom_emoji_chooser_v2_real_show (GtkWidget* base);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self);
VALA_EXTERN TubaWidgetsCustomEmojiChooserV2EmojiCategory* tuba_widgets_custom_emoji_chooser_v2_emoji_category_new (void);
VALA_EXTERN TubaWidgetsCustomEmojiChooserV2EmojiCategory* tuba_widgets_custom_emoji_chooser_v2_emoji_category_construct (GType object_type);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                   const gchar* value);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                                 const gchar* value);
static gint tuba_widgets_custom_emoji_chooser_v2_sort_strings (TubaWidgetsCustomEmojiChooserV2* self,
                                                        const gchar* a,
                                                        const gchar* b);
static gint _tuba_widgets_custom_emoji_chooser_v2_sort_strings_gcompare_data_func (gconstpointer a,
                                                                            gconstpointer b,
                                                                            gpointer self);
static void _vala_array_add138 (TubaWidgetsCustomEmojiChooserV2EmojiCategory** * array,
                         gint* length,
                         gint* size,
                         TubaWidgetsCustomEmojiChooserV2EmojiCategory* value);
static void _vala_array_add139 (TubaWidgetsCustomEmojiChooserV2EmojiCategory** * array,
                         gint* length,
                         gint* size,
                         TubaWidgetsCustomEmojiChooserV2EmojiCategory* value);
VALA_EXTERN TubaWidgetsCustomEmojiChooserV2* tuba_widgets_custom_emoji_chooser_v2_new (void);
VALA_EXTERN TubaWidgetsCustomEmojiChooserV2* tuba_widgets_custom_emoji_chooser_v2_construct (GType object_type);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_shortcode (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_shortcode (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                              const gchar* value);
VALA_EXTERN const gchar* tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_url (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self);
VALA_EXTERN void tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_url (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                        const gchar* value);
VALA_EXTERN const gchar* tuba_api_emoji_get_url (TubaAPIEmoji* self);
static void tuba_widgets_custom_emoji_chooser_v2_emoji_category_finalize (GObject * obj);
static GType tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type_once (void);
static void _vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_property (GObject * object,
                                                                             guint property_id,
                                                                             GValue * value,
                                                                             GParamSpec * pspec);
static void _vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_property (GObject * object,
                                                                             guint property_id,
                                                                             const GValue * value,
                                                                             GParamSpec * pspec);
static void tuba_widgets_custom_emoji_chooser_v2_finalize (GObject * obj);
static GType tuba_widgets_custom_emoji_chooser_v2_get_type_once (void);
static void _vala_tuba_widgets_custom_emoji_chooser_v2_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_tuba_widgets_custom_emoji_chooser_v2_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_widgets_custom_emoji_chooser_v2_get_instance_private (TubaWidgetsCustomEmojiChooserV2* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsCustomEmojiChooserV2_private_offset);
}

static Block91Data*
block91_data_ref (Block91Data* _data91_)
{
	g_atomic_int_inc (&_data91_->_ref_count_);
	return _data91_;
}

static void
block91_data_unref (void * _userdata_)
{
	Block91Data* _data91_;
	_data91_ = (Block91Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data91_->_ref_count_)) {
		TubaWidgetsCustomEmojiChooserV2* self;
		self = _data91_->self;
		_g_object_unref0 (_data91_->res);
		_g_object_unref0 (self);
		g_slice_free (Block91Data, _data91_);
	}
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static gboolean
___lambda74_ (Block91Data* _data91_,
              TubaAPIEmoji* e)
{
	TubaWidgetsCustomEmojiChooserV2* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GeeHashMap* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	TubaSettings* _tmp18_;
	gchar** _tmp19_;
	gint _tmp19__length1;
	gint _tmp20_ = 0;
	gchar** _tmp21_;
	gint _tmp21__length1;
	gboolean result;
	self = _data91_->self;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = tuba_api_emoji_get_visible_in_picker (e);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = TRUE;
		_g_object_unref0 (e);
		return result;
	}
	_tmp2_ = _data91_->res;
	_tmp3_ = tuba_api_emoji_get_category (e);
	_tmp4_ = _tmp3_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp4_)) {
		GeeArrayList* array = NULL;
		GeeHashMap* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gpointer _tmp8_;
		GeeArrayList* _tmp9_;
		_tmp5_ = _data91_->res;
		_tmp6_ = tuba_api_emoji_get_category (e);
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, _tmp7_);
		array = (GeeArrayList*) _tmp8_;
		_tmp9_ = array;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, e);
		_g_object_unref0 (array);
	} else {
		GeeArrayList* array = NULL;
		GeeArrayList* _tmp10_;
		GeeArrayList* _tmp11_;
		GeeHashMap* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		GeeArrayList* _tmp15_;
		_tmp10_ = gee_array_list_new (TUBA_API_TYPE_EMOJI, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		array = _tmp10_;
		_tmp11_ = array;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, e);
		_tmp12_ = _data91_->res;
		_tmp13_ = tuba_api_emoji_get_category (e);
		_tmp14_ = _tmp13_;
		_tmp15_ = array;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, _tmp14_, _tmp15_);
		_g_object_unref0 (array);
	}
	_tmp16_ = tuba_api_emoji_get_shortcode (e);
	_tmp17_ = _tmp16_;
	_tmp18_ = tuba_settings;
	_tmp19_ = tuba_settings_get_recently_used_custom_emojis (_tmp18_, &_tmp20_);
	_tmp19__length1 = _tmp20_;
	_tmp21_ = _tmp19_;
	_tmp21__length1 = _tmp19__length1;
	if (_vala_string_array_contains (_tmp21_, _tmp21__length1, _tmp17_)) {
		GeeHashMap* _tmp22_;
		gpointer _tmp23_;
		GeeArrayList* _tmp24_;
		_tmp22_ = _data91_->res;
		_tmp23_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp22_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY);
		_tmp24_ = (GeeArrayList*) _tmp23_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, e);
		_g_object_unref0 (_tmp24_);
	}
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
____lambda74__gee_forall_func (gpointer g,
                               gpointer self)
{
	gboolean result;
	result = ___lambda74_ (self, (TubaAPIEmoji*) g);
	return result;
}

static gint
_tuba_widgets_custom_emoji_chooser_v2_sort_emojis_gcompare_data_func (gconstpointer a,
                                                                      gconstpointer b,
                                                                      gpointer self)
{
	gint result;
	result = tuba_widgets_custom_emoji_chooser_v2_sort_emojis ((TubaWidgetsCustomEmojiChooserV2*) self, (TubaAPIEmoji*) a, (TubaAPIEmoji*) b);
	return result;
}

static gboolean
___lambda75_ (TubaWidgetsCustomEmojiChooserV2* self,
              GeeMapEntry* e)
{
	gconstpointer _tmp0_;
	gconstpointer _tmp1_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = gee_map_entry_get_value (e);
	_tmp1_ = _tmp0_;
	gee_list_sort ((GeeList*) ((GeeArrayList*) _tmp1_), _tuba_widgets_custom_emoji_chooser_v2_sort_emojis_gcompare_data_func, g_object_ref (self), g_object_unref);
	result = TRUE;
	_g_object_unref0 (e);
	return result;
}

static gboolean
____lambda75__gee_forall_func (gpointer g,
                               gpointer self)
{
	gboolean result;
	result = ___lambda75_ ((TubaWidgetsCustomEmojiChooserV2*) self, (GeeMapEntry*) g);
	return result;
}

static GeeHashMap*
tuba_widgets_custom_emoji_chooser_v2_gen_emojis_cat_map (TubaWidgetsCustomEmojiChooserV2* self)
{
	Block91Data* _data91_;
	GeeHashMap* _tmp0_;
	GeeArrayList* emojis = NULL;
	TubaAccountStore* _tmp1_;
	TubaInstanceAccount* _tmp2_;
	TubaInstanceAccount* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GeeArrayList* _tmp8_;
	GeeHashMap* _tmp17_;
	GeeHashMap* _tmp18_;
	GeeHashMap* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data91_ = g_slice_new0 (Block91Data);
	_data91_->_ref_count_ = 1;
	_data91_->self = g_object_ref (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data91_->res = _tmp0_;
	_tmp1_ = tuba_accounts;
	_tmp2_ = tuba_account_store_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = tuba_instance_account_get_instance_emojis (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	emojis = _tmp6_;
	_tmp8_ = emojis;
	if (_tmp8_ != NULL) {
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp9_ = emojis;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_ > 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		GeeHashMap* _tmp12_;
		GeeArrayList* _tmp13_;
		GeeArrayList* _tmp14_;
		GeeArrayList* _tmp15_;
		GeeHashMap* _tmp16_;
		_tmp12_ = _data91_->res;
		_tmp13_ = gee_array_list_new (TUBA_API_TYPE_EMOJI, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_tmp14_ = _tmp13_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY, _tmp14_);
		_g_object_unref0 (_tmp14_);
		_tmp15_ = emojis;
		gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp15_, ____lambda74__gee_forall_func, _data91_);
		_tmp16_ = _data91_->res;
		gee_abstract_map_foreach ((GeeAbstractMap*) _tmp16_, ____lambda75__gee_forall_func, self);
	}
	_tmp17_ = _data91_->res;
	_tmp18_ = _g_object_ref0 (_tmp17_);
	result = _tmp18_;
	_g_object_unref0 (emojis);
	block91_data_unref (_data91_);
	_data91_ = NULL;
	return result;
}

static gint
tuba_widgets_custom_emoji_chooser_v2_sort_emojis (TubaWidgetsCustomEmojiChooserV2* self,
                                                  TubaAPIEmoji* a,
                                                  TubaAPIEmoji* b)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = tuba_api_emoji_get_shortcode (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_api_emoji_get_shortcode (b);
	_tmp3_ = _tmp2_;
	result = g_utf8_collate (_tmp1_, _tmp3_);
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
_tuba_widgets_custom_emoji_chooser_v2_on_cat_activated_gtk_list_view_activate (GtkListView* _sender,
                                                                               guint position,
                                                                               gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_on_cat_activated ((TubaWidgetsCustomEmojiChooserV2*) self, position);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked_gtk_grid_view_activate (GtkGridView* _sender,
                                                                              guint position,
                                                                              gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked ((TubaWidgetsCustomEmojiChooserV2*) self, position);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_on_stack_changed_g_object_notify (GObject* _sender,
                                                                        GParamSpec* pspec,
                                                                        gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_on_stack_changed ((TubaWidgetsCustomEmojiChooserV2*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_on_back_clicked ((TubaWidgetsCustomEmojiChooserV2*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                        gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_search ((TubaWidgetsCustomEmojiChooserV2*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                              gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_search ((TubaWidgetsCustomEmojiChooserV2*) self);
}

static void
_tuba_widgets_custom_emoji_chooser_v2_on_close_gtk_search_entry_stop_search (GtkSearchEntry* _sender,
                                                                             gpointer self)
{
	tuba_widgets_custom_emoji_chooser_v2_on_close ((TubaWidgetsCustomEmojiChooserV2*) self);
}

static void
tuba_widgets_custom_emoji_chooser_v2_initial_construct (TubaWidgetsCustomEmojiChooserV2* self)
{
	GtkStack* _tmp0_ = NULL;
	GListStore* _tmp1_;
	GtkListView* cat_listview = NULL;
	GListStore* _tmp2_;
	GListModel* _tmp3_;
	GtkNoSelection* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkBuilderListItemFactory* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	GtkListView* _tmp11_ = NULL;
	GtkListView* _tmp12_;
	GtkListView* _tmp13_;
	GtkStack* _tmp14_;
	GtkListView* _tmp15_;
	GtkWidget* _tmp16_;
	GtkScrolledWindow* _tmp17_ = NULL;
	GtkScrolledWindow* _tmp18_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp19_;
	GtkBox* _tmp20_;
	GtkStack* _tmp21_;
	GtkBox* _tmp22_;
	GListStore* _tmp23_;
	GListStore* _tmp24_;
	GListModel* _tmp25_;
	GtkStringFilter* _tmp26_;
	GtkFilter* _tmp27_;
	GtkFilterListModel* _tmp28_;
	GtkPropertyExpression* _tmp29_;
	GtkStringFilter* _tmp30_ = NULL;
	GtkGridView* moji_grid = NULL;
	GtkFilterListModel* _tmp31_;
	GListModel* _tmp32_;
	GtkNoSelection* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	GtkBuilderListItemFactory* _tmp37_;
	gchar* _tmp38_;
	gchar** _tmp39_;
	GtkGridView* _tmp40_ = NULL;
	GtkGridView* _tmp41_;
	GtkGridView* _tmp42_;
	GtkStack* _tmp43_;
	GtkGridView* _tmp44_;
	GtkWidget* _tmp45_;
	GtkScrolledWindow* _tmp46_ = NULL;
	GtkScrolledWindow* _tmp47_;
	GtkStack* _tmp48_;
	GtkBox* _tmp49_ = NULL;
	const gchar* _tmp50_ = NULL;
	GtkButton* back_btn = NULL;
	gchar* _tmp51_;
	gchar* _tmp52_;
	gchar** _tmp53_;
	GtkButton* _tmp54_ = NULL;
	GtkButton* _tmp55_;
	gchar* _tmp56_;
	gchar** _tmp57_;
	GtkLabel* _tmp58_ = NULL;
	GtkBox* _tmp59_;
	GtkButton* _tmp60_;
	GtkBox* _tmp61_;
	GtkLabel* _tmp62_;
	GtkBox* _tmp63_;
	GtkBox* _tmp64_;
	const gchar* _tmp65_;
	gchar* _tmp66_;
	gchar* _tmp67_;
	GtkSearchEntry* _tmp68_ = NULL;
	AdwBin* entry_bin = NULL;
	gchar* _tmp69_;
	gchar** _tmp70_;
	GtkSearchEntry* _tmp71_;
	GtkWidget* _tmp72_;
	AdwBin* _tmp73_ = NULL;
	GtkBox* _tmp74_;
	AdwBin* _tmp75_;
	GtkSearchEntry* _tmp76_;
	GtkSearchEntry* _tmp77_;
	GtkSearchEntry* _tmp78_;
	g_return_if_fail (self != NULL);
	if (self->priv->has_been_constructed) {
		return;
	}
	self->priv->has_been_constructed = TRUE;
	gtk_widget_add_css_class ((GtkWidget*) self, "emoji-picker");
	_tmp0_ = (GtkStack*) gtk_stack_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_stack_set_hhomogeneous (_tmp0_, FALSE);
	gtk_stack_set_vhomogeneous (_tmp0_, FALSE);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->main_stack);
	self->priv->main_stack = _tmp0_;
	_tmp1_ = g_list_store_new (TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY);
	_g_object_unref0 (self->priv->cat_model);
	self->priv->cat_model = _tmp1_;
	_tmp2_ = self->priv->cat_model;
	_tmp3_ = _g_object_ref0 ((GListModel*) _tmp2_);
	_tmp4_ = gtk_no_selection_new (_tmp3_);
	_tmp5_ = string_to_string (BUILD_RESOURCES);
	_tmp6_ = g_strconcat (_tmp5_, "gtk/dropdown/cep_main.ui", NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = (GtkBuilderListItemFactory*) gtk_builder_list_item_factory_new_from_resource (NULL, _tmp7_);
	_tmp9_ = g_strdup ("cep-category");
	_tmp10_ = g_new0 (gchar*, 1 + 1);
	_tmp10_[0] = _tmp9_;
	_tmp11_ = (GtkListView*) gtk_list_view_new ((GtkSelectionModel*) _tmp4_, (GtkListItemFactory*) _tmp8_);
	gtk_list_view_set_single_click_activate (_tmp11_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp11_, _tmp10_);
	_tmp10_ = (_vala_array_free (_tmp10_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp11_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp7_);
	cat_listview = _tmp12_;
	_tmp13_ = cat_listview;
	g_signal_connect_object (_tmp13_, "activate", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_on_cat_activated_gtk_list_view_activate, self, 0);
	_tmp14_ = self->priv->main_stack;
	_tmp15_ = cat_listview;
	_tmp16_ = _g_object_ref0 ((GtkWidget*) _tmp15_);
	_tmp17_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp17_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set ((GtkWidget*) _tmp17_, "height-request", 256, NULL);
	gtk_scrolled_window_set_child (_tmp17_, _tmp16_);
	_g_object_unref0 (_tmp16_);
	g_object_ref_sink (_tmp17_);
	_tmp18_ = _tmp17_;
	gtk_stack_add_named (_tmp14_, (GtkWidget*) _tmp18_, "categories");
	_g_object_unref0 (_tmp18_);
	_tmp19_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp19_);
	content_box = _tmp19_;
	_tmp20_ = content_box;
	_tmp21_ = self->priv->main_stack;
	gtk_box_append (_tmp20_, (GtkWidget*) _tmp21_);
	_tmp22_ = content_box;
	gtk_popover_set_child ((GtkPopover*) self, (GtkWidget*) _tmp22_);
	_tmp23_ = g_list_store_new (TUBA_API_TYPE_EMOJI);
	_g_object_unref0 (self->priv->moji_grid_model);
	self->priv->moji_grid_model = _tmp23_;
	_tmp24_ = self->priv->moji_grid_model;
	_tmp25_ = _g_object_ref0 ((GListModel*) _tmp24_);
	_tmp26_ = self->priv->in_category_string_filter;
	_tmp27_ = _g_object_ref0 ((GtkFilter*) _tmp26_);
	_tmp28_ = gtk_filter_list_model_new (_tmp25_, _tmp27_);
	_g_object_unref0 (self->priv->filter_list_model);
	self->priv->filter_list_model = _tmp28_;
	_tmp29_ = (GtkPropertyExpression*) gtk_property_expression_new (TUBA_API_TYPE_EMOJI, NULL, "shortcode");
	_tmp30_ = gtk_string_filter_new ((GtkExpression*) _tmp29_);
	gtk_string_filter_set_match_mode (_tmp30_, GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
	_g_object_unref0 (self->priv->in_category_string_filter);
	self->priv->in_category_string_filter = _tmp30_;
	_tmp31_ = self->priv->filter_list_model;
	_tmp32_ = _g_object_ref0 ((GListModel*) _tmp31_);
	_tmp33_ = gtk_no_selection_new (_tmp32_);
	_tmp34_ = string_to_string (BUILD_RESOURCES);
	_tmp35_ = g_strconcat (_tmp34_, "gtk/dropdown/cep_emoji.ui", NULL);
	_tmp36_ = _tmp35_;
	_tmp37_ = (GtkBuilderListItemFactory*) gtk_builder_list_item_factory_new_from_resource (NULL, _tmp36_);
	_tmp38_ = g_strdup ("cep-emoji");
	_tmp39_ = g_new0 (gchar*, 1 + 1);
	_tmp39_[0] = _tmp38_;
	_tmp40_ = (GtkGridView*) gtk_grid_view_new ((GtkSelectionModel*) _tmp33_, (GtkListItemFactory*) _tmp37_);
	gtk_grid_view_set_single_click_activate (_tmp40_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp40_, _tmp39_);
	_tmp39_ = (_vala_array_free (_tmp39_, 1, (GDestroyNotify) g_free), NULL);
	gtk_grid_view_set_max_columns (_tmp40_, (guint) 6);
	gtk_grid_view_set_min_columns (_tmp40_, (guint) 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp40_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp40_, 6);
	g_object_ref_sink (_tmp40_);
	_tmp41_ = _tmp40_;
	_g_free0 (_tmp36_);
	moji_grid = _tmp41_;
	_tmp42_ = moji_grid;
	g_signal_connect_object (_tmp42_, "activate", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked_gtk_grid_view_activate, self, 0);
	_tmp43_ = self->priv->main_stack;
	_tmp44_ = moji_grid;
	_tmp45_ = _g_object_ref0 ((GtkWidget*) _tmp44_);
	_tmp46_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp46_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set ((GtkWidget*) _tmp46_, "height-request", 256, NULL);
	gtk_scrolled_window_set_child (_tmp46_, _tmp45_);
	_g_object_unref0 (_tmp45_);
	g_object_ref_sink (_tmp46_);
	_tmp47_ = _tmp46_;
	gtk_stack_add_named (_tmp43_, (GtkWidget*) _tmp47_, "mojis");
	_g_object_unref0 (_tmp47_);
	_tmp48_ = self->priv->main_stack;
	g_signal_connect_object ((GObject*) _tmp48_, "notify::visible-child-name", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_on_stack_changed_g_object_notify, self, 0);
	_tmp49_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_set_visible ((GtkWidget*) _tmp49_, FALSE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp49_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp49_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp49_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp49_, 6);
	g_object_ref_sink (_tmp49_);
	_g_object_unref0 (self->priv->bottom_bar);
	self->priv->bottom_bar = _tmp49_;
	if (tuba_is_rtl) {
		_tmp50_ = "tuba-right-large-symbolic";
	} else {
		_tmp50_ = "tuba-left-large-symbolic";
	}
	_tmp51_ = g_strdup (_ ("Categories"));
	_tmp52_ = g_strdup ("flat");
	_tmp53_ = g_new0 (gchar*, 1 + 1);
	_tmp53_[0] = _tmp52_;
	_tmp54_ = (GtkButton*) gtk_button_new_from_icon_name (_tmp50_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp54_, _tmp51_);
	_g_free0 (_tmp51_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp54_, _tmp53_);
	_tmp53_ = (_vala_array_free (_tmp53_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp54_);
	back_btn = _tmp54_;
	_tmp55_ = back_btn;
	g_signal_connect_object (_tmp55_, "clicked", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_on_back_clicked_gtk_button_clicked, self, 0);
	_tmp56_ = g_strdup ("font-bold");
	_tmp57_ = g_new0 (gchar*, 1 + 1);
	_tmp57_[0] = _tmp56_;
	_tmp58_ = (GtkLabel*) gtk_label_new ("");
	gtk_label_set_ellipsize (_tmp58_, PANGO_ELLIPSIZE_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp58_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp58_, _tmp57_);
	_tmp57_ = (_vala_array_free (_tmp57_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp58_);
	_g_object_unref0 (self->priv->cat_label);
	self->priv->cat_label = _tmp58_;
	_tmp59_ = self->priv->bottom_bar;
	_tmp60_ = back_btn;
	gtk_box_append (_tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = self->priv->bottom_bar;
	_tmp62_ = self->priv->cat_label;
	gtk_box_append (_tmp61_, (GtkWidget*) _tmp62_);
	_tmp63_ = content_box;
	_tmp64_ = self->priv->bottom_bar;
	gtk_box_append (_tmp63_, (GtkWidget*) _tmp64_);
	_tmp65_ = self->priv->_query;
	_tmp66_ = g_strdup (_tmp65_);
	_tmp67_ = g_strdup ("boiled_skibidi_pizza…");
	_tmp68_ = (GtkSearchEntry*) gtk_search_entry_new ();
	gtk_editable_set_text ((GtkEditable*) _tmp68_, _tmp66_);
	_g_free0 (_tmp66_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp68_, TRUE);
	g_object_set (_tmp68_, "placeholder-text", _tmp67_, NULL);
	_g_free0 (_tmp67_);
	g_object_ref_sink (_tmp68_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp68_;
	_tmp69_ = g_strdup ("emoji-searchbar");
	_tmp70_ = g_new0 (gchar*, 1 + 1);
	_tmp70_[0] = _tmp69_;
	_tmp71_ = self->priv->entry;
	_tmp72_ = _g_object_ref0 ((GtkWidget*) _tmp71_);
	_tmp73_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp73_, _tmp70_);
	_tmp70_ = (_vala_array_free (_tmp70_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp73_, _tmp72_);
	_g_object_unref0 (_tmp72_);
	g_object_ref_sink (_tmp73_);
	entry_bin = _tmp73_;
	_tmp74_ = content_box;
	_tmp75_ = entry_bin;
	gtk_box_prepend (_tmp74_, (GtkWidget*) _tmp75_);
	_tmp76_ = self->priv->entry;
	g_signal_connect_object (_tmp76_, "activate", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_activate, self, 0);
	_tmp77_ = self->priv->entry;
	g_signal_connect_object (_tmp77_, "search-changed", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_search_gtk_search_entry_search_changed, self, 0);
	_tmp78_ = self->priv->entry;
	g_signal_connect_object (_tmp78_, "stop-search", (GCallback) _tuba_widgets_custom_emoji_chooser_v2_on_close_gtk_search_entry_stop_search, self, 0);
	tuba_widgets_custom_emoji_chooser_v2_populate_chooser (self);
	_g_object_unref0 (entry_bin);
	_g_object_unref0 (back_btn);
	_g_object_unref0 (moji_grid);
	_g_object_unref0 (content_box);
	_g_object_unref0 (cat_listview);
}

static void
_vala_array_add135 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add136 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add137 (gchar** * array,
                    gint* length,
                    gint* size,
                    gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
tuba_widgets_custom_emoji_chooser_v2_update_recents (TubaWidgetsCustomEmojiChooserV2* self,
                                                     TubaAPIEmoji* api_emoji)
{
	gchar** res = NULL;
	gchar** _tmp0_;
	gint res_length1;
	gint _res_size_;
	gchar* shortcode = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	GeeArrayList* recent_emojis_in_map = NULL;
	GeeHashMap* _tmp6_;
	gpointer _tmp7_;
	const gchar* _tmp8_;
	TubaSettings* _tmp9_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_ = 0;
	gchar** _tmp12_;
	gint _tmp12__length1;
	TubaSettings* _tmp50_;
	gchar** _tmp51_;
	gint _tmp51__length1;
	GeeArrayList* _tmp52_;
	GListStore* _tmp53_;
	GObject* _tmp54_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp55_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (api_emoji != NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	res = _tmp0_;
	res_length1 = 0;
	_res_size_ = res_length1;
	_tmp1_ = tuba_api_emoji_get_shortcode (api_emoji);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	shortcode = _tmp3_;
	_tmp4_ = shortcode;
	_tmp5_ = g_strdup (_tmp4_);
	_vala_array_add135 (&res, &res_length1, &_res_size_, _tmp5_);
	_tmp6_ = self->priv->instance_emoji_map;
	_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY);
	recent_emojis_in_map = (GeeArrayList*) _tmp7_;
	_tmp8_ = shortcode;
	_tmp9_ = tuba_settings;
	_tmp10_ = tuba_settings_get_recently_used_custom_emojis (_tmp9_, &_tmp11_);
	_tmp10__length1 = _tmp11_;
	_tmp12_ = _tmp10_;
	_tmp12__length1 = _tmp10__length1;
	if (_vala_string_array_contains (_tmp12_, _tmp12__length1, _tmp8_)) {
		TubaSettings* _tmp13_;
		gchar** _tmp14_;
		gint _tmp14__length1;
		gint _tmp15_ = 0;
		gchar** _tmp16_;
		gint _tmp16__length1;
		GeeArrayList* _tmp22_;
		_tmp13_ = tuba_settings;
		_tmp14_ = tuba_settings_get_recently_used_custom_emojis (_tmp13_, &_tmp15_);
		_tmp14__length1 = _tmp15_;
		_tmp16_ = _tmp14_;
		_tmp16__length1 = _tmp14__length1;
		{
			gchar** emoji_collection = NULL;
			gint emoji_collection_length1 = 0;
			gint _emoji_collection_size_ = 0;
			gint emoji_it = 0;
			emoji_collection = _tmp16_;
			emoji_collection_length1 = _tmp16__length1;
			for (emoji_it = 0; emoji_it < emoji_collection_length1; emoji_it = emoji_it + 1) {
				gchar* _tmp17_;
				gchar* emoji = NULL;
				_tmp17_ = g_strdup (emoji_collection[emoji_it]);
				emoji = _tmp17_;
				{
					const gchar* _tmp18_;
					const gchar* _tmp19_;
					_tmp18_ = emoji;
					_tmp19_ = shortcode;
					if (g_strcmp0 (_tmp18_, _tmp19_) != 0) {
						const gchar* _tmp20_;
						gchar* _tmp21_;
						_tmp20_ = emoji;
						_tmp21_ = g_strdup (_tmp20_);
						_vala_array_add136 (&res, &res_length1, &_res_size_, _tmp21_);
					}
					_g_free0 (emoji);
				}
			}
		}
		_tmp22_ = recent_emojis_in_map;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp22_, api_emoji);
	} else {
		TubaSettings* _tmp40_;
		gchar** _tmp41_;
		gint _tmp41__length1;
		gint _tmp42_ = 0;
		gchar** _tmp43_;
		gint _tmp43__length1;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp23_ = FALSE;
				_tmp23_ = TRUE;
				while (TRUE) {
					gint _tmp25_ = 0;
					TubaSettings* _tmp26_;
					gchar** _tmp27_;
					gint _tmp27__length1;
					gint _tmp28_ = 0;
					gchar** _tmp29_;
					gint _tmp29__length1;
					TubaSettings* _tmp34_;
					gchar** _tmp35_;
					gint _tmp35__length1;
					gint _tmp36_ = 0;
					gchar** _tmp37_;
					gint _tmp37__length1;
					const gchar* _tmp38_;
					gchar* _tmp39_;
					if (!_tmp23_) {
						gint _tmp24_;
						_tmp24_ = i;
						i = _tmp24_ + 1;
					}
					_tmp23_ = FALSE;
					_tmp26_ = tuba_settings;
					_tmp27_ = tuba_settings_get_recently_used_custom_emojis (_tmp26_, &_tmp28_);
					_tmp27__length1 = _tmp28_;
					_tmp29_ = _tmp27_;
					_tmp29__length1 = _tmp27__length1;
					if (_tmp29__length1 < TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_MAX_RECENTS) {
						TubaSettings* _tmp30_;
						gchar** _tmp31_;
						gint _tmp31__length1;
						gint _tmp32_ = 0;
						gchar** _tmp33_;
						gint _tmp33__length1;
						_tmp30_ = tuba_settings;
						_tmp31_ = tuba_settings_get_recently_used_custom_emojis (_tmp30_, &_tmp32_);
						_tmp31__length1 = _tmp32_;
						_tmp33_ = _tmp31_;
						_tmp33__length1 = _tmp31__length1;
						_tmp25_ = _tmp33__length1;
					} else {
						_tmp25_ = TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_MAX_RECENTS - 1;
					}
					if (!(i < _tmp25_)) {
						break;
					}
					_tmp34_ = tuba_settings;
					_tmp35_ = tuba_settings_get_recently_used_custom_emojis (_tmp34_, &_tmp36_);
					_tmp35__length1 = _tmp36_;
					_tmp37_ = _tmp35_;
					_tmp37__length1 = _tmp35__length1;
					_tmp38_ = _tmp37_[i];
					_tmp39_ = g_strdup (_tmp38_);
					_vala_array_add137 (&res, &res_length1, &_res_size_, _tmp39_);
				}
			}
		}
		_tmp40_ = tuba_settings;
		_tmp41_ = tuba_settings_get_recently_used_custom_emojis (_tmp40_, &_tmp42_);
		_tmp41__length1 = _tmp42_;
		_tmp43_ = _tmp41_;
		_tmp43__length1 = _tmp41__length1;
		if (_tmp43__length1 >= TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_MAX_RECENTS) {
			GeeArrayList* _tmp44_;
			GeeArrayList* _tmp45_;
			gint _tmp46_;
			gint _tmp47_;
			gpointer _tmp48_;
			TubaAPIEmoji* _tmp49_;
			_tmp44_ = recent_emojis_in_map;
			_tmp45_ = recent_emojis_in_map;
			_tmp46_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp45_);
			_tmp47_ = _tmp46_;
			_tmp48_ = gee_abstract_list_remove_at ((GeeAbstractList*) _tmp44_, _tmp47_ - 1);
			_tmp49_ = (TubaAPIEmoji*) _tmp48_;
			_g_object_unref0 (_tmp49_);
		}
	}
	_tmp50_ = tuba_settings;
	_tmp51_ = res;
	_tmp51__length1 = res_length1;
	tuba_settings_set_recently_used_custom_emojis (_tmp50_, _tmp51_, _tmp51__length1);
	_tmp52_ = recent_emojis_in_map;
	gee_abstract_list_insert ((GeeAbstractList*) _tmp52_, 0, api_emoji);
	tuba_widgets_custom_emoji_chooser_v2_setup_recents_emoji_category (self);
	_tmp53_ = self->priv->cat_model;
	_tmp54_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp53_, g_list_model_get_type (), GListModel), (guint) 0);
	_tmp55_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp54_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (_tmp55_, api_emoji);
	_g_object_unref0 (_tmp55_);
	_g_object_unref0 (recent_emojis_in_map);
	_g_free0 (shortcode);
	res = (_vala_array_free (res, res_length1, (GDestroyNotify) g_free), NULL);
}

static gchar*
string_chug (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchug (_result_);
	result = _result_;
	return result;
}

static gchar*
string_chomp (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchomp (_result_);
	result = _result_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
tuba_widgets_custom_emoji_chooser_v2_search (TubaWidgetsCustomEmojiChooserV2* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkStack* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GtkStringFilter* _tmp14_;
	const gchar* _tmp15_;
	gboolean _tmp16_ = FALSE;
	const gchar* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_chug (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_chomp (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_tmp9_ = string_replace (_tmp8_, ":", "");
	_tmp10_ = _tmp9_;
	tuba_widgets_custom_emoji_chooser_v2_set_query (self, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_tmp11_ = self->priv->main_stack;
	_tmp12_ = gtk_stack_get_visible_child_name (_tmp11_);
	_tmp13_ = _tmp12_;
	if (g_strcmp0 (_tmp13_, "categories") == 0) {
		tuba_widgets_custom_emoji_chooser_v2_setup_search (self);
		tuba_widgets_custom_emoji_chooser_v2_set_search_active (self, TRUE);
	}
	_tmp14_ = self->priv->in_category_string_filter;
	_tmp15_ = self->priv->_query;
	gtk_string_filter_set_search (_tmp14_, _tmp15_);
	_tmp17_ = self->priv->_query;
	if (g_strcmp0 (_tmp17_, "") == 0) {
		gboolean _tmp18_;
		_tmp18_ = self->priv->_search_active;
		_tmp16_ = _tmp18_;
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		GtkStack* _tmp19_;
		_tmp19_ = self->priv->main_stack;
		gtk_stack_set_visible_child_name (_tmp19_, "categories");
		tuba_widgets_custom_emoji_chooser_v2_set_search_active (self, FALSE);
		return;
	}
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_custom_emoji_picked (TubaWidgetsCustomEmojiChooserV2* self,
                                                             TubaAPIEmoji* emoji)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (emoji != NULL);
	tuba_widgets_custom_emoji_chooser_v2_on_close (self);
	tuba_widgets_custom_emoji_chooser_v2_update_recents (self, emoji);
	_tmp0_ = tuba_api_emoji_get_shortcode (emoji);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_to_string (_tmp1_);
	_tmp3_ = g_strconcat (":", _tmp2_, ": ", NULL);
	_tmp4_ = _tmp3_;
	g_signal_emit (self, tuba_widgets_custom_emoji_chooser_v2_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_PICKED_SIGNAL], 0, _tmp4_);
	_g_free0 (_tmp4_);
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_close (TubaWidgetsCustomEmojiChooserV2* self)
{
	g_return_if_fail (self != NULL);
	gtk_popover_popdown ((GtkPopover*) self);
}

static void
tuba_widgets_custom_emoji_chooser_v2_real_show (GtkWidget* base)
{
	TubaWidgetsCustomEmojiChooserV2 * self;
	GtkSearchEntry* _tmp0_;
	self = (TubaWidgetsCustomEmojiChooserV2*) base;
	GTK_WIDGET_CLASS (tuba_widgets_custom_emoji_chooser_v2_parent_class)->show ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_popover_get_type (), GtkPopover));
	if (!self->priv->has_been_constructed) {
		tuba_widgets_custom_emoji_chooser_v2_initial_construct (self);
	}
	_tmp0_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

static void
tuba_widgets_custom_emoji_chooser_v2_setup_recents_emoji_category (TubaWidgetsCustomEmojiChooserV2* self)
{
	gboolean _tmp0_ = FALSE;
	TubaSettings* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	gchar** _tmp4_;
	gint _tmp4__length1;
	GListStore* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GeeHashMap* _tmp17_;
	gpointer _tmp18_;
	GeeArrayList* _tmp19_;
	gpointer _tmp20_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp21_ = NULL;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp1_ = tuba_settings;
	_tmp2_ = tuba_settings_get_recently_used_custom_emojis (_tmp1_, &_tmp3_);
	_tmp2__length1 = _tmp3_;
	_tmp4_ = _tmp2_;
	_tmp4__length1 = _tmp2__length1;
	if (_tmp4__length1 == 0) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		GListStore* _tmp6_;
		guint _tmp7_;
		guint _tmp8_;
		_tmp6_ = self->priv->cat_model;
		g_object_get (_tmp6_, "n-items", &_tmp7_, NULL);
		_tmp8_ = _tmp7_;
		if (_tmp8_ > ((guint) 0)) {
			GListStore* _tmp9_;
			GObject* _tmp10_;
			TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_tmp9_ = self->priv->cat_model;
			_tmp10_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, g_list_model_get_type (), GListModel), (guint) 0);
			_tmp11_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
			_tmp12_ = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp5_ = g_strcmp0 (_tmp13_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY) == 0;
			_g_object_unref0 (_tmp11_);
		} else {
			_tmp5_ = FALSE;
		}
		_tmp0_ = _tmp5_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp14_ = self->priv->cat_model;
	_tmp15_ = g_strdup (_ ("Recently Used"));
	_tmp16_ = g_strdup (TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY);
	_tmp17_ = self->priv->instance_emoji_map;
	_tmp18_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp17_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY);
	_tmp19_ = (GeeArrayList*) _tmp18_;
	_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, 0);
	_tmp21_ = tuba_widgets_custom_emoji_chooser_v2_emoji_category_new ();
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (_tmp21_, _tmp15_);
	_g_free0 (_tmp15_);
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (_tmp21_, _tmp16_);
	_g_free0 (_tmp16_);
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (_tmp21_, (TubaAPIEmoji*) _tmp20_);
	_g_object_unref0 (_tmp20_);
	_tmp22_ = _tmp21_;
	g_list_store_insert (_tmp14_, (guint) 0, (GObject*) _tmp22_);
	_g_object_unref0 (_tmp22_);
	_g_object_unref0 (_tmp19_);
}

static gint
_tuba_widgets_custom_emoji_chooser_v2_sort_strings_gcompare_data_func (gconstpointer a,
                                                                       gconstpointer b,
                                                                       gpointer self)
{
	gint result;
	result = tuba_widgets_custom_emoji_chooser_v2_sort_strings ((TubaWidgetsCustomEmojiChooserV2*) self, (const gchar*) a, (const gchar*) b);
	return result;
}

static void
_vala_array_add138 (TubaWidgetsCustomEmojiChooserV2EmojiCategory** * array,
                    gint* length,
                    gint* size,
                    TubaWidgetsCustomEmojiChooserV2EmojiCategory* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (TubaWidgetsCustomEmojiChooserV2EmojiCategory*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add139 (TubaWidgetsCustomEmojiChooserV2EmojiCategory** * array,
                    gint* length,
                    gint* size,
                    TubaWidgetsCustomEmojiChooserV2EmojiCategory* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (TubaWidgetsCustomEmojiChooserV2EmojiCategory*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
tuba_widgets_custom_emoji_chooser_v2_populate_chooser (TubaWidgetsCustomEmojiChooserV2* self)
{
	TubaWidgetsCustomEmojiChooserV2EmojiCategory** cats = NULL;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory** _tmp0_;
	gint cats_length1;
	gint _cats_size_;
	GeeHashMap* _tmp1_;
	GeeArrayList* categories_keys = NULL;
	GeeHashMap* _tmp2_;
	GeeSet* _tmp3_;
	GeeSet* _tmp4_;
	GeeSet* _tmp5_;
	gint _tmp6_ = 0;
	gpointer* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	GeeArrayList* _tmp10_;
	GeeArrayList* _tmp11_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* other_cat = NULL;
	GeeHashMap* _tmp12_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp48_;
	GListStore* _tmp51_;
	GListStore* _tmp52_;
	guint _tmp53_;
	guint _tmp54_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory** _tmp55_;
	gint _tmp55__length1;
	GeeArrayList* _tmp56_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (TubaWidgetsCustomEmojiChooserV2EmojiCategory*, 0 + 1);
	cats = _tmp0_;
	cats_length1 = 0;
	_cats_size_ = cats_length1;
	_tmp1_ = tuba_widgets_custom_emoji_chooser_v2_gen_emojis_cat_map (self);
	_g_object_unref0 (self->priv->instance_emoji_map);
	self->priv->instance_emoji_map = _tmp1_;
	tuba_widgets_custom_emoji_chooser_v2_setup_recents_emoji_category (self);
	_tmp2_ = self->priv->instance_emoji_map;
	_tmp3_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp7_ = gee_collection_to_array ((GeeCollection*) _tmp5_, &_tmp6_);
	_tmp8_ = gee_array_list_new_wrap (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp7_, _tmp6_, NULL, NULL, NULL);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp5_);
	categories_keys = _tmp9_;
	_tmp10_ = categories_keys;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp10_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY);
	_tmp11_ = categories_keys;
	gee_list_sort ((GeeList*) _tmp11_, _tuba_widgets_custom_emoji_chooser_v2_sort_strings_gcompare_data_func, g_object_ref (self), g_object_unref);
	other_cat = NULL;
	_tmp12_ = self->priv->instance_emoji_map;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp12_, _ ("Other"))) {
		GeeArrayList* mojis = NULL;
		GeeHashMap* _tmp13_;
		gpointer _tmp14_;
		GeeArrayList* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		_tmp13_ = self->priv->instance_emoji_map;
		_tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp13_, _ ("Other"));
		mojis = (GeeArrayList*) _tmp14_;
		_tmp15_ = mojis;
		_tmp16_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp15_);
		_tmp17_ = _tmp16_;
		if (_tmp17_ > 0) {
			const gchar* _tmp18_ = NULL;
			GeeHashMap* _tmp19_;
			gint _tmp20_;
			gint _tmp21_;
			gchar* cat_name = NULL;
			gchar* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			GeeArrayList* _tmp25_;
			gpointer _tmp26_;
			gchar* _tmp27_;
			TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp28_ = NULL;
			GeeArrayList* _tmp29_;
			_tmp19_ = self->priv->instance_emoji_map;
			_tmp20_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp19_);
			_tmp21_ = _tmp20_;
			if (_tmp21_ > 1) {
				_tmp18_ = _ ("Other");
			} else {
				_tmp18_ = _ ("Custom Emojis");
			}
			_tmp22_ = g_strdup (_tmp18_);
			cat_name = _tmp22_;
			_tmp23_ = cat_name;
			_tmp24_ = g_strdup (_tmp23_);
			_tmp25_ = mojis;
			_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, 0);
			_tmp27_ = g_strdup (_ ("Other"));
			_tmp28_ = tuba_widgets_custom_emoji_chooser_v2_emoji_category_new ();
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (_tmp28_, _tmp24_);
			_g_free0 (_tmp24_);
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (_tmp28_, (TubaAPIEmoji*) _tmp26_);
			_g_object_unref0 (_tmp26_);
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (_tmp28_, _tmp27_);
			_g_free0 (_tmp27_);
			_g_object_unref0 (other_cat);
			other_cat = _tmp28_;
			_tmp29_ = categories_keys;
			gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp29_, _ ("Other"));
			_g_free0 (cat_name);
		}
		_g_object_unref0 (mojis);
	}
	{
		GeeArrayList* _category_list = NULL;
		GeeArrayList* _tmp30_;
		gint _category_size = 0;
		GeeArrayList* _tmp31_;
		gint _tmp32_;
		gint _tmp33_;
		gint _category_index = 0;
		_tmp30_ = categories_keys;
		_category_list = _tmp30_;
		_tmp31_ = _category_list;
		_tmp32_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp31_);
		_tmp33_ = _tmp32_;
		_category_size = _tmp33_;
		_category_index = -1;
		while (TRUE) {
			gint _tmp34_;
			gint _tmp35_;
			gchar* category = NULL;
			GeeArrayList* _tmp36_;
			gpointer _tmp37_;
			const gchar* _tmp38_;
			gchar* _tmp39_;
			GeeHashMap* _tmp40_;
			const gchar* _tmp41_;
			gpointer _tmp42_;
			GeeArrayList* _tmp43_;
			gpointer _tmp44_;
			const gchar* _tmp45_;
			gchar* _tmp46_;
			TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp47_ = NULL;
			_category_index = _category_index + 1;
			_tmp34_ = _category_index;
			_tmp35_ = _category_size;
			if (!(_tmp34_ < _tmp35_)) {
				break;
			}
			_tmp36_ = _category_list;
			_tmp37_ = gee_abstract_list_get ((GeeAbstractList*) _tmp36_, _category_index);
			category = (gchar*) _tmp37_;
			_tmp38_ = category;
			_tmp39_ = g_strdup (_tmp38_);
			_tmp40_ = self->priv->instance_emoji_map;
			_tmp41_ = category;
			_tmp42_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp40_, _tmp41_);
			_tmp43_ = (GeeArrayList*) _tmp42_;
			_tmp44_ = gee_abstract_list_get ((GeeAbstractList*) _tmp43_, 0);
			_tmp45_ = category;
			_tmp46_ = g_strdup (_tmp45_);
			_tmp47_ = tuba_widgets_custom_emoji_chooser_v2_emoji_category_new ();
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (_tmp47_, _tmp39_);
			_g_free0 (_tmp39_);
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (_tmp47_, (TubaAPIEmoji*) _tmp44_);
			_g_object_unref0 (_tmp44_);
			tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (_tmp47_, _tmp46_);
			_g_free0 (_tmp46_);
			_vala_array_add138 (&cats, &cats_length1, &_cats_size_, _tmp47_);
			_g_object_unref0 (_tmp43_);
			_g_free0 (category);
		}
	}
	_tmp48_ = other_cat;
	if (_tmp48_ != NULL) {
		TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp49_;
		TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp50_;
		_tmp49_ = other_cat;
		_tmp50_ = _g_object_ref0 (_tmp49_);
		_vala_array_add139 (&cats, &cats_length1, &_cats_size_, _tmp50_);
	}
	_tmp51_ = self->priv->cat_model;
	_tmp52_ = self->priv->cat_model;
	g_object_get (_tmp52_, "n-items", &_tmp53_, NULL);
	_tmp54_ = _tmp53_;
	_tmp55_ = cats;
	_tmp55__length1 = cats_length1;
	g_list_store_splice (_tmp51_, _tmp54_, (guint) 0, _tmp55_, (guint) _tmp55__length1);
	_tmp56_ = categories_keys;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp56_);
	_g_object_unref0 (other_cat);
	_g_object_unref0 (categories_keys);
	cats = (_vala_array_free (cats, cats_length1, (GDestroyNotify) g_object_unref), NULL);
}

static gint
tuba_widgets_custom_emoji_chooser_v2_sort_strings (TubaWidgetsCustomEmojiChooserV2* self,
                                                   const gchar* a,
                                                   const gchar* b)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	result = g_utf8_collate (a, b);
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_v2_setup_search (TubaWidgetsCustomEmojiChooserV2* self)
{
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	TubaAccountStore* _tmp4_;
	TubaInstanceAccount* _tmp5_;
	TubaInstanceAccount* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	gint _tmp9_ = 0;
	gpointer* _tmp10_;
	TubaAPIEmoji** _tmp11_;
	gint _tmp11__length1;
	GtkLabel* _tmp12_;
	GtkStack* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->moji_grid_model;
	_tmp1_ = self->priv->moji_grid_model;
	g_object_get (_tmp1_, "n-items", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = tuba_accounts;
	_tmp5_ = tuba_account_store_get_active (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = tuba_instance_account_get_instance_emojis (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp10_ = gee_collection_to_array ((GeeCollection*) _tmp8_, &_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _tmp9_;
	g_list_store_splice (_tmp0_, (guint) 0, _tmp3_, _tmp11_, (guint) _tmp9_);
	_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp12_ = self->priv->cat_label;
	gtk_label_set_label (_tmp12_, _ ("Search"));
	_tmp13_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp13_, "mojis");
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_cat_activated (TubaWidgetsCustomEmojiChooserV2* self,
                                                       guint pos)
{
	gchar* category_name = NULL;
	GListStore* _tmp0_;
	GObject* _tmp1_;
	TubaWidgetsCustomEmojiChooserV2EmojiCategory* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GListStore* _tmp7_;
	GListStore* _tmp8_;
	guint _tmp9_;
	guint _tmp10_;
	GeeHashMap* _tmp11_;
	const gchar* _tmp12_;
	gpointer _tmp13_;
	GeeArrayList* _tmp14_;
	gint _tmp15_ = 0;
	gpointer* _tmp16_;
	TubaAPIEmoji** _tmp17_;
	gint _tmp17__length1;
	const gchar* _tmp18_ = NULL;
	const gchar* _tmp19_;
	GtkLabel* _tmp21_;
	GtkStack* _tmp22_;
	GtkSearchEntry* _tmp23_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cat_model;
	_tmp1_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_list_model_get_type (), GListModel), pos);
	_tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
	_tmp3_ = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup (_tmp4_);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp2_);
	category_name = _tmp6_;
	_tmp7_ = self->priv->moji_grid_model;
	_tmp8_ = self->priv->moji_grid_model;
	g_object_get (_tmp8_, "n-items", &_tmp9_, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->instance_emoji_map;
	_tmp12_ = category_name;
	_tmp13_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp11_, _tmp12_);
	_tmp14_ = (GeeArrayList*) _tmp13_;
	_tmp16_ = gee_collection_to_array ((GeeCollection*) _tmp14_, &_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp17__length1 = _tmp15_;
	g_list_store_splice (_tmp7_, (guint) 0, _tmp10_, _tmp17_, (guint) _tmp15_);
	_tmp17_ = (_vala_array_free (_tmp17_, _tmp17__length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (_tmp14_);
	_tmp19_ = category_name;
	if (g_strcmp0 (_tmp19_, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_RECENT_EMOJIS_CATEGORY) == 0) {
		_tmp18_ = _ ("Recently Used");
	} else {
		const gchar* _tmp20_;
		_tmp20_ = category_name;
		_tmp18_ = _tmp20_;
	}
	_tmp21_ = self->priv->cat_label;
	gtk_label_set_label (_tmp21_, _tmp18_);
	_tmp22_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp22_, "mojis");
	_tmp23_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp23_);
	tuba_widgets_custom_emoji_chooser_v2_set_search_active (self, FALSE);
	_g_free0 (category_name);
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_emoji_picked (TubaWidgetsCustomEmojiChooserV2* self,
                                                      guint pos)
{
	GtkFilterListModel* _tmp0_;
	GObject* _tmp1_;
	TubaAPIEmoji* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->filter_list_model;
	_tmp1_ = g_list_model_get_item (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_list_model_get_type (), GListModel), pos);
	_tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TUBA_API_TYPE_EMOJI, TubaAPIEmoji);
	tuba_widgets_custom_emoji_chooser_v2_on_custom_emoji_picked (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_stack_changed (TubaWidgetsCustomEmojiChooserV2* self)
{
	GtkBox* _tmp0_;
	GtkStack* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->bottom_bar;
	_tmp1_ = self->priv->main_stack;
	_tmp2_ = gtk_stack_get_visible_child_name (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, g_strcmp0 (_tmp3_, "categories") != 0);
}

static void
tuba_widgets_custom_emoji_chooser_v2_on_back_clicked (TubaWidgetsCustomEmojiChooserV2* self)
{
	GtkStack* _tmp0_;
	GListStore* _tmp1_;
	GtkSearchEntry* _tmp2_;
	GtkSearchEntry* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp0_, "categories");
	_tmp1_ = self->priv->moji_grid_model;
	g_list_store_remove_all (_tmp1_);
	_tmp2_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->entry;
	gtk_editable_set_text ((GtkEditable*) _tmp3_, "");
	tuba_widgets_custom_emoji_chooser_v2_set_search_active (self, FALSE);
}

TubaWidgetsCustomEmojiChooserV2*
tuba_widgets_custom_emoji_chooser_v2_construct (GType object_type)
{
	TubaWidgetsCustomEmojiChooserV2 * self = NULL;
	self = (TubaWidgetsCustomEmojiChooserV2*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsCustomEmojiChooserV2*
tuba_widgets_custom_emoji_chooser_v2_new (void)
{
	return tuba_widgets_custom_emoji_chooser_v2_construct (TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2);
}

const gchar*
tuba_widgets_custom_emoji_chooser_v2_get_query (TubaWidgetsCustomEmojiChooserV2* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_query;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_v2_set_query (TubaWidgetsCustomEmojiChooserV2* self,
                                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_v2_get_query (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_query);
		self->priv->_query = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY]);
	}
}

static gboolean
tuba_widgets_custom_emoji_chooser_v2_get_search_active (TubaWidgetsCustomEmojiChooserV2* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_search_active;
	return result;
}

static void
tuba_widgets_custom_emoji_chooser_v2_set_search_active (TubaWidgetsCustomEmojiChooserV2* self,
                                                        gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_search_active = value;
}

static inline gpointer
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_instance_private (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsCustomEmojiChooserV2EmojiCategory_private_offset);
}

TubaWidgetsCustomEmojiChooserV2EmojiCategory*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_construct (GType object_type)
{
	TubaWidgetsCustomEmojiChooserV2EmojiCategory * self = NULL;
	self = (TubaWidgetsCustomEmojiChooserV2EmojiCategory*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsCustomEmojiChooserV2EmojiCategory*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_new (void)
{
	return tuba_widgets_custom_emoji_chooser_v2_emoji_category_construct (TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY);
}

const gchar*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY]);
	}
}

const gchar*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_shortcode (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_emoji_shortcode;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_shortcode (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_shortcode (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_emoji_shortcode);
		self->priv->_emoji_shortcode = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY]);
	}
}

const gchar*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_url (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_emoji_url;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_url (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_url (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_emoji_url);
		self->priv->_emoji_url = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY]);
	}
}

const gchar*
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_real_category_name;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_real_category_name);
		self->priv->_real_category_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY]);
	}
}

void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (TubaWidgetsCustomEmojiChooserV2EmojiCategory* self,
                                                                    TubaAPIEmoji* value)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_api_emoji_get_shortcode (value);
	_tmp1_ = _tmp0_;
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_shortcode (self, _tmp1_);
	_tmp2_ = tuba_api_emoji_get_url (value);
	_tmp3_ = _tmp2_;
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_url (self, _tmp3_);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_FACE_PROPERTY]);
}

static void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_class_init (TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass * klass,
                                                                gpointer klass_data)
{
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsCustomEmojiChooserV2EmojiCategory_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_custom_emoji_chooser_v2_emoji_category_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY] = g_param_spec_string ("emoji-shortcode", "emoji-shortcode", "emoji-shortcode", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY] = g_param_spec_string ("emoji-url", "emoji-url", "emoji-url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY] = g_param_spec_string ("real-category-name", "real-category-name", "real-category-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_FACE_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_emoji_category_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_FACE_PROPERTY] = g_param_spec_object ("emoji-face", "emoji-face", "emoji-face", TUBA_API_TYPE_EMOJI, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_instance_init (TubaWidgetsCustomEmojiChooserV2EmojiCategory * self,
                                                                   gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	self->priv = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_emoji_shortcode = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_emoji_url = _tmp1_;
}

static void
tuba_widgets_custom_emoji_chooser_v2_emoji_category_finalize (GObject * obj)
{
	TubaWidgetsCustomEmojiChooserV2EmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_emoji_shortcode);
	_g_free0 (self->priv->_emoji_url);
	_g_free0 (self->priv->_real_category_name);
	G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_v2_emoji_category_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsCustomEmojiChooserV2EmojiCategoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_custom_emoji_chooser_v2_emoji_category_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsCustomEmojiChooserV2EmojiCategory), 0, (GInstanceInitFunc) tuba_widgets_custom_emoji_chooser_v2_emoji_category_instance_init, NULL };
	GType tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id;
	tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id = g_type_register_static (G_TYPE_OBJECT, "TubaWidgetsCustomEmojiChooserV2EmojiCategory", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsCustomEmojiChooserV2EmojiCategory_private_offset = g_type_add_instance_private (tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id, sizeof (TubaWidgetsCustomEmojiChooserV2EmojiCategoryPrivate));
	return tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id;
}

GType
tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type (void)
{
	static GType tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id__once)) {
		GType tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id;
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id = tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id__once, tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id);
	}
	return tuba_widgets_custom_emoji_chooser_v2_emoji_category_type_id__once;
}

static void
_vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserV2EmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_name (self));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_shortcode (self));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_emoji_url (self));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_v2_emoji_category_get_real_category_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_property (GObject * object,
                                                                        guint property_id,
                                                                        const GValue * value,
                                                                        GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserV2EmojiCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_TYPE_EMOJI_CATEGORY, TubaWidgetsCustomEmojiChooserV2EmojiCategory);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_NAME_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_name (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_SHORTCODE_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_shortcode (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_URL_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_url (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_REAL_CATEGORY_NAME_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_real_category_name (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_CATEGORY_EMOJI_FACE_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_emoji_category_set_emoji_face (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
tuba_widgets_custom_emoji_chooser_v2_class_init (TubaWidgetsCustomEmojiChooserV2Class * klass,
                                                 gpointer klass_data)
{
	tuba_widgets_custom_emoji_chooser_v2_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsCustomEmojiChooserV2_private_offset);
	((GtkWidgetClass *) klass)->show = (void (*) (GtkWidget*)) tuba_widgets_custom_emoji_chooser_v2_real_show;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_custom_emoji_chooser_v2_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_custom_emoji_chooser_v2_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_custom_emoji_chooser_v2_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY, tuba_widgets_custom_emoji_chooser_v2_properties[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY] = g_param_spec_string ("query", "query", "query", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_widgets_custom_emoji_chooser_v2_signals[TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_EMOJI_PICKED_SIGNAL] = g_signal_new ("emoji-picked", TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_custom_emoji_chooser_v2_instance_init (TubaWidgetsCustomEmojiChooserV2 * self,
                                                    gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_widgets_custom_emoji_chooser_v2_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_query = _tmp0_;
	self->priv->_search_active = FALSE;
	self->priv->instance_emoji_map = NULL;
	self->priv->has_been_constructed = FALSE;
}

static void
tuba_widgets_custom_emoji_chooser_v2_finalize (GObject * obj)
{
	TubaWidgetsCustomEmojiChooserV2 * self;
	GeeHashMap* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2);
	g_debug ("CustomEmojiChooserV2.vala:50: Destroying CustomEmojiChooserV2");
	_tmp0_ = self->priv->instance_emoji_map;
	if (_tmp0_ != NULL) {
		GeeHashMap* _tmp1_;
		_tmp1_ = self->priv->instance_emoji_map;
		gee_abstract_map_clear ((GeeAbstractMap*) _tmp1_);
	}
	_g_free0 (self->priv->_query);
	_g_object_unref0 (self->priv->instance_emoji_map);
	_g_object_unref0 (self->priv->entry);
	_g_object_unref0 (self->priv->main_stack);
	_g_object_unref0 (self->priv->cat_model);
	_g_object_unref0 (self->priv->moji_grid_model);
	_g_object_unref0 (self->priv->cat_label);
	_g_object_unref0 (self->priv->bottom_bar);
	_g_object_unref0 (self->priv->in_category_string_filter);
	_g_object_unref0 (self->priv->filter_list_model);
	G_OBJECT_CLASS (tuba_widgets_custom_emoji_chooser_v2_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_custom_emoji_chooser_v2_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsCustomEmojiChooserV2Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_custom_emoji_chooser_v2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsCustomEmojiChooserV2), 0, (GInstanceInitFunc) tuba_widgets_custom_emoji_chooser_v2_instance_init, NULL };
	GType tuba_widgets_custom_emoji_chooser_v2_type_id;
	tuba_widgets_custom_emoji_chooser_v2_type_id = g_type_register_static (gtk_popover_get_type (), "TubaWidgetsCustomEmojiChooserV2", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsCustomEmojiChooserV2_private_offset = g_type_add_instance_private (tuba_widgets_custom_emoji_chooser_v2_type_id, sizeof (TubaWidgetsCustomEmojiChooserV2Private));
	return tuba_widgets_custom_emoji_chooser_v2_type_id;
}

GType
tuba_widgets_custom_emoji_chooser_v2_get_type (void)
{
	static GType tuba_widgets_custom_emoji_chooser_v2_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_custom_emoji_chooser_v2_type_id__once)) {
		GType tuba_widgets_custom_emoji_chooser_v2_type_id;
		tuba_widgets_custom_emoji_chooser_v2_type_id = tuba_widgets_custom_emoji_chooser_v2_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_custom_emoji_chooser_v2_type_id__once, tuba_widgets_custom_emoji_chooser_v2_type_id);
	}
	return tuba_widgets_custom_emoji_chooser_v2_type_id__once;
}

static void
_vala_tuba_widgets_custom_emoji_chooser_v2_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserV2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY:
		g_value_set_string (value, tuba_widgets_custom_emoji_chooser_v2_get_query (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_custom_emoji_chooser_v2_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	TubaWidgetsCustomEmojiChooserV2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_CUSTOM_EMOJI_CHOOSER_V2, TubaWidgetsCustomEmojiChooserV2);
	switch (property_id) {
		case TUBA_WIDGETS_CUSTOM_EMOJI_CHOOSER_V2_QUERY_PROPERTY:
		tuba_widgets_custom_emoji_chooser_v2_set_query (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

