/* MarkupView.c generated by valac 0.56.19, the Vala compiler
 * generated from MarkupView.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 <adwaita.h>
#include <libxml/HTMLtree.h>
#include <libxml/HTMLparser.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <gio/gio.h>
#include <float.h>
#include <math.h>

#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_MARKUP_VIEW (tuba_widgets_markup_view_get_type ())
#define TUBA_WIDGETS_MARKUP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupView))
#define TUBA_WIDGETS_MARKUP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupViewClass))
#define TUBA_WIDGETS_IS_MARKUP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_MARKUP_VIEW))
#define TUBA_WIDGETS_IS_MARKUP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_MARKUP_VIEW))
#define TUBA_WIDGETS_MARKUP_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupViewClass))

typedef struct _TubaWidgetsMarkupView TubaWidgetsMarkupView;
typedef struct _TubaWidgetsMarkupViewClass TubaWidgetsMarkupViewClass;
typedef struct _TubaWidgetsMarkupViewPrivate TubaWidgetsMarkupViewPrivate;

#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_MENTION (tuba_api_mention_get_type ())
#define TUBA_API_MENTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_MENTION, TubaAPIMention))
#define TUBA_API_MENTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_MENTION, TubaAPIMentionClass))
#define TUBA_API_IS_MENTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_MENTION))
#define TUBA_API_IS_MENTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_MENTION))
#define TUBA_API_MENTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_MENTION, TubaAPIMentionClass))

typedef struct _TubaAPIMention TubaAPIMention;
typedef struct _TubaAPIMentionClass TubaAPIMentionClass;

#define TUBA_UTILS_TAG_EXTRACTOR_TYPE_TAG (tuba_utils_tag_extractor_tag_get_type ())
typedef struct _TubaUtilsTagExtractorTag TubaUtilsTagExtractorTag;
enum  {
	TUBA_WIDGETS_MARKUP_VIEW_0_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY,
	TUBA_WIDGETS_MARKUP_VIEW_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_WIDGETS_TYPE_RICH_LABEL (tuba_widgets_rich_label_get_type ())
#define TUBA_WIDGETS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_RICH_LABEL, TubaWidgetsRichLabel))
#define TUBA_WIDGETS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_RICH_LABEL, TubaWidgetsRichLabelClass))
#define TUBA_WIDGETS_IS_RICH_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_RICH_LABEL))
#define TUBA_WIDGETS_IS_RICH_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_RICH_LABEL))
#define TUBA_WIDGETS_RICH_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_RICH_LABEL, TubaWidgetsRichLabelClass))

typedef struct _TubaWidgetsRichLabel TubaWidgetsRichLabel;
typedef struct _TubaWidgetsRichLabelClass TubaWidgetsRichLabelClass;
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))
typedef void (*TubaWidgetsMarkupViewNodeFn) (xmlNode* node, gpointer user_data);
typedef void (*TubaWidgetsMarkupViewNodeHandlerFn) (TubaWidgetsMarkupView* view, xmlNode* node, gpointer user_data);
typedef struct _Block92Data Block92Data;

#define TUBA_UTILS_TAG_EXTRACTOR_TYPE_RESULT (tuba_utils_tag_extractor_result_get_type ())
typedef struct _TubaUtilsTagExtractorResult TubaUtilsTagExtractorResult;

#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;
typedef struct _TubaWidgetsRichLabelPrivate TubaWidgetsRichLabelPrivate;
typedef struct _Block93Data Block93Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _TubaWidgetsMarkupView {
	GtkBox parent_instance;
	TubaWidgetsMarkupViewPrivate * priv;
};

struct _TubaWidgetsMarkupViewClass {
	GtkBoxClass parent_class;
};

struct _TubaUtilsTagExtractorTag {
	gchar* tag;
	gchar* link;
};

struct _TubaWidgetsMarkupViewPrivate {
	gchar* current_chunk;
	gchar* _content;
	GRegex* _bold_text_regex;
	GeeHashMap* _instance_emojis;
	GeeArrayList* _mentions;
	gboolean _has_quote;
	gboolean _extract_last_tags;
	gboolean _has_link;
	TubaUtilsTagExtractorTag* extracted_tags;
	gint extracted_tags_length1;
	gint _extracted_tags_size_;
	gboolean _selectable;
	gboolean _can_open;
};

struct _Block92Data {
	int _ref_count_;
	TubaWidgetsMarkupView* v;
	TubaWidgetsMarkupViewNodeHandlerFn handler;
	gpointer handler_target;
	GDestroyNotify handler_target_destroy_notify;
};

struct _TubaUtilsTagExtractorResult {
	gchar* input_without_tags;
	TubaUtilsTagExtractorTag* extracted_tags;
	gint extracted_tags_length1;
};

struct _TubaWidgetsRichLabel {
	AdwBin parent_instance;
	TubaWidgetsRichLabelPrivate * priv;
	GeeArrayList* mentions;
};

struct _TubaWidgetsRichLabelClass {
	AdwBinClass parent_class;
};

struct _Block93Data {
	int _ref_count_;
	xmlNode* root;
	GRegex* bold_text_regex;
};

static gint TubaWidgetsMarkupView_private_offset;
static gpointer tuba_widgets_markup_view_parent_class = NULL;
static gchar* tuba_widgets_markup_view_blockquote_handler_text;
static gchar* tuba_widgets_markup_view_blockquote_handler_text = NULL;
VALA_EXTERN TubaSettings* tuba_settings;

VALA_EXTERN GType tuba_widgets_markup_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsMarkupView, 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_mention_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIMention, g_object_unref)
VALA_EXTERN GType tuba_utils_tag_extractor_tag_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaUtilsTagExtractorTag* tuba_utils_tag_extractor_tag_dup (const TubaUtilsTagExtractorTag* self);
VALA_EXTERN void tuba_utils_tag_extractor_tag_free (TubaUtilsTagExtractorTag* self);
VALA_EXTERN void tuba_utils_tag_extractor_tag_copy (const TubaUtilsTagExtractorTag* self,
                                        TubaUtilsTagExtractorTag* dest);
VALA_EXTERN void tuba_utils_tag_extractor_tag_destroy (TubaUtilsTagExtractorTag* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaUtilsTagExtractorTag, tuba_utils_tag_extractor_tag_destroy)
static void _vala_TubaUtilsTagExtractorTag_array_free (TubaUtilsTagExtractorTag * array,
                                                gssize array_length);
VALA_EXTERN TubaUtilsTagExtractorTag* tuba_widgets_markup_view_get_extracted_tags (TubaWidgetsMarkupView* self,
                                                                       gint* result_length1);
static TubaUtilsTagExtractorTag* _vala_array_dup49 (TubaUtilsTagExtractorTag* self,
                                             gssize length);
static void tuba_widgets_markup_view_update_aria (TubaWidgetsMarkupView* self);
VALA_EXTERN GType tuba_widgets_rich_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsRichLabel, g_object_unref)
VALA_EXTERN const gchar* tuba_widgets_rich_label_get_accessible_text (TubaWidgetsRichLabel* self);
static void tuba_widgets_markup_view_update_content (TubaWidgetsMarkupView* self,
                                              const gchar* content);
VALA_EXTERN void tuba_widgets_markup_view_set_has_link (TubaWidgetsMarkupView* self,
                                            gboolean value);
VALA_EXTERN gchar* tuba_utils_htmlx_replace_with_pango_markup (const gchar* str);
VALA_EXTERN void tuba_widgets_markup_view_default_handler (TubaWidgetsMarkupView* v,
                                               xmlNode* root);
static void tuba_widgets_markup_view_traverse (xmlNode* root,
                                        TubaWidgetsMarkupViewNodeFn cb,
                                        gpointer cb_target,
                                        GDestroyNotify cb_target_destroy_notify);
static void tuba_widgets_markup_view_traverse_and_handle (TubaWidgetsMarkupView* v,
                                                   xmlNode* root,
                                                   TubaWidgetsMarkupViewNodeHandlerFn handler,
                                                   gpointer handler_target,
                                                   GDestroyNotify handler_target_destroy_notify);
static Block92Data* block92_data_ref (Block92Data* _data92_);
static void block92_data_unref (void * _userdata_);
static void __lambda42_ (Block92Data* _data92_,
                  xmlNode* node);
static void ___lambda42__tuba_widgets_markup_view_node_fn (xmlNode* node,
                                                    gpointer self);
static void tuba_widgets_markup_view_extract_tags (TubaWidgetsMarkupView* self);
VALA_EXTERN gboolean tuba_widgets_markup_view_get_has_link (TubaWidgetsMarkupView* self);
VALA_EXTERN GType tuba_utils_tag_extractor_result_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaUtilsTagExtractorResult* tuba_utils_tag_extractor_result_dup (const TubaUtilsTagExtractorResult* self);
VALA_EXTERN void tuba_utils_tag_extractor_result_free (TubaUtilsTagExtractorResult* self);
VALA_EXTERN void tuba_utils_tag_extractor_result_copy (const TubaUtilsTagExtractorResult* self,
                                           TubaUtilsTagExtractorResult* dest);
VALA_EXTERN void tuba_utils_tag_extractor_result_destroy (TubaUtilsTagExtractorResult* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaUtilsTagExtractorResult, tuba_utils_tag_extractor_result_destroy)
VALA_EXTERN void tuba_utils_tag_extractor_from_string (const gchar* input,
                                           TubaUtilsTagExtractorResult* result);
static TubaUtilsTagExtractorTag* _vala_array_dup50 (TubaUtilsTagExtractorTag* self,
                                             gssize length);
static void tuba_widgets_markup_view_commit_chunk (TubaWidgetsMarkupView* self);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN gboolean tuba_settings_get_enlarge_custom_emojis (TubaSettings* self);
VALA_EXTERN TubaWidgetsRichLabel* tuba_widgets_rich_label_new (const gchar* text);
VALA_EXTERN TubaWidgetsRichLabel* tuba_widgets_rich_label_construct (GType object_type,
                                                         const gchar* text);
VALA_EXTERN void tuba_widgets_rich_label_set_selectable (TubaWidgetsRichLabel* self,
                                             gboolean value);
VALA_EXTERN void tuba_widgets_rich_label_set_large_emojis (TubaWidgetsRichLabel* self,
                                               gboolean value);
VALA_EXTERN void tuba_widgets_rich_label_set_use_markup (TubaWidgetsRichLabel* self,
                                             gboolean value);
VALA_EXTERN void tuba_widgets_rich_label_set_yalign (TubaWidgetsRichLabel* self,
                                         gfloat value);
VALA_EXTERN GeeHashMap* tuba_widgets_markup_view_get_instance_emojis (TubaWidgetsMarkupView* self);
VALA_EXTERN void tuba_widgets_rich_label_set_instance_emojis (TubaWidgetsRichLabel* self,
                                                  GeeHashMap* value);
VALA_EXTERN GeeArrayList* tuba_widgets_markup_view_get_mentions (TubaWidgetsMarkupView* self);
VALA_EXTERN void tuba_widgets_rich_label_set_label (TubaWidgetsRichLabel* self,
                                        const gchar* value);
static void tuba_widgets_markup_view_write_chunk (TubaWidgetsMarkupView* self,
                                           const gchar* chunk);
static void tuba_widgets_markup_view_strip_chunk (TubaWidgetsMarkupView* self);
static gboolean tuba_widgets_markup_view_chunk_ends_in_newline (TubaWidgetsMarkupView* self);
static void tuba_widgets_markup_view_blockquote_handler (xmlNode* root,
                                                  GRegex* bold_text_regex);
static Block93Data* block93_data_ref (Block93Data* _data93_);
static void block93_data_unref (void * _userdata_);
static void __lambda44_ (Block93Data* _data93_,
                  xmlNode* node);
static gchar* tuba_widgets_markup_view_bold_needle (gchar* source,
                                             GRegex* bold_text_regex);
static void ___lambda44__tuba_widgets_markup_view_node_fn (xmlNode* node,
                                                    gpointer self);
VALA_EXTERN void tuba_widgets_markup_view_list_item_handler (TubaWidgetsMarkupView* v,
                                                 xmlNode* root);
static void _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn (TubaWidgetsMarkupView* view,
                                                                                         xmlNode* node,
                                                                                         gpointer self);
VALA_EXTERN gboolean tuba_widgets_markup_view_get_has_quote (TubaWidgetsMarkupView* self);
VALA_EXTERN gboolean tuba_widgets_markup_view_get_extract_last_tags (TubaWidgetsMarkupView* self);
VALA_EXTERN GRegex* tuba_widgets_markup_view_get_bold_text_regex (TubaWidgetsMarkupView* self);
VALA_EXTERN gboolean tuba_widgets_markup_view_get_selectable (TubaWidgetsMarkupView* self);
static void _tuba_widgets_markup_view_list_item_handler_tuba_widgets_markup_view_node_handler_fn (TubaWidgetsMarkupView* view,
                                                                                           xmlNode* node,
                                                                                           gpointer self);
VALA_EXTERN TubaWidgetsMarkupView* tuba_widgets_markup_view_new (void);
VALA_EXTERN TubaWidgetsMarkupView* tuba_widgets_markup_view_construct (GType object_type);
VALA_EXTERN const gchar* tuba_widgets_markup_view_get_content (TubaWidgetsMarkupView* self);
VALA_EXTERN void tuba_widgets_markup_view_set_content (TubaWidgetsMarkupView* self,
                                           const gchar* value);
VALA_EXTERN void tuba_widgets_markup_view_set_bold_text_regex (TubaWidgetsMarkupView* self,
                                                   GRegex* value);
VALA_EXTERN void tuba_widgets_markup_view_set_instance_emojis (TubaWidgetsMarkupView* self,
                                                   GeeHashMap* value);
VALA_EXTERN void tuba_widgets_markup_view_set_mentions (TubaWidgetsMarkupView* self,
                                            GeeArrayList* value);
VALA_EXTERN void tuba_widgets_markup_view_set_has_quote (TubaWidgetsMarkupView* self,
                                             gboolean value);
VALA_EXTERN void tuba_widgets_markup_view_set_extract_last_tags (TubaWidgetsMarkupView* self,
                                                     gboolean value);
VALA_EXTERN void tuba_widgets_markup_view_set_selectable (TubaWidgetsMarkupView* self,
                                              gboolean value);
VALA_EXTERN gboolean tuba_widgets_markup_view_get_can_open (TubaWidgetsMarkupView* self);
VALA_EXTERN void tuba_widgets_markup_view_set_can_open (TubaWidgetsMarkupView* self,
                                            gboolean value);
VALA_EXTERN void tuba_widgets_rich_label_set_can_open (TubaWidgetsRichLabel* self,
                                           gboolean value);
static GObject * tuba_widgets_markup_view_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void tuba_widgets_markup_view_finalize (GObject * obj);
static GType tuba_widgets_markup_view_get_type_once (void);
static void _vala_tuba_widgets_markup_view_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_tuba_widgets_markup_view_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_markup_view_get_instance_private (TubaWidgetsMarkupView* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsMarkupView_private_offset);
}

static void
_vala_TubaUtilsTagExtractorTag_array_free (TubaUtilsTagExtractorTag * array,
                                           gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			tuba_utils_tag_extractor_tag_destroy (&array[i]);
		}
	}
	g_free (array);
}

static TubaUtilsTagExtractorTag*
_vala_array_dup49 (TubaUtilsTagExtractorTag* self,
                   gssize length)
{
	if (length > 0) {
		TubaUtilsTagExtractorTag* result;
		gssize i;
		result = g_new0 (TubaUtilsTagExtractorTag, length);
		for (i = 0; i < length; i++) {
			TubaUtilsTagExtractorTag _tmp0_;
			TubaUtilsTagExtractorTag _tmp1_ = {0};
			_tmp0_ = self[i];
			tuba_utils_tag_extractor_tag_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

TubaUtilsTagExtractorTag*
tuba_widgets_markup_view_get_extracted_tags (TubaWidgetsMarkupView* self,
                                             gint* result_length1)
{
	TubaUtilsTagExtractorTag* _tmp0_;
	gint _tmp0__length1;
	TubaUtilsTagExtractorTag* _tmp1_;
	gint _tmp1__length1;
	TubaUtilsTagExtractorTag* _tmp2_;
	gint _tmp2__length1;
	TubaUtilsTagExtractorTag* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->extracted_tags;
	_tmp0__length1 = self->priv->extracted_tags_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup49 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

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

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_markup_view_update_aria (TubaWidgetsMarkupView* self)
{
	gchar* total_aria = NULL;
	gchar* _tmp0_;
	const gchar* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("");
	total_aria = _tmp0_;
	{
		GtkWidget* w = NULL;
		GtkWidget* _tmp1_;
		GtkWidget* _tmp2_;
		_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) self);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		w = _tmp2_;
		while (TRUE) {
			GtkWidget* _tmp3_;
			TubaWidgetsRichLabel* label = NULL;
			GtkWidget* _tmp4_;
			TubaWidgetsRichLabel* _tmp5_;
			TubaWidgetsRichLabel* _tmp6_;
			GtkWidget* _tmp15_;
			GtkWidget* _tmp16_;
			GtkWidget* _tmp17_;
			_tmp3_ = w;
			if (!(_tmp3_ != NULL)) {
				break;
			}
			_tmp4_ = w;
			_tmp5_ = _g_object_ref0 (TUBA_WIDGETS_IS_RICH_LABEL (_tmp4_) ? ((TubaWidgetsRichLabel*) _tmp4_) : NULL);
			label = _tmp5_;
			_tmp6_ = label;
			if (_tmp6_ != NULL) {
				const gchar* _tmp7_;
				TubaWidgetsRichLabel* _tmp8_;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				_tmp7_ = total_aria;
				_tmp8_ = label;
				_tmp9_ = tuba_widgets_rich_label_get_accessible_text (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = string_to_string (_tmp10_);
				_tmp12_ = g_strconcat ("\n", _tmp11_, NULL);
				_tmp13_ = _tmp12_;
				_tmp14_ = g_strconcat (_tmp7_, _tmp13_, NULL);
				_g_free0 (total_aria);
				total_aria = _tmp14_;
				_g_free0 (_tmp13_);
			}
			_tmp15_ = w;
			_tmp16_ = gtk_widget_get_next_sibling (_tmp15_);
			_tmp17_ = _g_object_ref0 (_tmp16_);
			_g_object_unref0 (w);
			w = _tmp17_;
			_g_object_unref0 (label);
		}
		_g_object_unref0 (w);
	}
	_tmp18_ = total_aria;
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, _tmp18_, -1, -1);
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, NULL, -1, -1);
	_g_free0 (total_aria);
}

static void
tuba_widgets_markup_view_update_content (TubaWidgetsMarkupView* self,
                                         const gchar* content)
{
	gchar* to_parse = NULL;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	xmlDoc* doc = NULL;
	const gchar* _tmp11_;
	xmlDoc* _tmp12_;
	xmlDoc* _tmp13_;
	xmlDoc* _tmp18_;
	GtkWidget* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	_g_free0 (self->priv->current_chunk);
	self->priv->current_chunk = NULL;
	self->priv->extracted_tags = (_vala_TubaUtilsTagExtractorTag_array_free (self->priv->extracted_tags, self->priv->extracted_tags_length1), NULL);
	self->priv->extracted_tags = NULL;
	self->priv->extracted_tags_length1 = 0;
	self->priv->_extracted_tags_size_ = self->priv->extracted_tags_length1;
	tuba_widgets_markup_view_set_has_link (self, FALSE);
	{
		GtkWidget* w = NULL;
		GtkWidget* _tmp0_;
		GtkWidget* _tmp1_;
		_tmp0_ = gtk_widget_get_first_child ((GtkWidget*) self);
		_tmp1_ = _g_object_ref0 (_tmp0_);
		w = _tmp1_;
		while (TRUE) {
			GtkWidget* _tmp2_;
			GtkWidget* w2 = NULL;
			GtkWidget* _tmp3_;
			GtkWidget* _tmp4_;
			GtkWidget* _tmp5_;
			GtkWidget* _tmp6_;
			GtkWidget* _tmp7_;
			GtkWidget* _tmp8_;
			_tmp2_ = w;
			if (!(_tmp2_ != NULL)) {
				break;
			}
			_tmp3_ = w;
			_tmp4_ = gtk_widget_get_next_sibling (_tmp3_);
			_tmp5_ = _g_object_ref0 (_tmp4_);
			w2 = _tmp5_;
			_tmp6_ = w;
			gtk_box_remove ((GtkBox*) self, _tmp6_);
			_tmp7_ = w2;
			_tmp8_ = _g_object_ref0 (_tmp7_);
			_g_object_unref0 (w);
			w = _tmp8_;
			_g_object_unref0 (w2);
		}
		_g_object_unref0 (w);
	}
	_tmp9_ = tuba_utils_htmlx_replace_with_pango_markup (content);
	to_parse = _tmp9_;
	_tmp10_ = to_parse;
	if (g_strcmp0 (_tmp10_, "") == 0) {
		_g_free0 (to_parse);
		return;
	}
	_tmp11_ = to_parse;
	_tmp12_ = htmlReadDoc ((xmlChar*) _tmp11_, "", "utf8", 0);
	doc = _tmp12_;
	_tmp13_ = doc;
	if (_tmp13_ != NULL) {
		xmlNode* root = NULL;
		xmlDoc* _tmp14_;
		xmlNode* _tmp15_;
		xmlNode* _tmp16_;
		_tmp14_ = doc;
		_tmp15_ = xmlDocGetRootElement (_tmp14_);
		root = _tmp15_;
		_tmp16_ = root;
		if (_tmp16_ != NULL) {
			xmlNode* _tmp17_;
			_tmp17_ = root;
			tuba_widgets_markup_view_default_handler (self, _tmp17_);
		}
	}
	_tmp18_ = doc;
	_xmlFreeDoc0 (_tmp18_);
	_tmp19_ = gtk_widget_get_first_child ((GtkWidget*) self);
	gtk_widget_set_visible ((GtkWidget*) self, _tmp19_ != NULL);
	tuba_widgets_markup_view_update_aria (self);
	_g_free0 (to_parse);
}

static void
tuba_widgets_markup_view_traverse (xmlNode* root,
                                   TubaWidgetsMarkupViewNodeFn cb,
                                   gpointer cb_target,
                                   GDestroyNotify cb_target_destroy_notify)
{
	{
		xmlNode* iter = NULL;
		xmlNode* _tmp0_;
		_tmp0_ = root->children;
		iter = _tmp0_;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp4_;
				xmlNode* _tmp5_;
				if (!_tmp1_) {
					xmlNode* _tmp2_;
					xmlNode* _tmp3_;
					_tmp2_ = iter;
					_tmp3_ = _tmp2_->next;
					iter = _tmp3_;
				}
				_tmp1_ = FALSE;
				_tmp4_ = iter;
				if (!(_tmp4_ != NULL)) {
					break;
				}
				_tmp5_ = iter;
				cb (_tmp5_, cb_target);
			}
		}
	}
	(cb_target_destroy_notify == NULL) ? NULL : (cb_target_destroy_notify (cb_target), NULL);
	cb = NULL;
	cb_target = NULL;
	cb_target_destroy_notify = NULL;
}

static Block92Data*
block92_data_ref (Block92Data* _data92_)
{
	g_atomic_int_inc (&_data92_->_ref_count_);
	return _data92_;
}

static void
block92_data_unref (void * _userdata_)
{
	Block92Data* _data92_;
	_data92_ = (Block92Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data92_->_ref_count_)) {
		_g_object_unref0 (_data92_->v);
		(_data92_->handler_target_destroy_notify == NULL) ? NULL : (_data92_->handler_target_destroy_notify (_data92_->handler_target), NULL);
		_data92_->handler = NULL;
		_data92_->handler_target = NULL;
		_data92_->handler_target_destroy_notify = NULL;
		g_slice_free (Block92Data, _data92_);
	}
}

static void
__lambda42_ (Block92Data* _data92_,
             xmlNode* node)
{
	_data92_->handler (_data92_->v, node, _data92_->handler_target);
}

static void
___lambda42__tuba_widgets_markup_view_node_fn (xmlNode* node,
                                               gpointer self)
{
	__lambda42_ (self, node);
}

static void
tuba_widgets_markup_view_traverse_and_handle (TubaWidgetsMarkupView* v,
                                              xmlNode* root,
                                              TubaWidgetsMarkupViewNodeHandlerFn handler,
                                              gpointer handler_target,
                                              GDestroyNotify handler_target_destroy_notify)
{
	Block92Data* _data92_;
	TubaWidgetsMarkupView* _tmp0_;
	g_return_if_fail (v != NULL);
	_data92_ = g_slice_new0 (Block92Data);
	_data92_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (v);
	_g_object_unref0 (_data92_->v);
	_data92_->v = _tmp0_;
	(_data92_->handler_target_destroy_notify == NULL) ? NULL : (_data92_->handler_target_destroy_notify (_data92_->handler_target), NULL);
	_data92_->handler = NULL;
	_data92_->handler_target = NULL;
	_data92_->handler_target_destroy_notify = NULL;
	_data92_->handler = handler;
	_data92_->handler_target = handler_target;
	_data92_->handler_target_destroy_notify = handler_target_destroy_notify;
	tuba_widgets_markup_view_traverse (root, ___lambda42__tuba_widgets_markup_view_node_fn, block92_data_ref (_data92_), block92_data_unref);
	block92_data_unref (_data92_);
	_data92_ = NULL;
}

static TubaUtilsTagExtractorTag*
_vala_array_dup50 (TubaUtilsTagExtractorTag* self,
                   gssize length)
{
	if (length > 0) {
		TubaUtilsTagExtractorTag* result;
		gssize i;
		result = g_new0 (TubaUtilsTagExtractorTag, length);
		for (i = 0; i < length; i++) {
			TubaUtilsTagExtractorTag _tmp0_;
			TubaUtilsTagExtractorTag _tmp1_ = {0};
			_tmp0_ = self[i];
			tuba_utils_tag_extractor_tag_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

static void
tuba_widgets_markup_view_extract_tags (TubaWidgetsMarkupView* self)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	TubaUtilsTagExtractorResult extracted = {0};
	const gchar* _tmp3_;
	TubaUtilsTagExtractorResult _tmp4_ = {0};
	gboolean _tmp5_ = FALSE;
	TubaUtilsTagExtractorResult _tmp6_;
	const gchar* _tmp7_;
	TubaUtilsTagExtractorResult _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	TubaUtilsTagExtractorResult _tmp13_;
	TubaUtilsTagExtractorTag* _tmp14_;
	gint _tmp14__length1;
	TubaUtilsTagExtractorTag* _tmp15_;
	gint _tmp15__length1;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->current_chunk;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp2_;
		_tmp2_ = self->priv->_has_link;
		_tmp0_ = !_tmp2_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->current_chunk;
	tuba_utils_tag_extractor_from_string (_tmp3_, &_tmp4_);
	extracted = _tmp4_;
	_tmp6_ = extracted;
	_tmp7_ = _tmp6_.input_without_tags;
	if (_tmp7_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		TubaUtilsTagExtractorResult _tmp8_;
		TubaUtilsTagExtractorTag* _tmp9_;
		gint _tmp9__length1;
		_tmp8_ = extracted;
		_tmp9_ = _tmp8_.extracted_tags;
		_tmp9__length1 = _tmp8_.extracted_tags_length1;
		_tmp5_ = _tmp9_ == NULL;
	}
	if (_tmp5_) {
		tuba_utils_tag_extractor_result_destroy (&extracted);
		return;
	}
	_tmp10_ = extracted;
	_tmp11_ = _tmp10_.input_without_tags;
	_tmp12_ = g_strdup (_tmp11_);
	_g_free0 (self->priv->current_chunk);
	self->priv->current_chunk = _tmp12_;
	_tmp13_ = extracted;
	_tmp14_ = _tmp13_.extracted_tags;
	_tmp14__length1 = _tmp13_.extracted_tags_length1;
	_tmp15_ = (_tmp14_ != NULL) ? _vala_array_dup50 (_tmp14_, _tmp14__length1) : _tmp14_;
	_tmp15__length1 = _tmp14__length1;
	self->priv->extracted_tags = (_vala_TubaUtilsTagExtractorTag_array_free (self->priv->extracted_tags, self->priv->extracted_tags_length1), NULL);
	self->priv->extracted_tags = _tmp15_;
	self->priv->extracted_tags_length1 = _tmp15__length1;
	self->priv->_extracted_tags_size_ = self->priv->extracted_tags_length1;
	tuba_utils_tag_extractor_result_destroy (&extracted);
}

static gchar*
string_strip (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_strstrip (_result_);
	result = _result_;
	return result;
}

static void
tuba_widgets_markup_view_commit_chunk (TubaWidgetsMarkupView* self)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->current_chunk;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->current_chunk;
		_tmp0_ = g_strcmp0 (_tmp2_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		TubaWidgetsRichLabel* label = NULL;
		TubaSettings* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		TubaWidgetsRichLabel* _tmp6_ = NULL;
		GeeHashMap* _tmp7_;
		GeeArrayList* _tmp10_;
		TubaWidgetsRichLabel* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		TubaWidgetsRichLabel* _tmp18_;
		_tmp3_ = tuba_settings;
		_tmp4_ = tuba_settings_get_enlarge_custom_emojis (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = tuba_widgets_rich_label_new (NULL);
		gtk_widget_set_visible ((GtkWidget*) _tmp6_, TRUE);
		tuba_widgets_rich_label_set_selectable (_tmp6_, self->priv->_selectable);
		gtk_widget_set_vexpand ((GtkWidget*) _tmp6_, TRUE);
		tuba_widgets_rich_label_set_large_emojis (_tmp6_, _tmp5_);
		tuba_widgets_rich_label_set_use_markup (_tmp6_, TRUE);
		tuba_widgets_rich_label_set_yalign (_tmp6_, 0.f);
		g_object_ref_sink (_tmp6_);
		label = _tmp6_;
		_tmp7_ = self->priv->_instance_emojis;
		if (_tmp7_ != NULL) {
			TubaWidgetsRichLabel* _tmp8_;
			GeeHashMap* _tmp9_;
			_tmp8_ = label;
			_tmp9_ = self->priv->_instance_emojis;
			tuba_widgets_rich_label_set_instance_emojis (_tmp8_, _tmp9_);
		}
		_tmp10_ = self->priv->_mentions;
		if (_tmp10_ != NULL) {
			TubaWidgetsRichLabel* _tmp11_;
			GeeArrayList* _tmp12_;
			GeeArrayList* _tmp13_;
			_tmp11_ = label;
			_tmp12_ = self->priv->_mentions;
			_tmp13_ = _g_object_ref0 (_tmp12_);
			_g_object_unref0 (_tmp11_->mentions);
			_tmp11_->mentions = _tmp13_;
		}
		_tmp14_ = label;
		_tmp15_ = self->priv->current_chunk;
		_tmp16_ = string_strip (_tmp15_);
		_tmp17_ = _tmp16_;
		tuba_widgets_rich_label_set_label (_tmp14_, _tmp17_);
		_g_free0 (_tmp17_);
		_tmp18_ = label;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp18_);
		_g_object_unref0 (label);
	}
	_g_free0 (self->priv->current_chunk);
	self->priv->current_chunk = NULL;
}

static void
tuba_widgets_markup_view_write_chunk (TubaWidgetsMarkupView* self,
                                      const gchar* chunk)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	if (chunk == NULL) {
		return;
	}
	_tmp0_ = self->priv->current_chunk;
	if (_tmp0_ == NULL) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup (chunk);
		_g_free0 (self->priv->current_chunk);
		self->priv->current_chunk = _tmp1_;
	} else {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = self->priv->current_chunk;
		_tmp3_ = g_strconcat (_tmp2_, chunk, NULL);
		_g_free0 (self->priv->current_chunk);
		self->priv->current_chunk = _tmp3_;
	}
}

static void
tuba_widgets_markup_view_strip_chunk (TubaWidgetsMarkupView* self)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_chunk;
	if (_tmp0_ != NULL) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->priv->current_chunk;
		_tmp2_ = string_strip (_tmp1_);
		_g_free0 (self->priv->current_chunk);
		self->priv->current_chunk = _tmp2_;
	}
}

static gboolean
tuba_widgets_markup_view_chunk_ends_in_newline (TubaWidgetsMarkupView* self)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->current_chunk;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->current_chunk;
	result = g_str_has_suffix (_tmp1_, "\n");
	return result;
}

static gpointer
_g_regex_ref0 (gpointer self)
{
	return self ? g_regex_ref (self) : NULL;
}

static Block93Data*
block93_data_ref (Block93Data* _data93_)
{
	g_atomic_int_inc (&_data93_->_ref_count_);
	return _data93_;
}

static void
block93_data_unref (void * _userdata_)
{
	Block93Data* _data93_;
	_data93_ = (Block93Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data93_->_ref_count_)) {
		_g_regex_unref0 (_data93_->bold_text_regex);
		g_slice_free (Block93Data, _data93_);
	}
}

static void
__lambda44_ (Block93Data* _data93_,
             xmlNode* node)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	static GQuark _tmp2_label4 = 0;
	static GQuark _tmp2_label5 = 0;
	static GQuark _tmp2_label6 = 0;
	static GQuark _tmp2_label7 = 0;
	static GQuark _tmp2_label8 = 0;
	static GQuark _tmp2_label9 = 0;
	static GQuark _tmp2_label10 = 0;
	static GQuark _tmp2_label11 = 0;
	static GQuark _tmp2_label12 = 0;
	static GQuark _tmp2_label13 = 0;
	static GQuark _tmp2_label14 = 0;
	static GQuark _tmp2_label15 = 0;
	static GQuark _tmp2_label16 = 0;
	static GQuark _tmp2_label17 = 0;
	static GQuark _tmp2_label18 = 0;
	static GQuark _tmp2_label19 = 0;
	_tmp0_ = node->name;
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("text")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				gchar* _tmp6_;
				gchar* _tmp7_;
				gchar* _tmp8_;
				gchar* _tmp9_;
				_tmp4_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp5_ = node->content;
				_tmp6_ = g_markup_escape_text (_tmp5_, (gssize) -1);
				_tmp7_ = tuba_widgets_markup_view_bold_needle (_tmp6_, _data93_->bold_text_regex);
				_tmp8_ = _tmp7_;
				_tmp9_ = g_strconcat (_tmp4_, _tmp8_, NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp9_;
				_g_free0 (_tmp8_);
				break;
			}
		}
	} else if (((((((_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("html")))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("span"))))) || (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("markup"))))) || (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("pre"))))) || (_tmp3_ == ((0 != _tmp2_label5) ? _tmp2_label5 : (_tmp2_label5 = g_quark_from_static_string ("body"))))) || (_tmp3_ == ((0 != _tmp2_label6) ? _tmp2_label6 : (_tmp2_label6 = g_quark_from_static_string ("p"))))) || (_tmp3_ == ((0 != _tmp2_label7) ? _tmp2_label7 : (_tmp2_label7 = g_quark_from_static_string ("div"))))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
				break;
			}
		}
	} else if ((((((_tmp3_ == ((0 != _tmp2_label8) ? _tmp2_label8 : (_tmp2_label8 = g_quark_from_static_string ("b")))) || (_tmp3_ == ((0 != _tmp2_label9) ? _tmp2_label9 : (_tmp2_label9 = g_quark_from_static_string ("i"))))) || (_tmp3_ == ((0 != _tmp2_label10) ? _tmp2_label10 : (_tmp2_label10 = g_quark_from_static_string ("u"))))) || (_tmp3_ == ((0 != _tmp2_label11) ? _tmp2_label11 : (_tmp2_label11 = g_quark_from_static_string ("s"))))) || (_tmp3_ == ((0 != _tmp2_label12) ? _tmp2_label12 : (_tmp2_label12 = g_quark_from_static_string ("sup"))))) || (_tmp3_ == ((0 != _tmp2_label13) ? _tmp2_label13 : (_tmp2_label13 = g_quark_from_static_string ("sub"))))) {
		switch (0) {
			default:
			{
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				gchar* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				_tmp10_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp11_ = node->name;
				_tmp12_ = string_to_string (_tmp11_);
				_tmp13_ = g_strconcat ("<", _tmp12_, ">", NULL);
				_tmp14_ = _tmp13_;
				_tmp15_ = g_strconcat (_tmp10_, _tmp14_, NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp15_;
				_g_free0 (_tmp14_);
				tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
				_tmp16_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp17_ = node->name;
				_tmp18_ = string_to_string (_tmp17_);
				_tmp19_ = g_strconcat ("</", _tmp18_, ">", NULL);
				_tmp20_ = _tmp19_;
				_tmp21_ = g_strconcat (_tmp16_, _tmp20_, NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp21_;
				_g_free0 (_tmp20_);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label14) ? _tmp2_label14 : (_tmp2_label14 = g_quark_from_static_string ("code")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp22_;
				gchar* _tmp23_;
				const gchar* _tmp24_;
				gchar* _tmp25_;
				_tmp22_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp23_ = g_strconcat (_tmp22_, "<span font_family=\"monospace\">", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp23_;
				tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
				_tmp24_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp25_ = g_strconcat (_tmp24_, "</span>", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp25_;
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label15) ? _tmp2_label15 : (_tmp2_label15 = g_quark_from_static_string ("a")))) {
		switch (0) {
			default:
			{
				gchar* href = NULL;
				gchar* _tmp26_;
				const gchar* _tmp27_;
				_tmp26_ = (gchar*) xmlGetProp (node, (xmlChar*) "href");
				href = _tmp26_;
				_tmp27_ = href;
				if (_tmp27_ != NULL) {
					const gchar* _tmp28_;
					const gchar* _tmp29_;
					gchar* _tmp30_;
					gchar* _tmp31_;
					gchar* _tmp32_;
					gchar* _tmp33_;
					gchar* _tmp34_;
					gchar* _tmp35_;
					gchar* _tmp36_;
					const gchar* _tmp37_;
					gchar* _tmp38_;
					_tmp28_ = tuba_widgets_markup_view_blockquote_handler_text;
					_tmp29_ = href;
					_tmp30_ = g_markup_escape_text (_tmp29_, (gssize) -1);
					_tmp31_ = _tmp30_;
					_tmp32_ = g_strconcat ("<a href='", _tmp31_, NULL);
					_tmp33_ = _tmp32_;
					_tmp34_ = g_strconcat (_tmp33_, "'>", NULL);
					_tmp35_ = _tmp34_;
					_tmp36_ = g_strconcat (_tmp28_, _tmp35_, NULL);
					_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
					tuba_widgets_markup_view_blockquote_handler_text = _tmp36_;
					_g_free0 (_tmp35_);
					_g_free0 (_tmp33_);
					_g_free0 (_tmp31_);
					tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
					_tmp37_ = tuba_widgets_markup_view_blockquote_handler_text;
					_tmp38_ = g_strconcat (_tmp37_, "</a>", NULL);
					_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
					tuba_widgets_markup_view_blockquote_handler_text = _tmp38_;
				}
				_g_free0 (href);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label16) ? _tmp2_label16 : (_tmp2_label16 = g_quark_from_static_string ("ol")))) {
		switch (0) {
			default:
			{
				gint li_count = 0;
				const gchar* _tmp54_;
				gchar* _tmp55_;
				li_count = 1;
				{
					xmlNode* iter = NULL;
					xmlNode* _tmp39_;
					_tmp39_ = node->children;
					iter = _tmp39_;
					{
						gboolean _tmp40_ = FALSE;
						_tmp40_ = TRUE;
						while (TRUE) {
							xmlNode* _tmp43_;
							xmlNode* _tmp44_;
							const gchar* _tmp45_;
							if (!_tmp40_) {
								xmlNode* _tmp41_;
								xmlNode* _tmp42_;
								_tmp41_ = iter;
								_tmp42_ = _tmp41_->next;
								iter = _tmp42_;
							}
							_tmp40_ = FALSE;
							_tmp43_ = iter;
							if (!(_tmp43_ != NULL)) {
								break;
							}
							_tmp44_ = iter;
							_tmp45_ = _tmp44_->name;
							if (g_strcmp0 (_tmp45_, "li") == 0) {
								const gchar* _tmp46_;
								gchar* _tmp47_;
								gchar* _tmp48_;
								gchar* _tmp49_;
								gchar* _tmp50_;
								gchar* _tmp51_;
								xmlNode* _tmp52_;
								gint _tmp53_;
								_tmp46_ = tuba_widgets_markup_view_blockquote_handler_text;
								_tmp47_ = g_strdup_printf ("%i", li_count);
								_tmp48_ = _tmp47_;
								_tmp49_ = g_strconcat ("\n", _tmp48_, ". ", NULL);
								_tmp50_ = _tmp49_;
								_tmp51_ = g_strconcat (_tmp46_, _tmp50_, NULL);
								_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
								tuba_widgets_markup_view_blockquote_handler_text = _tmp51_;
								_g_free0 (_tmp50_);
								_g_free0 (_tmp48_);
								_tmp52_ = iter;
								tuba_widgets_markup_view_blockquote_handler (_tmp52_, _data93_->bold_text_regex);
								_tmp53_ = li_count;
								li_count = _tmp53_ + 1;
							} else {
								break;
							}
						}
					}
				}
				_tmp54_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp55_ = g_strconcat (_tmp54_, "\n", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp55_;
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label17) ? _tmp2_label17 : (_tmp2_label17 = g_quark_from_static_string ("ul")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp56_;
				gchar* _tmp57_;
				tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
				_tmp56_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp57_ = g_strconcat (_tmp56_, "\n", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp57_;
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label18) ? _tmp2_label18 : (_tmp2_label18 = g_quark_from_static_string ("li")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp58_;
				gchar* _tmp59_;
				_tmp58_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp59_ = g_strconcat (_tmp58_, "\n• ", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp59_;
				tuba_widgets_markup_view_blockquote_handler (node, _data93_->bold_text_regex);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label19) ? _tmp2_label19 : (_tmp2_label19 = g_quark_from_static_string ("br")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp60_;
				gchar* _tmp61_;
				_tmp60_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp61_ = g_strconcat (_tmp60_, "\n", NULL);
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp61_;
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				{
					xmlNode* iter = NULL;
					xmlNode* _tmp62_;
					_tmp62_ = _data93_->root->children;
					iter = _tmp62_;
					{
						gboolean _tmp63_ = FALSE;
						_tmp63_ = TRUE;
						while (TRUE) {
							xmlNode* _tmp66_;
							xmlNode* _tmp67_;
							if (!_tmp63_) {
								xmlNode* _tmp64_;
								xmlNode* _tmp65_;
								_tmp64_ = iter;
								_tmp65_ = _tmp64_->next;
								iter = _tmp65_;
							}
							_tmp63_ = FALSE;
							_tmp66_ = iter;
							if (!(_tmp66_ != NULL)) {
								break;
							}
							_tmp67_ = iter;
							tuba_widgets_markup_view_blockquote_handler (_tmp67_, _data93_->bold_text_regex);
						}
					}
				}
				break;
			}
		}
	}
}

static void
___lambda44__tuba_widgets_markup_view_node_fn (xmlNode* node,
                                               gpointer self)
{
	__lambda44_ (self, node);
}

static void
tuba_widgets_markup_view_blockquote_handler (xmlNode* root,
                                             GRegex* bold_text_regex)
{
	Block93Data* _data93_;
	GRegex* _tmp0_;
	xmlNode* _tmp1_;
	_data93_ = g_slice_new0 (Block93Data);
	_data93_->_ref_count_ = 1;
	_data93_->root = root;
	_tmp0_ = _g_regex_ref0 (bold_text_regex);
	_g_regex_unref0 (_data93_->bold_text_regex);
	_data93_->bold_text_regex = _tmp0_;
	_tmp1_ = _data93_->root;
	tuba_widgets_markup_view_traverse (_tmp1_, ___lambda44__tuba_widgets_markup_view_node_fn, block93_data_ref (_data93_), block93_data_unref);
	block93_data_unref (_data93_);
	_data93_ = NULL;
}

static void
_tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn (TubaWidgetsMarkupView* view,
                                                                                    xmlNode* node,
                                                                                    gpointer self)
{
	tuba_widgets_markup_view_default_handler (view, node);
}

void
tuba_widgets_markup_view_list_item_handler (TubaWidgetsMarkupView* v,
                                            xmlNode* root)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	g_return_if_fail (v != NULL);
	_tmp0_ = root->name;
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("p")))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_default_handler (v, root);
				break;
			}
		}
	}
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
_tuba_widgets_markup_view_list_item_handler_tuba_widgets_markup_view_node_handler_fn (TubaWidgetsMarkupView* view,
                                                                                      xmlNode* node,
                                                                                      gpointer self)
{
	tuba_widgets_markup_view_list_item_handler (view, node);
}

void
tuba_widgets_markup_view_default_handler (TubaWidgetsMarkupView* v,
                                          xmlNode* root)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	static GQuark _tmp2_label4 = 0;
	static GQuark _tmp2_label5 = 0;
	static GQuark _tmp2_label6 = 0;
	static GQuark _tmp2_label7 = 0;
	static GQuark _tmp2_label8 = 0;
	static GQuark _tmp2_label9 = 0;
	static GQuark _tmp2_label10 = 0;
	static GQuark _tmp2_label11 = 0;
	static GQuark _tmp2_label12 = 0;
	static GQuark _tmp2_label13 = 0;
	static GQuark _tmp2_label14 = 0;
	static GQuark _tmp2_label15 = 0;
	static GQuark _tmp2_label16 = 0;
	static GQuark _tmp2_label17 = 0;
	static GQuark _tmp2_label18 = 0;
	static GQuark _tmp2_label19 = 0;
	static GQuark _tmp2_label20 = 0;
	static GQuark _tmp2_label21 = 0;
	static GQuark _tmp2_label22 = 0;
	static GQuark _tmp2_label23 = 0;
	static GQuark _tmp2_label24 = 0;
	static GQuark _tmp2_label25 = 0;
	static GQuark _tmp2_label26 = 0;
	g_return_if_fail (v != NULL);
	_tmp0_ = root->name;
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("span")))) {
		switch (0) {
			default:
			{
				gchar* classes = NULL;
				gchar* _tmp4_;
				gboolean _tmp5_ = FALSE;
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_;
				_tmp4_ = (gchar*) xmlGetProp (root, (xmlChar*) "class");
				classes = _tmp4_;
				_tmp7_ = v->priv->_has_quote;
				if (!_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					const gchar* _tmp8_;
					_tmp8_ = classes;
					_tmp6_ = _tmp8_ == NULL;
				}
				if (_tmp6_) {
					_tmp5_ = TRUE;
				} else {
					const gchar* _tmp9_;
					_tmp9_ = classes;
					_tmp5_ = !string_contains (_tmp9_, "quote-inline");
				}
				if (_tmp5_) {
					tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				}
				_g_free0 (classes);
				break;
			}
		}
	} else if (((_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("html")))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("markup"))))) || (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("div"))))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("body")))) {
		switch (0) {
			default:
			{
				gboolean _tmp10_;
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				_tmp10_ = v->priv->_extract_last_tags;
				if (_tmp10_) {
					tuba_widgets_markup_view_extract_tags (v);
				}
				tuba_widgets_markup_view_commit_chunk (v);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label5) ? _tmp2_label5 : (_tmp2_label5 = g_quark_from_static_string ("p")))) {
		switch (0) {
			default:
			{
				gboolean _tmp11_ = FALSE;
				xmlNode* _tmp12_;
				gchar* classes = NULL;
				gchar* _tmp14_;
				gboolean _tmp15_ = FALSE;
				gboolean _tmp16_ = FALSE;
				gboolean _tmp17_;
				_tmp12_ = root->children;
				if (_tmp12_ == NULL) {
					const gchar* _tmp13_;
					_tmp13_ = root->content;
					_tmp11_ = _tmp13_ == NULL;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					break;
				}
				_tmp14_ = (gchar*) xmlGetProp (root, (xmlChar*) "class");
				classes = _tmp14_;
				_tmp17_ = v->priv->_has_quote;
				if (_tmp17_) {
					const gchar* _tmp18_;
					_tmp18_ = classes;
					_tmp16_ = _tmp18_ != NULL;
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					const gchar* _tmp19_;
					_tmp19_ = classes;
					_tmp15_ = string_contains (_tmp19_, "quote-inline");
				} else {
					_tmp15_ = FALSE;
				}
				if (_tmp15_) {
					_g_free0 (classes);
					break;
				}
				if (!tuba_widgets_markup_view_chunk_ends_in_newline (v)) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "\n");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "\n");
				_g_free0 (classes);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label6) ? _tmp2_label6 : (_tmp2_label6 = g_quark_from_static_string ("pre")))) {
		switch (0) {
			default:
			{
				gboolean _tmp20_ = FALSE;
				gboolean _tmp21_ = FALSE;
				xmlNode* _tmp22_;
				_tmp22_ = root->children;
				if (_tmp22_ != NULL) {
					xmlNode* _tmp23_;
					const gchar* _tmp24_;
					_tmp23_ = root->children;
					_tmp24_ = _tmp23_->name;
					_tmp21_ = g_strcmp0 (_tmp24_, "code") == 0;
				} else {
					_tmp21_ = FALSE;
				}
				if (_tmp21_) {
					xmlNode* _tmp25_;
					xmlNode* _tmp26_;
					_tmp25_ = root->children;
					_tmp26_ = _tmp25_->children;
					_tmp20_ = _tmp26_ != NULL;
				} else {
					_tmp20_ = FALSE;
				}
				if (_tmp20_) {
					gchar* _tmp27_;
					xmlNode* _tmp28_;
					GRegex* _tmp29_;
					gchar* text = NULL;
					const gchar* _tmp30_;
					gchar* _tmp31_;
					TubaWidgetsRichLabel* label = NULL;
					const gchar* _tmp32_;
					gchar* _tmp33_;
					gchar* _tmp34_;
					gchar** _tmp35_;
					gboolean _tmp36_;
					gboolean _tmp37_;
					TubaWidgetsRichLabel* _tmp38_ = NULL;
					TubaWidgetsRichLabel* _tmp39_;
					tuba_widgets_markup_view_commit_chunk (v);
					_tmp27_ = g_strdup ("");
					_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
					tuba_widgets_markup_view_blockquote_handler_text = _tmp27_;
					_tmp28_ = root->children;
					_tmp29_ = v->priv->_bold_text_regex;
					tuba_widgets_markup_view_blockquote_handler (_tmp28_, _tmp29_);
					_tmp30_ = tuba_widgets_markup_view_blockquote_handler_text;
					_tmp31_ = string_strip (_tmp30_);
					text = _tmp31_;
					_tmp32_ = text;
					_tmp33_ = g_strdup ("ttl-code");
					_tmp34_ = g_strdup ("monospace");
					_tmp35_ = g_new0 (gchar*, 2 + 1);
					_tmp35_[0] = _tmp33_;
					_tmp35_[1] = _tmp34_;
					_tmp36_ = tuba_widgets_markup_view_get_selectable (v);
					_tmp37_ = _tmp36_;
					_tmp38_ = tuba_widgets_rich_label_new (_tmp32_);
					gtk_widget_set_visible ((GtkWidget*) _tmp38_, TRUE);
					gtk_widget_set_css_classes ((GtkWidget*) _tmp38_, _tmp35_);
					_tmp35_ = (_vala_array_free (_tmp35_, 2, (GDestroyNotify) g_free), NULL);
					tuba_widgets_rich_label_set_use_markup (_tmp38_, TRUE);
					tuba_widgets_rich_label_set_selectable (_tmp38_, _tmp37_);
					g_object_ref_sink (_tmp38_);
					label = _tmp38_;
					_tmp39_ = label;
					gtk_box_append ((GtkBox*) v, (GtkWidget*) _tmp39_);
					_g_object_unref0 (label);
					_g_free0 (text);
				} else {
					tuba_widgets_markup_view_write_chunk (v, "\n");
					tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label7) ? _tmp2_label7 : (_tmp2_label7 = g_quark_from_static_string ("code")))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_write_chunk (v, "<span background=\"#9696961a\" font_family=\"monospace\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_strip_chunk (v);
				tuba_widgets_markup_view_write_chunk (v, "</span>");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label8) ? _tmp2_label8 : (_tmp2_label8 = g_quark_from_static_string ("blockquote")))) {
		switch (0) {
			default:
			{
				gchar* _tmp40_;
				GRegex* _tmp41_;
				gchar* text = NULL;
				const gchar* _tmp42_;
				gchar* _tmp43_;
				TubaWidgetsRichLabel* label = NULL;
				const gchar* _tmp44_;
				gchar* _tmp45_;
				gchar* _tmp46_;
				gchar** _tmp47_;
				gboolean _tmp48_;
				gboolean _tmp49_;
				TubaWidgetsRichLabel* _tmp50_ = NULL;
				TubaWidgetsRichLabel* _tmp51_;
				tuba_widgets_markup_view_commit_chunk (v);
				_tmp40_ = g_strdup ("");
				_g_free0 (tuba_widgets_markup_view_blockquote_handler_text);
				tuba_widgets_markup_view_blockquote_handler_text = _tmp40_;
				_tmp41_ = v->priv->_bold_text_regex;
				tuba_widgets_markup_view_blockquote_handler (root, _tmp41_);
				_tmp42_ = tuba_widgets_markup_view_blockquote_handler_text;
				_tmp43_ = string_strip (_tmp42_);
				text = _tmp43_;
				_tmp44_ = text;
				_tmp45_ = g_strdup ("ttl-code");
				_tmp46_ = g_strdup ("italic");
				_tmp47_ = g_new0 (gchar*, 2 + 1);
				_tmp47_[0] = _tmp45_;
				_tmp47_[1] = _tmp46_;
				_tmp48_ = tuba_widgets_markup_view_get_selectable (v);
				_tmp49_ = _tmp48_;
				_tmp50_ = tuba_widgets_rich_label_new (_tmp44_);
				gtk_widget_set_visible ((GtkWidget*) _tmp50_, TRUE);
				gtk_widget_set_css_classes ((GtkWidget*) _tmp50_, _tmp47_);
				_tmp47_ = (_vala_array_free (_tmp47_, 2, (GDestroyNotify) g_free), NULL);
				tuba_widgets_rich_label_set_use_markup (_tmp50_, TRUE);
				tuba_widgets_rich_label_set_selectable (_tmp50_, _tmp49_);
				g_object_ref_sink (_tmp50_);
				label = _tmp50_;
				_tmp51_ = label;
				gtk_box_append ((GtkBox*) v, (GtkWidget*) _tmp51_);
				_g_object_unref0 (label);
				_g_free0 (text);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label9) ? _tmp2_label9 : (_tmp2_label9 = g_quark_from_static_string ("a")))) {
		switch (0) {
			default:
			{
				gchar* href = NULL;
				gchar* _tmp52_;
				const gchar* _tmp53_;
				_tmp52_ = (gchar*) xmlGetProp (root, (xmlChar*) "href");
				href = _tmp52_;
				_tmp53_ = href;
				if (_tmp53_ != NULL) {
					const gchar* _tmp54_;
					gchar* _tmp55_;
					gchar* _tmp56_;
					const gchar* _tmp57_;
					gchar* _tmp58_;
					gchar* _tmp59_;
					_tmp54_ = href;
					_tmp55_ = g_markup_escape_text (_tmp54_, (gssize) -1);
					_tmp56_ = _tmp55_;
					_tmp57_ = string_to_string (_tmp56_);
					_tmp58_ = g_strconcat ("<a href='", _tmp57_, "'>", NULL);
					_tmp59_ = _tmp58_;
					tuba_widgets_markup_view_write_chunk (v, _tmp59_);
					_g_free0 (_tmp59_);
					_g_free0 (_tmp56_);
					tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
					tuba_widgets_markup_view_write_chunk (v, "</a>");
					tuba_widgets_markup_view_set_has_link (v, TRUE);
				}
				_g_free0 (href);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label10) ? _tmp2_label10 : (_tmp2_label10 = g_quark_from_static_string ("h1")))) {
		switch (0) {
			default:
			{
				gboolean _tmp60_ = FALSE;
				const gchar* _tmp61_;
				_tmp61_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp61_, "") != 0) {
					const gchar* _tmp62_;
					_tmp62_ = v->priv->current_chunk;
					_tmp60_ = _tmp62_ != NULL;
				} else {
					_tmp60_ = FALSE;
				}
				if (_tmp60_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b><span size=\"xx-large\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</span></b>\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label11) ? _tmp2_label11 : (_tmp2_label11 = g_quark_from_static_string ("h2")))) {
		switch (0) {
			default:
			{
				gboolean _tmp63_ = FALSE;
				const gchar* _tmp64_;
				_tmp64_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp64_, "") != 0) {
					const gchar* _tmp65_;
					_tmp65_ = v->priv->current_chunk;
					_tmp63_ = _tmp65_ != NULL;
				} else {
					_tmp63_ = FALSE;
				}
				if (_tmp63_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b><span size=\"x-large\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</span></b>\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label12) ? _tmp2_label12 : (_tmp2_label12 = g_quark_from_static_string ("h3")))) {
		switch (0) {
			default:
			{
				gboolean _tmp66_ = FALSE;
				const gchar* _tmp67_;
				_tmp67_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp67_, "") != 0) {
					const gchar* _tmp68_;
					_tmp68_ = v->priv->current_chunk;
					_tmp66_ = _tmp68_ != NULL;
				} else {
					_tmp66_ = FALSE;
				}
				if (_tmp66_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b><span size=\"large\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</span></b>\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label13) ? _tmp2_label13 : (_tmp2_label13 = g_quark_from_static_string ("h4")))) {
		switch (0) {
			default:
			{
				gboolean _tmp69_ = FALSE;
				const gchar* _tmp70_;
				_tmp70_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp70_, "") != 0) {
					const gchar* _tmp71_;
					_tmp71_ = v->priv->current_chunk;
					_tmp69_ = _tmp71_ != NULL;
				} else {
					_tmp69_ = FALSE;
				}
				if (_tmp69_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b>");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</b>\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label14) ? _tmp2_label14 : (_tmp2_label14 = g_quark_from_static_string ("h5")))) {
		switch (0) {
			default:
			{
				gboolean _tmp72_ = FALSE;
				const gchar* _tmp73_;
				_tmp73_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp73_, "") != 0) {
					const gchar* _tmp74_;
					_tmp74_ = v->priv->current_chunk;
					_tmp72_ = _tmp74_ != NULL;
				} else {
					_tmp72_ = FALSE;
				}
				if (_tmp72_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b><span size=\"small\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</span></b>\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label15) ? _tmp2_label15 : (_tmp2_label15 = g_quark_from_static_string ("h6")))) {
		switch (0) {
			default:
			{
				gboolean _tmp75_ = FALSE;
				const gchar* _tmp76_;
				_tmp76_ = v->priv->current_chunk;
				if (g_strcmp0 (_tmp76_, "") != 0) {
					const gchar* _tmp77_;
					_tmp77_ = v->priv->current_chunk;
					_tmp75_ = _tmp77_ != NULL;
				} else {
					_tmp75_ = FALSE;
				}
				if (_tmp75_) {
					tuba_widgets_markup_view_write_chunk (v, "\n");
				}
				tuba_widgets_markup_view_write_chunk (v, "<b><span size=\"x-small\">");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "</span></b>\n");
				break;
			}
		}
	} else if ((((((_tmp3_ == ((0 != _tmp2_label16) ? _tmp2_label16 : (_tmp2_label16 = g_quark_from_static_string ("b")))) || (_tmp3_ == ((0 != _tmp2_label17) ? _tmp2_label17 : (_tmp2_label17 = g_quark_from_static_string ("i"))))) || (_tmp3_ == ((0 != _tmp2_label18) ? _tmp2_label18 : (_tmp2_label18 = g_quark_from_static_string ("u"))))) || (_tmp3_ == ((0 != _tmp2_label19) ? _tmp2_label19 : (_tmp2_label19 = g_quark_from_static_string ("s"))))) || (_tmp3_ == ((0 != _tmp2_label20) ? _tmp2_label20 : (_tmp2_label20 = g_quark_from_static_string ("sup"))))) || (_tmp3_ == ((0 != _tmp2_label21) ? _tmp2_label21 : (_tmp2_label21 = g_quark_from_static_string ("sub"))))) {
		switch (0) {
			default:
			{
				const gchar* _tmp78_;
				const gchar* _tmp79_;
				gchar* _tmp80_;
				gchar* _tmp81_;
				const gchar* _tmp82_;
				const gchar* _tmp83_;
				gchar* _tmp84_;
				gchar* _tmp85_;
				_tmp78_ = root->name;
				_tmp79_ = string_to_string (_tmp78_);
				_tmp80_ = g_strconcat ("<", _tmp79_, ">", NULL);
				_tmp81_ = _tmp80_;
				tuba_widgets_markup_view_write_chunk (v, _tmp81_);
				_g_free0 (_tmp81_);
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				_tmp82_ = root->name;
				_tmp83_ = string_to_string (_tmp82_);
				_tmp84_ = g_strconcat ("</", _tmp83_, ">", NULL);
				_tmp85_ = _tmp84_;
				tuba_widgets_markup_view_write_chunk (v, _tmp85_);
				_g_free0 (_tmp85_);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label22) ? _tmp2_label22 : (_tmp2_label22 = g_quark_from_static_string ("ol")))) {
		switch (0) {
			default:
			{
				gint li_count = 0;
				li_count = 1;
				{
					xmlNode* iter = NULL;
					xmlNode* _tmp86_;
					_tmp86_ = root->children;
					iter = _tmp86_;
					{
						gboolean _tmp87_ = FALSE;
						_tmp87_ = TRUE;
						while (TRUE) {
							xmlNode* _tmp90_;
							xmlNode* _tmp91_;
							const gchar* _tmp92_;
							if (!_tmp87_) {
								xmlNode* _tmp88_;
								xmlNode* _tmp89_;
								_tmp88_ = iter;
								_tmp89_ = _tmp88_->next;
								iter = _tmp89_;
							}
							_tmp87_ = FALSE;
							_tmp90_ = iter;
							if (!(_tmp90_ != NULL)) {
								break;
							}
							_tmp91_ = iter;
							_tmp92_ = _tmp91_->name;
							if (g_strcmp0 (_tmp92_, "li") == 0) {
								gchar* _tmp93_;
								gchar* _tmp94_;
								gchar* _tmp95_;
								gchar* _tmp96_;
								xmlNode* _tmp97_;
								gint _tmp98_;
								_tmp93_ = g_strdup_printf ("%i", li_count);
								_tmp94_ = _tmp93_;
								_tmp95_ = g_strconcat ("\n", _tmp94_, ". ", NULL);
								_tmp96_ = _tmp95_;
								tuba_widgets_markup_view_write_chunk (v, _tmp96_);
								_g_free0 (_tmp96_);
								_g_free0 (_tmp94_);
								_tmp97_ = iter;
								tuba_widgets_markup_view_traverse_and_handle (v, _tmp97_, _tuba_widgets_markup_view_list_item_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
								_tmp98_ = li_count;
								li_count = _tmp98_ + 1;
							} else {
								continue;
							}
						}
					}
				}
				tuba_widgets_markup_view_write_chunk (v, "\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label23) ? _tmp2_label23 : (_tmp2_label23 = g_quark_from_static_string ("ul")))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				tuba_widgets_markup_view_write_chunk (v, "\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label24) ? _tmp2_label24 : (_tmp2_label24 = g_quark_from_static_string ("li")))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_write_chunk (v, "\n• ");
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_list_item_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label25) ? _tmp2_label25 : (_tmp2_label25 = g_quark_from_static_string ("br")))) {
		switch (0) {
			default:
			{
				tuba_widgets_markup_view_write_chunk (v, "\n");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label26) ? _tmp2_label26 : (_tmp2_label26 = g_quark_from_static_string ("text")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp99_;
				_tmp99_ = root->content;
				if (_tmp99_ != NULL) {
					const gchar* _tmp100_;
					gchar* _tmp101_;
					GRegex* _tmp102_;
					gchar* _tmp103_;
					gchar* _tmp104_;
					_tmp100_ = root->content;
					_tmp101_ = g_markup_escape_text (_tmp100_, (gssize) -1);
					_tmp102_ = v->priv->_bold_text_regex;
					_tmp103_ = tuba_widgets_markup_view_bold_needle (_tmp101_, _tmp102_);
					_tmp104_ = _tmp103_;
					tuba_widgets_markup_view_write_chunk (v, _tmp104_);
					_g_free0 (_tmp104_);
				}
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				const gchar* _tmp105_;
				const gchar* _tmp106_;
				gchar* _tmp107_;
				gchar* _tmp108_;
				_tmp105_ = root->name;
				_tmp106_ = string_to_string (_tmp105_);
				_tmp107_ = g_strconcat ("Unknown HTML tag: \"", _tmp106_, "\"", NULL);
				_tmp108_ = _tmp107_;
				g_warning ("MarkupView.vala:438: %s", _tmp108_);
				_g_free0 (_tmp108_);
				tuba_widgets_markup_view_traverse_and_handle (v, root, _tuba_widgets_markup_view_default_handler_tuba_widgets_markup_view_node_handler_fn, NULL, NULL);
				break;
			}
		}
	}
}

static gchar*
tuba_widgets_markup_view_bold_needle (gchar* source,
                                      GRegex* bold_text_regex)
{
	gboolean _tmp0_ = FALSE;
	gchar* _tmp14_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (source != NULL, NULL);
	if (bold_text_regex == NULL) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (source);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ >= 2000;
	}
	if (_tmp0_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup (source);
		result = _tmp3_;
		_g_free0 (source);
		return result;
	}
	{
		gchar* _tmp4_ = NULL;
		gint _tmp5_;
		gint _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp5_ = strlen (source);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_regex_replace (bold_text_regex, source, (gssize) _tmp6_, 0, "<b>\\0</b>", 0, &_inner_error0_);
		_tmp4_ = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_free0 (source);
			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_ = _tmp4_;
		_tmp4_ = NULL;
		_g_free0 (source);
		source = _tmp8_;
		_g_free0 (_tmp4_);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		GError* e = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = e;
		_tmp10_ = _tmp9_->message;
		_tmp11_ = string_to_string (_tmp10_);
		_tmp12_ = g_strconcat ("Couldn't set search bold text: ", _tmp11_, NULL);
		_tmp13_ = _tmp12_;
		g_warning ("MarkupView.vala:450: %s", _tmp13_);
		_g_free0 (_tmp13_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (source);
		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;
	}
	_tmp14_ = g_strdup (source);
	result = _tmp14_;
	_g_free0 (source);
	return result;
}

TubaWidgetsMarkupView*
tuba_widgets_markup_view_construct (GType object_type)
{
	TubaWidgetsMarkupView * self = NULL;
	self = (TubaWidgetsMarkupView*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsMarkupView*
tuba_widgets_markup_view_new (void)
{
	return tuba_widgets_markup_view_construct (TUBA_WIDGETS_TYPE_MARKUP_VIEW);
}

const gchar*
tuba_widgets_markup_view_get_content (TubaWidgetsMarkupView* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_markup_view_set_content (TubaWidgetsMarkupView* self,
                                      const gchar* value)
{
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_content);
	self->priv->_content = _tmp0_;
	_tmp1_ = self->priv->_content;
	tuba_widgets_markup_view_update_content (self, _tmp1_);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY]);
}

GRegex*
tuba_widgets_markup_view_get_bold_text_regex (TubaWidgetsMarkupView* self)
{
	GRegex* result;
	GRegex* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bold_text_regex;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_markup_view_set_bold_text_regex (TubaWidgetsMarkupView* self,
                                              GRegex* value)
{
	GRegex* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_bold_text_regex (self);
	if (old_value != value) {
		GRegex* _tmp0_;
		_tmp0_ = _g_regex_ref0 (value);
		_g_regex_unref0 (self->priv->_bold_text_regex);
		self->priv->_bold_text_regex = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY]);
	}
}

GeeHashMap*
tuba_widgets_markup_view_get_instance_emojis (TubaWidgetsMarkupView* self)
{
	GeeHashMap* result;
	GeeHashMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_instance_emojis;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_markup_view_set_instance_emojis (TubaWidgetsMarkupView* self,
                                              GeeHashMap* value)
{
	GeeHashMap* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_instance_emojis (self);
	if (old_value != value) {
		GeeHashMap* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_instance_emojis);
		self->priv->_instance_emojis = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY]);
	}
}

GeeArrayList*
tuba_widgets_markup_view_get_mentions (TubaWidgetsMarkupView* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_mentions;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_markup_view_set_mentions (TubaWidgetsMarkupView* self,
                                       GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_mentions (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_mentions);
		self->priv->_mentions = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY]);
	}
}

gboolean
tuba_widgets_markup_view_get_has_quote (TubaWidgetsMarkupView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_quote;
	return result;
}

void
tuba_widgets_markup_view_set_has_quote (TubaWidgetsMarkupView* self,
                                        gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_has_quote (self);
	if (old_value != value) {
		self->priv->_has_quote = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY]);
	}
}

gboolean
tuba_widgets_markup_view_get_extract_last_tags (TubaWidgetsMarkupView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_extract_last_tags;
	return result;
}

void
tuba_widgets_markup_view_set_extract_last_tags (TubaWidgetsMarkupView* self,
                                                gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_extract_last_tags (self);
	if (old_value != value) {
		self->priv->_extract_last_tags = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY]);
	}
}

gboolean
tuba_widgets_markup_view_get_has_link (TubaWidgetsMarkupView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_link;
	return result;
}

void
tuba_widgets_markup_view_set_has_link (TubaWidgetsMarkupView* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_markup_view_get_has_link (self);
	if (old_value != value) {
		self->priv->_has_link = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY]);
	}
}

gboolean
tuba_widgets_markup_view_get_selectable (TubaWidgetsMarkupView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_selectable;
	return result;
}

void
tuba_widgets_markup_view_set_selectable (TubaWidgetsMarkupView* self,
                                         gboolean value)
{
	GtkWidget* w = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_selectable = value;
	_tmp0_ = gtk_widget_get_first_child ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	w = _tmp1_;
	while (TRUE) {
		GtkWidget* _tmp2_;
		TubaWidgetsRichLabel* label = NULL;
		GtkWidget* _tmp3_;
		TubaWidgetsRichLabel* _tmp4_;
		TubaWidgetsRichLabel* _tmp5_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp2_ = w;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = w;
		_tmp4_ = _g_object_ref0 (TUBA_WIDGETS_IS_RICH_LABEL (_tmp3_) ? ((TubaWidgetsRichLabel*) _tmp3_) : NULL);
		label = _tmp4_;
		_tmp5_ = label;
		if (_tmp5_ != NULL) {
			TubaWidgetsRichLabel* _tmp6_;
			_tmp6_ = label;
			tuba_widgets_rich_label_set_selectable (_tmp6_, self->priv->_selectable);
		}
		_tmp7_ = w;
		_tmp8_ = gtk_widget_get_next_sibling (_tmp7_);
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_g_object_unref0 (w);
		w = _tmp9_;
		_g_object_unref0 (label);
	}
	_g_object_unref0 (w);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY]);
}

gboolean
tuba_widgets_markup_view_get_can_open (TubaWidgetsMarkupView* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_open;
	return result;
}

void
tuba_widgets_markup_view_set_can_open (TubaWidgetsMarkupView* self,
                                       gboolean value)
{
	GtkWidget* w = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_can_open = value;
	_tmp0_ = gtk_widget_get_first_child ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	w = _tmp1_;
	while (TRUE) {
		GtkWidget* _tmp2_;
		TubaWidgetsRichLabel* label = NULL;
		GtkWidget* _tmp3_;
		TubaWidgetsRichLabel* _tmp4_;
		TubaWidgetsRichLabel* _tmp5_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp2_ = w;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = w;
		_tmp4_ = _g_object_ref0 (TUBA_WIDGETS_IS_RICH_LABEL (_tmp3_) ? ((TubaWidgetsRichLabel*) _tmp3_) : NULL);
		label = _tmp4_;
		_tmp5_ = label;
		if (_tmp5_ != NULL) {
			TubaWidgetsRichLabel* _tmp6_;
			_tmp6_ = label;
			tuba_widgets_rich_label_set_can_open (_tmp6_, self->priv->_can_open);
		}
		_tmp7_ = w;
		_tmp8_ = gtk_widget_get_next_sibling (_tmp7_);
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_g_object_unref0 (w);
		w = _tmp9_;
		_g_object_unref0 (label);
	}
	_g_object_unref0 (w);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY]);
}

static GObject *
tuba_widgets_markup_view_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsMarkupView * self;
	parent_class = G_OBJECT_CLASS (tuba_widgets_markup_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupView);
	gtk_widget_set_focusable ((GtkWidget*) self, TRUE);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	gtk_box_set_spacing ((GtkBox*) self, 12);
	return obj;
}

static void
tuba_widgets_markup_view_class_init (TubaWidgetsMarkupViewClass * klass,
                                     gpointer klass_data)
{
	gchar* _tmp0_;
	tuba_widgets_markup_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsMarkupView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_markup_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_markup_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_markup_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_markup_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY] = g_param_spec_boxed ("bold-text-regex", "bold-text-regex", "bold-text-regex", G_TYPE_REGEX, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY] = g_param_spec_object ("instance-emojis", "instance-emojis", "instance-emojis", GEE_TYPE_HASH_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY] = g_param_spec_object ("mentions", "mentions", "mentions", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY] = g_param_spec_boolean ("has-quote", "has-quote", "has-quote", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY] = g_param_spec_boolean ("extract-last-tags", "extract-last-tags", "extract-last-tags", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY] = g_param_spec_boolean ("has-link", "has-link", "has-link", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY] = g_param_spec_boolean ("selectable", "selectable", "selectable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY, tuba_widgets_markup_view_properties[TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY] = g_param_spec_boolean ("can-open", "can-open", "can-open", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	_tmp0_ = g_strdup ("");
	tuba_widgets_markup_view_blockquote_handler_text = _tmp0_;
	gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (klass), GTK_ACCESSIBLE_ROLE_GROUP);
}

static void
tuba_widgets_markup_view_instance_init (TubaWidgetsMarkupView * self,
                                        gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_widgets_markup_view_get_instance_private (self);
	self->priv->current_chunk = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->_content = _tmp0_;
	self->priv->_bold_text_regex = NULL;
	self->priv->_instance_emojis = NULL;
	self->priv->_mentions = NULL;
	self->priv->_has_quote = FALSE;
	self->priv->_extract_last_tags = FALSE;
	self->priv->_has_link = FALSE;
	self->priv->extracted_tags = NULL;
	self->priv->extracted_tags_length1 = 0;
	self->priv->_extracted_tags_size_ = self->priv->extracted_tags_length1;
	self->priv->_selectable = FALSE;
	self->priv->_can_open = TRUE;
}

static void
tuba_widgets_markup_view_finalize (GObject * obj)
{
	TubaWidgetsMarkupView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupView);
	_g_free0 (self->priv->current_chunk);
	_g_free0 (self->priv->_content);
	_g_regex_unref0 (self->priv->_bold_text_regex);
	_g_object_unref0 (self->priv->_instance_emojis);
	_g_object_unref0 (self->priv->_mentions);
	self->priv->extracted_tags = (_vala_TubaUtilsTagExtractorTag_array_free (self->priv->extracted_tags, self->priv->extracted_tags_length1), NULL);
	G_OBJECT_CLASS (tuba_widgets_markup_view_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_markup_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsMarkupViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_markup_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsMarkupView), 0, (GInstanceInitFunc) tuba_widgets_markup_view_instance_init, NULL };
	GType tuba_widgets_markup_view_type_id;
	tuba_widgets_markup_view_type_id = g_type_register_static (gtk_box_get_type (), "TubaWidgetsMarkupView", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsMarkupView_private_offset = g_type_add_instance_private (tuba_widgets_markup_view_type_id, sizeof (TubaWidgetsMarkupViewPrivate));
	return tuba_widgets_markup_view_type_id;
}

GType
tuba_widgets_markup_view_get_type (void)
{
	static GType tuba_widgets_markup_view_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_markup_view_type_id__once)) {
		GType tuba_widgets_markup_view_type_id;
		tuba_widgets_markup_view_type_id = tuba_widgets_markup_view_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_markup_view_type_id__once, tuba_widgets_markup_view_type_id);
	}
	return tuba_widgets_markup_view_type_id__once;
}

static void
_vala_tuba_widgets_markup_view_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	TubaWidgetsMarkupView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupView);
	switch (property_id) {
		case TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY:
		g_value_set_string (value, tuba_widgets_markup_view_get_content (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY:
		g_value_set_boxed (value, tuba_widgets_markup_view_get_bold_text_regex (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY:
		g_value_set_object (value, tuba_widgets_markup_view_get_instance_emojis (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY:
		g_value_set_object (value, tuba_widgets_markup_view_get_mentions (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_markup_view_get_has_quote (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_markup_view_get_extract_last_tags (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_markup_view_get_has_link (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_markup_view_get_selectable (self));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_markup_view_get_can_open (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_markup_view_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	TubaWidgetsMarkupView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_MARKUP_VIEW, TubaWidgetsMarkupView);
	switch (property_id) {
		case TUBA_WIDGETS_MARKUP_VIEW_CONTENT_PROPERTY:
		tuba_widgets_markup_view_set_content (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_BOLD_TEXT_REGEX_PROPERTY:
		tuba_widgets_markup_view_set_bold_text_regex (self, g_value_get_boxed (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_INSTANCE_EMOJIS_PROPERTY:
		tuba_widgets_markup_view_set_instance_emojis (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_MENTIONS_PROPERTY:
		tuba_widgets_markup_view_set_mentions (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_HAS_QUOTE_PROPERTY:
		tuba_widgets_markup_view_set_has_quote (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_EXTRACT_LAST_TAGS_PROPERTY:
		tuba_widgets_markup_view_set_extract_last_tags (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_HAS_LINK_PROPERTY:
		tuba_widgets_markup_view_set_has_link (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_SELECTABLE_PROPERTY:
		tuba_widgets_markup_view_set_selectable (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_MARKUP_VIEW_CAN_OPEN_PROPERTY:
		tuba_widgets_markup_view_set_can_open (self, g_value_get_boolean (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);
}

