text:
#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include "sds/sds.h"

#include "executor.h"
#include "json_helpers.h"
#include "hash_funcs.h"
#include "hash_table.h"
#include "time_utils.h"

#define DEFAULT_START_TIME 0
#define DEFAULT_SAMPLER_SIZE 1000

/***** HELPER DATA TYPES *****/
enum EntryType {
  ET_UNKNOWN = 0,
  ETMHTCounter = 1,
  ETMHTSampler = 2
};

struct VisitorData {
  sds *dest;
  int counter;
  enum EntryType type;
};

/***** STATIC HELPER PROTOTYPES *****/
static void handleMHTCounterAdd(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static char *handleMHTCounterGet(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static void handleMHTSamplerAdd(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static char *handleALLDumpJSON(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static char *handleALLListJSON(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static void handleALLFlush(VARZExecutor_t *executor, struct VARZOperationDescription *op);
static void JSONDictKeysList(VARZHashTable_t *ht, sds *dest);
static void JSONKeyListVisitor(struct VARZHashTableEntry *entry, void *data);
static void JSONReprVisitor(struct VARZHashTableEntry *entry, void *data);
static void MHTCountersJSONRepr(VARZExecutor_t *executor, sds *dest);
static void MHTSamplersJSONRepr(VARZExecutor_t *executor, sds *dest);
static void metadataJSONRepr(VARZExecutor_t *executor, sds *dest);
static void MHTCounterFreeVisitor(struct VARZHashTableEntry *entry, void *data);
static void MHTSamplersFreeVisitor(struct VARZHashTableEntry *entry, void *data);

/***** INTERFACE IMPLEMENTATION *****/

void VARZExecutorInit(VARZExecutor_t *executor, unsigned long hash_table_size) {
  memset(executor, 0, sizeof(VARZExecutor_t));
  VARZHashTableInit(&(executor->mht_counters_ht), hash_table_size);
  VARZHashTableInit(&(executor->mht_samplers_ht), hash_table_size);
  executor->metadata.executor_start_time = VARZCurrentTime();
}

void VARZExecutorFree(VARZExecutor_t *executor) {
  VARZHashTableVisit(&(executor->mht_counters_ht), MHTCounterFreeVisitor, NULL);
  VARZHashTableFree(&(executor->mht_counters_ht));
  VARZHashTableVisit(&(executor->mht_samplers_ht), MHTSamplersFreeVisitor, NULL);
  VARZHashTableFree(&(executor->mht_samplers_ht));
}

void *VARZExecutorExecute(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  // TODO Come up with a less stupid way of doing this
  switch (op->op) {
    case VARZOP_INVALID:
      return NULL;
    case VARZOP_MHT_COUNTER_ADD:
      handleMHTCounterAdd(executor, op);
      return NULL;
    case VARZOP_MHT_SAMPLE_ADD:
      handleMHTSamplerAdd(executor, op);
      return NULL;
    case VARZOP_ALL_DUMP_JSON:
      return handleALLDumpJSON(executor, op);
    case VARZOP_ALL_LIST_JSON:
      return handleALLListJSON(executor, op);
    case VARZOP_ALL_FLUSH:
      handleALLFlush(executor, op);
      return NULL;
    case VARZOP_MHT_COUNTER_GET:
      return handleMHTCounterGet(executor, op);
  }

  // We got an invalid op...
  assert(0);
}

/***** STATIC HELPERS *****/
static void handleMHTCounterAdd(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  VARZMHTIntCounter_t *counter;
  struct VARZMHTCounterAddOp *counter_add_op;
  uint64_t name_hash = VARZHashString(op->variable_name);
  counter = VARZHashTableGet(&(executor->mht_counters_ht), op->variable_name, name_hash);

  // Check if it exists
  if (!counter) {
    counter = calloc(1, sizeof(VARZMHTIntCounter_t));
    VARZMHTIntCounterInit(counter, DEFAULT_START_TIME);
    VARZHashTableAdd(&(executor->mht_counters_ht), op->variable_name, name_hash, counter);
  }

  counter_add_op = &(op->op_data.counter_add_op);
  VARZMHTIntCounterIncrement(counter, counter_add_op->time, counter_add_op->amt);
}

static char *handleMHTCounterGet(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  char *returnme;
  sds return_sds = sdsempty();
  sds *dest = &return_sds;
  VARZMHTIntCounter_t *counter;
  uint64_t name_hash = VARZHashString(op->variable_name);
  counter = VARZHashTableGet(&(executor->mht_counters_ht), op->variable_name, name_hash);
  if(counter) { // found
    VARZMHTIntCounterJSONRepr(counter, dest);
  }
  returnme = strdup(return_sds);
  sdsfree(return_sds);
  return returnme;
}

static void handleMHTSamplerAdd(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  VARZMHTIntSampler_t *sampler;
  struct VARZMHTSamplerAddOp *sampler_add_op;
  uint64_t name_hash = VARZHashString(op->variable_name);
  sampler = VARZHashTableGet(&(executor->mht_samplers_ht), op->variable_name, name_hash);

  if (!sampler) {
    sampler = calloc(1, sizeof(VARZMHTIntSampler_t));
    VARZMHTIntSamplerInit(sampler, DEFAULT_START_TIME, DEFAULT_SAMPLER_SIZE);
    VARZHashTableAdd(&(executor->mht_samplers_ht), op->variable_name, name_hash, sampler);
  }
  sampler_add_op = &(op->op_data.sampler_add_op);
  VARZMHTIntSamplerAddSample(sampler, sampler_add_op->time, sampler_add_op->value,
                             sampler_add_op->random_vals);
}

static char *handleALLDumpJSON(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  char *returnme;
  sds return_sds = sdsempty();
  sds *dest = &return_sds;
  VARZJSONDictStart(dest);
  VARZJSONDictKey(dest, "mht_counters");
  MHTCountersJSONRepr(executor, dest);

  VARZJSONDictNextKey(dest);
  VARZJSONDictKey(dest, "mht_samplers");
  MHTSamplersJSONRepr(executor, dest);

  VARZJSONDictNextKey(dest);
  VARZJSONDictKey(dest, "metadata");
  metadataJSONRepr(executor, dest);

  VARZJSONDictEnd(dest);

  returnme = strdup(return_sds);
  sdsfree(return_sds);
  return returnme;
}

static char *handleALLListJSON(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  char *returnme;
  sds return_sds = sdsempty();

  sds *dest = &return_sds;

  VARZJSONDictStart(dest);

  VARZJSONDictKey(dest, "mht_counters");
  JSONDictKeysList(&(executor->mht_counters_ht), dest);

  VARZJSONDictNextKey(dest);
  VARZJSONDictKey(dest, "mht_samplers");
  JSONDictKeysList(&(executor->mht_samplers_ht), dest);

  VARZJSONDictEnd(dest);

  returnme = strdup(return_sds);
  sdsfree(return_sds);
  return returnme;
}

static void handleALLFlush(VARZExecutor_t *executor, struct VARZOperationDescription *op) {
  unsigned long hash_table_size = executor->mht_counters_ht.num_slots;
  VARZExecutorFree(executor);
  VARZExecutorInit(executor, hash_table_size);
}

static void JSONDictKeysList(VARZHashTable_t *ht, sds *dest) {
  struct VisitorData vd;
  vd.dest = dest;
  vd.counter = 0;
  vd.type = ET_UNKNOWN;
  VARZJSONArrayStart(dest);
  VARZHashTableVisit(ht, JSONKeyListVisitor, &vd);
  VARZJSONArrayEnd(dest);
}

static void JSONKeyListVisitor(struct VARZHashTableEntry *entry, void *data) {
  struct VisitorData *vd = (struct VisitorData*) data;
  sds *dest = vd->dest;
  if(vd->counter != 0) {
    VARZJSONArrayNextItem(dest);
  }
  VARZJSONStringRepr(dest, entry->name);
  vd->counter ++;
}

static void JSONReprVisitor(struct VARZHashTableEntry *entry, void *data) {
  struct VisitorData *vd = (struct VisitorData*) data;
  sds *dest = vd->dest;
  if (vd->counter != 0) {
    VARZJSONArrayNextItem(dest);
  }

  VARZJSONDictStart(dest);

  VARZJSONDictKey(dest, "name");
  VARZJSONStringRepr(dest, entry->name);

  VARZJSONDictNextKey(dest);
  VARZJSONDictKey(dest, "value");
  switch (vd->type) {
    case ETMHTCounter:
      VARZMHTIntCounterJSONRepr(entry->value, dest);
      break;
    case ETMHTSampler:
      VARZMHTIntSamplerJSONRepr(entry->value, dest);
      break;
    default:
      assert(1); // Should never pass
  }

  VARZJSONDictNextKey(dest);
  VARZJSONDictKey(dest, "name_hash");
  VARZJSONUnsignedLongRepr(dest, entry->name_hash);

  VARZJSONDictEnd(dest);
  vd->counter ++;
}

static void MHTCountersJSONRepr(VARZExecutor_t *executor, sds *dest) {
  struct VisitorData vd;
  vd.dest = dest;
  vd.counter = 0;
  vd.type = ETMHTCounter;

  VARZJSONArrayStart(dest);
  VARZHashTableVisit(&(executor->mht_counters_ht), &JSONReprVisitor, &vd);
  VARZJSONArrayEnd(dest);
}

static void MHTSamplersJSONRepr(VARZExecutor_t *executor, sds *dest) {
  struct VisitorData vd;
  vd.dest = dest;
  vd.counter = 0;
  vd.type = ETMHTSampler;

  VARZJSONArrayStart(dest);
  VARZHashTableVisit(&(executor->mht_samplers_ht), &JSONReprVisitor, &vd);
  VARZJSONArrayEnd(dest);
}

static void metadataJSONRepr(VARZExecutor_t *executor, sds *dest) {
  VARZJSONDictStart(dest);

  // We won't call it executor_start_time since that's not part of the abstraction
  VARZJSONDictKey(dest, "start_time");
  VARZJSONUnsignedLongRepr(dest, executor->metadata.executor_start_time);

  VARZJSONDictEnd(dest);
}

static void MHTCounterFreeVisitor(struct VARZHashTableEntry *entry, void *data) {
  free(entry->value);
}

static void MHTSamplersFreeVisitor(struct VARZHashTableEntry *entry, void *data) {
  VARZMHTIntSamplerFree((VARZMHTIntSampler_t*)entry->value);
  free(entry->value);
}


text:
var dbm = global.dbm || require('db-migrate');
var type = dbm.dataType;
var fs = require('fs');
var path = require('path');

exports.up = function (db, callback) {
    var filePath = path.join(__dirname + '/sqls/20161003092733-fix-user-get-target-time-up.sql');
    fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
        if (err) return callback(err);
        console.log('received data: ' + data);

        db.runSql(data, function (err) {
            if (err) return callback(err);
            callback();
        });
    });
};

exports.down = function (db, callback) {
    var filePath = path.join(__dirname + '/sqls/20161003092733-fix-user-get-target-time-down.sql');
    fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
        if (err) return callback(err);
        console.log('received data: ' + data);

        db.runSql(data, function (err) {
            if (err) return callback(err);
            callback();
        });
    });
};

redpajama_set_name: RedPajamaGithub


text:
DS_DECL void DSConvertRLLuminance8ToLuminance8(const void * sourceImage, int width, int height, uint8_t * leftImage, uint8_t * rightImage);
DS_DECL void DSConvertRLLuminance8ToLuminance8(const void * sourceImage, int width, int height, int stride, uint8_t * leftImage, uint8_t * rightImage);

DS_DECL void DSConvertRLLuminance12ToLuminance8(const void * sourceImage, int width, int height, int shift, uint8_t * leftImage, uint8_t * rightImage);
DS_DECL void DSConvertRLLuminance12ToLuminance8(const void * sourceImage, int width, int height, int stride, int shift, uint8_t * leftImage, uint8_t * rightImage);
DS_DECL void DSConvertRLLuminance12ToLuminance16(const void * sourceImage, int width, int height, uint16_t * leftImage, uint16_t * rightImage);
DS_DECL void DSConvertRLLuminance12ToLuminance16(const void * sourceImage, int width, int height, int stride, uint16_t * leftImage, uint16_t * rightImage);

DS_DECL void DSConvertRLLuminance16ToLuminance8(const void * sourceImage, int width, int height, int shift, uint8_t * leftImage, uint8_t * rightImage);
DS_DECL void DSConvertRLLuminance16ToLuminance8(const void * sourceImage, int width, int height, int stride, int shift, uint8_t * leftImage, uint8_t * rightImage);
DS_DECL void DSConvertRLLuminance16ToLuminance16(const void * sourceImage, int width, int height, uint16_t * leftImage, uint16_t * rightImage);
DS_DECL void DSConvertRLLuminance16ToLuminance16(const void * sourceImage, int width, int height, int stride, uint16_t * leftImage, uint16_t * rightImage);

DS_DECL void DSConvertYUY2ToRGB8(const void * sourceImage, int width, int height, uint8_t * destImage);
DS_DECL void DSConvertYUY2ToBGRA8(const void * sourceImage, int width, int height, uint8_t * destImage);

DS_DECL void DSConvertRaw10ToRGB8(const void * sourceImage, int width, int height, uint8_t * destImage);
DS_DECL void DSConvertRaw10ToBGRA8(const void * sourceImage, int width, int height, uint8_t * destImage);

/// @}


text:
package com.intellij.diff.tools.simple;

import com.intellij.diff.util.ThreeSide;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class MergeInnerDifferences {
  @Nullable private final List<TextRange> myLeft;
  @Nullable private final List<TextRange> myBase;
  @Nullable private final List<TextRange> myRight;

  public MergeInnerDifferences(@Nullable List<TextRange> left, @Nullable List<TextRange> base, @Nullable List<TextRange> right) {
    myLeft = left;
    myBase = base;
    myRight = right;
  }

  @Nullable
  public List<TextRange> get(@NotNull ThreeSide side) {
    return side.select(myLeft, myBase, myRight);
  }
}


text:
<?php
require_once("commons/mysql.php");
require_once("commons/config.php");
require_once("paginator.php");

// Get total number of rows to prepare for pagination
$results = $mysql->query("SELECT COUNT(*) FROM speedtest");
$t = $results->fetch_all();
$num_records = $t[0][0];
$num_pages = ceil($num_records / RESULTS_PER_PAGE);

// Handle pagination
$current_page = intval($_GET["page"]);
if ($current_page > $num_pages) {
	$current_page = $num_pages;
} else if ($current_page < 1) {
	$current_page = 1;
}
$per_page     = RESULTS_PER_PAGE;
$first_index  = ($current_page-1) * RESULTS_PER_PAGE;

$results = $mysql->query("SELECT * FROM speedtest ORDER BY `ts` DESC LIMIT $first_index, $per_page");
date_default_timezone_set("UTC");
$results_arr = $results->fetch_all(MYSQLI_ASSOC);
foreach ($results_arr as $i => $row) {
	$date = new DateTime("@" . $row["ts"]);
	$date->setTimeZone(new DateTimeZone("Asia/Kuala_Lumpur"));
	$results_arr[$i]["ts"] = $date->format("d/m/y h:i A");
}

$paginator = new Paginator($current_page, $num_pages);
?>
<!DOCTYPE html>

	<meta chatset="utf-8">
	<title>Internet Speed</title>
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

				Time
				Ping
				DL
				UL
				Server

				<?php foreach($results_arr as $row): ?>
					<tr<?php if ($row["dl"] < LOW_SPEED_CUTOFF):?> class="text-danger"<?php endif; ?>>
						<?php echo $row["ts"]; ?>
						<?php echo $row["ping"]; ?>
						<?php echo $row["dl"]; ?>
						<?php echo $row["ul"]; ?>
						<?php echo ($row["server_id"] ? $row["server_id"] : "N/A"); ?>

				<?php endforeach; ?>

		<?php echo $paginator->get_output(); ?>


text:
module.exports = function(config){

	this.jade = require('jade'),
	this.bcrypt = require('bcrypt');
	this.flash = require('connect-flash');

	//Twitter
	var Twit = require('twit')
	this.twitter = new Twit({
		consumer_key: config.services.twitter.consumer_key,
		consumer_secret: config.services.twitter.consumer_secret,
		access_token: config.services.twitter.access_token,
		access_token_secret: config.services.twitter.access_token_secret
	})

	//Facebook
	this.facebook = require('fb')
	facebook.options({
		appId: config.services.facebook.appId,
		appSecret: config.services.facebook.appSecret,
		redirectUri: 'http://localhost:3000'
	})

	//Flickr
	this.flickr = require('flickr')

	//RSS
	this.feedparser = require('feedparser')

	//Youtube
	this.youtube = require('youtube-feeds')

	//Instagram
	this.instagram = require('instagram-node-lib')

	//Vimeo
	this.vimeo = require('n-vimeo')

	return this;
}


text:
.class Landroid/support/v4/graphics/drawable/DrawableCompat$HoneycombDrawableImpl;
.super Landroid/support/v4/graphics/drawable/DrawableCompat$BaseDrawableImpl;
.source "DrawableCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/graphics/drawable/DrawableCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "HoneycombDrawableImpl"
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 92
    invoke-direct {p0}, Landroid/support/v4/graphics/drawable/DrawableCompat$BaseDrawableImpl;-><init>()V

    return-void
.end method

# virtual methods
.method public jumpToCurrentState(Landroid/graphics/drawable/Drawable;)V
    .locals 0
    .param p1, "drawable"    # Landroid/graphics/drawable/Drawable;

    .prologue
    .line 95
    invoke-static {p1}, Landroid/support/v4/graphics/drawable/DrawableCompatHoneycomb;->jumpToCurrentState(Landroid/graphics/drawable/Drawable;)V

    .line 96
    return-void
.end method

.method public wrap(Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .param p1, "drawable"    # Landroid/graphics/drawable/Drawable;

    .prologue
    .line 100
    invoke-static {p1}, Landroid/support/v4/graphics/drawable/DrawableCompatHoneycomb;->wrapForTinting(Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    return-object v0
.end method


text:
<?php
$search_data = $this->session->flashdata('event_filter');
?>
<link rel="stylesheet" type="text/css" href="<?php echo DEFAULT_CSS_PATH . "bootstrap-datetimepicker.min.css" ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo DEFAULT_ADMIN_CSS_PATH . "sweetalert.css"; ?>">

    <?php if ($banner_image != "" && $banner_image != null) { ?>
        <img src="<?php echo DEFAULT_BANNER_IMAGE_PATH . $banner_image; ?>" class="img-responsive center-block">
    <?php } else {
        ?>

    <?php }
    ?>

        <?php echo lang('New'); ?>
<?php echo lang('Join me'); ?>

            <?php echo lang('Filters'); ?>

    <?php
    $message = $this->session->flashdata('message');
    if (!empty($message) && isset($message)) {
        ($message['class'] != '') ? $message['class'] : '';
        echo '
' . $message['message'] . '
';
    }

    $all_errors = validation_errors();
    if (isset($all_errors) && !empty($all_errors)) {
        echo '
' . $all_errors . '
';
    }
    $cnt = 0;
    ?>

                    <?php
                    if (isset($event_posts) && !empty($event_posts)) {
                        $cnt = count($event_posts);
                        $this->load->view('user/partial/events/display_events');
                    } else {
                        ?>

                            <?php echo lang('No Events found.'); ?>

                        <?php
                    }
                    ?>

    <?php
    if ($cnt >= 2) {
        ?>

                    <?php echo lang('Load More'); ?>

                        <img class = "img-responsive" src = "<?php echo DEFAULT_IMAGE_PATH . "upload.png" ?>">

        <?php
    }
    ?>

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <?php echo lang('Create New Event'); ?>

                <form class="" role="form" method="post" action="<?php echo base_url() . "events/add_event"; ?>" enctype="multipart/form-data">

                                <img class="img-circle img-responsive event_user" src="<?php echo DEFAULT_PROFILE_IMAGE_PATH . $this->session->user['user_image'] ?>">
                                <?php echo $this->session->user['name']; ?>

                                <input type="text" class="form-control" placeholder="<?php echo lang('Event title'); ?>:" name="title" id="title" required="true">

                            <textarea class="form-control" name="details" id="details" placeholder="<?php echo lang("Events details and who you are looking for"); ?>"></textarea>

                                 <?php echo lang('Images'); ?>
                                <input type="file" name="uploadfile[]" class="upload" id="uploadFile"/>

                            <?php echo lang("Event start time"); ?>

                                <input type='text' class="form-control" name="start_time" id="start_time_txt" required/>

                            <?php echo lang("Event end time"); ?>

                                <input type='text' class="form-control" name="end_time" id="end_time_txt" required/>

                            <?php echo lang("Number of people to join"); ?>

                            <input type="number" class="form-control" min="1" name="limit" required="true" id="limit">

                            <?php echo lang("Approval needed"); ?>

                            <input type="radio" class="" style="margin-right: 5px;" name="approval" id="approval" checked="checked" value="Yes"><?php echo lang("Yes"); ?>
                            <input type="radio" class="" name="approval" value="No" style="margin:0px 5px;"><?php echo lang("No"); ?>

                            <input type="submit" class="pstbtn" value="<?php echo lang('Create') ?>"/>

                    <input type="hidden" name="lat" class="lat" value="">
                    <input type="hidden" name="long" class="long" value="">
                </form>

            <form method="post" action="<?php echo base_url() . "events/filter_event"; ?>">

                    <button type="button" class="close" data-dismiss="modal">×</button>

<?php echo lang('Enter your searching criteria') ?>

<?php echo lang("Filter By"); ?> :

                                <?php echo lang("Release Date"); ?>:

                                        <input type="radio" class="" name="release_date" value="desc" <?php echo ($this->session->has_userdata('event_filter') && $this->session->userdata('event_filter')['release_date'] == "asc") ? '' : 'checked' ?>> <?php echo lang("From Newest to Oldest"); ?>

                                        <input type="radio" class="" name="release_date" <?php echo ($this->session->has_userdata('event_filter') && $this->session->userdata('event_filter')['release_date'] == "asc") ? 'checked' : '' ?> value="asc"> <?php echo lang("From Oldest to Newest"); ?>

                                <?php echo lang("Number of seat"); ?>:

                                    <?php echo lang(""); ?>From <input type="number" class="form-control" value="<?php echo ($this->session->has_userdata('event_filter')) ? $this->session->userdata('event_filter')['from_seat'] : '' ?>" min="0" style="width:30%;display:inline-block;" name="from_seat">
                                    <?php echo lang(""); ?>to <input type="number" value="<?php echo ($this->session->has_userdata('event_filter')) ? $this->session->userdata('event_filter')['to_seat'] : '' ?>" min="1" class="form-control" style="width:30%;display:inline-block;" name="to_seat">

                                <?php echo lang("Range Distance"); ?>:

                                    <select class='form-control' name="distance_range" required="true" style="width:30%;display:inline-block;">
                                        <?php
                                        for ($i = 1; $i <= 10; ++$i) {
                                            ?>

                                            <option value='<?php echo $i; ?>' <?php echo ($this->session->has_userdata('event_filter') && $this->session->userdata('event_filter')['distance_range'] == $i) ? 'selected' : ''; ?>><?php echo $i; ?> <?php echo lang("Mile"); ?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                    <?php echo lang("From current location"); ?>

                                <?php echo lang("Approval needed"); ?>:

                                        <input type="radio" class="" name="approval_needed" value="yes" <?php echo ($this->session->has_userdata('event_filter') && $this->session->userdata('event_filter')['approval_needed'] == "no") ? '' : 'checked' ?>> <?php echo lang("Yes"); ?>

                                        <input type="radio" class="" name="approval_needed" value="no" <?php echo ($this->session->has_userdata('event_filter') && $this->session->userdata('event_filter')['approval_needed'] == "no") ? 'checked' : '' ?>> <?php echo lang("No"); ?>

                    <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo lang("Close"); ?></button>
                    <button type="submit" class="btn btn-default"><?php echo lang("Search"); ?></button>

                <input type="hidden" name="lat" class="lat" value="">
                <input type="hidden" name="long" class="long" value="">
            </form>


text:
php5-pecl-deb
=============

Configs debian builds of php5 pecl modules to have useful postinst, prerm, etc. scripts.

Why
---

`dh-make-pecl` does not include sane postinst, prerm, etc. maintainer scripts. The dotdeb packages include scripts that enable/disable the module as it gets installed/removed. That's where this tool comes in, it puts those scripts into the package.

Use
---

Replace `[module]` with the module you want to build (e.g. redis).

```bash
dh-make-pecl --phpversion 5 --prefix php5- [module]
cd php5-[module]
/path/to/config.sh [module] ./debian
./debian/rules binary
```

Thanks
------

Thanks to [Guillaume Plessis](https://github.com/gplessis/) for his awesome work with [dotdeb](http://www.dotdeb.org) and creating the scripts these are based off.


text:
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("react"));
	else if(typeof define === 'function' && define.amd)
		define(["react"], factory);
	else if(typeof exports === 'object')
		exports["HTMLReactParser"] = factory(require("react"));
	else
		root["HTMLReactParser"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var _hyphenPattern = /-(.)/g;

/**
 * Convert a string to camel case.
 *
 * @param  {String} string - The string.
 * @return {String}
 */
function camelCase(string) {
    if (typeof string !== 'string') { // null is an object
        throw new TypeError('First argument must be a string');
    }
    if(string.indexOf('-') < 0) {
        return string;
    }
    return string.toLowerCase().replace(_hyphenPattern, function(_, character) {
        return character.toUpperCase();
    });
}

/**
 * Swap key with value in an object.
 *
 * @param  {Object}   obj        - The object.
 * @param  {Function} [override] - The override method.
 * @return {Object}              - The inverted object.
 */
function invertObject(obj, override) {
    if (typeof obj !== 'object' || !obj) { // null is an object
        throw new TypeError('First argument must be an object');
    }

    var key;
    var value;
    var isOverridePresent = typeof override === 'function';
    var overrides = {};
    var result = {};

    for (key in obj) {
        value = obj[key];

        if (isOverridePresent) {
            overrides = override(key, value);
            if (overrides && overrides.length === 2) {
                result[overrides[0]] = overrides[1];
                continue;
            }
        }

        if (typeof value === 'string') {
            result[value] = key;
        }
    }

    return result;
}

/**
 * Export utilties.
 */
module.exports = {
    camelCase: camelCase,
    invertObject: invertObject
};

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Format DOM attributes to an associative array.
 *
 * @param  {NamedNodeMap} - The list of attributes.
 * @return {Object}       - The object of attributes.
 */
function formatAttributes(attributes) {
    var result = {};
    var attribute;

    // NamedNodeMap is array-like
    for (var i = 0, len = attributes.length; i < len; i++) {
        attribute = attributes[i];
        result[attribute.name] = attribute.value;
    }

    return result;
}

/**
 * Format the browser DOM nodes to mimic the output of `htmlparser2.parseDOM()`.
 *
 * @param  {NodeList} nodes        - The DOM nodes.
 * @param  {Object}   [parentObj]  - The formatted parent node.
 * @param  {String}   [directive]  - The directive.
 * @return {Object}                - The formatted DOM object.
 */
function formatDOM(nodes, parentObj, directive) {
    parentObj = parentObj || null;

    var result = [];
    var node;
    var prevNode;
    var nodeObj;

    // NodeList is array-like
    for (var i = 0, len = nodes.length; i < len; i++) {
        node = nodes[i];
        // reset
        nodeObj = {
            next: null,
            prev: result[i - 1] || null,
            parent: parentObj
        };

        // set the next node for the previous node (if applicable)
        prevNode = result[i - 1];
        if (prevNode) {
            prevNode.next = nodeObj;
        }

        // set the node name if it's not "#text" or "#comment"
        // e.g., "div"
        if (node.nodeName.indexOf('#') !== 0) {
            nodeObj.name = node.nodeName.toLowerCase();

            // also, nodes of type "tag" have "attribs"
            nodeObj.attribs = {}; // default
            if (node.attributes && node.attributes.length) {
                nodeObj.attribs = formatAttributes(node.attributes);
            }
        }

        // set the node type
        // e.g., "tag"
        switch (node.nodeType) {
            // 1 = element
            case 1:
                if (nodeObj.name === 'script' || nodeObj.name === 'style') {
                    nodeObj.type = nodeObj.name;
                } else {
                    nodeObj.type = 'tag';
                }
                // recursively format the children
                nodeObj.children = formatDOM(node.childNodes, nodeObj);
                break;
                // 2 = attribute
                // 3 = text
            case 3:
                nodeObj.type = 'text';
                nodeObj.data = node.nodeValue;
                break;
                // 8 = comment
            case 8:
                nodeObj.type = 'comment';
                nodeObj.data = node.nodeValue;
                break;
            default:
                break;
        }

        result.push(nodeObj);
    }

    if (directive) {
        result.unshift({
            name: directive.substring(0, directive.indexOf(' ')).toLowerCase(),
            data: directive,
            type: 'directive',
            next: result[0] ? result[0] : null,
            prev: null,
            parent: parentObj
        });

        if (result[1]) {
            result[1].prev = result[0];
        }
    }

    return result;
}

/**
 * Detect IE with or without version.
 *
 * @param  {Number} [version] - The IE version to detect.
 * @return {Boolean}          - Whether IE or the version has been detected.
 */
function isIE(version) {
    if (version) {
        return document.documentMode === version;
    }
    return /(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent);
}

/**
 * Export utilities.
 */
module.exports = {
    formatAttributes: formatAttributes,
    formatDOM: formatDOM,
    isIE: isIE
};

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var domToReact = __webpack_require__(3);
var htmlToDOM = __webpack_require__(14);

// decode HTML entities by default for `htmlparser2`
var domParserOptions = { decodeEntities: true };

/**
 * Convert HTML string to React elements.
 *
 * @param  {String}   html              - The HTML string.
 * @param  {Object}   [options]         - The additional options.
 * @param  {Function} [options.replace] - The replace method.
 * @return {ReactElement|Array}
 */
function HTMLReactParser(html, options) {
    if (typeof html !== 'string') {
        throw new TypeError('First argument must be a string');
    }
    return domToReact(htmlToDOM(html, domParserOptions), options);
}

/**
 * Export HTML to React parser.
 */
module.exports = HTMLReactParser;

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var React = __webpack_require__(4);
var attributesToProps = __webpack_require__(5);

/**
 * Convert DOM nodes to React elements.
 *
 * @param  {Array}    nodes             - The DOM nodes.
 * @param  {Object}   [options]         - The additional options.
 * @param  {Function} [options.replace] - The replace method.
 * @return {ReactElement|Array}
 */
function domToReact(nodes, options) {
    options = options || {};
    var result = [];
    var node;
    var isReplacePresent = typeof options.replace === 'function';
    var replacement;
    var props;
    var children;

    for (var i = 0, len = nodes.length; i < len; i++) {
        node = nodes[i];

        // replace with custom React element (if applicable)
        if (isReplacePresent) {
            replacement = options.replace(node);

            if (React.isValidElement(replacement)) {
                // specify a "key" prop if element has siblings
                // https://fb.me/react-warning-keys
                if (len > 1) {
                    replacement = React.cloneElement(replacement, { key: i });
                }
                result.push(replacement);
                continue;
            }
        }

        if (node.type === 'text') {
            result.push(node.data);
            continue;
        }

        // update values
        props = attributesToProps(node.attribs);
        children = null;

        // node type for <script> is "script"
        // node type for <style> is "style"
        if (node.type === 'script' || node.type === 'style') {
            // prevent text in <script> or <style> from being escaped
            // https://facebook.github.io/react/tips/dangerously-set-inner-html.html
            if (node.children[0]) {
                props.dangerouslySetInnerHTML = {
                    __html: node.children[0].data
                };
            }

        } else if (node.type === 'tag') {
            // setting textarea value in children is an antipattern in React
            // https://facebook.github.io/react/docs/forms.html#why-textarea-value
            if (node.name === 'textarea' && node.children[0]) {
                props.defaultValue = node.children[0].data;

            // continue recursion of creating React elements (if applicable)
            } else if (node.children && node.children.length) {
                children = domToReact(node.children, options);
            }

        // skip all other cases (e.g., comment)
        } else {
            continue;
        }

        // specify a "key" prop if element has siblings
        // https://fb.me/react-warning-keys
        if (len > 1) {
            props.key = i;
        }

        result.push(
            React.createElement(node.name, props, children)
        );
    }

    if (result.length === 1) {
        return result[0];
    } else {
        return result;
    }
}

/**
 * Export DOM to React parser.
 */
module.exports = domToReact;

/***/ }),
/* 4 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_4__;

/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var utilities = __webpack_require__(0);
var propertyConfig = __webpack_require__(6);
var styleToObject = __webpack_require__(12);
var config = propertyConfig.config;
var isCustomAttribute = propertyConfig.HTMLDOMPropertyConfig.isCustomAttribute;

/**
 * Make attributes compatible with React props.
 *
 * @param  {Object} attributes - The attributes.
 * @return {Object}            - The props.
 */
function attributesToProps(attributes) {
    attributes = attributes || {};
    var props = {};
    var propertyName;
    var propertyValue;
    var reactProperty;

    for (propertyName in attributes) {
        propertyValue = attributes[propertyName];

        // custom attributes (`data-` and `aria-`)
        if (isCustomAttribute(propertyName)) {
            props[propertyName] = propertyValue;
            continue;
        }

        // make HTML DOM attribute/property consistent with React attribute/property
        reactProperty = config.html[propertyName.toLowerCase()];
        if (reactProperty) {
            props[reactProperty] = propertyValue;
            continue;
        }

        // make SVG DOM attribute/property consistent with React attribute/property
        reactProperty = config.svg[propertyName];
        if (reactProperty) {
            props[reactProperty] = propertyValue;
        }
    }

    // convert inline style to object
    if (attributes.style) {
        props.style = cssToJs(attributes.style);
    }

    return props;
}

/**
 * Convert CSS style string to JS style object.
 *
 * @param  {String} style - The CSS style.
 * @return {Object}       - The JS style object.
 */
function cssToJs(style) {
    if (typeof style !== 'string') {
        throw new Error('`cssToJs`: first argument must be a string. ');
    }

    var styleObj = {};

    styleToObject(style, function(propName, propValue) {
        // Check if it's not a comment node
        if (propName && propValue) {
            styleObj[utilities.camelCase(propName)] = propValue;
        }
    });

    return styleObj;
}

/**
 * Export attributes to props helper.
 */
module.exports = attributesToProps;

/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var utilities = __webpack_require__(0);

// HTML and SVG DOM Property Configs
var HTMLDOMPropertyConfig = __webpack_require__(7);
var SVGDOMPropertyConfig = __webpack_require__(11);

var config = {
    html: {},
    svg: {}
};

var propertyName;

/**
 * HTML DOM property config.
 * https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
 */

// first map out the HTML attribute names
// e.g., { className: 'class' } => { 'class': 'className' }
config.html = utilities.invertObject(
    HTMLDOMPropertyConfig.DOMAttributeNames
);

// then map out the rest of the HTML properties
// e.g., { readOnly: 0 } => { readonly: 'readOnly' }
for (propertyName in HTMLDOMPropertyConfig.Properties) {
    // lowercase to make matching property names easier
    config.html[propertyName.toLowerCase()] = propertyName;
}

/**
 * SVG DOM property config.
 * https://github.com/facebook/react/blob/master/src/renderers/dom/shared/SVGDOMPropertyConfig.js
 */

// first map out the SVG attribute names
// e.g., { fontSize: 'font-size' } => { 'font-size': 'fontSize' }
config.svg = utilities.invertObject(
    SVGDOMPropertyConfig.DOMAttributeNames
);

// then map out the rest of the SVG properties
// e.g., { fillRule: 0 } => { fillRule: 'fillRule' }
for (propertyName in SVGDOMPropertyConfig.Properties) {
    // do not lowercase as some svg properties are camel cased
    config.html[propertyName] = propertyName;
}

/**
 * Export property configs.
 */
module.exports = {
    config: config,
    HTMLDOMPropertyConfig: HTMLDOMPropertyConfig,
    SVGDOMPropertyConfig: SVGDOMPropertyConfig
};

/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

var DOMProperty = __webpack_require__(8);

var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;

var HTMLDOMPropertyConfig = {
  isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')),
  Properties: {
    /**
     * Standard Properties
     */
    accept: 0,
    acceptCharset: 0,
    accessKey: 0,
    action: 0,
    allowFullScreen: HAS_BOOLEAN_VALUE,
    allowTransparency: 0,
    alt: 0,
    // specifies target context for links with `preload` type
    as: 0,
    async: HAS_BOOLEAN_VALUE,
    autoComplete: 0,
    // autoFocus is polyfilled/normalized by AutoFocusUtils
    // autoFocus: HAS_BOOLEAN_VALUE,
    autoPlay: HAS_BOOLEAN_VALUE,
    capture: HAS_BOOLEAN_VALUE,
    cellPadding: 0,
    cellSpacing: 0,
    charSet: 0,
    challenge: 0,
    checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
    cite: 0,
    classID: 0,
    className: 0,
    cols: HAS_POSITIVE_NUMERIC_VALUE,
    colSpan: 0,
    content: 0,
    contentEditable: 0,
    contextMenu: 0,
    controls: HAS_BOOLEAN_VALUE,
    controlsList: 0,
    coords: 0,
    crossOrigin: 0,
    data: 0, // For `<object />` acts as `src`.
    dateTime: 0,
    'default': HAS_BOOLEAN_VALUE,
    defer: HAS_BOOLEAN_VALUE,
    dir: 0,
    disabled: HAS_BOOLEAN_VALUE,
    download: HAS_OVERLOADED_BOOLEAN_VALUE,
    draggable: 0,
    encType: 0,
    form: 0,
    formAction: 0,
    formEncType: 0,
    formMethod: 0,
    formNoValidate: HAS_BOOLEAN_VALUE,
    formTarget: 0,
    frameBorder: 0,
    headers: 0,
    height: 0,
    hidden: HAS_BOOLEAN_VALUE,
    high: 0,
    href: 0,
    hrefLang: 0,
    htmlFor: 0,
    httpEquiv: 0,
    icon: 0,
    id: 0,
    inputMode: 0,
    integrity: 0,
    is: 0,
    keyParams: 0,
    keyType: 0,
    kind: 0,
    label: 0,
    lang: 0,
    list: 0,
    loop: HAS_BOOLEAN_VALUE,
    low: 0,
    manifest: 0,
    marginHeight: 0,
    marginWidth: 0,
    max: 0,
    maxLength: 0,
    media: 0,
    mediaGroup: 0,
    method: 0,
    min: 0,
    minLength: 0,
    // Caution; `option.selected` is not updated if `select.multiple` is
    // disabled with `removeAttribute`.
    multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
    muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
    name: 0,
    nonce: 0,
    noValidate: HAS_BOOLEAN_VALUE,
    open: HAS_BOOLEAN_VALUE,
    optimum: 0,
    pattern: 0,
    placeholder: 0,
    playsInline: HAS_BOOLEAN_VALUE,
    poster: 0,
    preload: 0,
    profile: 0,
    radioGroup: 0,
    readOnly: HAS_BOOLEAN_VALUE,
    referrerPolicy: 0,
    rel: 0,
    required: HAS_BOOLEAN_VALUE,
    reversed: HAS_BOOLEAN_VALUE,
    role: 0,
    rows: HAS_POSITIVE_NUMERIC_VALUE,
    rowSpan: HAS_NUMERIC_VALUE,
    sandbox: 0,
    scope: 0,
    scoped: HAS_BOOLEAN_VALUE,
    scrolling: 0,
    seamless: HAS_BOOLEAN_VALUE,
    selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
    shape: 0,
    size: HAS_POSITIVE_NUMERIC_VALUE,
    sizes: 0,
    span: HAS_POSITIVE_NUMERIC_VALUE,
    spellCheck: 0,
    src: 0,
    srcDoc: 0,
    srcLang: 0,
    srcSet: 0,
    start: HAS_NUMERIC_VALUE,
    step: 0,
    style: 0,
    summary: 0,
    tabIndex: 0,
    target: 0,
    title: 0,
    // Setting .type throws on non-<input> tags
    type: 0,
    useMap: 0,
    value: 0,
    width: 0,
    wmode: 0,
    wrap: 0,

    /**
     * RDFa Properties
     */
    about: 0,
    datatype: 0,
    inlist: 0,
    prefix: 0,
    // property is also supported for OpenGraph in meta tags.
    property: 0,
    resource: 0,
    'typeof': 0,
    vocab: 0,

    /**
     * Non-standard Properties
     */
    // autoCapitalize and autoCorrect are supported in Mobile Safari for
    // keyboard hints.
    autoCapitalize: 0,
    autoCorrect: 0,
    // autoSave allows WebKit/Blink to persist values of input fields on page reloads
    autoSave: 0,
    // color is for Safari mask-icon link
    color: 0,
    // itemProp, itemScope, itemType are for
    // Microdata support. See http://schema.org/docs/gs.html
    itemProp: 0,
    itemScope: HAS_BOOLEAN_VALUE,
    itemType: 0,
    // itemID and itemRef are for Microdata support as well but
    // only specified in the WHATWG spec document. See
    // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
    itemID: 0,
    itemRef: 0,
    // results show looking glass icon and recent searches on input
    // search fields in WebKit/Blink
    results: 0,
    // IE-only attribute that specifies security restrictions on an iframe
    // as an alternative to the sandbox attribute on IE<10
    security: 0,
    // IE-only attribute that controls focus behavior
    unselectable: 0
  },
  DOMAttributeNames: {
    acceptCharset: 'accept-charset',
    className: 'class',
    htmlFor: 'for',
    httpEquiv: 'http-equiv'
  },
  DOMPropertyNames: {},
  DOMMutationMethods: {
    value: function (node, value) {
      if (value == null) {
        return node.removeAttribute('value');
      }

      // Number inputs get special treatment due to some edge cases in
      // Chrome. Let everything else assign the value attribute as normal.
      // https://github.com/facebook/react/issues/7253#issuecomment-236074326
      if (node.type !== 'number' || node.hasAttribute('value') === false) {
        node.setAttribute('value', '' + value);
      } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) {
        // Don't assign an attribute if validation reports bad
        // input. Chrome will clear the value. Additionally, don't
        // operate on inputs that have focus, otherwise Chrome might
        // strip off trailing decimal places and cause the user's
        // cursor position to jump to the beginning of the input.
        //
        // In ReactDOMInput, we have an onBlur event that will trigger
        // this function again when focus is lost.
        node.setAttribute('value', '' + value);
      }
    }
  }
};

module.exports = HTMLDOMPropertyConfig;

/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

var _prodInvariant = __webpack_require__(9);

var invariant = __webpack_require__(10);

function checkMask(value, bitmask) {
  return (value & bitmask) === bitmask;
}

var DOMPropertyInjection = {
  /**
   * Mapping from normalized, camelcased property names to a configuration that
   * specifies how the associated DOM property should be accessed or rendered.
   */
  MUST_USE_PROPERTY: 0x1,
  HAS_BOOLEAN_VALUE: 0x4,
  HAS_NUMERIC_VALUE: 0x8,
  HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
  HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,

  /**
   * Inject some specialized knowledge about the DOM. This takes a config object
   * with the following properties:
   *
   * isCustomAttribute: function that given an attribute name will return true
   * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
   * attributes where it's impossible to enumerate all of the possible
   * attribute names,
   *
   * Properties: object mapping DOM property name to one of the
   * DOMPropertyInjection constants or null. If your attribute isn't in here,
   * it won't get written to the DOM.
   *
   * DOMAttributeNames: object mapping React attribute name to the DOM
   * attribute name. Attribute names not specified use the **lowercase**
   * normalized name.
   *
   * DOMAttributeNamespaces: object mapping React attribute name to the DOM
   * attribute namespace URL. (Attribute names not specified use no namespace.)
   *
   * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
   * Property names not specified use the normalized name.
   *
   * DOMMutationMethods: Properties that require special mutation methods. If
   * `value` is undefined, the mutation method should unset the property.
   *
   * @param {object} domPropertyConfig the config as described above.
   */
  injectDOMPropertyConfig: function (domPropertyConfig) {
    var Injection = DOMPropertyInjection;
    var Properties = domPropertyConfig.Properties || {};
    var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
    var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
    var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
    var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};

    if (domPropertyConfig.isCustomAttribute) {
      DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
    }

    for (var propName in Properties) {
      !!DOMProperty.properties.hasOwnProperty(propName) ?  true ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;

      var lowerCased = propName.toLowerCase();
      var propConfig = Properties[propName];

      var propertyInfo = {
        attributeName: lowerCased,
        attributeNamespace: null,
        propertyName: propName,
        mutationMethod: null,

        mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
        hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
        hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
        hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
        hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
      };
      !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ?  true ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;

      if (true) {
        DOMProperty.getPossibleStandardName[lowerCased] = propName;
      }

      if (DOMAttributeNames.hasOwnProperty(propName)) {
        var attributeName = DOMAttributeNames[propName];
        propertyInfo.attributeName = attributeName;
        if (true) {
          DOMProperty.getPossibleStandardName[attributeName] = propName;
        }
      }

      if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
        propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
      }

      if (DOMPropertyNames.hasOwnProperty(propName)) {
        propertyInfo.propertyName = DOMPropertyNames[propName];
      }

      if (DOMMutationMethods.hasOwnProperty(propName)) {
        propertyInfo.mutationMethod = DOMMutationMethods[propName];
      }

      DOMProperty.properties[propName] = propertyInfo;
    }
  }
};

/* eslint-disable max-len */
var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
/* eslint-enable max-len */

/**
 * DOMProperty exports lookup objects that can be used like functions:
 *
 *   > DOMProperty.isValid['id']
 *   true
 *   > DOMProperty.isValid['foobar']
 *   undefined
 *
 * Although this may be confusing, it performs better in general.
 *
 * @see http://jsperf.com/key-exists
 * @see http://jsperf.com/key-missing
 */
var DOMProperty = {
  ID_ATTRIBUTE_NAME: 'data-reactid',
  ROOT_ATTRIBUTE_NAME: 'data-reactroot',

  ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
  ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',

  /**
   * Map from property "standard name" to an object with info about how to set
   * the property in the DOM. Each object contains:
   *
   * attributeName:
   *   Used when rendering markup or with `*Attribute()`.
   * attributeNamespace
   * propertyName:
   *   Used on DOM node instances. (This includes properties that mutate due to
   *   external factors.)
   * mutationMethod:
   *   If non-null, used instead of the property or `setAttribute()` after
   *   initial render.
   * mustUseProperty:
   *   Whether the property must be accessed and mutated as an object property.
   * hasBooleanValue:
   *   Whether the property should be removed when set to a falsey value.
   * hasNumericValue:
   *   Whether the property must be numeric or parse as a numeric and should be
   *   removed when set to a falsey value.
   * hasPositiveNumericValue:
   *   Whether the property must be positive numeric or parse as a positive
   *   numeric and should be removed when set to a falsey value.
   * hasOverloadedBooleanValue:
   *   Whether the property can be used as a flag as well as with a value.
   *   Removed when strictly equal to false; present without a value when
   *   strictly equal to true; present with a value otherwise.
   */
  properties: {},

  /**
   * Mapping from lowercase property names to the properly cased version, used
   * to warn in the case of missing properties. Available only in __DEV__.
   *
   * autofocus is predefined, because adding it to the property whitelist
   * causes unintended side effects.
   *
   * @type {Object}
   */
  getPossibleStandardName:  true ? { autofocus: 'autoFocus' } : null,

  /**
   * All of the isCustomAttribute() functions that have been injected.
   */
  _isCustomAttributeFunctions: [],

  /**
   * Checks whether a property name is a custom attribute.
   * @method
   */
  isCustomAttribute: function (attributeName) {
    for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
      var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
      if (isCustomAttributeFn(attributeName)) {
        return true;
      }
    }
    return false;
  },

  injection: DOMPropertyInjection
};

module.exports = DOMProperty;

/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 *
 */

/**
 * WARNING: DO NOT manually require this module.
 * This is a replacement for `invariant(...)` used by the error code system
 * and will _only_ be required by the corresponding babel pass.
 * It always throws.
 */

function reactProdInvariant(code) {
  var argCount = arguments.length - 1;

  var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;

  for (var argIdx = 0; argIdx < argCount; argIdx++) {
    message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
  }

  message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';

  var error = new Error(message);
  error.name = 'Invariant Violation';
  error.framesToPop = 1; // we don't care about reactProdInvariant's own frame

  throw error;
}

module.exports = reactProdInvariant;

/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 */

/**
 * Use invariant() to assert state which your program assumes to be true.
 *
 * Provide sprintf-style format (only %s is supported) and arguments
 * to provide information about what broke and what you were
 * expecting.
 *
 * The invariant message will be stripped in production, but the invariant
 * will remain to ensure logic does not differ in production.
 */

var validateFormat = function validateFormat(format) {};

if (true) {
  validateFormat = function validateFormat(format) {
    if (format === undefined) {
      throw new Error('invariant requires an error message argument');
    }
  };
}

function invariant(condition, format, a, b, c, d, e, f) {
  validateFormat(format);

  if (!condition) {
    var error;
    if (format === undefined) {
      error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
    } else {
      var args = [a, b, c, d, e, f];
      var argIndex = 0;
      error = new Error(format.replace(/%s/g, function () {
        return args[argIndex++];
      }));
      error.name = 'Invariant Violation';
    }

    error.framesToPop = 1; // we don't care about invariant's own frame
    throw error;
  }
}

module.exports = invariant;

/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

var NS = {
  xlink: 'http://www.w3.org/1999/xlink',
  xml: 'http://www.w3.org/XML/1998/namespace'
};

// We use attributes for everything SVG so let's avoid some duplication and run
// code instead.
// The following are all specified in the HTML config already so we exclude here.
// - class (as className)
// - color
// - height
// - id
// - lang
// - max
// - media
// - method
// - min
// - name
// - style
// - target
// - type
// - width
var ATTRS = {
  accentHeight: 'accent-height',
  accumulate: 0,
  additive: 0,
  alignmentBaseline: 'alignment-baseline',
  allowReorder: 'allowReorder',
  alphabetic: 0,
  amplitude: 0,
  arabicForm: 'arabic-form',
  ascent: 0,
  attributeName: 'attributeName',
  attributeType: 'attributeType',
  autoReverse: 'autoReverse',
  azimuth: 0,
  baseFrequency: 'baseFrequency',
  baseProfile: 'baseProfile',
  baselineShift: 'baseline-shift',
  bbox: 0,
  begin: 0,
  bias: 0,
  by: 0,
  calcMode: 'calcMode',
  capHeight: 'cap-height',
  clip: 0,
  clipPath: 'clip-path',
  clipRule: 'clip-rule',
  clipPathUnits: 'clipPathUnits',
  colorInterpolation: 'color-interpolation',
  colorInterpolationFilters: 'color-interpolation-filters',
  colorProfile: 'color-profile',
  colorRendering: 'color-rendering',
  contentScriptType: 'contentScriptType',
  contentStyleType: 'contentStyleType',
  cursor: 0,
  cx: 0,
  cy: 0,
  d: 0,
  decelerate: 0,
  descent: 0,
  diffuseConstant: 'diffuseConstant',
  direction: 0,
  display: 0,
  divisor: 0,
  dominantBaseline: 'dominant-baseline',
  dur: 0,
  dx: 0,
  dy: 0,
  edgeMode: 'edgeMode',
  elevation: 0,
  enableBackground: 'enable-background',
  end: 0,
  exponent: 0,
  externalResourcesRequired: 'externalResourcesRequired',
  fill: 0,
  fillOpacity: 'fill-opacity',
  fillRule: 'fill-rule',
  filter: 0,
  filterRes: 'filterRes',
  filterUnits: 'filterUnits',
  floodColor: 'flood-color',
  floodOpacity: 'flood-opacity',
  focusable: 0,
  fontFamily: 'font-family',
  fontSize: 'font-size',
  fontSizeAdjust: 'font-size-adjust',
  fontStretch: 'font-stretch',
  fontStyle: 'font-style',
  fontVariant: 'font-variant',
  fontWeight: 'font-weight',
  format: 0,
  from: 0,
  fx: 0,
  fy: 0,
  g1: 0,
  g2: 0,
  glyphName: 'glyph-name',
  glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  glyphOrientationVertical: 'glyph-orientation-vertical',
  glyphRef: 'glyphRef',
  gradientTransform: 'gradientTransform',
  gradientUnits: 'gradientUnits',
  hanging: 0,
  horizAdvX: 'horiz-adv-x',
  horizOriginX: 'horiz-origin-x',
  ideographic: 0,
  imageRendering: 'image-rendering',
  'in': 0,
  in2: 0,
  intercept: 0,
  k: 0,
  k1: 0,
  k2: 0,
  k3: 0,
  k4: 0,
  kernelMatrix: 'kernelMatrix',
  kernelUnitLength: 'kernelUnitLength',
  kerning: 0,
  keyPoints: 'keyPoints',
  keySplines: 'keySplines',
  keyTimes: 'keyTimes',
  lengthAdjust: 'lengthAdjust',
  letterSpacing: 'letter-spacing',
  lightingColor: 'lighting-color',
  limitingConeAngle: 'limitingConeAngle',
  local: 0,
  markerEnd: 'marker-end',
  markerMid: 'marker-mid',
  markerStart: 'marker-start',
  markerHeight: 'markerHeight',
  markerUnits: 'markerUnits',
  markerWidth: 'markerWidth',
  mask: 0,
  maskContentUnits: 'maskContentUnits',
  maskUnits: 'maskUnits',
  mathematical: 0,
  mode: 0,
  numOctaves: 'numOctaves',
  offset: 0,
  opacity: 0,
  operator: 0,
  order: 0,
  orient: 0,
  orientation: 0,
  origin: 0,
  overflow: 0,
  overlinePosition: 'overline-position',
  overlineThickness: 'overline-thickness',
  paintOrder: 'paint-order',
  panose1: 'panose-1',
  pathLength: 'pathLength',
  patternContentUnits: 'patternContentUnits',
  patternTransform: 'patternTransform',
  patternUnits: 'patternUnits',
  pointerEvents: 'pointer-events',
  points: 0,
  pointsAtX: 'pointsAtX',
  pointsAtY: 'pointsAtY',
  pointsAtZ: 'pointsAtZ',
  preserveAlpha: 'preserveAlpha',
  preserveAspectRatio: 'preserveAspectRatio',
  primitiveUnits: 'primitiveUnits',
  r: 0,
  radius: 0,
  refX: 'refX',
  refY: 'refY',
  renderingIntent: 'rendering-intent',
  repeatCount: 'repeatCount',
  repeatDur: 'repeatDur',
  requiredExtensions: 'requiredExtensions',
  requiredFeatures: 'requiredFeatures',
  restart: 0,
  result: 0,
  rotate: 0,
  rx: 0,
  ry: 0,
  scale: 0,
  seed: 0,
  shapeRendering: 'shape-rendering',
  slope: 0,
  spacing: 0,
  specularConstant: 'specularConstant',
  specularExponent: 'specularExponent',
  speed: 0,
  spreadMethod: 'spreadMethod',
  startOffset: 'startOffset',
  stdDeviation: 'stdDeviation',
  stemh: 0,
  stemv: 0,
  stitchTiles: 'stitchTiles',
  stopColor: 'stop-color',
  stopOpacity: 'stop-opacity',
  strikethroughPosition: 'strikethrough-position',
  strikethroughThickness: 'strikethrough-thickness',
  string: 0,
  stroke: 0,
  strokeDasharray: 'stroke-dasharray',
  strokeDashoffset: 'stroke-dashoffset',
  strokeLinecap: 'stroke-linecap',
  strokeLinejoin: 'stroke-linejoin',
  strokeMiterlimit: 'stroke-miterlimit',
  strokeOpacity: 'stroke-opacity',
  strokeWidth: 'stroke-width',
  surfaceScale: 'surfaceScale',
  systemLanguage: 'systemLanguage',
  tableValues: 'tableValues',
  targetX: 'targetX',
  targetY: 'targetY',
  textAnchor: 'text-anchor',
  textDecoration: 'text-decoration',
  textRendering: 'text-rendering',
  textLength: 'textLength',
  to: 0,
  transform: 0,
  u1: 0,
  u2: 0,
  underlinePosition: 'underline-position',
  underlineThickness: 'underline-thickness',
  unicode: 0,
  unicodeBidi: 'unicode-bidi',
  unicodeRange: 'unicode-range',
  unitsPerEm: 'units-per-em',
  vAlphabetic: 'v-alphabetic',
  vHanging: 'v-hanging',
  vIdeographic: 'v-ideographic',
  vMathematical: 'v-mathematical',
  values: 0,
  vectorEffect: 'vector-effect',
  version: 0,
  vertAdvY: 'vert-adv-y',
  vertOriginX: 'vert-origin-x',
  vertOriginY: 'vert-origin-y',
  viewBox: 'viewBox',
  viewTarget: 'viewTarget',
  visibility: 0,
  widths: 0,
  wordSpacing: 'word-spacing',
  writingMode: 'writing-mode',
  x: 0,
  xHeight: 'x-height',
  x1: 0,
  x2: 0,
  xChannelSelector: 'xChannelSelector',
  xlinkActuate: 'xlink:actuate',
  xlinkArcrole: 'xlink:arcrole',
  xlinkHref: 'xlink:href',
  xlinkRole: 'xlink:role',
  xlinkShow: 'xlink:show',
  xlinkTitle: 'xlink:title',
  xlinkType: 'xlink:type',
  xmlBase: 'xml:base',
  xmlns: 0,
  xmlnsXlink: 'xmlns:xlink',
  xmlLang: 'xml:lang',
  xmlSpace: 'xml:space',
  y: 0,
  y1: 0,
  y2: 0,
  yChannelSelector: 'yChannelSelector',
  z: 0,
  zoomAndPan: 'zoomAndPan'
};

var SVGDOMPropertyConfig = {
  Properties: {},
  DOMAttributeNamespaces: {
    xlinkActuate: NS.xlink,
    xlinkArcrole: NS.xlink,
    xlinkHref: NS.xlink,
    xlinkRole: NS.xlink,
    xlinkShow: NS.xlink,
    xlinkTitle: NS.xlink,
    xlinkType: NS.xlink,
    xmlBase: NS.xml,
    xmlLang: NS.xml,
    xmlSpace: NS.xml
  },
  DOMAttributeNames: {}
};

Object.keys(ATTRS).forEach(function (key) {
  SVGDOMPropertyConfig.Properties[key] = 0;
  if (ATTRS[key]) {
    SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
  }
});

module.exports = SVGDOMPropertyConfig;

/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {

var parse = __webpack_require__(13);

/**
 * Parses inline style.
 *
 * Example: 'color:red' => { color: 'red' }
 *
 * @param  {String}      style      - The inline style.
 * @param  {Function}    [iterator] - The iterator function.
 * @return {null|Object}
 */
module.exports = function parseInlineStyle(style, iterator) {
  if (!style || typeof style !== 'string') return null;

  // make sure to wrap declarations in placeholder
  var declarations = parse('p{' + style + '}').stylesheet.rules[0].declarations;
  var declaration, property, value;

  var output = null;
  var hasIterator = typeof iterator === 'function';

  for (var i = 0, len = declarations.length; i < len; i++) {
    declaration = declarations[i];
    property = declaration.property;
    value = declaration.value;

    if (hasIterator) {
      iterator(property, value, declaration);
    } else if (value) {
      output || (output = {});
      output[property] = value;
    }
  }

  return output;
};

/***/ }),
/* 13 */
/***/ (function(module, exports) {

// http://www.w3.org/TR/CSS21/grammar.html
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g

module.exports = function(css, options){
  options = options || {};

  /**
   * Positional.
   */

  var lineno = 1;
  var column = 1;

  /**
   * Update lineno and column based on `str`.
   */

  function updatePosition(str) {
    var lines = str.match(/\n/g);
    if (lines) lineno += lines.length;
    var i = str.lastIndexOf('\n');
    column = ~i ? str.length - i : column + str.length;
  }

  /**
   * Mark position and patch `node.position`.
   */

  function position() {
    var start = { line: lineno, column: column };
    return function(node){
      node.position = new Position(start);
      whitespace();
      return node;
    };
  }

  /**
   * Store position information for a node
   */

  function Position(start) {
    this.start = start;
    this.end = { line: lineno, column: column };
    this.source = options.source;
  }

  /**
   * Non-enumerable source string
   */

  Position.prototype.content = css;

  /**
   * Error `msg`.
   */

  var errorsList = [];

  function error(msg) {
    var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
    err.reason = msg;
    err.filename = options.source;
    err.line = lineno;
    err.column = column;
    err.source = css;

    if (options.silent) {
      errorsList.push(err);
    } else {
      throw err;
    }
  }

  /**
   * Parse stylesheet.
   */

  function stylesheet() {
    var rulesList = rules();

    return {
      type: 'stylesheet',
      stylesheet: {
        rules: rulesList,
        parsingErrors: errorsList
      }
    };
  }

  /**
   * Opening brace.
   */

  function open() {
    return match(/^{\s*/);
  }

  /**
   * Closing brace.
   */

  function close() {
    return match(/^}/);
  }

  /**
   * Parse ruleset.
   */

  function rules() {
    var node;
    var rules = [];
    whitespace();
    comments(rules);
    while (css.length && css.charAt(0) != '}' && (node = atrule() || rule())) {
      if (node !== false) {
        rules.push(node);
        comments(rules);
      }
    }
    return rules;
  }

  /**
   * Match `re` and return captures.
   */

  function match(re) {
    var m = re.exec(css);
    if (!m) return;
    var str = m[0];
    updatePosition(str);
    css = css.slice(str.length);
    return m;
  }

  /**
   * Parse whitespace.
   */

  function whitespace() {
    match(/^\s*/);
  }

  /**
   * Parse comments;
   */

  function comments(rules) {
    var c;
    rules = rules || [];
    while (c = comment()) {
      if (c !== false) {
        rules.push(c);
      }
    }
    return rules;
  }

  /**
   * Parse comment.
   */

  function comment() {
    var pos = position();
    if ('/' != css.charAt(0) || '*' != css.charAt(1)) return;

    var i = 2;
    while ("" != css.charAt(i) && ('*' != css.charAt(i) || '/' != css.charAt(i + 1))) ++i;
    i += 2;

    if ("" === css.charAt(i-1)) {
      return error('End of comment missing');
    }

    var str = css.slice(2, i - 2);
    column += 2;
    updatePosition(str);
    css = css.slice(i);
    column += 2;

    return pos({
      type: 'comment',
      comment: str
    });
  }

  /**
   * Parse selector.
   */

  function selector() {
    var m = match(/^([^{]+)/);
    if (!m) return;
    /* @fix Remove all comments from selectors
     * http://ostermiller.org/findcomment.html */
    return trim(m[0])
      .replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
      .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function(m) {
        return m.replace(/,/g, '\u200C');
      })
      .split(/\s*(?![^(]*\)),\s*/)
      .map(function(s) {
        return s.replace(/\u200C/g, ',');
      });
  }

  /**
   * Parse declaration.
   */

  function declaration() {
    var pos = position();

    // prop
    var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
    if (!prop) return;
    prop = trim(prop[0]);

    // :
    if (!match(/^:\s*/)) return error("property missing ':'");

    // val
    var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);

    var ret = pos({
      type: 'declaration',
      property: prop.replace(commentre, ''),
      value: val ? trim(val[0]).replace(commentre, '') : ''
    });

    // ;
    match(/^[;\s]*/);

    return ret;
  }

  /**
   * Parse declarations.
   */

  function declarations() {
    var decls = [];

    if (!open()) return error("missing '{'");
    comments(decls);

    // declarations
    var decl;
    while (decl = declaration()) {
      if (decl !== false) {
        decls.push(decl);
        comments(decls);
      }
    }

    if (!close()) return error("missing '}'");
    return decls;
  }

  /**
   * Parse keyframe.
   */

  function keyframe() {
    var m;
    var vals = [];
    var pos = position();

    while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
      vals.push(m[1]);
      match(/^,\s*/);
    }

    if (!vals.length) return;

    return pos({
      type: 'keyframe',
      values: vals,
      declarations: declarations()
    });
  }

  /**
   * Parse keyframes.
   */

  function atkeyframes() {
    var pos = position();
    var m = match(/^@([-\w]+)?keyframes\s*/);

    if (!m) return;
    var vendor = m[1];

    // identifier
    var m = match(/^([-\w]+)\s*/);
    if (!m) return error("@keyframes missing name");
    var name = m[1];

    if (!open()) return error("@keyframes missing '{'");

    var frame;
    var frames = comments();
    while (frame = keyframe()) {
      frames.push(frame);
      frames = frames.concat(comments());
    }

    if (!close()) return error("@keyframes missing '}'");

    return pos({
      type: 'keyframes',
      name: name,
      vendor: vendor,
      keyframes: frames
    });
  }

  /**
   * Parse supports.
   */

  function atsupports() {
    var pos = position();
    var m = match(/^@supports *([^{]+)/);

    if (!m) return;
    var supports = trim(m[1]);

    if (!open()) return error("@supports missing '{'");

    var style = comments().concat(rules());

    if (!close()) return error("@supports missing '}'");

    return pos({
      type: 'supports',
      supports: supports,
      rules: style
    });
  }

  /**
   * Parse host.
   */

  function athost() {
    var pos = position();
    var m = match(/^@host\s*/);

    if (!m) return;

    if (!open()) return error("@host missing '{'");

    var style = comments().concat(rules());

    if (!close()) return error("@host missing '}'");

    return pos({
      type: 'host',
      rules: style
    });
  }

  /**
   * Parse media.
   */

  function atmedia() {
    var pos = position();
    var m = match(/^@media *([^{]+)/);

    if (!m) return;
    var media = trim(m[1]);

    if (!open()) return error("@media missing '{'");

    var style = comments().concat(rules());

    if (!close()) return error("@media missing '}'");

    return pos({
      type: 'media',
      media: media,
      rules: style
    });
  }

  /**
   * Parse custom-media.
   */

  function atcustommedia() {
    var pos = position();
    var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
    if (!m) return;

    return pos({
      type: 'custom-media',
      name: trim(m[1]),
      media: trim(m[2])
    });
  }

  /**
   * Parse paged media.
   */

  function atpage() {
    var pos = position();
    var m = match(/^@page */);
    if (!m) return;

    var sel = selector() || [];

    if (!open()) return error("@page missing '{'");
    var decls = comments();

    // declarations
    var decl;
    while (decl = declaration()) {
      decls.push(decl);
      decls = decls.concat(comments());
    }

    if (!close()) return error("@page missing '}'");

    return pos({
      type: 'page',
      selectors: sel,
      declarations: decls
    });
  }

  /**
   * Parse document.
   */

  function atdocument() {
    var pos = position();
    var m = match(/^@([-\w]+)?document *([^{]+)/);
    if (!m) return;

    var vendor = trim(m[1]);
    var doc = trim(m[2]);

    if (!open()) return error("@document missing '{'");

    var style = comments().concat(rules());

    if (!close()) return error("@document missing '}'");

    return pos({
      type: 'document',
      document: doc,
      vendor: vendor,
      rules: style
    });
  }

  /**
   * Parse font-face.
   */

  function atfontface() {
    var pos = position();
    var m = match(/^@font-face\s*/);
    if (!m) return;

    if (!open()) return error("@font-face missing '{'");
    var decls = comments();

    // declarations
    var decl;
    while (decl = declaration()) {
      decls.push(decl);
      decls = decls.concat(comments());
    }

    if (!close()) return error("@font-face missing '}'");

    return pos({
      type: 'font-face',
      declarations: decls
    });
  }

  /**
   * Parse import
   */

  var atimport = _compileAtrule('import');

  /**
   * Parse charset
   */

  var atcharset = _compileAtrule('charset');

  /**
   * Parse namespace
   */

  var atnamespace = _compileAtrule('namespace');

  /**
   * Parse non-block at-rules
   */

  function _compileAtrule(name) {
    var re = new RegExp('^@' + name + '\\s*([^;]+);');
    return function() {
      var pos = position();
      var m = match(re);
      if (!m) return;
      var ret = { type: name };
      ret[name] = m[1].trim();
      return pos(ret);
    }
  }

  /**
   * Parse at rule.
   */

  function atrule() {
    if (css[0] != '@') return;

    return atkeyframes()
      || atmedia()
      || atcustommedia()
      || atsupports()
      || atimport()
      || atcharset()
      || atnamespace()
      || atdocument()
      || atpage()
      || athost()
      || atfontface();
  }

  /**
   * Parse rule.
   */

  function rule() {
    var pos = position();
    var sel = selector();

    if (!sel) return error('selector missing');
    comments();

    return pos({
      type: 'rule',
      selectors: sel,
      declarations: declarations()
    });
  }

  return addParent(stylesheet());
};

/**
 * Trim `str`.
 */

function trim(str) {
  return str ? str.replace(/^\s+|\s+$/g, '') : '';
}

/**
 * Adds non-enumerable parent node reference to each node.
 */

function addParent(obj, parent) {
  var isNode = obj && typeof obj.type === 'string';
  var childParent = isNode ? obj : parent;

  for (var k in obj) {
    var value = obj[k];
    if (Array.isArray(value)) {
      value.forEach(function(v) { addParent(v, childParent); });
    } else if (value && typeof value === 'object') {
      addParent(value, childParent);
    }
  }

  if (isNode) {
    Object.defineProperty(obj, 'parent', {
      configurable: true,
      writable: true,
      enumerable: false,
      value: parent || null
    });
  }

  return obj;
}

/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var domparser = __webpack_require__(15);
var utilities = __webpack_require__(1);
var formatDOM = utilities.formatDOM;
var isIE9 = utilities.isIE(9);

/**
 * Constants.
 */
var DIRECTIVE_REGEX = /<(![a-zA-Z\s]+)>/; // e.g., <!doctype html>

/**
 * Parses HTML and reformats DOM nodes output.
 *
 * @param  {String} html - The HTML string.
 * @return {Array}       - The formatted DOM nodes.
 */
module.exports = function parseDOM(html) {
    if (typeof html !== 'string') {
        throw new TypeError('First argument must be a string.');
    }
    if (!html) return [];

    // match directive
    var match = html.match(DIRECTIVE_REGEX);
    var directive;
    if (match && match[1]) {
        directive = match[1];

        // remove directive in IE9 because DOMParser uses
        // MIME type 'text/xml' instead of 'text/html'
        if (isIE9) {
            html = html.replace(match[0], '');
        }
    }

    return formatDOM(domparser(html), null, directive);
};

/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/**
 * Module dependencies.
 */
var utilities = __webpack_require__(1);
var detectIE = utilities.isIE;

/**
 * Constants.
 */
var HTML_TAG_NAME = 'html';
var BODY_TAG_NAME = 'body';
var HEAD_TAG_NAME = 'head';
var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/; // e.g., <h1>
var HEAD_REGEX = /<head[\s\S]*>[\s\S]*<\/head>/i;
var BODY_REGEX = /<body[\s\S]*>[\s\S]*<\/body>/i;
// http://www.w3.org/TR/html/syntax.html#void-elements
var VOID_ELEMENTS_REGEX = /<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi;

// browser support
var isIE = detectIE();
var isIE9 = detectIE(9);

/**
 * DOMParser (performance: slow).
 *
 * https://developer.mozilla.org/docs/Web/API/DOMParser#Parsing_an_SVG_or_HTML_document
 */
var parseFromString;
if (typeof window.DOMParser === 'function') {
    var domParser = new window.DOMParser();
    // IE9 does not support 'text/html' MIME type
    // https://msdn.microsoft.com/en-us/library/ff975278(v=vs.85).aspx
    var MIME_TYPE = isIE9 ? 'text/xml' : 'text/html';

    /**
     * Creates an HTML document using `DOMParser.parseFromString`.
     *
     * @param  {String} html      - The HTML string.
     * @param  {String} [tagName] - The element to render the HTML (with 'body' as fallback).
     * @return {HTMLDocument}
     */
    parseFromString = function domStringParser(html, tagName) {
        if (tagName) {
            html = ['<', tagName, '>', html, '</', tagName, '>'].join('');
        }
        // because IE9 only supports MIME type 'text/xml', void elements need to be self-closed
        if (isIE9) {
            html = html.replace(VOID_ELEMENTS_REGEX, '<$1$2$3/>');
        }
        return domParser.parseFromString(html, MIME_TYPE);
    };
}

/**
 * DOMImplementation (performance: fair).
 *
 * https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument
 */
var parseFromDocument;
if (typeof document.implementation === 'object') {
    // title parameter is required in IE
    // https://msdn.microsoft.com/en-us/library/ff975457(v=vs.85).aspx
    var doc = document.implementation.createHTMLDocument(isIE ? 'HTML_DOM_PARSER_TITLE' : undefined);

    /**
     * Use HTML document created by `document.implementation.createHTMLDocument`.
     *
     * @param  {String} html      - The HTML string.
     * @param  {String} [tagName] - The element to render the HTML (with 'body' as fallback).
     * @return {HTMLDocument}
     */
    parseFromDocument = function createHTMLDocument(html, tagName) {
        if (tagName) {
            doc.documentElement.getElementsByTagName(tagName)[0].innerHTML = html;
            return doc;
        }

        try {
            doc.documentElement.innerHTML = html;
            return doc;
        // fallback when certain elements in `documentElement` are read-only (IE9)
        } catch (err) {
            if (parseFromString) return parseFromString(html);
        }
    };
}

/**
 * Template (performance: fast).
 *
 * https://developer.mozilla.org/docs/Web/HTML/Element/template
 */
var parseFromTemplate;
var template = document.createElement('template');
if (template.content) {

    /**
     * Uses a template element (content fragment) to parse HTML.
     *
     * @param  {String} html - The HTML string.
     * @return {NodeList}
     */
    parseFromTemplate = function templateParser(html) {
        template.innerHTML = html;
        return template.content.childNodes;
    };
}

/** Fallback document parser. */
var parseWithFallback = parseFromDocument || parseFromString;

/**
 * Parses HTML string to DOM nodes.
 *
 * @param  {String} html      - The HTML string.
 * @param  {String} [tagName] - The tag name.
 * @return {NodeList|Array}
 */
module.exports = function domparser(html) {
    // try to match first tag
    var tagName;
    var match = html.match(FIRST_TAG_REGEX);
    if (match && match[1]) {
        tagName = match[1];
    }

    var doc;
    var element;
    var elements;

    switch (tagName) {
        case HTML_TAG_NAME:
            if (parseFromString) {
                doc = parseFromString(html);

                // strip elements if not found
                if (!HEAD_REGEX.test(html)) {
                    element = doc.getElementsByTagName(HEAD_TAG_NAME)[0];
                    element && element.parentNode.removeChild(element);
                }

                if (!BODY_REGEX.test(html)) {
                    element = doc.getElementsByTagName(BODY_TAG_NAME)[0];
                    element && element.parentNode.removeChild(element);
                }

                return doc.getElementsByTagName(HTML_TAG_NAME);
            }
            break;

        case HEAD_TAG_NAME:
            if (parseWithFallback) {
                elements = parseWithFallback(html).getElementsByTagName(HEAD_TAG_NAME);

                // account for possibility of sibling
                if (BODY_REGEX.test(html)) {
                    return elements[0].parentNode.childNodes;
                }
                return elements;
            }
            break;

        case BODY_TAG_NAME:
            if (parseWithFallback) {
                elements = parseWithFallback(html).getElementsByTagName(BODY_TAG_NAME);

                // account for possibility of sibling
                if (HEAD_REGEX.test(html)) {
                    return elements[0].parentNode.childNodes;
                }
                return elements;
            }
            break;

        // low-level tag or text
        default:
            if (parseFromTemplate) return parseFromTemplate(html);
            if (parseWithFallback) {
                return parseWithFallback(html, BODY_TAG_NAME).getElementsByTagName(BODY_TAG_NAME)[0].childNodes;
            }
            break;
    }

    return [];
};

/***/ })
/******/ ]);
});


text:
require 'open-uri'

class Event < ActiveRecord::Base
  include PublicActivity::Model
  tracked
  attr_accessor :image, :img_url

  has_attached_file :image,

                    styles: { thumb: ["64x64#", :jpg],
                    original: ['500x500>', :jpg] },
                    convert_options: { thumb: "-quality 75 -strip",
                    original: "-quality 85 -strip" }

  validates_attachment :image, content_type: { content_type:
                    ["image/jpeg", "image/gif", "image/png"]}

  belongs_to :venue
  belongs_to :creator, class_name: "User"
  has_many :invitations
  # has_many :invitees, through: :invitations

  geocoded_by :location
  after_validation :geocode
  validates :title, presence: true
  # tracked owner: Proc.new { |controller, model| controller.current_user ? controller.current_user  : nil }
  # after_validation :geocode, if: ->(obj){ obj.location.present? and obj.location_changed? }

    def invite(user)
      self.invitations.create(invitee: user)
    end

    def img_url(url)
      self.image = Uri.parse(url).open unless url.blank?
      # @img_url = url
      super
    end

end


text:
<?php

namespace PHPExiftool\Driver\Tag\IFD0;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class DNGBackwardVersion extends AbstractTag
{

    protected $Id = 50707;

    protected $Name = 'DNGBackwardVersion';

    protected $FullName = 'Exif::Main';

    protected $GroupName = 'IFD0';

    protected $g0 = 'EXIF';

    protected $g1 = 'IFD0';

    protected $g2 = 'Image';

    protected $Type = 'int8u';

    protected $Writable = true;

    protected $Description = 'DNG Backward Version';

    protected $flag_Unsafe = true;

    protected $MaxLength = 4;

}


text:
jQuery(document).ready(function($){
	// Scroll (in pixels) after which the "To Top" link is shown
	var offset = 300,
		//Scroll (in pixels) after which the "back to top" link opacity is reduced
		offset_opacity = 1200,
		//Duration of the top scrolling animation (in ms)
		scroll_top_duration = 700,
		//Get the "To Top" link
		$back_to_top = $('.to-top');

	//Visible or not "To Top" link
	$(window).scroll(function(){
		( $(this).scrollTop() > offset ) ? $back_to_top.addClass('top-is-visible') : $back_to_top.removeClass('top-is-visible top-fade-out');
		if( $(this).scrollTop() > offset_opacity ) {
			$back_to_top.addClass('top-fade-out');
		}
	});

	//Smoothy scroll to top
	$back_to_top.on('click', function(event){
		event.preventDefault();
		$('body,html').animate({
			scrollTop: 0 ,
		 	}, scroll_top_duration
		);
	});

});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _7.Get_Numbers_Print_Sum
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Insert some numbers separated by empty space: ");

            string input = Console.ReadLine();

            char [] separators = {' '};
            string[] separatedNumbers = input.Split(separators, StringSplitOptions.RemoveEmptyEntries);

            float sum = 0;
            for (int i = 0; i < separatedNumbers.Length; i++)
			{
			    sum += float.Parse(separatedNumbers[i]);
			}

            Console.WriteLine("Sum: " + sum);

            //// 7. Write a program that gets a number n
            ////    and after that gets more n numbers and calculates and prints their sum.

            //Console.WriteLine("Insert number: ");
            //int n = int.Parse(Console.ReadLine());
            //int sum = 0;

            //for (int i = 1; i <= n; i++)
            //{
            //    Console.WriteLine("Insert number {0}: ", i);
            //    sum = sum + int.Parse(Console.ReadLine());
            //}
            //Console.WriteLine("Sum = " + sum);
        }
    }
}


text:
package org.drools.core.command.runtime.process;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.drools.core.command.impl.GenericCommand;
import org.drools.core.command.impl.KnowledgeCommandContext;
import org.kie.internal.command.Context;
import org.kie.api.runtime.KieSession;

@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class AbortWorkItemCommand
    implements
    GenericCommand<Void> {

    @XmlAttribute(name="id", required=true)
    private long workItemId;

    public AbortWorkItemCommand() {

    }

    public AbortWorkItemCommand(long workItemId) {
        this.workItemId = workItemId;
    }

    public long getWorkItemId() {
        return workItemId;
    }

    public void setWorkItemId(long workItemId) {
        this.workItemId = workItemId;
    }

    public Void execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        ksession.getWorkItemManager().abortWorkItem( workItemId );
        return null;
    }

    public String toString() {
        return "session.getWorkItemManager().abortWorkItem(" + workItemId + ");";
    }

}


text:
// The MIT License (MIT)
//
// Copyright (c) 2014-2022 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import './interactionbtngroup.css';
import angular from 'angular';
import gmfMapComponent from 'gmf/map/component';
import options from './options';

import ngeoMiscBtnComponent from 'ngeo/misc/btnComponent';
import ngeoMapFeatureOverlayMgr from 'ngeo/map/FeatureOverlayMgr';

import {interactionDecoration} from 'ngeo/misc/decorate';
import olCollection from 'ol/Collection';
import olMap from 'ol/Map';
import olView from 'ol/View';
import olInteractionDraw from 'ol/interaction/Draw';
import olLayerTile from 'ol/layer/Tile';
import olSourceOSM from 'ol/source/OSM';
import olStyleCircle from 'ol/style/Circle';
import olStyleFill from 'ol/style/Fill';
import olStyleStroke from 'ol/style/Stroke';
import olStyleStyle from 'ol/style/Style';

/** @type {angular.IModule} **/
const myModule = angular.module('app', ['gettext', gmfMapComponent.name, ngeoMiscBtnComponent.name]);

/**
 * @class
 * @ngInject
 */
function MainController() {
  /**
   * Collection shared between the drawing interactions and the feature
   * overlay used to render the drawn features.
   *
   * @type {import('ol/Collection').default<import('ol/Feature').default<import('ol/geom/Geometry').default>>}
   */
  const features = new olCollection();

  const overlay = ngeoMapFeatureOverlayMgr.getFeatureOverlay();
  overlay.setFeatures(features);
  overlay.setStyle(
    new olStyleStyle({
      fill: new olStyleFill({
        color: 'rgba(255, 255, 255, 0.2)',
      }),
      stroke: new olStyleStroke({
        color: '#ffcc33',
        width: 2,
      }),
      image: new olStyleCircle({
        radius: 7,
        fill: new olStyleFill({
          color: '#ffcc33',
        }),
      }),
    })
  );

  /**
   * @type {import('ol/Map').default}
   */
  this.map = new olMap({
    layers: [
      new olLayerTile({
        source: new olSourceOSM(),
      }),
    ],
    view: new olView({
      center: [-10997148, 4569099],
      zoom: 4,
    }),
  });

  const map = this.map;

  // initialize the feature overlay manager with the map
  ngeoMapFeatureOverlayMgr.init(map);

  /**
   * @type {import('ol/interaction/Draw').default}
   */
  this.drawPolygon = new olInteractionDraw(
    /** @type {import('ol/interaction/Draw').Options} */ ({
      type: 'Polygon',
      features: features,
    })
  );

  const drawPolygon = this.drawPolygon;

  drawPolygon.setActive(false);
  interactionDecoration(drawPolygon);
  map.addInteraction(drawPolygon);

  /**
   * @type {import('ol/interaction/Draw').default}
   */
  this.drawPoint = new olInteractionDraw(
    /** @type {import('ol/interaction/Draw').Options} */ ({
      type: 'Point',
      features: features,
    })
  );

  const drawPoint = this.drawPoint;
  drawPoint.setActive(false);
  interactionDecoration(drawPoint);
  map.addInteraction(drawPoint);

  /**
   * @type {import('ol/interaction/Draw').default}
   */
  this.drawLine = new olInteractionDraw(
    /** @type {import('ol/interaction/Draw').Options} */ ({
      type: 'LineString',
      features: features,
    })
  );

  const drawLine = this.drawLine;
  drawLine.setActive(false);
  interactionDecoration(drawLine);
  map.addInteraction(drawLine);
}

myModule.controller('MainController', MainController);
options(myModule);

export default myModule;


text:
class Donator < ActiveRecord::Base
  schema_associations
include Rails.application.routes.url_helpers
Rails.application.routes.default_url_options = { :host => 'lillah.org' } #Configuration[:base_domain] || request.domain }
  belongs_to :users
  belongs_to :projects
  attr_accessible :amount, :comment, :status, :anonymous
  validates_presence_of :amount, :project_id
  validates_numericality_of :amount, greater_than: 0.00

  def payment(project,donator,user_id)
    @merchant = ::Configuration[:paypal_email]
    amount = donator.amount
    begin
    pay_request = PaypalAdaptive::Request.new
    data = {
    "returnUrl" => return_project_donators_url(project.id) + "?project_id=#{project.id}&amt=#{amount}",
    "requestEnvelope" => {"errorLanguage" => "en_US"},
    "currencyCode"=> project.currency.to_s,
    "receiverList" => receivers(project,amount),
    "cancelUrl"=> new_project_donator_url(project),
    "actionType"=>"PAY",
    "ipnNotificationUrl"=> paypal3_url + "?donator_id=#{Donator.count + 1}&user_id=#{user_id}&project_id=#{project.id}&amount=#{amount}&comment=#{CGI::escape(donator.comment)}&anonymous=#{donator.anonymous}"
    }
    data["feesPayer"] = "PRIMARYRECEIVER" if !project.subscribed
    pay_response = pay_request.pay(data)
    return pay_response
    rescue => e
    puts e
    end
   end

   def receivers(project,amount)
     if project.subscribed
      {"receiver"=>[{"email"=>project.email.to_s, "amount"=> amount.to_s}]}
    else
      fee = ((::Configuration[:platform_fee].to_f)*amount).round(2)
      {"receiver"=>[{"email"=>project.email.to_s, "amount"=> amount.to_s, "primary" => true},
                     {"email"=> @merchant, "amount"=>fee}
        ]}
    end
    end
end