/* Youtube.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Youtube.vala, do not modify */

/*
* Copyright (c) 2016 Felipe Escoto (https://github.com/Philip-Scott/Notes-up)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authored by: Felipe Escoto <felescoto95@hotmail.com>
*/

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <glib/gi18n-lib.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 ENOTES_TYPE_PLUGIN (enotes_plugin_get_type ())
#define ENOTES_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_PLUGIN, ENotesPlugin))
#define ENOTES_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_PLUGIN, ENotesPluginClass))
#define ENOTES_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_PLUGIN))
#define ENOTES_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_PLUGIN))
#define ENOTES_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_PLUGIN, ENotesPluginClass))

typedef struct _ENotesPlugin ENotesPlugin;
typedef struct _ENotesPluginClass ENotesPluginClass;
typedef struct _ENotesPluginPrivate ENotesPluginPrivate;

#define TYPE_BL_MEMBER (bl_member_get_type ())
#define BL_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BL_MEMBER, BLMember))
#define BL_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BL_MEMBER, BLMemberClass))
#define IS_BL_MEMBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BL_MEMBER))
#define IS_BL_MEMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BL_MEMBER))
#define BL_MEMBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BL_MEMBER, BLMemberClass))

typedef struct _BLMember BLMember;
typedef struct _BLMemberClass BLMemberClass;

#define ENOTES_TYPE_YOUTUBE (enotes_youtube_get_type ())
#define ENOTES_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_YOUTUBE, ENotesYoutube))
#define ENOTES_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_YOUTUBE, ENotesYoutubeClass))
#define ENOTES_IS_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_YOUTUBE))
#define ENOTES_IS_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_YOUTUBE))
#define ENOTES_YOUTUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_YOUTUBE, ENotesYoutubeClass))

typedef struct _ENotesYoutube ENotesYoutube;
typedef struct _ENotesYoutubeClass ENotesYoutubeClass;
typedef struct _ENotesYoutubePrivate ENotesYoutubePrivate;
enum  {
	ENOTES_YOUTUBE_0_PROPERTY,
	ENOTES_YOUTUBE_NUM_PROPERTIES
};
static GParamSpec* enotes_youtube_properties[ENOTES_YOUTUBE_NUM_PROPERTIES];
#define _g_pattern_spec_free0(var) ((var == NULL) ? NULL : (var = (g_pattern_spec_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _bl_member_unref0(var) ((var == NULL) ? NULL : (var = (bl_member_unref (var), NULL)))

struct _ENotesPlugin {
	GObject parent_instance;
	ENotesPluginPrivate * priv;
	gboolean state;
	gchar* code_name;
};

struct _ENotesPluginClass {
	GObjectClass parent_class;
	gchar* (*get_desctiption) (ENotesPlugin* self);
	gchar* (*get_name) (ENotesPlugin* self);
	gboolean (*has_match) (ENotesPlugin* self, const gchar* text);
	gchar* (*convert) (ENotesPlugin* self, const gchar* line);
	GtkWidget* (*editor_button) (ENotesPlugin* self);
	gchar* (*get_button_desctiption) (ENotesPlugin* self);
	gchar* (*request_string) (ENotesPlugin* self, const gchar* selection);
	GeeList* (*get_blacklist_members) (ENotesPlugin* self);
};

struct _ENotesYoutube {
	ENotesPlugin parent_instance;
	ENotesYoutubePrivate * priv;
};

struct _ENotesYoutubeClass {
	ENotesPluginClass parent_class;
};

struct _ENotesYoutubePrivate {
	GPatternSpec* spec;
};

static gint ENotesYoutube_private_offset;
static gpointer enotes_youtube_parent_class = NULL;

VALA_EXTERN GType enotes_plugin_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPlugin, g_object_unref)
VALA_EXTERN gpointer bl_member_ref (gpointer instance);
VALA_EXTERN void bl_member_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_bl_member (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_bl_member (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_bl_member (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_bl_member (const GValue* value);
VALA_EXTERN GType bl_member_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BLMember, bl_member_unref)
VALA_EXTERN GType enotes_youtube_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesYoutube, g_object_unref)
VALA_EXTERN gchar* enotes_plugin_get_desctiption (ENotesPlugin* self);
VALA_EXTERN gchar* enotes_plugin_get_name (ENotesPlugin* self);
VALA_EXTERN GtkWidget* enotes_plugin_editor_button (ENotesPlugin* self);
VALA_EXTERN gchar* enotes_plugin_get_button_desctiption (ENotesPlugin* self);
VALA_EXTERN gboolean enotes_plugin_has_match (ENotesPlugin* self,
                                  const gchar* text);
VALA_EXTERN gchar* enotes_plugin_convert (ENotesPlugin* self,
                              const gchar* line);
VALA_EXTERN GeeList* enotes_plugin_get_blacklist_members (ENotesPlugin* self);
static gchar* enotes_youtube_real_get_desctiption (ENotesPlugin* base);
static gchar* enotes_youtube_real_get_name (ENotesPlugin* base);
static GtkWidget* enotes_youtube_real_editor_button (ENotesPlugin* base);
static gchar* enotes_youtube_real_get_button_desctiption (ENotesPlugin* base);
static gboolean enotes_youtube_real_has_match (ENotesPlugin* base,
                                        const gchar* text);
static gchar* enotes_youtube_real_convert (ENotesPlugin* base,
                                    const gchar* line_);
static GeeList* enotes_youtube_real_get_blacklist_members (ENotesPlugin* base);
VALA_EXTERN BLMember* bl_member_new (GRegex* reg,
                         const gchar* replace);
VALA_EXTERN BLMember* bl_member_construct (GType object_type,
                               GRegex* reg,
                               const gchar* replace);
VALA_EXTERN ENotesYoutube* enotes_youtube_new (void);
VALA_EXTERN ENotesYoutube* enotes_youtube_construct (GType object_type);
VALA_EXTERN ENotesPlugin* enotes_plugin_construct (GType object_type);
static GObject * enotes_youtube_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void enotes_youtube_finalize (GObject * obj);
static GType enotes_youtube_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GRegex* _tmp_regex_0 = NULL;
static GRegex* _tmp_regex_1 = NULL;

static inline gpointer
enotes_youtube_get_instance_private (ENotesYoutube* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesYoutube_private_offset);
}

static gchar*
enotes_youtube_real_get_desctiption (ENotesPlugin* base)
{
	ENotesYoutube * self;
	gchar* _tmp0_;
	gchar* result;
#line 29 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 30 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = g_strdup (_ ("Embed youtube videos: <youtube [video]>"));
#line 30 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = _tmp0_;
#line 30 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 202 "Youtube.c"
}

static gchar*
enotes_youtube_real_get_name (ENotesPlugin* base)
{
	ENotesYoutube * self;
	gchar* _tmp0_;
	gchar* result;
#line 33 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 34 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = g_strdup (_ ("Youtube"));
#line 34 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = _tmp0_;
#line 34 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 219 "Youtube.c"
}

static GtkWidget*
enotes_youtube_real_editor_button (ENotesPlugin* base)
{
	ENotesYoutube * self;
	GtkWidget* result;
#line 37 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 38 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = NULL;
#line 38 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 233 "Youtube.c"
}

static gchar*
enotes_youtube_real_get_button_desctiption (ENotesPlugin* base)
{
	ENotesYoutube * self;
	gchar* _tmp0_;
	gchar* result;
#line 41 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 42 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = g_strdup (_ ("Insert Youtube video"));
#line 42 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = _tmp0_;
#line 42 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 250 "Youtube.c"
}

static gboolean
enotes_youtube_real_has_match (ENotesPlugin* base,
                               const gchar* text)
{
	ENotesYoutube * self;
	GPatternSpec* _tmp0_;
	gboolean result;
#line 45 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 45 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	g_return_val_if_fail (text != NULL, FALSE);
#line 46 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = self->priv->spec;
#line 46 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = g_pattern_match_string (_tmp0_, text);
#line 46 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 270 "Youtube.c"
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
#line 1283 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, '\0');
#line 1284 "glib-2.0.vapi"
	_tmp0_ = ((gchar*) self)[index];
#line 1284 "glib-2.0.vapi"
	result = _tmp0_;
#line 1284 "glib-2.0.vapi"
	return result;
#line 287 "Youtube.c"
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
#line 1534 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1535 "glib-2.0.vapi"
	_tmp0_ = strlen (self);
#line 1535 "glib-2.0.vapi"
	_tmp1_ = _tmp0_;
#line 1535 "glib-2.0.vapi"
	string_length = (glong) _tmp1_;
#line 1536 "glib-2.0.vapi"
	if (start < ((glong) 0)) {
#line 1537 "glib-2.0.vapi"
		start = string_length + start;
#line 314 "Youtube.c"
	}
#line 1539 "glib-2.0.vapi"
	if (end < ((glong) 0)) {
#line 1540 "glib-2.0.vapi"
		end = string_length + end;
#line 320 "Youtube.c"
	}
#line 1542 "glib-2.0.vapi"
	if (start >= ((glong) 0)) {
#line 1542 "glib-2.0.vapi"
		_tmp2_ = start <= string_length;
#line 326 "Youtube.c"
	} else {
#line 1542 "glib-2.0.vapi"
		_tmp2_ = FALSE;
#line 330 "Youtube.c"
	}
#line 1542 "glib-2.0.vapi"
	g_return_val_if_fail (_tmp2_, NULL);
#line 1543 "glib-2.0.vapi"
	if (end >= ((glong) 0)) {
#line 1543 "glib-2.0.vapi"
		_tmp3_ = end <= string_length;
#line 338 "Youtube.c"
	} else {
#line 1543 "glib-2.0.vapi"
		_tmp3_ = FALSE;
#line 342 "Youtube.c"
	}
#line 1543 "glib-2.0.vapi"
	g_return_val_if_fail (_tmp3_, NULL);
#line 1544 "glib-2.0.vapi"
	g_return_val_if_fail (start <= end, NULL);
#line 1545 "glib-2.0.vapi"
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
#line 1545 "glib-2.0.vapi"
	result = _tmp4_;
#line 1545 "glib-2.0.vapi"
	return result;
#line 354 "Youtube.c"
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
#line 1584 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, FALSE);
#line 1584 "glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, FALSE);
#line 1585 "glib-2.0.vapi"
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
#line 1585 "glib-2.0.vapi"
	result = _tmp0_ != NULL;
#line 1585 "glib-2.0.vapi"
	return result;
#line 373 "Youtube.c"
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
#line 1184 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, 0);
#line 1184 "glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, 0);
#line 1185 "glib-2.0.vapi"
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
#line 1185 "glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1187 "glib-2.0.vapi"
	_tmp1_ = _result_;
#line 1187 "glib-2.0.vapi"
	if (_tmp1_ != NULL) {
#line 397 "Youtube.c"
		gchar* _tmp2_;
#line 1188 "glib-2.0.vapi"
		_tmp2_ = _result_;
#line 1188 "glib-2.0.vapi"
		result = (gint) (_tmp2_ - ((gchar*) self));
#line 1188 "glib-2.0.vapi"
		return result;
#line 405 "Youtube.c"
	} else {
#line 1190 "glib-2.0.vapi"
		result = -1;
#line 1190 "glib-2.0.vapi"
		return result;
#line 411 "Youtube.c"
	}
}

static gchar*
enotes_youtube_real_convert (ENotesPlugin* base,
                             const gchar* line_)
{
	ENotesYoutube * self;
	gint chars = 0;
	gint _tmp0_;
	gint _tmp1_;
	gchar* line = NULL;
	gchar* _tmp2_;
	gchar* builed = NULL;
	gchar* _tmp3_;
	gint initial = 0;
	gint final = 0;
	gint last = 0;
	gint i = 0;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* result;
#line 49 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 49 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	g_return_val_if_fail (line_ != NULL, NULL);
#line 50 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = strlen (line_);
#line 50 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp1_ = _tmp0_;
#line 50 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	chars = _tmp1_;
#line 51 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp2_ = g_strconcat (line_, "     ", NULL);
#line 51 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	line = _tmp2_;
#line 52 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp3_ = g_strdup ("");
#line 52 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	builed = _tmp3_;
#line 54 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	initial = 0;
#line 54 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	final = 0;
#line 54 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	last = 0;
#line 462 "Youtube.c"
	{
		gboolean _tmp4_ = FALSE;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
		i = -1;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
		_tmp4_ = TRUE;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
		while (TRUE) {
#line 471 "Youtube.c"
			const gchar* _tmp6_;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
			if (!_tmp4_) {
#line 475 "Youtube.c"
				gint _tmp5_;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				i = i + 1;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				_tmp5_ = i;
#line 481 "Youtube.c"
			}
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
			_tmp4_ = FALSE;
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
			if (!(i < chars)) {
#line 56 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				break;
#line 489 "Youtube.c"
			}
#line 57 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
			_tmp6_ = line;
#line 57 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
			if (string_get (_tmp6_, (glong) i) == '<') {
#line 57 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				initial = i;
#line 497 "Youtube.c"
			} else {
				const gchar* _tmp7_;
#line 58 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				_tmp7_ = line;
#line 58 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
				if (string_get (_tmp7_, (glong) i) == '>') {
#line 504 "Youtube.c"
					gchar* cut = NULL;
					const gchar* _tmp8_;
					gchar* _tmp9_;
					const gchar* _tmp10_;
#line 59 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					final = i;
#line 60 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					_tmp8_ = line;
#line 60 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					_tmp9_ = string_slice (_tmp8_, (glong) initial, (glong) final);
#line 60 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					cut = _tmp9_;
#line 61 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					_tmp10_ = cut;
#line 61 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					if (string_contains (_tmp10_, "<youtube ")) {
#line 521 "Youtube.c"
						gint index = 0;
						const gchar* _tmp11_;
						const gchar* _tmp12_;
						const gchar* _tmp13_;
						gchar* _tmp14_;
						gchar* _tmp15_;
						gchar* _tmp16_;
						gchar* _tmp17_;
						gchar* _tmp18_;
						gchar* _tmp19_;
						const gchar* _tmp20_;
						gchar* _tmp21_;
						gchar* _tmp22_;
						gchar* _tmp23_;
						gchar* _tmp24_;
						gchar* _tmp25_;
#line 62 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp11_ = cut;
#line 62 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						index = string_index_of (_tmp11_, "v=", 0);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp12_ = builed;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp13_ = line;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp14_ = string_slice (_tmp13_, (glong) last, (glong) initial);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp15_ = _tmp14_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp16_ = g_strconcat (_tmp12_, _tmp15_, NULL);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp17_ = _tmp16_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp18_ = g_strconcat (_tmp17_, "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/emb" \
"ed/", NULL);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp19_ = _tmp18_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp20_ = cut;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp21_ = string_slice (_tmp20_, (glong) (index + 2), (glong) (index + 13));
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp22_ = _tmp21_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp23_ = g_strconcat (_tmp19_, _tmp22_, NULL);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp24_ = _tmp23_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_tmp25_ = g_strconcat (_tmp24_, "\" frameborder=\"0\" allowfullscreen></iframe>", NULL);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (builed);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						builed = _tmp25_;
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (_tmp24_);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (_tmp22_);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (_tmp19_);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (_tmp17_);
#line 64 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						_g_free0 (_tmp15_);
#line 66 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
						last = final + 1;
#line 586 "Youtube.c"
					}
#line 58 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
					_g_free0 (cut);
#line 590 "Youtube.c"
				}
			}
		}
	}
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp26_ = builed;
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp27_ = line;
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp28_ = string_slice (_tmp27_, (glong) last, (glong) i);
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp29_ = _tmp28_;
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp30_ = g_strconcat (_tmp26_, _tmp29_, NULL);
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp31_ = _tmp30_;
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_g_free0 (_tmp29_);
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = _tmp31_;
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_g_free0 (builed);
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_g_free0 (line);
#line 71 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 617 "Youtube.c"
}

static inline GRegex*
_thread_safe_regex_init (GRegex** re,
                         const gchar * pattern,
                         GRegexCompileFlags compile_flags)
{
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	if (g_once_init_enter ((volatile gsize*) re)) {
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
		GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
		g_once_init_leave ((volatile gsize*) re, (gsize) val);
#line 631 "Youtube.c"
	}
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return *re;
#line 635 "Youtube.c"
}

static GeeList*
enotes_youtube_real_get_blacklist_members (ENotesPlugin* base)
{
	ENotesYoutube * self;
	GeeLinkedList* list = NULL;
	GeeLinkedList* _tmp0_;
	BLMember* empty_link = NULL;
	BLMember* _tmp1_;
	BLMember* youtube_video = NULL;
	BLMember* _tmp2_;
	GeeList* result;
#line 74 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) base;
#line 75 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = gee_linked_list_new (TYPE_BL_MEMBER, (GBoxedCopyFunc) bl_member_ref, (GDestroyNotify) bl_member_unref, NULL, NULL, NULL);
#line 75 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	list = _tmp0_;
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp1_ = bl_member_new (_thread_safe_regex_init (&_tmp_regex_0, "<youtube \\[Link\\]>", 0), "");
#line 77 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	empty_link = _tmp1_;
#line 78 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp2_ = bl_member_new (_thread_safe_regex_init (&_tmp_regex_1, "<youtube [\\p{L}\\d_\\.\\?\\/:\\=\\+&\\-'\"]*>", 0), _ ("Youtube Video"));
#line 78 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	youtube_video = _tmp2_;
#line 79 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	gee_abstract_collection_add ((GeeAbstractCollection*) list, youtube_video);
#line 80 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	gee_abstract_collection_add ((GeeAbstractCollection*) list, empty_link);
#line 81 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	result = (GeeList*) list;
#line 81 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_bl_member_unref0 (youtube_video);
#line 81 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_bl_member_unref0 (empty_link);
#line 81 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return result;
#line 675 "Youtube.c"
}

ENotesYoutube*
enotes_youtube_construct (GType object_type)
{
	ENotesYoutube * self = NULL;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = (ENotesYoutube*) enotes_plugin_construct (object_type);
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return self;
#line 686 "Youtube.c"
}

ENotesYoutube*
enotes_youtube_new (void)
{
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return enotes_youtube_construct (ENOTES_TYPE_YOUTUBE);
#line 694 "Youtube.c"
}

static GObject *
enotes_youtube_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesYoutube * self;
#line 25 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	parent_class = G_OBJECT_CLASS (enotes_youtube_parent_class);
#line 25 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
#line 25 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_YOUTUBE, ENotesYoutube);
#line 25 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	return obj;
#line 713 "Youtube.c"
}

static void
enotes_youtube_class_init (ENotesYoutubeClass * klass,
                           gpointer klass_data)
{
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	enotes_youtube_parent_class = g_type_class_peek_parent (klass);
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	g_type_class_adjust_private_offset (klass, &ENotesYoutube_private_offset);
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->get_desctiption = (gchar* (*) (ENotesPlugin*)) enotes_youtube_real_get_desctiption;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->get_name = (gchar* (*) (ENotesPlugin*)) enotes_youtube_real_get_name;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->editor_button = (GtkWidget* (*) (ENotesPlugin*)) enotes_youtube_real_editor_button;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->get_button_desctiption = (gchar* (*) (ENotesPlugin*)) enotes_youtube_real_get_button_desctiption;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->has_match = (gboolean (*) (ENotesPlugin*, const gchar*)) enotes_youtube_real_has_match;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->convert = (gchar* (*) (ENotesPlugin*, const gchar*)) enotes_youtube_real_convert;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	((ENotesPluginClass *) klass)->get_blacklist_members = (GeeList* (*) (ENotesPlugin*)) enotes_youtube_real_get_blacklist_members;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	G_OBJECT_CLASS (klass)->constructor = enotes_youtube_constructor;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	G_OBJECT_CLASS (klass)->finalize = enotes_youtube_finalize;
#line 742 "Youtube.c"
}

static void
enotes_youtube_instance_init (ENotesYoutube * self,
                              gpointer klass)
{
	GPatternSpec* _tmp0_;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self->priv = enotes_youtube_get_instance_private (self);
#line 23 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_tmp0_ = g_pattern_spec_new ("*<youtube *>*");
#line 23 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self->priv->spec = _tmp0_;
#line 756 "Youtube.c"
}

static void
enotes_youtube_finalize (GObject * obj)
{
	ENotesYoutube * self;
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_YOUTUBE, ENotesYoutube);
#line 23 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	_g_pattern_spec_free0 (self->priv->spec);
#line 22 "../Notes-up-2.0.6/src/Plugins/Youtube.vala"
	G_OBJECT_CLASS (enotes_youtube_parent_class)->finalize (obj);
#line 769 "Youtube.c"
}

static GType
enotes_youtube_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesYoutubeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_youtube_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesYoutube), 0, (GInstanceInitFunc) enotes_youtube_instance_init, NULL };
	GType enotes_youtube_type_id;
	enotes_youtube_type_id = g_type_register_static (ENOTES_TYPE_PLUGIN, "ENotesYoutube", &g_define_type_info, 0);
	ENotesYoutube_private_offset = g_type_add_instance_private (enotes_youtube_type_id, sizeof (ENotesYoutubePrivate));
	return enotes_youtube_type_id;
}

GType
enotes_youtube_get_type (void)
{
	static volatile gsize enotes_youtube_type_id__once = 0;
	if (g_once_init_enter (&enotes_youtube_type_id__once)) {
		GType enotes_youtube_type_id;
		enotes_youtube_type_id = enotes_youtube_get_type_once ();
		g_once_init_leave (&enotes_youtube_type_id__once, enotes_youtube_type_id);
	}
	return enotes_youtube_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

