code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Damien P. George
* Copyright (c) 2016 Paul Sokolovsky
*
* 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.
*/
#include "py/mpconfig.h"
#if MICROPY_VFS_FAT
#if !MICROPY_VFS
#error "with MICROPY_VFS_FAT enabled, must also enable MICROPY_VFS"
#endif
#include <string.h>
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/mperrno.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "lib/timeutils/timeutils.h"
#if _MAX_SS == _MIN_SS
#define SECSIZE(fs) (_MIN_SS)
#else
#define SECSIZE(fs) ((fs)->ssize)
#endif
#define mp_obj_fat_vfs_t fs_user_mount_t
STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// create new object
fs_user_mount_t *vfs = m_new_obj(fs_user_mount_t);
vfs->base.type = type;
vfs->flags = FSUSER_FREE_OBJ;
vfs->fatfs.drv = vfs;
// load block protocol methods
mp_load_method(args[0], MP_QSTR_readblocks, vfs->readblocks);
mp_load_method_maybe(args[0], MP_QSTR_writeblocks, vfs->writeblocks);
mp_load_method_maybe(args[0], MP_QSTR_ioctl, vfs->u.ioctl);
if (vfs->u.ioctl[0] != MP_OBJ_NULL) {
// device supports new block protocol, so indicate it
vfs->flags |= FSUSER_HAVE_IOCTL;
} else {
// no ioctl method, so assume the device uses the old block protocol
mp_load_method_maybe(args[0], MP_QSTR_sync, vfs->u.old.sync);
mp_load_method(args[0], MP_QSTR_count, vfs->u.old.count);
}
return MP_OBJ_FROM_PTR(vfs);
}
STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
// create new object
fs_user_mount_t *vfs = MP_OBJ_TO_PTR(fat_vfs_make_new(&mp_fat_vfs_type, 1, 0, &bdev_in));
// make the filesystem
uint8_t working_buf[_MAX_SS];
FRESULT res = f_mkfs(&vfs->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);
STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(fat_vfs_mkfs_obj, MP_ROM_PTR(&fat_vfs_mkfs_fun_obj));
STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_open_obj, fatfs_builtin_open_self);
STATIC mp_obj_t fat_vfs_listdir_func(size_t n_args, const mp_obj_t *args) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(args[0]);
bool is_str_type = true;
const char *path;
if (n_args == 2) {
if (mp_obj_get_type(args[1]) == &mp_type_bytes) {
is_str_type = false;
}
path = mp_obj_str_get_str(args[1]);
} else {
path = "";
}
return fat_vfs_listdir2(self, path, is_str_type);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fat_vfs_listdir_obj, 1, 2, fat_vfs_listdir_func);
STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_int_t attr) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_in);
FILINFO fno;
FRESULT res = f_stat(&self->fatfs, path, &fno);
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
// check if path is a file or directory
if ((fno.fattrib & AM_DIR) == attr) {
res = f_unlink(&self->fatfs, path);
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_const_none;
} else {
mp_raise_OSError(attr ? MP_ENOTDIR : MP_EISDIR);
}
}
STATIC mp_obj_t fat_vfs_remove(mp_obj_t vfs_in, mp_obj_t path_in) {
return fat_vfs_remove_internal(vfs_in, path_in, 0); // 0 == file attribute
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_remove_obj, fat_vfs_remove);
STATIC mp_obj_t fat_vfs_rmdir(mp_obj_t vfs_in, mp_obj_t path_in) {
return fat_vfs_remove_internal(vfs_in, path_in, AM_DIR);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_rmdir_obj, fat_vfs_rmdir);
STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_out) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *old_path = mp_obj_str_get_str(path_in);
const char *new_path = mp_obj_str_get_str(path_out);
FRESULT res = f_rename(&self->fatfs, old_path, new_path);
if (res == FR_EXIST) {
// if new_path exists then try removing it (but only if it's a file)
fat_vfs_remove_internal(vfs_in, path_out, 0); // 0 == file attribute
// try to rename again
res = f_rename(&self->fatfs, old_path, new_path);
}
if (res == FR_OK) {
return mp_const_none;
} else {
mp_raise_OSError(fresult_to_errno_table[res]);
}
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_rename_obj, fat_vfs_rename);
STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_o);
FRESULT res = f_mkdir(&self->fatfs, path);
if (res == FR_OK) {
return mp_const_none;
} else {
mp_raise_OSError(fresult_to_errno_table[res]);
}
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);
/// Change current directory.
STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path;
path = mp_obj_str_get_str(path_in);
FRESULT res = f_chdir(&self->fatfs, path);
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);
/// Get the current directory.
STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
char buf[MICROPY_ALLOC_PATH_MAX + 1];
FRESULT res = f_getcwd(&self->fatfs, buf, sizeof(buf));
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_obj_new_str(buf, strlen(buf), false);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);
/// \function stat(path)
/// Get the status of a file or directory.
STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_in);
FILINFO fno;
if (path[0] == 0 || (path[0] == '/' && path[1] == 0)) {
// stat root directory
fno.fsize = 0;
fno.fdate = 0x2821; // Jan 1, 2000
fno.ftime = 0;
fno.fattrib = AM_DIR;
} else {
FRESULT res = f_stat(&self->fatfs, path, &fno);
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
mp_int_t mode = 0;
if (fno.fattrib & AM_DIR) {
mode |= 0x4000; // stat.S_IFDIR
} else {
mode |= 0x8000; // stat.S_IFREG
}
mp_int_t seconds = timeutils_seconds_since_2000(
1980 + ((fno.fdate >> 9) & 0x7f),
(fno.fdate >> 5) & 0x0f,
fno.fdate & 0x1f,
(fno.ftime >> 11) & 0x1f,
(fno.ftime >> 5) & 0x3f,
2 * (fno.ftime & 0x1f)
);
t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode
t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev
t->items[3] = MP_OBJ_NEW_SMALL_INT(0); // st_nlink
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
t->items[6] = MP_OBJ_NEW_SMALL_INT(fno.fsize); // st_size
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
return MP_OBJ_FROM_PTR(t);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_stat_obj, fat_vfs_stat);
// Get the status of a VFS.
STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
(void)path_in;
DWORD nclst;
FATFS *fatfs = &self->fatfs;
FRESULT res = f_getfree(fatfs, &nclst);
if (FR_OK != res) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * SECSIZE(fatfs)); // f_bsize
t->items[1] = t->items[0]; // f_frsize
t->items[2] = MP_OBJ_NEW_SMALL_INT((fatfs->n_fatent - 2)); // f_blocks
t->items[3] = MP_OBJ_NEW_SMALL_INT(nclst); // f_bfree
t->items[4] = t->items[3]; // f_bavail
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // f_files
t->items[6] = MP_OBJ_NEW_SMALL_INT(0); // f_ffree
t->items[7] = MP_OBJ_NEW_SMALL_INT(0); // f_favail
t->items[8] = MP_OBJ_NEW_SMALL_INT(0); // f_flags
t->items[9] = MP_OBJ_NEW_SMALL_INT(_MAX_LFN); // f_namemax
return MP_OBJ_FROM_PTR(t);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_statvfs_obj, fat_vfs_statvfs);
STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
// Read-only device indicated by writeblocks[0] == MP_OBJ_NULL.
// User can specify read-only device by:
// 1. readonly=True keyword argument
// 2. nonexistent writeblocks method (then writeblocks[0] == MP_OBJ_NULL already)
if (mp_obj_is_true(readonly)) {
self->writeblocks[0] = MP_OBJ_NULL;
}
// mount the block device
FRESULT res = f_mount(&self->fatfs);
// check if we need to make the filesystem
if (res == FR_NO_FILESYSTEM && mp_obj_is_true(mkfs)) {
uint8_t working_buf[_MAX_SS];
res = f_mkfs(&self->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
}
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_fat_mount_obj, vfs_fat_mount);
STATIC mp_obj_t vfs_fat_umount(mp_obj_t self_in) {
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
FRESULT res = f_umount(&self->fatfs);
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_umount_obj, vfs_fat_umount);
STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_mkfs), MP_ROM_PTR(&fat_vfs_mkfs_obj) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&fat_vfs_open_obj) },
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&fat_vfs_listdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&fat_vfs_mkdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&fat_vfs_rmdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&fat_vfs_chdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&fat_vfs_getcwd_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&fat_vfs_remove_obj) },
{ MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&fat_vfs_rename_obj) },
{ MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&fat_vfs_stat_obj) },
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&fat_vfs_statvfs_obj) },
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_fat_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&fat_vfs_umount_obj) },
};
STATIC MP_DEFINE_CONST_DICT(fat_vfs_locals_dict, fat_vfs_locals_dict_table);
const mp_obj_type_t mp_fat_vfs_type = {
{ &mp_type_type },
.name = MP_QSTR_VfsFat,
.make_new = fat_vfs_make_new,
.locals_dict = (mp_obj_dict_t*)&fat_vfs_locals_dict,
};
#endif // MICROPY_VFS_FAT
| Peetz0r/micropython-esp32 | extmod/vfs_fat.c | C | mit | 12,566 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
12702,
7685,
2705,
2239,
2622,
1010,
8299,
1024,
1013,
1013,
12702,
7685,
2705,
2239,
1012,
8917,
1013,
1008,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
1008,
1008,
9385,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.join.aggregations;
import org.apache.lucene.search.Query;
import org.elasticsearch.search.aggregations.AggregationExecutionException;
import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.CardinalityUpperBound;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.support.AggregationContext;
import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.search.aggregations.support.AggregationUsageService.OTHER_SUBTYPE;
public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory {
private final Query parentFilter;
private final Query childFilter;
public ChildrenAggregatorFactory(String name,
ValuesSourceConfig config,
Query childFilter,
Query parentFilter,
AggregationContext context,
AggregatorFactory parent,
AggregatorFactories.Builder subFactoriesBuilder,
Map<String, Object> metadata) throws IOException {
super(name, config, context, parent, subFactoriesBuilder, metadata);
this.childFilter = childFilter;
this.parentFilter = parentFilter;
}
@Override
protected Aggregator createUnmapped(Aggregator parent, Map<String, Object> metadata) throws IOException {
return new NonCollectingAggregator(name, context, parent, factories, metadata) {
@Override
public InternalAggregation buildEmptyAggregation() {
return new InternalChildren(name, 0, buildEmptySubAggregations(), metadata());
}
};
}
@Override
protected Aggregator doCreateInternal(Aggregator parent, CardinalityUpperBound cardinality, Map<String, Object> metadata)
throws IOException {
ValuesSource rawValuesSource = config.getValuesSource();
if (rawValuesSource instanceof WithOrdinals == false) {
throw new AggregationExecutionException("ValuesSource type " + rawValuesSource.toString() +
"is not supported for aggregation " + this.name());
}
WithOrdinals valuesSource = (WithOrdinals) rawValuesSource;
long maxOrd = valuesSource.globalMaxOrd(context.searcher());
return new ParentToChildrenAggregator(name, factories, context, parent, childFilter,
parentFilter, valuesSource, maxOrd, cardinality, metadata);
}
@Override
public String getStatsSubtype() {
// Child Aggregation is registered in non-standard way, so it might return child's values type
return OTHER_SUBTYPE;
}
}
| nknize/elasticsearch | modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregatorFactory.java | Java | apache-2.0 | 4,159 | [
30522,
1013,
1008,
1008,
7000,
2000,
21274,
17310,
11140,
2104,
2028,
2030,
2062,
12130,
1008,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
1008,
6095,
1012,
21274,
17310,
11140,
159... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Fri Aug 28 09:51:32 EDT 2015 -->
<title>Uses of Class org.apache.cassandra.db.KeyspaceNotDefinedException (apache-cassandra API)</title>
<meta name="date" content="2015-08-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.cassandra.db.KeyspaceNotDefinedException (apache-cassandra API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/db/KeyspaceNotDefinedException.html" title="class in org.apache.cassandra.db">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/db/class-use/KeyspaceNotDefinedException.html" target="_top">Frames</a></li>
<li><a href="KeyspaceNotDefinedException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.cassandra.db.KeyspaceNotDefinedException" class="title">Uses of Class<br>org.apache.cassandra.db.KeyspaceNotDefinedException</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/apache/cassandra/db/KeyspaceNotDefinedException.html" title="class in org.apache.cassandra.db">KeyspaceNotDefinedException</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.cassandra.thrift">org.apache.cassandra.thrift</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.cassandra.thrift">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/apache/cassandra/db/KeyspaceNotDefinedException.html" title="class in org.apache.cassandra.db">KeyspaceNotDefinedException</a> in <a href="../../../../../org/apache/cassandra/thrift/package-summary.html">org.apache.cassandra.thrift</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/thrift/package-summary.html">org.apache.cassandra.thrift</a> that throw <a href="../../../../../org/apache/cassandra/db/KeyspaceNotDefinedException.html" title="class in org.apache.cassandra.db">KeyspaceNotDefinedException</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><span class="typeNameLabel">ThriftValidation.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/thrift/ThriftValidation.html#validateKeyspace-java.lang.String-">validateKeyspace</a></span>(java.lang.String keyspaceName)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/db/KeyspaceNotDefinedException.html" title="class in org.apache.cassandra.db">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/db/class-use/KeyspaceNotDefinedException.html" target="_top">Frames</a></li>
<li><a href="KeyspaceNotDefinedException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 The Apache Software Foundation</small></p>
</body>
</html>
| mitch-kyle/message-board | support/apache-cassandra-2.2.1/javadoc/org/apache/cassandra/db/class-use/KeyspaceNotDefinedException.html | HTML | apache-2.0 | 6,767 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @Created By ECMall PhpCacheServer
* @Time:2015-01-26 00:07:24
*/
if(filemtime(__FILE__) + 600 < time())return false;
return array (
'inbox' => '0',
'outbox' => '0',
'total' => 0,
);
?> | guotao2000/ecmall | temp/caches/0034/193eb3ed1f27841412d84dec2e96d200.cache.php | PHP | mit | 220 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
2580,
2011,
14925,
9067,
2140,
25718,
3540,
8376,
2121,
6299,
1008,
1030,
2051,
1024,
2325,
1011,
5890,
1011,
2656,
4002,
1024,
5718,
1024,
2484,
1008,
1013,
2065,
1006,
5371,
20492,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DROP TABLE IF EXISTS `spell_stack_masks`;
| milleniumcore/CactusEMU | sql/updates/TrinityCore_old/3.2.2a_old/7283_world_spell_stack_masks.sql | SQL | gpl-2.0 | 42 | [
30522,
4530,
2795,
2065,
6526,
1036,
6297,
1035,
9991,
1035,
15806,
1036,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class Relationship < ApplicationRecord
belongs_to :follower, class_name: "User"
belongs_to :followed, class_name: "User"
validates :follower_id, presence: true
validates :followed_id, presence: true
end
| yukung/playground | rails-tutorial/sample_app/app/models/relationship.rb | Ruby | mit | 211 | [
30522,
2465,
3276,
1026,
4646,
2890,
27108,
2094,
7460,
1035,
2000,
1024,
22399,
1010,
2465,
1035,
2171,
1024,
1000,
5310,
1000,
7460,
1035,
2000,
1024,
2628,
1010,
2465,
1035,
2171,
1024,
1000,
5310,
1000,
9398,
8520,
1024,
22399,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package net.glowstone.net.codec.play.game;
import com.flowpowered.network.Codec;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.glowstone.net.GlowBufUtils;
import net.glowstone.net.message.play.game.UpdateBlockEntityMessage;
import net.glowstone.util.nbt.CompoundTag;
import org.bukkit.util.BlockVector;
public final class UpdateBlockEntityCodec implements Codec<UpdateBlockEntityMessage> {
@Override
public UpdateBlockEntityMessage decode(ByteBuf buffer) throws IOException {
BlockVector pos = GlowBufUtils.readBlockPosition(buffer);
int action = buffer.readByte();
CompoundTag nbt = GlowBufUtils.readCompound(buffer);
return new UpdateBlockEntityMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(),
action, nbt);
}
@Override
public ByteBuf encode(ByteBuf buf, UpdateBlockEntityMessage message) throws IOException {
GlowBufUtils.writeBlockPosition(buf, message.getX(), message.getY(), message.getZ());
buf.writeByte(message.getAction());
GlowBufUtils.writeCompound(buf, message.getNbt());
return buf;
}
}
| GlowstoneMC/GlowstonePlusPlus | src/main/java/net/glowstone/net/codec/play/game/UpdateBlockEntityCodec.java | Java | mit | 1,140 | [
30522,
7427,
5658,
1012,
8652,
9221,
1012,
5658,
1012,
3642,
2278,
1012,
2377,
1012,
2208,
1025,
12324,
4012,
1012,
4834,
27267,
1012,
2897,
1012,
3642,
2278,
1025,
12324,
22834,
1012,
5658,
3723,
1012,
17698,
1012,
24880,
8569,
2546,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2018 Mauricio Colli <mauriciocolli@outlook.com>
* AnimationUtils.java is part of NewPipe
*
* License: GPL-3.0+
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.schabi.newpipe.util;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.res.ColorStateList;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.FloatRange;
import androidx.core.view.ViewCompat;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import org.schabi.newpipe.MainActivity;
public final class AnimationUtils {
private static final String TAG = "AnimationUtils";
private static final boolean DEBUG = MainActivity.DEBUG;
private AnimationUtils() { }
public static void animateView(final View view, final boolean enterOrExit,
final long duration) {
animateView(view, Type.ALPHA, enterOrExit, duration, 0, null);
}
public static void animateView(final View view, final boolean enterOrExit,
final long duration, final long delay) {
animateView(view, Type.ALPHA, enterOrExit, duration, delay, null);
}
public static void animateView(final View view, final boolean enterOrExit, final long duration,
final long delay, final Runnable execOnEnd) {
animateView(view, Type.ALPHA, enterOrExit, duration, delay, execOnEnd);
}
public static void animateView(final View view, final Type animationType,
final boolean enterOrExit, final long duration) {
animateView(view, animationType, enterOrExit, duration, 0, null);
}
public static void animateView(final View view, final Type animationType,
final boolean enterOrExit, final long duration,
final long delay) {
animateView(view, animationType, enterOrExit, duration, delay, null);
}
/**
* Animate the view.
*
* @param view view that will be animated
* @param animationType {@link Type} of the animation
* @param enterOrExit true to enter, false to exit
* @param duration how long the animation will take, in milliseconds
* @param delay how long the animation will wait to start, in milliseconds
* @param execOnEnd runnable that will be executed when the animation ends
*/
public static void animateView(final View view, final Type animationType,
final boolean enterOrExit, final long duration,
final long delay, final Runnable execOnEnd) {
if (DEBUG) {
String id;
try {
id = view.getResources().getResourceEntryName(view.getId());
} catch (final Exception e) {
id = view.getId() + "";
}
final String msg = String.format("%8s โ [%s:%s] [%s %s:%s] execOnEnd=%s", enterOrExit,
view.getClass().getSimpleName(), id, animationType, duration, delay, execOnEnd);
Log.d(TAG, "animateView()" + msg);
}
if (view.getVisibility() == View.VISIBLE && enterOrExit) {
if (DEBUG) {
Log.d(TAG, "animateView() view was already visible > view = [" + view + "]");
}
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
view.setAlpha(1f);
if (execOnEnd != null) {
execOnEnd.run();
}
return;
} else if ((view.getVisibility() == View.GONE || view.getVisibility() == View.INVISIBLE)
&& !enterOrExit) {
if (DEBUG) {
Log.d(TAG, "animateView() view was already gone > view = [" + view + "]");
}
view.animate().setListener(null).cancel();
view.setVisibility(View.GONE);
view.setAlpha(0f);
if (execOnEnd != null) {
execOnEnd.run();
}
return;
}
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
switch (animationType) {
case ALPHA:
animateAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
case SCALE_AND_ALPHA:
animateScaleAndAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
case LIGHT_SCALE_AND_ALPHA:
animateLightScaleAndAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
case SLIDE_AND_ALPHA:
animateSlideAndAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
case LIGHT_SLIDE_AND_ALPHA:
animateLightSlideAndAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
}
}
/**
* Animate the background color of a view.
*
* @param view the view to animate
* @param duration the duration of the animation
* @param colorStart the background color to start with
* @param colorEnd the background color to end with
*/
public static void animateBackgroundColor(final View view, final long duration,
@ColorInt final int colorStart,
@ColorInt final int colorEnd) {
if (DEBUG) {
Log.d(TAG, "animateBackgroundColor() called with: "
+ "view = [" + view + "], duration = [" + duration + "], "
+ "colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
}
final int[][] empty = {new int[0]};
final ValueAnimator viewPropertyAnimator = ValueAnimator
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
viewPropertyAnimator.setDuration(duration);
viewPropertyAnimator.addUpdateListener(animation ->
ViewCompat.setBackgroundTintList(view,
new ColorStateList(empty, new int[]{(int) animation.getAnimatedValue()})));
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
ViewCompat.setBackgroundTintList(view,
new ColorStateList(empty, new int[]{colorEnd}));
}
@Override
public void onAnimationCancel(final Animator animation) {
onAnimationEnd(animation);
}
});
viewPropertyAnimator.start();
}
/**
* Animate the text color of any view that extends {@link TextView} (Buttons, EditText...).
*
* @param view the text view to animate
* @param duration the duration of the animation
* @param colorStart the text color to start with
* @param colorEnd the text color to end with
*/
public static void animateTextColor(final TextView view, final long duration,
@ColorInt final int colorStart,
@ColorInt final int colorEnd) {
if (DEBUG) {
Log.d(TAG, "animateTextColor() called with: "
+ "view = [" + view + "], duration = [" + duration + "], "
+ "colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
}
final ValueAnimator viewPropertyAnimator = ValueAnimator
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
viewPropertyAnimator.setDuration(duration);
viewPropertyAnimator.addUpdateListener(animation ->
view.setTextColor((int) animation.getAnimatedValue()));
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setTextColor(colorEnd);
}
@Override
public void onAnimationCancel(final Animator animation) {
view.setTextColor(colorEnd);
}
});
viewPropertyAnimator.start();
}
public static ValueAnimator animateHeight(final View view, final long duration,
final int targetHeight) {
final int height = view.getHeight();
if (DEBUG) {
Log.d(TAG, "animateHeight: duration = [" + duration + "], "
+ "from " + height + " to โ " + targetHeight + " in: " + view);
}
final ValueAnimator animator = ValueAnimator.ofFloat(height, targetHeight);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(duration);
animator.addUpdateListener(animation -> {
final float value = (float) animation.getAnimatedValue();
view.getLayoutParams().height = (int) value;
view.requestLayout();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.getLayoutParams().height = targetHeight;
view.requestLayout();
}
@Override
public void onAnimationCancel(final Animator animation) {
view.getLayoutParams().height = targetHeight;
view.requestLayout();
}
});
animator.start();
return animator;
}
public static void animateRotation(final View view, final long duration,
final int targetRotation) {
if (DEBUG) {
Log.d(TAG, "animateRotation: duration = [" + duration + "], "
+ "from " + view.getRotation() + " to โ " + targetRotation + " in: " + view);
}
view.animate().setListener(null).cancel();
view.animate()
.rotation(targetRotation).setDuration(duration)
.setInterpolator(new FastOutSlowInInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(final Animator animation) {
view.setRotation(targetRotation);
}
@Override
public void onAnimationEnd(final Animator animation) {
view.setRotation(targetRotation);
}
}).start();
}
private static void animateAlpha(final View view, final boolean enterOrExit,
final long duration, final long delay,
final Runnable execOnEnd) {
if (enterOrExit) {
view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(1f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
} else {
view.animate().setInterpolator(new FastOutSlowInInterpolator()).alpha(0f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
}
}
/*//////////////////////////////////////////////////////////////////////////
// Internals
//////////////////////////////////////////////////////////////////////////*/
private static void animateScaleAndAlpha(final View view, final boolean enterOrExit,
final long duration, final long delay,
final Runnable execOnEnd) {
if (enterOrExit) {
view.setScaleX(.8f);
view.setScaleY(.8f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.alpha(1f).scaleX(1f).scaleY(1f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
} else {
view.setScaleX(1f);
view.setScaleY(1f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.alpha(0f).scaleX(.8f).scaleY(.8f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
}
}
private static void animateLightScaleAndAlpha(final View view, final boolean enterOrExit,
final long duration, final long delay,
final Runnable execOnEnd) {
if (enterOrExit) {
view.setAlpha(.5f);
view.setScaleX(.95f);
view.setScaleY(.95f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.alpha(1f).scaleX(1f).scaleY(1f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
} else {
view.setAlpha(1f);
view.setScaleX(1f);
view.setScaleY(1f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.alpha(0f).scaleX(.95f).scaleY(.95f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
}
}
private static void animateSlideAndAlpha(final View view, final boolean enterOrExit,
final long duration, final long delay,
final Runnable execOnEnd) {
if (enterOrExit) {
view.setTranslationY(-view.getHeight());
view.setAlpha(0f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
} else {
view.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.alpha(0f).translationY(-view.getHeight())
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
}
}
private static void animateLightSlideAndAlpha(final View view, final boolean enterOrExit,
final long duration, final long delay,
final Runnable execOnEnd) {
if (enterOrExit) {
view.setTranslationY(-view.getHeight() / 2.0f);
view.setAlpha(0f);
view.animate()
.setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
} else {
view.animate().setInterpolator(new FastOutSlowInInterpolator())
.alpha(0f).translationY(-view.getHeight() / 2.0f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) {
execOnEnd.run();
}
}
}).start();
}
}
public static void slideUp(final View view, final long duration, final long delay,
@FloatRange(from = 0.0f, to = 1.0f)
final float translationPercent) {
final int translationY = (int) (view.getResources().getDisplayMetrics().heightPixels
* (translationPercent));
view.animate().setListener(null).cancel();
view.setAlpha(0f);
view.setTranslationY(translationY);
view.setVisibility(View.VISIBLE);
view.animate()
.alpha(1f)
.translationY(0)
.setStartDelay(delay)
.setDuration(duration)
.setInterpolator(new FastOutSlowInInterpolator())
.start();
}
public enum Type {
ALPHA,
SCALE_AND_ALPHA, LIGHT_SCALE_AND_ALPHA,
SLIDE_AND_ALPHA, LIGHT_SLIDE_AND_ALPHA
}
}
| theScrabi/NewPipe | app/src/main/java/org/schabi/newpipe/util/AnimationUtils.java | Java | gpl-3.0 | 20,120 | [
30522,
1013,
1008,
1008,
9385,
2760,
5003,
9496,
9793,
8902,
3669,
1026,
5003,
9496,
9793,
26895,
2072,
1030,
17680,
1012,
4012,
1028,
1008,
7284,
21823,
4877,
1012,
9262,
2003,
2112,
1997,
2047,
24548,
1008,
1008,
6105,
1024,
14246,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// src/Acme/DemoBundle/Form/EventListener/AddNameFieldSubscriber.php
namespace CCTracing\CMSBundle\Form\EventListener;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\FormFactoryInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\PropertyAccess\PropertyAccess;
class AddCampanaFieldSubscriber implements EventSubscriberInterface
{
private $factory;
public function __construct(FormFactoryInterface $factory)
{
$this->factory = $factory;
}
public static function getSubscribedEvents()
{
return array(
FormEvents::PRE_SET_DATA => 'preSetData',
FormEvents::PRE_SUBMIT => 'preSubmit'
);
}
private function addCampanaForm($form, $campana, $marca)
{
$form->add($this->factory->createNamed('campana','entity', $campana, array(
'class' => 'CCTracingCMSBundle:Campana',
'empty_value' => 'Campaรฑa',
'mapped' => false,
'auto_initialize' => false,
'property' => 'campana',
'query_builder' => function (EntityRepository $repository) use ($marca) {
$qb = $repository->createQueryBuilder('campana')
->innerJoin('campana.marca', 'marca');
if($marca instanceof CCTracing\CMSBundle\Marca){
$qb->where('campana.marca = :marca')
->setParameter('marca', $marca);
}elseif(is_numeric($marca)){
$qb->where('marca.id = :marca')
->setParameter('marca', $marca);
}else{
$qb->where('marca.marca = :marca')
->setParameter('marca', null);
}
return $qb;
}
)));
}
//se le llama justo antes de poblar el formulario con los datos del modelo
public function preSetData(FormEvent $event)
{
$data = $event->getData();
$form = $event->getForm();
if (null === $data) {
return;
}
$accessor = PropertyAccess::getPropertyAccessor();
$campana = $accessor->getValue($data, 'campana');
$marca = ($campana) ? $campana->getMarca() : null ;
$this->addCampanaForm($form, $campana, $marca);
}
public function preSubmit(FormEvent $event)
{
$data = $event->getData();
$form = $event->getForm();
if (null === $data) {
return;
}
echo "----------------";
$campana = array_key_exists('campana', $data) ? $data['campana'] : null;
$marca = array_key_exists('marca', $data) ? $data['marca'] : null;
print_r($marca);
print_r($campana);
die();
$this->addCampanaForm($form, $campana, $marca);
}
} | cmaciasg/cmaciasg | src/CCTracing/CMSBundle/Form/EventListener/AddCampanaFieldSubscriber.php | PHP | mit | 2,909 | [
30522,
1026,
1029,
25718,
1013,
1013,
5034,
2278,
1013,
9353,
4168,
1013,
9703,
27265,
2571,
1013,
2433,
1013,
2724,
9863,
24454,
1013,
5587,
18442,
15155,
12083,
29234,
2099,
1012,
25718,
3415,
15327,
10507,
6494,
6129,
1032,
4642,
19022,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python3
#
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Adds the code parts to a resource APK."""
import argparse
import logging
import os
import shutil
import sys
import tempfile
import zipfile
import zlib
import finalize_apk
from util import build_utils
from util import diff_utils
from util import zipalign
# Input dex.jar files are zipaligned.
zipalign.ApplyZipFileZipAlignFix()
# Taken from aapt's Package.cpp:
_NO_COMPRESS_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.gif', '.wav', '.mp2',
'.mp3', '.ogg', '.aac', '.mpg', '.mpeg', '.mid',
'.midi', '.smf', '.jet', '.rtttl', '.imy', '.xmf',
'.mp4', '.m4a', '.m4v', '.3gp', '.3gpp', '.3g2',
'.3gpp2', '.amr', '.awb', '.wma', '.wmv', '.webm')
def _ParseArgs(args):
parser = argparse.ArgumentParser()
build_utils.AddDepfileOption(parser)
parser.add_argument(
'--assets',
help='GYP-list of files to add as assets in the form '
'"srcPath:zipPath", where ":zipPath" is optional.')
parser.add_argument(
'--java-resources', help='GYP-list of java_resources JARs to include.')
parser.add_argument('--write-asset-list',
action='store_true',
help='Whether to create an assets/assets_list file.')
parser.add_argument(
'--uncompressed-assets',
help='Same as --assets, except disables compression.')
parser.add_argument('--resource-apk',
help='An .ap_ file built using aapt',
required=True)
parser.add_argument('--output-apk',
help='Path to the output file',
required=True)
parser.add_argument('--format', choices=['apk', 'bundle-module'],
default='apk', help='Specify output format.')
parser.add_argument('--dex-file',
help='Path to the classes.dex to use')
parser.add_argument(
'--jdk-libs-dex-file',
help='Path to classes.dex created by dex_jdk_libs.py')
parser.add_argument('--uncompress-dex', action='store_true',
help='Store .dex files uncompressed in the APK')
parser.add_argument('--native-libs',
action='append',
help='GYP-list of native libraries to include. '
'Can be specified multiple times.',
default=[])
parser.add_argument('--secondary-native-libs',
action='append',
help='GYP-list of native libraries for secondary '
'android-abi. Can be specified multiple times.',
default=[])
parser.add_argument('--android-abi',
help='Android architecture to use for native libraries')
parser.add_argument('--secondary-android-abi',
help='The secondary Android architecture to use for'
'secondary native libraries')
parser.add_argument(
'--is-multi-abi',
action='store_true',
help='Will add a placeholder for the missing ABI if no native libs or '
'placeholders are set for either the primary or secondary ABI. Can only '
'be set if both --android-abi and --secondary-android-abi are set.')
parser.add_argument(
'--native-lib-placeholders',
help='GYP-list of native library placeholders to add.')
parser.add_argument(
'--secondary-native-lib-placeholders',
help='GYP-list of native library placeholders to add '
'for the secondary ABI')
parser.add_argument('--uncompress-shared-libraries', default='False',
choices=['true', 'True', 'false', 'False'],
help='Whether to uncompress native shared libraries. Argument must be '
'a boolean value.')
parser.add_argument(
'--apksigner-jar', help='Path to the apksigner executable.')
parser.add_argument('--zipalign-path',
help='Path to the zipalign executable.')
parser.add_argument('--key-path',
help='Path to keystore for signing.')
parser.add_argument('--key-passwd',
help='Keystore password')
parser.add_argument('--key-name',
help='Keystore name')
parser.add_argument(
'--min-sdk-version', required=True, help='Value of APK\'s minSdkVersion')
parser.add_argument(
'--best-compression',
action='store_true',
help='Use zip -9 rather than zip -1')
parser.add_argument(
'--library-always-compress',
action='append',
help='The list of library files that we always compress.')
parser.add_argument(
'--library-renames',
action='append',
help='The list of library files that we prepend crazy. to their names.')
parser.add_argument('--warnings-as-errors',
action='store_true',
help='Treat all warnings as errors.')
diff_utils.AddCommandLineFlags(parser)
options = parser.parse_args(args)
options.assets = build_utils.ParseGnList(options.assets)
options.uncompressed_assets = build_utils.ParseGnList(
options.uncompressed_assets)
options.native_lib_placeholders = build_utils.ParseGnList(
options.native_lib_placeholders)
options.secondary_native_lib_placeholders = build_utils.ParseGnList(
options.secondary_native_lib_placeholders)
options.java_resources = build_utils.ParseGnList(options.java_resources)
options.native_libs = build_utils.ParseGnList(options.native_libs)
options.secondary_native_libs = build_utils.ParseGnList(
options.secondary_native_libs)
options.library_always_compress = build_utils.ParseGnList(
options.library_always_compress)
options.library_renames = build_utils.ParseGnList(options.library_renames)
# --apksigner-jar, --zipalign-path, --key-xxx arguments are
# required when building an APK, but not a bundle module.
if options.format == 'apk':
required_args = [
'apksigner_jar', 'zipalign_path', 'key_path', 'key_passwd', 'key_name'
]
for required in required_args:
if not vars(options)[required]:
raise Exception('Argument --%s is required for APKs.' % (
required.replace('_', '-')))
options.uncompress_shared_libraries = \
options.uncompress_shared_libraries in [ 'true', 'True' ]
if not options.android_abi and (options.native_libs or
options.native_lib_placeholders):
raise Exception('Must specify --android-abi with --native-libs')
if not options.secondary_android_abi and (options.secondary_native_libs or
options.secondary_native_lib_placeholders):
raise Exception('Must specify --secondary-android-abi with'
' --secondary-native-libs')
if options.is_multi_abi and not (options.android_abi
and options.secondary_android_abi):
raise Exception('Must specify --is-multi-abi with both --android-abi '
'and --secondary-android-abi.')
return options
def _SplitAssetPath(path):
"""Returns (src, dest) given an asset path in the form src[:dest]."""
path_parts = path.split(':')
src_path = path_parts[0]
if len(path_parts) > 1:
dest_path = path_parts[1]
else:
dest_path = os.path.basename(src_path)
return src_path, dest_path
def _ExpandPaths(paths):
"""Converts src:dst into tuples and enumerates files within directories.
Args:
paths: Paths in the form "src_path:dest_path"
Returns:
A list of (src_path, dest_path) tuples sorted by dest_path (for stable
ordering within output .apk).
"""
ret = []
for path in paths:
src_path, dest_path = _SplitAssetPath(path)
if os.path.isdir(src_path):
for f in build_utils.FindInDirectory(src_path, '*'):
ret.append((f, os.path.join(dest_path, f[len(src_path) + 1:])))
else:
ret.append((src_path, dest_path))
ret.sort(key=lambda t:t[1])
return ret
def _GetAssetsToAdd(path_tuples,
fast_align,
disable_compression=False,
allow_reads=True):
"""Returns the list of file_detail tuples for assets in the apk.
Args:
path_tuples: List of src_path, dest_path tuples to add.
fast_align: Whether to perform alignment in python zipfile (alternatively
alignment can be done using the zipalign utility out of band).
disable_compression: Whether to disable compression.
allow_reads: If false, we do not try to read the files from disk (to find
their size for example).
Returns: A list of (src_path, apk_path, compress, alignment) tuple
representing what and how assets are added.
"""
assets_to_add = []
# Group all uncompressed assets together in the hope that it will increase
# locality of mmap'ed files.
for target_compress in (False, True):
for src_path, dest_path in path_tuples:
compress = not disable_compression and (
os.path.splitext(src_path)[1] not in _NO_COMPRESS_EXTENSIONS)
if target_compress == compress:
# AddToZipHermetic() uses this logic to avoid growing small files.
# We need it here in order to set alignment correctly.
if allow_reads and compress and os.path.getsize(src_path) < 16:
compress = False
apk_path = 'assets/' + dest_path
alignment = 0 if compress and not fast_align else 4
assets_to_add.append((apk_path, src_path, compress, alignment))
return assets_to_add
def _AddFiles(apk, details):
"""Adds files to the apk.
Args:
apk: path to APK to add to.
details: A list of file detail tuples (src_path, apk_path, compress,
alignment) representing what and how files are added to the APK.
"""
for apk_path, src_path, compress, alignment in details:
# This check is only relevant for assets, but it should not matter if it is
# checked for the whole list of files.
try:
apk.getinfo(apk_path)
# Should never happen since write_build_config.py handles merging.
raise Exception(
'Multiple targets specified the asset path: %s' % apk_path)
except KeyError:
zipalign.AddToZipHermetic(
apk,
apk_path,
src_path=src_path,
compress=compress,
alignment=alignment)
def _GetNativeLibrariesToAdd(native_libs, android_abi, uncompress, fast_align,
lib_always_compress, lib_renames):
"""Returns the list of file_detail tuples for native libraries in the apk.
Returns: A list of (src_path, apk_path, compress, alignment) tuple
representing what and how native libraries are added.
"""
libraries_to_add = []
for path in native_libs:
basename = os.path.basename(path)
compress = not uncompress or any(lib_name in basename
for lib_name in lib_always_compress)
rename = any(lib_name in basename for lib_name in lib_renames)
if rename:
basename = 'crazy.' + basename
lib_android_abi = android_abi
if path.startswith('android_clang_arm64_hwasan/'):
lib_android_abi = 'arm64-v8a-hwasan'
apk_path = 'lib/%s/%s' % (lib_android_abi, basename)
alignment = 0 if compress and not fast_align else 0x1000
libraries_to_add.append((apk_path, path, compress, alignment))
return libraries_to_add
def _CreateExpectationsData(native_libs, assets):
"""Creates list of native libraries and assets."""
native_libs = sorted(native_libs)
assets = sorted(assets)
ret = []
for apk_path, _, compress, alignment in native_libs + assets:
ret.append('apk_path=%s, compress=%s, alignment=%s\n' %
(apk_path, compress, alignment))
return ''.join(ret)
def main(args):
build_utils.InitLogging('APKBUILDER_DEBUG')
args = build_utils.ExpandFileArgs(args)
options = _ParseArgs(args)
# Until Python 3.7, there's no better way to set compression level.
# The default is 6.
if options.best_compression:
# Compresses about twice as slow as the default.
zlib.Z_DEFAULT_COMPRESSION = 9
else:
# Compresses about twice as fast as the default.
zlib.Z_DEFAULT_COMPRESSION = 1
# Manually align only when alignment is necessary.
# Python's zip implementation duplicates file comments in the central
# directory, whereas zipalign does not, so use zipalign for official builds.
fast_align = options.format == 'apk' and not options.best_compression
native_libs = sorted(options.native_libs)
# Include native libs in the depfile_deps since GN doesn't know about the
# dependencies when is_component_build=true.
depfile_deps = list(native_libs)
# For targets that depend on static library APKs, dex paths are created by
# the static library's dexsplitter target and GN doesn't know about these
# paths.
if options.dex_file:
depfile_deps.append(options.dex_file)
secondary_native_libs = []
if options.secondary_native_libs:
secondary_native_libs = sorted(options.secondary_native_libs)
depfile_deps += secondary_native_libs
if options.java_resources:
# Included via .build_config, so need to write it to depfile.
depfile_deps.extend(options.java_resources)
assets = _ExpandPaths(options.assets)
uncompressed_assets = _ExpandPaths(options.uncompressed_assets)
# Included via .build_config, so need to write it to depfile.
depfile_deps.extend(x[0] for x in assets)
depfile_deps.extend(x[0] for x in uncompressed_assets)
# Bundle modules have a structure similar to APKs, except that resources
# are compiled in protobuf format (instead of binary xml), and that some
# files are located into different top-level directories, e.g.:
# AndroidManifest.xml -> manifest/AndroidManifest.xml
# classes.dex -> dex/classes.dex
# res/ -> res/ (unchanged)
# assets/ -> assets/ (unchanged)
# <other-file> -> root/<other-file>
#
# Hence, the following variables are used to control the location of files in
# the final archive.
if options.format == 'bundle-module':
apk_manifest_dir = 'manifest/'
apk_root_dir = 'root/'
apk_dex_dir = 'dex/'
else:
apk_manifest_dir = ''
apk_root_dir = ''
apk_dex_dir = ''
def _GetAssetDetails(assets, uncompressed_assets, fast_align, allow_reads):
ret = _GetAssetsToAdd(assets,
fast_align,
disable_compression=False,
allow_reads=allow_reads)
ret.extend(
_GetAssetsToAdd(uncompressed_assets,
fast_align,
disable_compression=True,
allow_reads=allow_reads))
return ret
libs_to_add = _GetNativeLibrariesToAdd(
native_libs, options.android_abi, options.uncompress_shared_libraries,
fast_align, options.library_always_compress, options.library_renames)
if options.secondary_android_abi:
libs_to_add.extend(
_GetNativeLibrariesToAdd(
secondary_native_libs, options.secondary_android_abi,
options.uncompress_shared_libraries, fast_align,
options.library_always_compress, options.library_renames))
if options.expected_file:
# We compute expectations without reading the files. This allows us to check
# expectations for different targets by just generating their build_configs
# and not have to first generate all the actual files and all their
# dependencies (for example by just passing --only-verify-expectations).
asset_details = _GetAssetDetails(assets,
uncompressed_assets,
fast_align,
allow_reads=False)
actual_data = _CreateExpectationsData(libs_to_add, asset_details)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
if options.depfile:
build_utils.WriteDepfile(options.depfile,
options.actual_file,
inputs=depfile_deps)
return
# If we are past this point, we are going to actually create the final apk so
# we should recompute asset details again but maybe perform some optimizations
# based on the size of the files on disk.
assets_to_add = _GetAssetDetails(
assets, uncompressed_assets, fast_align, allow_reads=True)
# Targets generally do not depend on apks, so no need for only_if_changed.
with build_utils.AtomicOutput(options.output_apk, only_if_changed=False) as f:
with zipfile.ZipFile(options.resource_apk) as resource_apk, \
zipfile.ZipFile(f, 'w') as out_apk:
def add_to_zip(zip_path, data, compress=True, alignment=4):
zipalign.AddToZipHermetic(
out_apk,
zip_path,
data=data,
compress=compress,
alignment=0 if compress and not fast_align else alignment)
def copy_resource(zipinfo, out_dir=''):
add_to_zip(
out_dir + zipinfo.filename,
resource_apk.read(zipinfo.filename),
compress=zipinfo.compress_type != zipfile.ZIP_STORED)
# Make assets come before resources in order to maintain the same file
# ordering as GYP / aapt. http://crbug.com/561862
resource_infos = resource_apk.infolist()
# 1. AndroidManifest.xml
logging.debug('Adding AndroidManifest.xml')
copy_resource(
resource_apk.getinfo('AndroidManifest.xml'), out_dir=apk_manifest_dir)
# 2. Assets
logging.debug('Adding assets/')
_AddFiles(out_apk, assets_to_add)
# 3. Dex files
logging.debug('Adding classes.dex')
if options.dex_file:
with open(options.dex_file, 'rb') as dex_file_obj:
if options.dex_file.endswith('.dex'):
max_dex_number = 1
# This is the case for incremental_install=true.
add_to_zip(
apk_dex_dir + 'classes.dex',
dex_file_obj.read(),
compress=not options.uncompress_dex)
else:
max_dex_number = 0
with zipfile.ZipFile(dex_file_obj) as dex_zip:
for dex in (d for d in dex_zip.namelist() if d.endswith('.dex')):
max_dex_number += 1
add_to_zip(
apk_dex_dir + dex,
dex_zip.read(dex),
compress=not options.uncompress_dex)
if options.jdk_libs_dex_file:
with open(options.jdk_libs_dex_file, 'rb') as dex_file_obj:
add_to_zip(
apk_dex_dir + 'classes{}.dex'.format(max_dex_number + 1),
dex_file_obj.read(),
compress=not options.uncompress_dex)
# 4. Native libraries.
logging.debug('Adding lib/')
_AddFiles(out_apk, libs_to_add)
# Add a placeholder lib if the APK should be multi ABI but is missing libs
# for one of the ABIs.
native_lib_placeholders = options.native_lib_placeholders
secondary_native_lib_placeholders = (
options.secondary_native_lib_placeholders)
if options.is_multi_abi:
if ((secondary_native_libs or secondary_native_lib_placeholders)
and not native_libs and not native_lib_placeholders):
native_lib_placeholders += ['libplaceholder.so']
if ((native_libs or native_lib_placeholders)
and not secondary_native_libs
and not secondary_native_lib_placeholders):
secondary_native_lib_placeholders += ['libplaceholder.so']
# Add placeholder libs.
for name in sorted(native_lib_placeholders):
# Note: Empty libs files are ignored by md5check (can cause issues
# with stale builds when the only change is adding/removing
# placeholders).
apk_path = 'lib/%s/%s' % (options.android_abi, name)
add_to_zip(apk_path, '', alignment=0x1000)
for name in sorted(secondary_native_lib_placeholders):
# Note: Empty libs files are ignored by md5check (can cause issues
# with stale builds when the only change is adding/removing
# placeholders).
apk_path = 'lib/%s/%s' % (options.secondary_android_abi, name)
add_to_zip(apk_path, '', alignment=0x1000)
# 5. Resources
logging.debug('Adding res/')
for info in sorted(resource_infos, key=lambda i: i.filename):
if info.filename != 'AndroidManifest.xml':
copy_resource(info)
# 6. Java resources that should be accessible via
# Class.getResourceAsStream(), in particular parts of Emma jar.
# Prebuilt jars may contain class files which we shouldn't include.
logging.debug('Adding Java resources')
for java_resource in options.java_resources:
with zipfile.ZipFile(java_resource, 'r') as java_resource_jar:
for apk_path in sorted(java_resource_jar.namelist()):
apk_path_lower = apk_path.lower()
if apk_path_lower.startswith('meta-inf/'):
continue
if apk_path_lower.endswith('/'):
continue
if apk_path_lower.endswith('.class'):
continue
add_to_zip(apk_root_dir + apk_path,
java_resource_jar.read(apk_path))
if options.format == 'apk':
zipalign_path = None if fast_align else options.zipalign_path
finalize_apk.FinalizeApk(options.apksigner_jar,
zipalign_path,
f.name,
f.name,
options.key_path,
options.key_passwd,
options.key_name,
int(options.min_sdk_version),
warnings_as_errors=options.warnings_as_errors)
logging.debug('Moving file into place')
if options.depfile:
build_utils.WriteDepfile(options.depfile,
options.output_apk,
inputs=depfile_deps)
if __name__ == '__main__':
main(sys.argv[1:])
| youtube/cobalt | build/android/gyp/apkbuilder.py | Python | bsd-3-clause | 22,278 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
2509,
1001,
1001,
9385,
1006,
1039,
1007,
2325,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1001,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var helpers = require('./');
/** Boids is a lot like Castle in the way it treats elements. But it is more
predictable, and retains attribute information.
1. The root node is collapsed, but its name is preserved in document['*']
2. Attributes are stored in a Object<String -> String> mapping, called "$".
* XML elements that are named '$' will conflict with the way boids represents
attributes.
3. in between elements is discarded.
4. Namespacing is taken literally.
5. Relative order between siblings of different names (or text nodes) is
disregarded, though order between siblings of the same name will be
preserved.
*/
function convertNode(node) {
/** Convert a single node into a javascript object. */
var obj = {$: {}};
// save all attributes to the '$' field
node.attrs().forEach(function(attr) {
obj.$[helpers.fullName.apply(attr)] = attr.value();
});
var texts = [];
node.childNodes().forEach(function(node) {
var type = node.type();
if (type == 'element') {
var tag = helpers.fullName.apply(node);
if (obj[tag] === undefined) {
obj[tag] = [];
}
obj[tag].push(convertNode(node));
}
else {
texts.push(node.text());
}
});
// finally concatenate all the text nodes together and save them as the '_' field
obj._ = helpers.parseString(texts.join('').trim());
return obj;
}
function boids(xml, opts) {
var root = helpers.parseXML(xml);
var obj = convertNode(root);
// special root handling:
obj['*'] = root.name();
return obj;
}
module.exports = boids;
| chbrown/xmlconv | lib/boids.js | JavaScript | mit | 1,571 | [
30522,
13075,
2393,
2545,
1027,
5478,
1006,
1005,
1012,
1013,
1005,
1007,
1025,
1013,
1008,
1008,
8945,
9821,
2003,
1037,
2843,
2066,
3317,
1999,
1996,
2126,
2009,
18452,
3787,
1012,
2021,
2009,
2003,
2062,
21425,
1010,
1998,
14567,
17961,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Exchange
module ExternalAPI
class ValutaKg < XML
API_URL = "http://m.valuta.kg/api/"
CURRENCIES = %I(kgs usd eur rub kzt uzs cny gbp)
def update opts={}
time = helper.assure_time(opts[:at], default: :now)
Call.new(API_URL, at: time, format: :xml) do |result|
@base = :kgs
@rates = result.search('currency').map do |c|
[
c.at("title_alias").text.downcase.to_sym,
(1 / BigDecimal.new(c.at('buy_rate').text.sub(',', '.')))
]
end.to_h.merge({ kgs: 1 })
@timestamp = Date.today.to_time.to_i
end
end
end
end
end
| sharshenov/exchange-nbkr | lib/exchange/external_api/valuta_kg.rb | Ruby | mit | 673 | [
30522,
11336,
3863,
11336,
6327,
9331,
2072,
2465,
11748,
13210,
2243,
2290,
1026,
20950,
17928,
1035,
24471,
2140,
1027,
1000,
8299,
1024,
1013,
1013,
1049,
1012,
11748,
13210,
1012,
4705,
1013,
17928,
1013,
1000,
12731,
14343,
14767,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/drive/drive_api_util.h"
#include <string>
#include "base/files/file.h"
#include "base/logging.h"
#include "base/md5.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/gdata_wapi_parser.h"
#include "net/base/escape.h"
#include "third_party/re2/re2/re2.h"
#include "url/gurl.h"
namespace drive {
namespace util {
namespace {
// Google Apps MIME types:
const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document";
const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing";
const char kGooglePresentationMimeType[] =
"application/vnd.google-apps.presentation";
const char kGoogleSpreadsheetMimeType[] =
"application/vnd.google-apps.spreadsheet";
const char kGoogleTableMimeType[] = "application/vnd.google-apps.table";
const char kGoogleFormMimeType[] = "application/vnd.google-apps.form";
const char kDriveFolderMimeType[] = "application/vnd.google-apps.folder";
std::string GetMimeTypeFromEntryKind(google_apis::DriveEntryKind kind) {
switch (kind) {
case google_apis::ENTRY_KIND_DOCUMENT:
return kGoogleDocumentMimeType;
case google_apis::ENTRY_KIND_SPREADSHEET:
return kGoogleSpreadsheetMimeType;
case google_apis::ENTRY_KIND_PRESENTATION:
return kGooglePresentationMimeType;
case google_apis::ENTRY_KIND_DRAWING:
return kGoogleDrawingMimeType;
case google_apis::ENTRY_KIND_TABLE:
return kGoogleTableMimeType;
case google_apis::ENTRY_KIND_FORM:
return kGoogleFormMimeType;
default:
return std::string();
}
}
ScopedVector<std::string> CopyScopedVectorString(
const ScopedVector<std::string>& source) {
ScopedVector<std::string> result;
result.reserve(source.size());
for (size_t i = 0; i < source.size(); ++i)
result.push_back(new std::string(*source[i]));
return result.Pass();
}
// Converts AppIcon (of GData WAPI) to DriveAppIcon.
scoped_ptr<google_apis::DriveAppIcon>
ConvertAppIconToDriveAppIcon(const google_apis::AppIcon& app_icon) {
scoped_ptr<google_apis::DriveAppIcon> resource(
new google_apis::DriveAppIcon);
switch (app_icon.category()) {
case google_apis::AppIcon::ICON_UNKNOWN:
resource->set_category(google_apis::DriveAppIcon::UNKNOWN);
break;
case google_apis::AppIcon::ICON_DOCUMENT:
resource->set_category(google_apis::DriveAppIcon::DOCUMENT);
break;
case google_apis::AppIcon::ICON_APPLICATION:
resource->set_category(google_apis::DriveAppIcon::APPLICATION);
break;
case google_apis::AppIcon::ICON_SHARED_DOCUMENT:
resource->set_category(google_apis::DriveAppIcon::SHARED_DOCUMENT);
break;
default:
NOTREACHED();
}
resource->set_icon_side_length(app_icon.icon_side_length());
resource->set_icon_url(app_icon.GetIconURL());
return resource.Pass();
}
// Converts InstalledApp to AppResource.
scoped_ptr<google_apis::AppResource>
ConvertInstalledAppToAppResource(
const google_apis::InstalledApp& installed_app) {
scoped_ptr<google_apis::AppResource> resource(new google_apis::AppResource);
resource->set_application_id(installed_app.app_id());
resource->set_name(installed_app.app_name());
resource->set_object_type(installed_app.object_type());
resource->set_supports_create(installed_app.supports_create());
{
ScopedVector<std::string> primary_mimetypes(
CopyScopedVectorString(installed_app.primary_mimetypes()));
resource->set_primary_mimetypes(primary_mimetypes.Pass());
}
{
ScopedVector<std::string> secondary_mimetypes(
CopyScopedVectorString(installed_app.secondary_mimetypes()));
resource->set_secondary_mimetypes(secondary_mimetypes.Pass());
}
{
ScopedVector<std::string> primary_file_extensions(
CopyScopedVectorString(installed_app.primary_extensions()));
resource->set_primary_file_extensions(primary_file_extensions.Pass());
}
{
ScopedVector<std::string> secondary_file_extensions(
CopyScopedVectorString(installed_app.secondary_extensions()));
resource->set_secondary_file_extensions(secondary_file_extensions.Pass());
}
{
const ScopedVector<google_apis::AppIcon>& app_icons =
installed_app.app_icons();
ScopedVector<google_apis::DriveAppIcon> icons;
icons.reserve(app_icons.size());
for (size_t i = 0; i < app_icons.size(); ++i) {
icons.push_back(ConvertAppIconToDriveAppIcon(*app_icons[i]).release());
}
resource->set_icons(icons.Pass());
}
// supports_import, installed and authorized are not supported in
// InstalledApp.
return resource.Pass();
}
// Returns the argument string.
std::string Identity(const std::string& resource_id) { return resource_id; }
} // namespace
std::string EscapeQueryStringValue(const std::string& str) {
std::string result;
result.reserve(str.size());
for (size_t i = 0; i < str.size(); ++i) {
if (str[i] == '\\' || str[i] == '\'') {
result.push_back('\\');
}
result.push_back(str[i]);
}
return result;
}
std::string TranslateQuery(const std::string& original_query) {
// In order to handle non-ascii white spaces correctly, convert to UTF16.
base::string16 query = base::UTF8ToUTF16(original_query);
const base::string16 kDelimiter(
base::kWhitespaceUTF16 +
base::string16(1, static_cast<base::char16>('"')));
std::string result;
for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16);
index != base::string16::npos;
index = query.find_first_not_of(base::kWhitespaceUTF16, index)) {
bool is_exclusion = (query[index] == '-');
if (is_exclusion)
++index;
if (index == query.length()) {
// Here, the token is '-' and it should be ignored.
continue;
}
size_t begin_token = index;
base::string16 token;
if (query[begin_token] == '"') {
// Quoted query.
++begin_token;
size_t end_token = query.find('"', begin_token);
if (end_token == base::string16::npos) {
// This is kind of syntax error, since quoted string isn't finished.
// However, the query is built by user manually, so here we treat
// whole remaining string as a token as a fallback, by appending
// a missing double-quote character.
end_token = query.length();
query.push_back('"');
}
token = query.substr(begin_token, end_token - begin_token);
index = end_token + 1; // Consume last '"', too.
} else {
size_t end_token = query.find_first_of(kDelimiter, begin_token);
if (end_token == base::string16::npos) {
end_token = query.length();
}
token = query.substr(begin_token, end_token - begin_token);
index = end_token;
}
if (token.empty()) {
// Just ignore an empty token.
continue;
}
if (!result.empty()) {
// If there are two or more tokens, need to connect with "and".
result.append(" and ");
}
// The meaning of "fullText" should include title, description and content.
base::StringAppendF(
&result,
"%sfullText contains \'%s\'",
is_exclusion ? "not " : "",
EscapeQueryStringValue(base::UTF16ToUTF8(token)).c_str());
}
return result;
}
std::string ExtractResourceIdFromUrl(const GURL& url) {
return net::UnescapeURLComponent(url.ExtractFileName(),
net::UnescapeRule::URL_SPECIAL_CHARS);
}
std::string CanonicalizeResourceId(const std::string& resource_id) {
// If resource ID is in the old WAPI format starting with a prefix like
// "document:", strip it and return the remaining part.
std::string stripped_resource_id;
if (RE2::FullMatch(resource_id, "^[a-z-]+(?::|%3A)([\\w-]+)$",
&stripped_resource_id))
return stripped_resource_id;
return resource_id;
}
ResourceIdCanonicalizer GetIdentityResourceIdCanonicalizer() {
return base::Bind(&Identity);
}
const char kDocsListScope[] = "https://docs.google.com/feeds/";
const char kDriveAppsScope[] = "https://www.googleapis.com/auth/drive.apps";
void ParseShareUrlAndRun(const google_apis::GetShareUrlCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<base::Value> value) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (!value) {
callback.Run(error, GURL());
return;
}
// Parsing ResourceEntry is cheap enough to do on UI thread.
scoped_ptr<google_apis::ResourceEntry> entry =
google_apis::ResourceEntry::ExtractAndParse(*value);
if (!entry) {
callback.Run(google_apis::GDATA_PARSE_ERROR, GURL());
return;
}
const google_apis::Link* share_link =
entry->GetLinkByType(google_apis::Link::LINK_SHARE);
callback.Run(error, share_link ? share_link->href() : GURL());
}
scoped_ptr<google_apis::AboutResource>
ConvertAccountMetadataToAboutResource(
const google_apis::AccountMetadata& account_metadata,
const std::string& root_resource_id) {
scoped_ptr<google_apis::AboutResource> resource(
new google_apis::AboutResource);
resource->set_largest_change_id(account_metadata.largest_changestamp());
resource->set_quota_bytes_total(account_metadata.quota_bytes_total());
resource->set_quota_bytes_used(account_metadata.quota_bytes_used());
resource->set_root_folder_id(root_resource_id);
return resource.Pass();
}
scoped_ptr<google_apis::AppList>
ConvertAccountMetadataToAppList(
const google_apis::AccountMetadata& account_metadata) {
scoped_ptr<google_apis::AppList> resource(new google_apis::AppList);
const ScopedVector<google_apis::InstalledApp>& installed_apps =
account_metadata.installed_apps();
ScopedVector<google_apis::AppResource> app_resources;
app_resources.reserve(installed_apps.size());
for (size_t i = 0; i < installed_apps.size(); ++i) {
app_resources.push_back(
ConvertInstalledAppToAppResource(*installed_apps[i]).release());
}
resource->set_items(app_resources.Pass());
// etag is not supported in AccountMetadata.
return resource.Pass();
}
scoped_ptr<google_apis::FileResource> ConvertResourceEntryToFileResource(
const google_apis::ResourceEntry& entry) {
scoped_ptr<google_apis::FileResource> file(new google_apis::FileResource);
file->set_file_id(entry.resource_id());
file->set_title(entry.title());
file->set_created_date(entry.published_time());
if (std::find(entry.labels().begin(), entry.labels().end(),
"shared-with-me") != entry.labels().end()) {
// Set current time to mark the file is shared_with_me, since ResourceEntry
// doesn't have |shared_with_me_date| equivalent.
file->set_shared_with_me_date(base::Time::Now());
}
file->set_shared(std::find(entry.labels().begin(), entry.labels().end(),
"shared") != entry.labels().end());
if (entry.is_folder()) {
file->set_mime_type(kDriveFolderMimeType);
} else {
std::string mime_type = GetMimeTypeFromEntryKind(entry.kind());
if (mime_type.empty())
mime_type = entry.content_mime_type();
file->set_mime_type(mime_type);
}
file->set_md5_checksum(entry.file_md5());
file->set_file_size(entry.file_size());
file->mutable_labels()->set_trashed(entry.deleted());
file->set_etag(entry.etag());
google_apis::ImageMediaMetadata* image_media_metadata =
file->mutable_image_media_metadata();
image_media_metadata->set_width(entry.image_width());
image_media_metadata->set_height(entry.image_height());
image_media_metadata->set_rotation(entry.image_rotation());
std::vector<google_apis::ParentReference>* parents = file->mutable_parents();
for (size_t i = 0; i < entry.links().size(); ++i) {
using google_apis::Link;
const Link& link = *entry.links()[i];
switch (link.type()) {
case Link::LINK_PARENT: {
google_apis::ParentReference parent;
parent.set_parent_link(link.href());
std::string file_id =
drive::util::ExtractResourceIdFromUrl(link.href());
parent.set_file_id(file_id);
parent.set_is_root(file_id == kWapiRootDirectoryResourceId);
parents->push_back(parent);
break;
}
case Link::LINK_ALTERNATE:
file->set_alternate_link(link.href());
break;
default:
break;
}
}
file->set_modified_date(entry.updated_time());
file->set_last_viewed_by_me_date(entry.last_viewed_time());
return file.Pass();
}
google_apis::DriveEntryKind GetKind(
const google_apis::FileResource& file_resource) {
if (file_resource.IsDirectory())
return google_apis::ENTRY_KIND_FOLDER;
const std::string& mime_type = file_resource.mime_type();
if (mime_type == kGoogleDocumentMimeType)
return google_apis::ENTRY_KIND_DOCUMENT;
if (mime_type == kGoogleSpreadsheetMimeType)
return google_apis::ENTRY_KIND_SPREADSHEET;
if (mime_type == kGooglePresentationMimeType)
return google_apis::ENTRY_KIND_PRESENTATION;
if (mime_type == kGoogleDrawingMimeType)
return google_apis::ENTRY_KIND_DRAWING;
if (mime_type == kGoogleTableMimeType)
return google_apis::ENTRY_KIND_TABLE;
if (mime_type == kGoogleFormMimeType)
return google_apis::ENTRY_KIND_FORM;
if (mime_type == "application/pdf")
return google_apis::ENTRY_KIND_PDF;
return google_apis::ENTRY_KIND_FILE;
}
scoped_ptr<google_apis::ResourceEntry>
ConvertFileResourceToResourceEntry(
const google_apis::FileResource& file_resource) {
scoped_ptr<google_apis::ResourceEntry> entry(new google_apis::ResourceEntry);
// ResourceEntry
entry->set_resource_id(file_resource.file_id());
entry->set_id(file_resource.file_id());
entry->set_kind(GetKind(file_resource));
entry->set_title(file_resource.title());
entry->set_published_time(file_resource.created_date());
std::vector<std::string> labels;
if (!file_resource.shared_with_me_date().is_null())
labels.push_back("shared-with-me");
if (file_resource.shared())
labels.push_back("shared");
entry->set_labels(labels);
// This should be the url to download the file_resource.
{
google_apis::Content content;
content.set_mime_type(file_resource.mime_type());
entry->set_content(content);
}
// TODO(kochi): entry->resource_links_
// For file entries
entry->set_filename(file_resource.title());
entry->set_suggested_filename(file_resource.title());
entry->set_file_md5(file_resource.md5_checksum());
entry->set_file_size(file_resource.file_size());
// If file is removed completely, that information is only available in
// ChangeResource, and is reflected in |removed_|. If file is trashed, the
// file entry still exists but with its "trashed" label true.
entry->set_deleted(file_resource.labels().is_trashed());
// ImageMediaMetadata
entry->set_image_width(file_resource.image_media_metadata().width());
entry->set_image_height(file_resource.image_media_metadata().height());
entry->set_image_rotation(file_resource.image_media_metadata().rotation());
// CommonMetadata
entry->set_etag(file_resource.etag());
// entry->authors_
// entry->links_.
ScopedVector<google_apis::Link> links;
for (size_t i = 0; i < file_resource.parents().size(); ++i) {
google_apis::Link* link = new google_apis::Link;
link->set_type(google_apis::Link::LINK_PARENT);
link->set_href(file_resource.parents()[i].parent_link());
links.push_back(link);
}
if (!file_resource.alternate_link().is_empty()) {
google_apis::Link* link = new google_apis::Link;
link->set_type(google_apis::Link::LINK_ALTERNATE);
link->set_href(file_resource.alternate_link());
links.push_back(link);
}
entry->set_links(links.Pass());
// entry->categories_
entry->set_updated_time(file_resource.modified_date());
entry->set_last_viewed_time(file_resource.last_viewed_by_me_date());
entry->FillRemainingFields();
return entry.Pass();
}
scoped_ptr<google_apis::ResourceEntry>
ConvertChangeResourceToResourceEntry(
const google_apis::ChangeResource& change_resource) {
scoped_ptr<google_apis::ResourceEntry> entry;
if (change_resource.file())
entry = ConvertFileResourceToResourceEntry(*change_resource.file()).Pass();
else
entry.reset(new google_apis::ResourceEntry);
entry->set_resource_id(change_resource.file_id());
// If |is_deleted()| returns true, the file is removed from Drive.
entry->set_removed(change_resource.is_deleted());
entry->set_changestamp(change_resource.change_id());
entry->set_modification_date(change_resource.modification_date());
return entry.Pass();
}
scoped_ptr<google_apis::ResourceList>
ConvertFileListToResourceList(const google_apis::FileList& file_list) {
scoped_ptr<google_apis::ResourceList> feed(new google_apis::ResourceList);
const ScopedVector<google_apis::FileResource>& items = file_list.items();
ScopedVector<google_apis::ResourceEntry> entries;
for (size_t i = 0; i < items.size(); ++i)
entries.push_back(ConvertFileResourceToResourceEntry(*items[i]).release());
feed->set_entries(entries.Pass());
ScopedVector<google_apis::Link> links;
if (!file_list.next_link().is_empty()) {
google_apis::Link* link = new google_apis::Link;
link->set_type(google_apis::Link::LINK_NEXT);
link->set_href(file_list.next_link());
links.push_back(link);
}
feed->set_links(links.Pass());
return feed.Pass();
}
scoped_ptr<google_apis::ResourceList>
ConvertChangeListToResourceList(const google_apis::ChangeList& change_list) {
scoped_ptr<google_apis::ResourceList> feed(new google_apis::ResourceList);
const ScopedVector<google_apis::ChangeResource>& items = change_list.items();
ScopedVector<google_apis::ResourceEntry> entries;
for (size_t i = 0; i < items.size(); ++i) {
entries.push_back(
ConvertChangeResourceToResourceEntry(*items[i]).release());
}
feed->set_entries(entries.Pass());
feed->set_largest_changestamp(change_list.largest_change_id());
ScopedVector<google_apis::Link> links;
if (!change_list.next_link().is_empty()) {
google_apis::Link* link = new google_apis::Link;
link->set_type(google_apis::Link::LINK_NEXT);
link->set_href(change_list.next_link());
links.push_back(link);
}
feed->set_links(links.Pass());
return feed.Pass();
}
std::string GetMd5Digest(const base::FilePath& file_path) {
const int kBufferSize = 512 * 1024; // 512kB.
base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
if (!file.IsValid())
return std::string();
base::MD5Context context;
base::MD5Init(&context);
int64 offset = 0;
scoped_ptr<char[]> buffer(new char[kBufferSize]);
while (true) {
int result = file.Read(offset, buffer.get(), kBufferSize);
if (result < 0) {
// Found an error.
return std::string();
}
if (result == 0) {
// End of file.
break;
}
offset += result;
base::MD5Update(&context, base::StringPiece(buffer.get(), result));
}
base::MD5Digest digest;
base::MD5Final(&digest, &context);
return MD5DigestToBase16(digest);
}
const char kWapiRootDirectoryResourceId[] = "folder:root";
} // namespace util
} // namespace drive
| patrickm/chromium.src | chrome/browser/drive/drive_api_util.cc | C++ | bsd-3-clause | 19,627 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
.yui-log{padding-top:3em;}.yui-log-container{width:40em;}.yui-log .yui-log-bd{height:60em;}.yui-log .yui-log-btns{display:none;}.yui-log .yui-log-ft .yui-log-sourcefilters{visibility:hidden;}.yui-log .yui-log-hd{display:none;}.yui-log .yui-log-ft{position:absolute;top:0;}.pass{background-color:green;font-weight:bold;color:white;}.fail{background-color:red;font-weight:bold;color:white;}.ignore{background-color:#666;font-weight:bold;color:white;} | CENDARI/atom | vendor/yui/yuitest/assets/testlogger.css | CSS | agpl-3.0 | 448 | [
30522,
1012,
9805,
2072,
1011,
8833,
1063,
11687,
4667,
1011,
2327,
1024,
1017,
6633,
1025,
1065,
1012,
9805,
2072,
1011,
8833,
1011,
11661,
1063,
9381,
1024,
2871,
6633,
1025,
1065,
1012,
9805,
2072,
1011,
8833,
1012,
9805,
2072,
1011,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
๏ปฟusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace Umbraco.Core.Models.EntityBase
{
/// <summary>
/// A base class for use to implement IRememberBeingDirty/ICanBeDirty
/// </summary>
public abstract class TracksChangesEntityBase : IRememberBeingDirty
{
/// <summary>
/// Tracks the properties that have changed
/// </summary>
private readonly IDictionary<string, bool> _propertyChangedInfo = new Dictionary<string, bool>();
/// <summary>
/// Tracks the properties that we're changed before the last commit (or last call to ResetDirtyProperties)
/// </summary>
private IDictionary<string, bool> _lastPropertyChangedInfo = null;
/// <summary>
/// Property changed event
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Method to call on a property setter.
/// </summary>
/// <param name="propertyInfo">The property info.</param>
protected virtual void OnPropertyChanged(PropertyInfo propertyInfo)
{
_propertyChangedInfo[propertyInfo.Name] = true;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyInfo.Name));
}
}
/// <summary>
/// Indicates whether a specific property on the current entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property is dirty, otherwise False</returns>
public virtual bool IsPropertyDirty(string propertyName)
{
return _propertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public virtual bool IsDirty()
{
return _propertyChangedInfo.Any();
}
/// <summary>
/// Indicates that the entity had been changed and the changes were committed
/// </summary>
/// <returns></returns>
public bool WasDirty()
{
return _lastPropertyChangedInfo != null && _lastPropertyChangedInfo.Any();
}
/// <summary>
/// Indicates whether a specific property on the current entity was changed and the changes were committed
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property was changed, otherwise False. Returns false if the entity had not been previously changed.</returns>
public virtual bool WasPropertyDirty(string propertyName)
{
return WasDirty() && _lastPropertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
/// Resets the remembered dirty properties from before the last commit
/// </summary>
public void ForgetPreviouslyDirtyProperties()
{
_lastPropertyChangedInfo.Clear();
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public virtual void ResetDirtyProperties()
{
ResetDirtyProperties(true);
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <param name="rememberPreviouslyChangedProperties">
/// true if we are to remember the last changes made after resetting
/// </param>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public virtual void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
if (rememberPreviouslyChangedProperties)
{
//copy the changed properties to the last changed properties
_lastPropertyChangedInfo = _propertyChangedInfo.ToDictionary(v => v.Key, v => v.Value);
}
_propertyChangedInfo.Clear();
}
/// <summary>
/// Used by inheritors to set the value of properties, this will detect if the property value actually changed and if it did
/// it will ensure that the property has a dirty flag set.
/// </summary>
/// <param name="setValue"></param>
/// <param name="value"></param>
/// <param name="propertySelector"></param>
/// <returns>returns true if the value changed</returns>
/// <remarks>
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// to the same value, so it's really not dirty.
/// </remarks>
internal bool SetPropertyValueAndDetectChanges<T>(Func<T, T> setValue, T value, PropertyInfo propertySelector)
{
var initVal = value;
var newVal = setValue(value);
if (!Equals(initVal, newVal))
{
OnPropertyChanged(propertySelector);
return true;
}
return false;
}
}
} | zidad/Umbraco-CMS | src/Umbraco.Core/Models/EntityBase/TracksChangesEntityBase.cs | C# | mit | 5,915 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
6922,
5302,
9247,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
9185,
1025,
3415,
15327,
8529,
10024,
3597,
1012,
4563,
1012,
4275,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.isme.zteui.cache;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader.ImageCache;
/**
* Title: Volley ็็ผๅญ็ฑป</br><br>
* Description: </br><br>
* Copyright: Copyright(c)2003</br><br>
* Company: ihalma </br><br>
* @author and</br><br>
* @version 1 </br><br>
* data: 2015-3-17</br>
*/
public class BitmapLruCache implements ImageCache {
private LruCache<String, Bitmap> mCache;
/**
* ๆๅคง็ผๅญ 10 M
*/
public BitmapLruCache() {
int maxSize = 1024 * 1024 * 10; //ๆๅคง็ผๅญ10M
mCache = new LruCache<String, Bitmap>(maxSize){
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight();
}
};
}
@Override
public Bitmap getBitmap(String url) {
return mCache.get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
mCache.put(url, bitmap);
}
}
| heyugtan/zteUI | ZTEUI/src/com/isme/zteui/cache/BitmapLruCache.java | Java | mit | 944 | [
30522,
7427,
4012,
1012,
2003,
4168,
1012,
1062,
2618,
10179,
1012,
17053,
1025,
12324,
11924,
1012,
8389,
1012,
2978,
2863,
2361,
1025,
12324,
11924,
1012,
2490,
1012,
1058,
2549,
1012,
21183,
4014,
1012,
1048,
6820,
3540,
5403,
1025,
1232... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* This file is part of Onlogistics, a web based ERP and supply chain
* management application.
*
* Copyright (C) 2003-2008 ATEOR
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* PHP version 5.1.0+
*
* @package Onlogistics
* @author ATEOR dev team <dev@ateor.com>
* @copyright 2003-2008 ATEOR <contact@ateor.com>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU AGPL
* @version SVN: $Id$
* @link http://www.onlogistics.org
* @link http://onlogistics.googlecode.com
* @since File available since release 0.1.0
* @filesource
*/
class GridColumnOrderWOOpeTaskList extends AbstractGridColumn {
/**
* Constructor
*
* @access protected
*/
function GridColumnOrderWOOpeTaskList($title = '', $params = array()) {
parent::__construct($title, $params);
}
function Render($object) {
require_once('Objects/WorkOrder.php');
$WorkOrderState = Tools::getValueFromMacro($object, '%OwnerWorkerOrder.State%');
if ($WorkOrderState == WorkOrder::WORK_ORDER_STATE_FULL) { // si le WO associe est cloture
if (0 == $object->GetOrderInWorkOrder() || is_Null($object->GetOrderInWorkOrder())) {
$output = _('N/A');
} else {
$output = $object->GetOrderInWorkOrder();
}
} else { // si pas cloture, on propose de le modifier: input text
if (0 == $object->GetOrderInWorkOrder() || is_Null($object->GetOrderInWorkOrder())) {
$output = '<input type="text" name="orderInWO[]" size="3" value="">';
} else {
$output = '<input type="text" name="orderInWO[]" size="3" value="' . $object->GetOrderInWorkOrder() . '">';
}
$output .= '<input type="hidden" name="OpeId[]" value="' . $object->GetId() . '">';
}
return $output;
}
}
?>
| danilo-cesar/onlogistics | lib/CustomGrid/Columns/GridColumnOrderWOOpeTaskList.php | PHP | agpl-3.0 | 2,613 | [
30522,
1026,
1029,
25718,
1013,
1008,
6819,
2213,
1024,
2275,
7818,
2696,
2497,
21628,
16033,
2361,
1027,
1018,
5670,
9148,
11927,
2232,
1027,
1018,
3730,
2696,
5910,
14399,
1027,
1018,
1024,
1008,
1013,
1013,
1008,
1008,
1008,
2023,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2018 Uber Technologies, Inc.
//
// 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.
package m3ql
//go:generate peg -inline -switch src/query/parser/m3ql/grammar.peg
import (
"fmt"
"io"
"math"
"os"
"sort"
"strconv"
)
const endSymbol rune = 1114112
/* The rule types inferred from the grammar are below. */
type pegRule uint8
const (
ruleUnknown pegRule = iota
ruleGrammar
ruleMacroDef
rulePipeline
ruleExpression
ruleFunctionCall
ruleArgument
ruleKeywordSpecifier
ruleNesting
ruleSpacing
ruleSpace
ruleEOL
ruleComment
ruleCommentStart
ruleIdentifier
ruleIdentifierStart
ruleIdentifierChars
ruleOperator
ruleOperatorSymbols
ruleBoolean
ruleTrue
ruleFalse
ruleNumber
ruleIntegralNumber
ruleFloatingNumber
ruleMinus
ruleStringLiteral
ruleQuoteChar
rulePattern
rulePatternChars
ruleGlobSymbols
ruleSemicolon
ruleEquals
rulePipe
ruleLParenthesis
ruleRParenthesis
ruleColon
ruleEOF
ruleAction0
ruleAction1
ruleAction2
ruleAction3
ruleAction4
ruleAction5
ruleAction6
ruleAction7
ruleAction8
ruleAction9
rulePegText
)
var rul3s = [...]string{
"Unknown",
"Grammar",
"MacroDef",
"Pipeline",
"Expression",
"FunctionCall",
"Argument",
"KeywordSpecifier",
"Nesting",
"Spacing",
"Space",
"EOL",
"Comment",
"CommentStart",
"Identifier",
"IdentifierStart",
"IdentifierChars",
"Operator",
"OperatorSymbols",
"Boolean",
"True",
"False",
"Number",
"IntegralNumber",
"FloatingNumber",
"Minus",
"StringLiteral",
"QuoteChar",
"Pattern",
"PatternChars",
"GlobSymbols",
"Semicolon",
"Equals",
"Pipe",
"LParenthesis",
"RParenthesis",
"Colon",
"EOF",
"Action0",
"Action1",
"Action2",
"Action3",
"Action4",
"Action5",
"Action6",
"Action7",
"Action8",
"Action9",
"PegText",
}
type token32 struct {
pegRule
begin, end uint32
}
func (t *token32) String() string {
return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v", rul3s[t.pegRule], t.begin, t.end)
}
type node32 struct {
token32
up, next *node32
}
func (node *node32) print(w io.Writer, pretty bool, buffer string) {
var print func(node *node32, depth int)
print = func(node *node32, depth int) {
for node != nil {
for c := 0; c < depth; c++ {
fmt.Printf(" ")
}
rule := rul3s[node.pegRule]
quote := strconv.Quote(string(([]rune(buffer)[node.begin:node.end])))
if !pretty {
fmt.Fprintf(w, "%v %v\n", rule, quote)
} else {
fmt.Fprintf(w, "\x1B[34m%v\x1B[m %v\n", rule, quote)
}
if node.up != nil {
print(node.up, depth+1)
}
node = node.next
}
}
print(node, 0)
}
func (node *node32) Print(w io.Writer, buffer string) {
node.print(w, false, buffer)
}
func (node *node32) PrettyPrint(w io.Writer, buffer string) {
node.print(w, true, buffer)
}
type tokens32 struct {
tree []token32
}
func (t *tokens32) Trim(length uint32) {
t.tree = t.tree[:length]
}
func (t *tokens32) Print() {
for _, token := range t.tree {
fmt.Println(token.String())
}
}
func (t *tokens32) AST() *node32 {
type element struct {
node *node32
down *element
}
tokens := t.Tokens()
var stack *element
for _, token := range tokens {
if token.begin == token.end {
continue
}
node := &node32{token32: token}
for stack != nil && stack.node.begin >= token.begin && stack.node.end <= token.end {
stack.node.next = node.up
node.up = stack.node
stack = stack.down
}
stack = &element{node: node, down: stack}
}
if stack != nil {
return stack.node
}
return nil
}
func (t *tokens32) PrintSyntaxTree(buffer string) {
t.AST().Print(os.Stdout, buffer)
}
func (t *tokens32) WriteSyntaxTree(w io.Writer, buffer string) {
t.AST().Print(w, buffer)
}
func (t *tokens32) PrettyPrintSyntaxTree(buffer string) {
t.AST().PrettyPrint(os.Stdout, buffer)
}
func (t *tokens32) Add(rule pegRule, begin, end, index uint32) {
if tree := t.tree; int(index) >= len(tree) {
expanded := make([]token32, 2*len(tree))
copy(expanded, tree)
t.tree = expanded
}
t.tree[index] = token32{
pegRule: rule,
begin: begin,
end: end,
}
}
func (t *tokens32) Tokens() []token32 {
return t.tree
}
type m3ql struct {
scriptBuilder
Buffer string
buffer []rune
rules [49]func() bool
parse func(rule ...int) error
reset func()
Pretty bool
tokens32
}
func (p *m3ql) Parse(rule ...int) error {
return p.parse(rule...)
}
func (p *m3ql) Reset() {
p.reset()
}
type textPosition struct {
line, symbol int
}
type textPositionMap map[int]textPosition
func translatePositions(buffer []rune, positions []int) textPositionMap {
length, translations, j, line, symbol := len(positions), make(textPositionMap, len(positions)), 0, 1, 0
sort.Ints(positions)
search:
for i, c := range buffer {
if c == '\n' {
line, symbol = line+1, 0
} else {
symbol++
}
if i == positions[j] {
translations[positions[j]] = textPosition{line, symbol}
for j++; j < length; j++ {
if i != positions[j] {
continue search
}
}
break search
}
}
return translations
}
type parseError struct {
p *m3ql
max token32
}
func (e *parseError) Error() string {
tokens, error := []token32{e.max}, "\n"
positions, p := make([]int, 2*len(tokens)), 0
for _, token := range tokens {
positions[p], p = int(token.begin), p+1
positions[p], p = int(token.end), p+1
}
translations := translatePositions(e.p.buffer, positions)
format := "parse error near %v (line %v symbol %v - line %v symbol %v):\n%v\n"
if e.p.Pretty {
format = "parse error near \x1B[34m%v\x1B[m (line %v symbol %v - line %v symbol %v):\n%v\n"
}
for _, token := range tokens {
begin, end := int(token.begin), int(token.end)
error += fmt.Sprintf(format,
rul3s[token.pegRule],
translations[begin].line, translations[begin].symbol,
translations[end].line, translations[end].symbol,
strconv.Quote(string(e.p.buffer[begin:end])))
}
return error
}
func (p *m3ql) PrintSyntaxTree() {
if p.Pretty {
p.tokens32.PrettyPrintSyntaxTree(p.Buffer)
} else {
p.tokens32.PrintSyntaxTree(p.Buffer)
}
}
func (p *m3ql) WriteSyntaxTree(w io.Writer) {
p.tokens32.WriteSyntaxTree(w, p.Buffer)
}
func (p *m3ql) Execute() {
buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
for _, token := range p.Tokens() {
switch token.pegRule {
case rulePegText:
begin, end = int(token.begin), int(token.end)
text = string(_buffer[begin:end])
case ruleAction0:
p.newMacro(text)
case ruleAction1:
p.newPipeline()
case ruleAction2:
p.endPipeline()
case ruleAction3:
p.newExpression(text)
case ruleAction4:
p.endExpression()
case ruleAction5:
p.newBooleanArgument(text)
case ruleAction6:
p.newNumericArgument(text)
case ruleAction7:
p.newPatternArgument(text)
case ruleAction8:
p.newStringLiteralArgument(text)
case ruleAction9:
p.newKeywordArgument(text)
}
}
_, _, _, _, _ = buffer, _buffer, text, begin, end
}
func (p *m3ql) Init() {
var (
max token32
position, tokenIndex uint32
buffer []rune
)
p.reset = func() {
max = token32{}
position, tokenIndex = 0, 0
p.buffer = []rune(p.Buffer)
if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol {
p.buffer = append(p.buffer, endSymbol)
}
buffer = p.buffer
}
p.reset()
_rules := p.rules
tree := tokens32{tree: make([]token32, math.MaxInt16)}
p.parse = func(rule ...int) error {
r := 1
if len(rule) > 0 {
r = rule[0]
}
matches := p.rules[r]()
p.tokens32 = tree
if matches {
p.Trim(tokenIndex)
return nil
}
return &parseError{p, max}
}
add := func(rule pegRule, begin uint32) {
tree.Add(rule, begin, position, tokenIndex)
tokenIndex++
if begin != position && position > max.end {
max = token32{rule, begin, position}
}
}
matchDot := func() bool {
if buffer[position] != endSymbol {
position++
return true
}
return false
}
/*matchChar := func(c byte) bool {
if buffer[position] == c {
position++
return true
}
return false
}*/
/*matchRange := func(lower byte, upper byte) bool {
if c := buffer[position]; c >= lower && c <= upper {
position++
return true
}
return false
}*/
_rules = [...]func() bool{
nil,
/* 0 Grammar <- <(Spacing (MacroDef Semicolon)* Pipeline EOF)> */
func() bool {
position0, tokenIndex0 := position, tokenIndex
{
position1 := position
if !_rules[ruleSpacing]() {
goto l0
}
l2:
{
position3, tokenIndex3 := position, tokenIndex
{
position4 := position
if !_rules[ruleIdentifier]() {
goto l3
}
{
add(ruleAction0, position)
}
{
position6 := position
if buffer[position] != rune('=') {
goto l3
}
position++
if !_rules[ruleSpacing]() {
goto l3
}
add(ruleEquals, position6)
}
if !_rules[rulePipeline]() {
goto l3
}
add(ruleMacroDef, position4)
}
{
position7 := position
if buffer[position] != rune(';') {
goto l3
}
position++
if !_rules[ruleSpacing]() {
goto l3
}
add(ruleSemicolon, position7)
}
goto l2
l3:
position, tokenIndex = position3, tokenIndex3
}
if !_rules[rulePipeline]() {
goto l0
}
{
position8 := position
{
position9, tokenIndex9 := position, tokenIndex
if !matchDot() {
goto l9
}
goto l0
l9:
position, tokenIndex = position9, tokenIndex9
}
add(ruleEOF, position8)
}
add(ruleGrammar, position1)
}
return true
l0:
position, tokenIndex = position0, tokenIndex0
return false
},
/* 1 MacroDef <- <(Identifier Action0 Equals Pipeline)> */
nil,
/* 2 Pipeline <- <(Action1 Expression (Pipe Expression)* Action2)> */
func() bool {
position11, tokenIndex11 := position, tokenIndex
{
position12 := position
{
add(ruleAction1, position)
}
if !_rules[ruleExpression]() {
goto l11
}
l14:
{
position15, tokenIndex15 := position, tokenIndex
{
position16 := position
if buffer[position] != rune('|') {
goto l15
}
position++
if !_rules[ruleSpacing]() {
goto l15
}
add(rulePipe, position16)
}
if !_rules[ruleExpression]() {
goto l15
}
goto l14
l15:
position, tokenIndex = position15, tokenIndex15
}
{
add(ruleAction2, position)
}
add(rulePipeline, position12)
}
return true
l11:
position, tokenIndex = position11, tokenIndex11
return false
},
/* 3 Expression <- <(FunctionCall / Nesting)> */
func() bool {
position18, tokenIndex18 := position, tokenIndex
{
position19 := position
{
position20, tokenIndex20 := position, tokenIndex
{
position22 := position
{
position23, tokenIndex23 := position, tokenIndex
if !_rules[ruleIdentifier]() {
goto l24
}
goto l23
l24:
position, tokenIndex = position23, tokenIndex23
{
position25 := position
{
position26 := position
{
position27 := position
{
position28, tokenIndex28 := position, tokenIndex
if buffer[position] != rune('<') {
goto l29
}
position++
if buffer[position] != rune('=') {
goto l29
}
position++
goto l28
l29:
position, tokenIndex = position28, tokenIndex28
if buffer[position] != rune('>') {
goto l30
}
position++
if buffer[position] != rune('=') {
goto l30
}
position++
goto l28
l30:
position, tokenIndex = position28, tokenIndex28
{
switch buffer[position] {
case '>':
if buffer[position] != rune('>') {
goto l21
}
position++
break
case '!':
if buffer[position] != rune('!') {
goto l21
}
position++
if buffer[position] != rune('=') {
goto l21
}
position++
break
case '=':
if buffer[position] != rune('=') {
goto l21
}
position++
if buffer[position] != rune('=') {
goto l21
}
position++
break
default:
if buffer[position] != rune('<') {
goto l21
}
position++
break
}
}
}
l28:
add(ruleOperatorSymbols, position27)
}
add(rulePegText, position26)
}
if !_rules[ruleSpacing]() {
goto l21
}
add(ruleOperator, position25)
}
}
l23:
{
add(ruleAction3, position)
}
l33:
{
position34, tokenIndex34 := position, tokenIndex
{
position35 := position
{
position36, tokenIndex36 := position, tokenIndex
{
position38 := position
if !_rules[ruleIdentifier]() {
goto l36
}
{
add(ruleAction9, position)
}
{
position40 := position
if buffer[position] != rune(':') {
goto l36
}
position++
if !_rules[ruleSpacing]() {
goto l36
}
add(ruleColon, position40)
}
add(ruleKeywordSpecifier, position38)
}
goto l37
l36:
position, tokenIndex = position36, tokenIndex36
}
l37:
{
position41, tokenIndex41 := position, tokenIndex
{
position43 := position
{
position44 := position
{
position45, tokenIndex45 := position, tokenIndex
{
position47 := position
{
position48, tokenIndex48 := position, tokenIndex
if buffer[position] != rune('t') {
goto l49
}
position++
goto l48
l49:
position, tokenIndex = position48, tokenIndex48
if buffer[position] != rune('T') {
goto l46
}
position++
}
l48:
{
position50, tokenIndex50 := position, tokenIndex
if buffer[position] != rune('r') {
goto l51
}
position++
goto l50
l51:
position, tokenIndex = position50, tokenIndex50
if buffer[position] != rune('R') {
goto l46
}
position++
}
l50:
{
position52, tokenIndex52 := position, tokenIndex
if buffer[position] != rune('u') {
goto l53
}
position++
goto l52
l53:
position, tokenIndex = position52, tokenIndex52
if buffer[position] != rune('U') {
goto l46
}
position++
}
l52:
{
position54, tokenIndex54 := position, tokenIndex
if buffer[position] != rune('e') {
goto l55
}
position++
goto l54
l55:
position, tokenIndex = position54, tokenIndex54
if buffer[position] != rune('E') {
goto l46
}
position++
}
l54:
add(ruleTrue, position47)
}
goto l45
l46:
position, tokenIndex = position45, tokenIndex45
{
position56 := position
{
position57, tokenIndex57 := position, tokenIndex
if buffer[position] != rune('f') {
goto l58
}
position++
goto l57
l58:
position, tokenIndex = position57, tokenIndex57
if buffer[position] != rune('F') {
goto l42
}
position++
}
l57:
{
position59, tokenIndex59 := position, tokenIndex
if buffer[position] != rune('a') {
goto l60
}
position++
goto l59
l60:
position, tokenIndex = position59, tokenIndex59
if buffer[position] != rune('A') {
goto l42
}
position++
}
l59:
{
position61, tokenIndex61 := position, tokenIndex
if buffer[position] != rune('l') {
goto l62
}
position++
goto l61
l62:
position, tokenIndex = position61, tokenIndex61
if buffer[position] != rune('L') {
goto l42
}
position++
}
l61:
{
position63, tokenIndex63 := position, tokenIndex
if buffer[position] != rune('s') {
goto l64
}
position++
goto l63
l64:
position, tokenIndex = position63, tokenIndex63
if buffer[position] != rune('S') {
goto l42
}
position++
}
l63:
{
position65, tokenIndex65 := position, tokenIndex
if buffer[position] != rune('e') {
goto l66
}
position++
goto l65
l66:
position, tokenIndex = position65, tokenIndex65
if buffer[position] != rune('E') {
goto l42
}
position++
}
l65:
add(ruleFalse, position56)
}
}
l45:
add(rulePegText, position44)
}
{
position67, tokenIndex67 := position, tokenIndex
if !_rules[rulePatternChars]() {
goto l67
}
goto l42
l67:
position, tokenIndex = position67, tokenIndex67
}
if !_rules[ruleSpacing]() {
goto l42
}
add(ruleBoolean, position43)
}
{
add(ruleAction5, position)
}
goto l41
l42:
position, tokenIndex = position41, tokenIndex41
{
position70 := position
{
position71 := position
{
position72, tokenIndex72 := position, tokenIndex
{
position74 := position
if buffer[position] != rune('-') {
goto l72
}
position++
add(ruleMinus, position74)
}
goto l73
l72:
position, tokenIndex = position72, tokenIndex72
}
l73:
{
position75, tokenIndex75 := position, tokenIndex
{
position77 := position
{
position78, tokenIndex78 := position, tokenIndex
if !_rules[ruleIntegralNumber]() {
goto l78
}
goto l79
l78:
position, tokenIndex = position78, tokenIndex78
}
l79:
if buffer[position] != rune('.') {
goto l76
}
position++
if !_rules[ruleIntegralNumber]() {
goto l76
}
add(ruleFloatingNumber, position77)
}
goto l75
l76:
position, tokenIndex = position75, tokenIndex75
if !_rules[ruleIntegralNumber]() {
goto l69
}
}
l75:
add(rulePegText, position71)
}
{
position80, tokenIndex80 := position, tokenIndex
if !_rules[rulePatternChars]() {
goto l80
}
goto l69
l80:
position, tokenIndex = position80, tokenIndex80
}
if !_rules[ruleSpacing]() {
goto l69
}
add(ruleNumber, position70)
}
{
add(ruleAction6, position)
}
goto l41
l69:
position, tokenIndex = position41, tokenIndex41
{
switch buffer[position] {
case '(':
if !_rules[ruleNesting]() {
goto l34
}
break
case '"':
{
position83 := position
if !_rules[ruleQuoteChar]() {
goto l34
}
{
position84 := position
l85:
{
position86, tokenIndex86 := position, tokenIndex
{
position87, tokenIndex87 := position, tokenIndex
if buffer[position] != rune('"') {
goto l87
}
position++
goto l86
l87:
position, tokenIndex = position87, tokenIndex87
}
if !matchDot() {
goto l86
}
goto l85
l86:
position, tokenIndex = position86, tokenIndex86
}
add(rulePegText, position84)
}
if !_rules[ruleQuoteChar]() {
goto l34
}
if !_rules[ruleSpacing]() {
goto l34
}
add(ruleStringLiteral, position83)
}
{
add(ruleAction8, position)
}
break
default:
{
position89 := position
{
position90 := position
if !_rules[rulePatternChars]() {
goto l34
}
l91:
{
position92, tokenIndex92 := position, tokenIndex
if !_rules[rulePatternChars]() {
goto l92
}
goto l91
l92:
position, tokenIndex = position92, tokenIndex92
}
add(rulePegText, position90)
}
if !_rules[ruleSpacing]() {
goto l34
}
add(rulePattern, position89)
}
{
add(ruleAction7, position)
}
break
}
}
}
l41:
add(ruleArgument, position35)
}
goto l33
l34:
position, tokenIndex = position34, tokenIndex34
}
{
add(ruleAction4, position)
}
add(ruleFunctionCall, position22)
}
goto l20
l21:
position, tokenIndex = position20, tokenIndex20
if !_rules[ruleNesting]() {
goto l18
}
}
l20:
add(ruleExpression, position19)
}
return true
l18:
position, tokenIndex = position18, tokenIndex18
return false
},
/* 4 FunctionCall <- <((Identifier / Operator) Action3 Argument* Action4)> */
nil,
/* 5 Argument <- <(KeywordSpecifier? ((Boolean Action5) / (Number Action6) / ((&('(') Nesting) | (&('"') (StringLiteral Action8)) | (&('$' | '*' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '?' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '[' | '\\' | ']' | '^' | '_' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '}') (Pattern Action7)))))> */
nil,
/* 6 KeywordSpecifier <- <(Identifier Action9 Colon)> */
nil,
/* 7 Nesting <- <(LParenthesis Pipeline RParenthesis)> */
func() bool {
position98, tokenIndex98 := position, tokenIndex
{
position99 := position
{
position100 := position
if buffer[position] != rune('(') {
goto l98
}
position++
if !_rules[ruleSpacing]() {
goto l98
}
add(ruleLParenthesis, position100)
}
if !_rules[rulePipeline]() {
goto l98
}
{
position101 := position
if buffer[position] != rune(')') {
goto l98
}
position++
if !_rules[ruleSpacing]() {
goto l98
}
add(ruleRParenthesis, position101)
}
add(ruleNesting, position99)
}
return true
l98:
position, tokenIndex = position98, tokenIndex98
return false
},
/* 8 Spacing <- <((&('#') Comment) | (&('\n' | '\r') EOL) | (&('\t' | ' ') Space))*> */
func() bool {
{
position103 := position
l104:
{
position105, tokenIndex105 := position, tokenIndex
{
switch buffer[position] {
case '#':
{
position107 := position
{
position108 := position
if buffer[position] != rune('#') {
goto l105
}
position++
add(ruleCommentStart, position108)
}
l109:
{
position110, tokenIndex110 := position, tokenIndex
{
position111, tokenIndex111 := position, tokenIndex
if !_rules[ruleEOL]() {
goto l111
}
goto l110
l111:
position, tokenIndex = position111, tokenIndex111
}
if !matchDot() {
goto l110
}
goto l109
l110:
position, tokenIndex = position110, tokenIndex110
}
add(ruleComment, position107)
}
break
case '\n', '\r':
if !_rules[ruleEOL]() {
goto l105
}
break
default:
{
position112 := position
{
position113, tokenIndex113 := position, tokenIndex
if buffer[position] != rune(' ') {
goto l114
}
position++
goto l113
l114:
position, tokenIndex = position113, tokenIndex113
if buffer[position] != rune('\t') {
goto l105
}
position++
}
l113:
add(ruleSpace, position112)
}
break
}
}
goto l104
l105:
position, tokenIndex = position105, tokenIndex105
}
add(ruleSpacing, position103)
}
return true
},
/* 9 Space <- <(' ' / '\t')> */
nil,
/* 10 EOL <- <(('\r' '\n') / '\n' / '\r')> */
func() bool {
position116, tokenIndex116 := position, tokenIndex
{
position117 := position
{
position118, tokenIndex118 := position, tokenIndex
if buffer[position] != rune('\r') {
goto l119
}
position++
if buffer[position] != rune('\n') {
goto l119
}
position++
goto l118
l119:
position, tokenIndex = position118, tokenIndex118
if buffer[position] != rune('\n') {
goto l120
}
position++
goto l118
l120:
position, tokenIndex = position118, tokenIndex118
if buffer[position] != rune('\r') {
goto l116
}
position++
}
l118:
add(ruleEOL, position117)
}
return true
l116:
position, tokenIndex = position116, tokenIndex116
return false
},
/* 11 Comment <- <(CommentStart (!EOL .)*)> */
nil,
/* 12 CommentStart <- <'#'> */
nil,
/* 13 Identifier <- <(<(IdentifierStart IdentifierChars*)> Spacing)> */
func() bool {
position123, tokenIndex123 := position, tokenIndex
{
position124 := position
{
position125 := position
if !_rules[ruleIdentifierStart]() {
goto l123
}
l126:
{
position127, tokenIndex127 := position, tokenIndex
if !_rules[ruleIdentifierChars]() {
goto l127
}
goto l126
l127:
position, tokenIndex = position127, tokenIndex127
}
add(rulePegText, position125)
}
if !_rules[ruleSpacing]() {
goto l123
}
add(ruleIdentifier, position124)
}
return true
l123:
position, tokenIndex = position123, tokenIndex123
return false
},
/* 14 IdentifierStart <- <((&('_') '_') | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z') [A-Z]) | (&('a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') [a-z]))> */
func() bool {
position128, tokenIndex128 := position, tokenIndex
{
position129 := position
{
switch buffer[position] {
case '_':
if buffer[position] != rune('_') {
goto l128
}
position++
break
case 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z':
if c := buffer[position]; c < rune('A') || c > rune('Z') {
goto l128
}
position++
break
default:
if c := buffer[position]; c < rune('a') || c > rune('z') {
goto l128
}
position++
break
}
}
add(ruleIdentifierStart, position129)
}
return true
l128:
position, tokenIndex = position128, tokenIndex128
return false
},
/* 15 IdentifierChars <- <((&('\\') '\\') | (&('/') '/') | (&('-') '-') | (&('.') '.') | (&('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') [0-9]) | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '_' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') IdentifierStart))> */
func() bool {
position131, tokenIndex131 := position, tokenIndex
{
position132 := position
{
switch buffer[position] {
case '\\':
if buffer[position] != rune('\\') {
goto l131
}
position++
break
case '/':
if buffer[position] != rune('/') {
goto l131
}
position++
break
case '-':
if buffer[position] != rune('-') {
goto l131
}
position++
break
case '.':
if buffer[position] != rune('.') {
goto l131
}
position++
break
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
if c := buffer[position]; c < rune('0') || c > rune('9') {
goto l131
}
position++
break
default:
if !_rules[ruleIdentifierStart]() {
goto l131
}
break
}
}
add(ruleIdentifierChars, position132)
}
return true
l131:
position, tokenIndex = position131, tokenIndex131
return false
},
/* 16 Operator <- <(<OperatorSymbols> Spacing)> */
nil,
/* 17 OperatorSymbols <- <(('<' '=') / ('>' '=') / ((&('>') '>') | (&('!') ('!' '=')) | (&('=') ('=' '=')) | (&('<') '<')))> */
nil,
/* 18 Boolean <- <(<(True / False)> !PatternChars Spacing)> */
nil,
/* 19 True <- <(('t' / 'T') ('r' / 'R') ('u' / 'U') ('e' / 'E'))> */
nil,
/* 20 False <- <(('f' / 'F') ('a' / 'A') ('l' / 'L') ('s' / 'S') ('e' / 'E'))> */
nil,
/* 21 Number <- <(<(Minus? (FloatingNumber / IntegralNumber))> !PatternChars Spacing)> */
nil,
/* 22 IntegralNumber <- <[0-9]+> */
func() bool {
position140, tokenIndex140 := position, tokenIndex
{
position141 := position
if c := buffer[position]; c < rune('0') || c > rune('9') {
goto l140
}
position++
l142:
{
position143, tokenIndex143 := position, tokenIndex
if c := buffer[position]; c < rune('0') || c > rune('9') {
goto l143
}
position++
goto l142
l143:
position, tokenIndex = position143, tokenIndex143
}
add(ruleIntegralNumber, position141)
}
return true
l140:
position, tokenIndex = position140, tokenIndex140
return false
},
/* 23 FloatingNumber <- <(IntegralNumber? '.' IntegralNumber)> */
nil,
/* 24 Minus <- <'-'> */
nil,
/* 25 StringLiteral <- <(QuoteChar <(!'"' .)*> QuoteChar Spacing)> */
nil,
/* 26 QuoteChar <- <'"'> */
func() bool {
position147, tokenIndex147 := position, tokenIndex
{
position148 := position
if buffer[position] != rune('"') {
goto l147
}
position++
add(ruleQuoteChar, position148)
}
return true
l147:
position, tokenIndex = position147, tokenIndex147
return false
},
/* 27 Pattern <- <(<PatternChars+> Spacing)> */
nil,
/* 28 PatternChars <- <(IdentifierChars / GlobSymbols)> */
func() bool {
position150, tokenIndex150 := position, tokenIndex
{
position151 := position
{
position152, tokenIndex152 := position, tokenIndex
if !_rules[ruleIdentifierChars]() {
goto l153
}
goto l152
l153:
position, tokenIndex = position152, tokenIndex152
{
position154 := position
{
switch buffer[position] {
case '$':
if buffer[position] != rune('$') {
goto l150
}
position++
break
case '^':
if buffer[position] != rune('^') {
goto l150
}
position++
break
case ',':
if buffer[position] != rune(',') {
goto l150
}
position++
break
case '?':
if buffer[position] != rune('?') {
goto l150
}
position++
break
case '*':
if buffer[position] != rune('*') {
goto l150
}
position++
break
case ']':
if buffer[position] != rune(']') {
goto l150
}
position++
break
case '[':
if buffer[position] != rune('[') {
goto l150
}
position++
break
case '}':
if buffer[position] != rune('}') {
goto l150
}
position++
break
default:
if buffer[position] != rune('{') {
goto l150
}
position++
break
}
}
add(ruleGlobSymbols, position154)
}
}
l152:
add(rulePatternChars, position151)
}
return true
l150:
position, tokenIndex = position150, tokenIndex150
return false
},
/* 29 GlobSymbols <- <((&('$') '$') | (&('^') '^') | (&(',') ',') | (&('?') '?') | (&('*') '*') | (&(']') ']') | (&('[') '[') | (&('}') '}') | (&('{') '{'))> */
nil,
/* 30 Semicolon <- <(';' Spacing)> */
nil,
/* 31 Equals <- <('=' Spacing)> */
nil,
/* 32 Pipe <- <('|' Spacing)> */
nil,
/* 33 LParenthesis <- <('(' Spacing)> */
nil,
/* 34 RParenthesis <- <(')' Spacing)> */
nil,
/* 35 Colon <- <(':' Spacing)> */
nil,
/* 36 EOF <- <!.> */
nil,
/* 38 Action0 <- <{ p.newMacro(text) }> */
nil,
/* 39 Action1 <- <{ p.newPipeline() }> */
nil,
/* 40 Action2 <- <{ p.endPipeline() }> */
nil,
/* 41 Action3 <- <{ p.newExpression(text) }> */
nil,
/* 42 Action4 <- <{ p.endExpression() }> */
nil,
/* 43 Action5 <- <{ p.newBooleanArgument(text) }> */
nil,
/* 44 Action6 <- <{ p.newNumericArgument(text) }> */
nil,
/* 45 Action7 <- <{ p.newPatternArgument(text) }> */
nil,
/* 46 Action8 <- <{ p.newStringLiteralArgument(text) }> */
nil,
/* 47 Action9 <- <{ p.newKeywordArgument(text) }> */
nil,
nil,
}
p.rules = _rules
}
| m3db/m3db | src/query/parser/m3ql/grammar.peg.go | GO | apache-2.0 | 37,003 | [
30522,
1013,
30524,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1013,
1013,
1997,
2023,
4007,
1998,
3378,
12653,
6764,
1006,
1996,
1000,
4007,
1000,
1007,
1010,
2000,
3066,
1013,
1013,
1999,
1996,
4007,
2302,
16840,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "catch.hpp"
#include "CourseScheduleII.hpp"
TEST_CASE("Course Schedule II") {
CourseScheduleII s;
SECTION("Sample test") {
vector<pair<int, int>> pre1{{1, 0}};
vector<int> expected1{0, 1};
vector<pair<int, int>> pre2{{1, 0},
{0, 1}};
vector<int> expected2;
REQUIRE(s.findOrder(2, pre1) == expected1);
REQUIRE(s.findOrder(2, pre2) == expected2);
vector<pair<int, int>> pre3{{1, 0},
{2, 0},
{3, 1},
{3, 2}};
vector<vector<int>> expected3{{0, 1, 2, 3},
{0, 2, 1, 3}};
vector<int> result3 = s.findOrder(4, pre3);
REQUIRE_FALSE(find(expected3.begin(), expected3.end(),
result3) == expected3.end());
}
}
| yanzhe-chen/leetcode | tests/CourseScheduleIITest.cpp | C++ | mit | 910 | [
30522,
1001,
2421,
1000,
4608,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
5352,
7690,
9307,
6137,
1012,
6522,
2361,
1000,
3231,
1035,
2553,
1006,
1000,
2607,
6134,
2462,
1000,
1007,
1063,
5352,
7690,
9307,
6137,
1055,
1025,
2930,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by texi2html, http://www.gnu.org/software/texinfo/ -->
<head>
<title>top section: first</title>
<meta name="description" content="top section: first">
<meta name="keywords" content="top section: first">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="top section">
<link href="../dir/index.html#Top" rel="up" title="(dir)">
<link href="node-in-menu-before-top.html#node-in-menu-before-top" rel="next" title="node in menu before top">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:pre}
span.nolinebreak {white-space:pre}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="first"></a>
<div class="header">
<p>
Next: <a href="index.html#Top" accesskey="n" rel="next">Top</a>, Up: <a href="../dir/index.html#Top" accesskey="u" rel="up">(dir)</a> </p>
</div>
<hr>
<h3 class="node-heading">first</h3>
<p>See <a href="it-doesn_0027t-exists.html#it-doesn_0027t-exists">it doesn't exists</a>
in first node
</p><table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="node-in-menu-before-top.html#node-in-menu-before-top" accesskey="1">node in menu before top</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="other-node-in-menu-before-top.html#other-node-in-menu-before-top" accesskey="2">other node in menu before top</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p>
</p>
</body>
</html>
| cgwalters/texinfo-git-mirror | texi2html/test/sectioning/res_html/novalidate/first.html | HTML | gpl-3.0 | 2,631 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var https = require( 'https' ),
zlib = require( 'zlib' ),
path = require( 'path' ),
fs = require( 'fs' );
var count = 0;
var resolved = 0;
var outputs = [];
var done;
function check()
{
if (resolved === count) {
normalize();
display();
}
}
function makeBar( length )
{
var i = '';
while (i.length < length) {
i += '=';
}
return i;
}
function normalize()
{
var i,
max = 0,
max2 = 0;
for (i = 0; i < count; i++) {
max = Math.max( max, outputs[i].gzip );
max2 = Math.max( max2, outputs[i].original );
}
for (i = 0; i < count; i++) {
outputs[i].bargraph = makeBar( (outputs[i].gzip / max) * 80 );
outputs[i].bargraph2 = makeBar( (outputs[i].original / max2) * 80 );
}
}
function display()
{
var i;
for (i = 0; i < count; i++) {
console.log( outputs[i].version + ' ' + outputs[i].gzip + ' ' + outputs[i].original );
console.log( 'gzip ' + outputs[i].bargraph );
console.log( 'orig ' + outputs[i].bargraph2 );
}
done();
}
function getSizeAtVersion( version, path )
{
var data = '',
op = {},
req = https.request( {
host: 'raw.github.com',
port: 443,
path: '/timrwood/moment/' + version + path
}, function( res )
{
res.setEncoding( 'utf8' );
res.on( 'data', function( chunk )
{
data += chunk;
} );
res.on( 'end', function( e )
{
zlib.gzip( data, function( error, result )
{
op.version = version;
op.gzip = result.length;
op.original = data.length;
resolved++;
check();
} );
} );
} );
req.on( 'error', function( e )
{
console.log( 'problem with request: ' + e.message );
} );
req.end();
count++;
outputs.push( op );
}
function getRemote()
{
var old_versions = '1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.4.0'.split( ' ' ),
new_versions = '1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.7.1'.split( ' ' ),
i;
for (i = 0; i < old_versions.length; i++) {
getSizeAtVersion( old_versions[i], '/moment.min.js' );
}
for (i = 0; i < new_versions.length; i++) {
getSizeAtVersion( new_versions[i], '/min/moment.min.js' );
}
}
function getLocal()
{
count++;
var op = {};
outputs.push( op );
fs.readFile( path.normalize( __dirname + '/../min/moment.min.js' ), 'utf8', function( err, data )
{
if (err) {
throw err;
}
zlib.gzip( data, function( error, result )
{
op.version = '.next';
op.gzip = result.length;
op.original = data.length;
resolved++;
check();
} );
} );
}
module.exports = function( grunt )
{
grunt.registerTask( 'history', 'Check the codebase filesize over different releases.', function()
{
done = this.async();
getRemote();
getLocal();
} );
};
| hannesk001/SPHERE-Framework | Library/Moment.Js/2.8.4/tasks/history.js | JavaScript | agpl-3.0 | 3,184 | [
30522,
13075,
16770,
1027,
5478,
1006,
1005,
16770,
1005,
1007,
1010,
1062,
29521,
1027,
5478,
1006,
1005,
1062,
29521,
1005,
1007,
1010,
4130,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
1010,
1042,
2015,
1027,
5478,
1006,
1005,
1042,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
package org.apache.taverna.workbench.views.graph.config;
import javax.swing.JPanel;
import org.apache.taverna.configuration.Configurable;
import org.apache.taverna.configuration.ConfigurationUIFactory;
/**
* ConfigurationFactory for the GraphViewConfiguration.
*
* @author David Withers
*/
public class GraphViewConfigurationUIFactory implements ConfigurationUIFactory {
private GraphViewConfiguration graphViewConfiguration;
@Override
public boolean canHandle(String uuid) {
return uuid.equals(getConfigurable().getUUID());
}
@Override
public JPanel getConfigurationPanel() {
return new GraphViewConfigurationPanel(graphViewConfiguration);
}
@Override
public Configurable getConfigurable() {
return graphViewConfiguration;
}
public void setGraphViewConfiguration(
GraphViewConfiguration graphViewConfiguration) {
this.graphViewConfiguration = graphViewConfiguration;
}
}
| ThilinaManamgoda/incubator-taverna-workbench | taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationUIFactory.java | Java | apache-2.0 | 1,714 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class AddPostMarkdownToPosts < ActiveRecord::Migration
def change
add_column :posts, :post_markdown, :text
end
end
| crowdAI/crowdai | doc/technical/archived_migrations/20161114141303_add_post_markdown_to_posts.rb | Ruby | agpl-3.0 | 123 | [
30522,
2465,
5587,
19894,
10665,
7698,
14399,
14122,
2015,
1026,
3161,
2890,
27108,
2094,
1024,
1024,
9230,
13366,
2689,
5587,
1035,
5930,
1024,
8466,
1010,
1024,
2695,
1035,
2928,
7698,
1010,
1024,
3793,
2203,
2203,
102,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package net.lightstone.net.codec;
import java.io.IOException;
import net.lightstone.msg.Message;
import org.jboss.netty.buffer.ChannelBuffer;
public abstract class MessageCodec<T extends Message> {
private final Class<T> clazz;
private final int opcode;
public MessageCodec(Class<T> clazz, int opcode) {
this.clazz = clazz;
this.opcode = opcode;
}
public final Class<T> getType() {
return clazz;
}
public final int getOpcode() {
return opcode;
}
public abstract ChannelBuffer encode(T message) throws IOException;
public abstract T decode(ChannelBuffer buffer) throws IOException;
}
| grahamedgecombe/lightstone | src/net/lightstone/net/codec/MessageCodec.java | Java | mit | 613 | [
30522,
7427,
5658,
1012,
4597,
5524,
1012,
5658,
1012,
3642,
2278,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
5658,
1012,
4597,
5524,
1012,
5796,
2290,
1012,
4471,
1025,
12324,
8917,
1012,
1046,
15853,
2015,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package edu.cmu.sv;
import edu.cmu.sv.database.Ontology;
import edu.cmu.sv.dialog_management.DialogRegistry;
import edu.cmu.sv.domain.DatabaseRegistry;
import edu.cmu.sv.domain.DomainSpec;
import edu.cmu.sv.domain.NonDialogTaskRegistry;
import edu.cmu.sv.domain.smart_house.SmartHouseDatabaseRegistry;
import edu.cmu.sv.domain.smart_house.SmartHouseLexicon;
import edu.cmu.sv.domain.smart_house.SmartHouseNonDialogTaskRegistry;
import edu.cmu.sv.domain.smart_house.SmartHouseOntologyRegistry;
import edu.cmu.sv.domain.smart_house.data.SmartHouseSLUDataset;
import edu.cmu.sv.domain.yoda_skeleton.YodaSkeletonLexicon;
import edu.cmu.sv.domain.yoda_skeleton.YodaSkeletonOntologyRegistry;
import edu.cmu.sv.domain.yoda_skeleton.data.YodaSkeletonSLUDataset;
import edu.cmu.sv.spoken_language_understanding.SLUDataset;
import edu.cmu.sv.spoken_language_understanding.regex_plus_keyword_understander.RegexPlusKeywordUnderstander;
import edu.cmu.sv.yoda_environment.YodaEnvironment;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
import java.util.List;
/**
* Created by David Cohen on 10/29/14.
*
* Generate an artificial corpus and use it to train language components (SLU / LM)
*/
public class TestRegexPlusKeywordUnderstander {
/*
* Can only create one yoda environment per program, since it relies on static classes
* */
@Test
public void Test() throws FileNotFoundException, UnsupportedEncodingException {
// testYodaSkeletonSLU();
testSmartHouseSLU();
// runUnderstander();
}
public void testYodaSkeletonSLU() throws FileNotFoundException, UnsupportedEncodingException {
YodaEnvironment yodaEnvironment = YodaEnvironment.dialogTestingEnvironment();
List<DomainSpec> domainSpecs = new LinkedList<>();
domainSpecs.add(new DomainSpec(
"YODA skeleton domain",
new YodaSkeletonLexicon(),
new YodaSkeletonOntologyRegistry(),
new NonDialogTaskRegistry(),
new DatabaseRegistry()));
for (DomainSpec spec : domainSpecs) {
System.err.println("loading domain spec ..." + spec.getDomainName());
yodaEnvironment.loadDomain(spec);
}
Ontology.finalizeOntology();
DialogRegistry.finalizeDialogRegistry();
((RegexPlusKeywordUnderstander) yodaEnvironment.slu).constructTemplates();
System.err.println("done loading domain");
SLUDataset tmp = new YodaSkeletonSLUDataset();
yodaEnvironment.slu.evaluate(yodaEnvironment, tmp);
}
//
// public void testYelpPhoenixSLU() throws FileNotFoundException, UnsupportedEncodingException {
// YodaEnvironment yodaEnvironment = YodaEnvironment.dialogTestingEnvironment();
//
// List<DomainSpec> domainSpecs = new LinkedList<>();
// domainSpecs.add(new DomainSpec(
// "YODA skeleton domain",
// new YodaSkeletonLexicon(),
// new YodaSkeletonOntologyRegistry(),
// new NonDialogTaskRegistry(),
// new DatabaseRegistry()));
// // yelp phoenix domain
// domainSpecs.add(new DomainSpec(
// "Yelp Phoenix domain",
// new YelpPhoenixLexicon(),
// new YelpPhoenixOntologyRegistry(),
// new YelpPhoenixNonDialogTaskRegistry(),
// new YelpPhoenixDatabaseRegistry()));
//
// for (DomainSpec spec : domainSpecs) {
// System.err.println("loading domain spec ..." + spec.getDomainName());
// yodaEnvironment.loadDomain(spec);
// }
// Ontology.finalizeOntology();
// DialogRegistry.finalizeDialogRegistry();
// ((RegexPlusKeywordUnderstander) yodaEnvironment.slu).constructTemplates();
// System.err.println("done loading domain");
//
// SLUDataset tmp = new YelpPhoenixSLUDataset();
// yodaEnvironment.slu.evaluate(yodaEnvironment, tmp);
// }
public void testSmartHouseSLU() throws FileNotFoundException, UnsupportedEncodingException{
YodaEnvironment yodaEnvironment = YodaEnvironment.dialogTestingEnvironment();
List<DomainSpec> domainSpecs = new LinkedList<>();
domainSpecs.add(new DomainSpec(
"YODA skeleton domain",
new YodaSkeletonLexicon(),
new YodaSkeletonOntologyRegistry(),
new NonDialogTaskRegistry(),
new DatabaseRegistry()));
// smart house domain
domainSpecs.add(new DomainSpec(
"Smart house domain",
new SmartHouseLexicon(),
new SmartHouseOntologyRegistry(),
new SmartHouseNonDialogTaskRegistry(),
new SmartHouseDatabaseRegistry()));
for (DomainSpec spec : domainSpecs) {
System.err.println("loading domain spec ..." + spec.getDomainName());
yodaEnvironment.loadDomain(spec);
}
Ontology.finalizeOntology();
DialogRegistry.finalizeDialogRegistry();
((RegexPlusKeywordUnderstander) yodaEnvironment.slu).constructTemplates();
System.err.println("done loading domain");
SLUDataset tmp = new SmartHouseSLUDataset();
yodaEnvironment.slu.evaluate(yodaEnvironment, tmp);
}
public void runUnderstander(){
YodaEnvironment yodaEnvironment = YodaEnvironment.dialogTestingEnvironment();
List<DomainSpec> domainSpecs = new LinkedList<>();
domainSpecs.add(new DomainSpec(
"YODA skeleton domain",
new YodaSkeletonLexicon(),
new YodaSkeletonOntologyRegistry(),
new NonDialogTaskRegistry(),
new DatabaseRegistry()));
// smart house domain
domainSpecs.add(new DomainSpec(
"Smart house domain",
new SmartHouseLexicon(),
new SmartHouseOntologyRegistry(),
new SmartHouseNonDialogTaskRegistry(),
new SmartHouseDatabaseRegistry()));
for (DomainSpec spec : domainSpecs) {
System.err.println("loading domain spec ..." + spec.getDomainName());
yodaEnvironment.loadDomain(spec);
}
Ontology.finalizeOntology();
DialogRegistry.finalizeDialogRegistry();
((RegexPlusKeywordUnderstander) yodaEnvironment.slu).constructTemplates();
System.err.println("done loading domain");
List<String> testUtterances = new LinkedList<>();
testUtterances.add("turn on the air conditioner");
testUtterances.add("turn it on");
testUtterances.add("turn on it");
testUtterances.add("is the air conditioner on");
testUtterances.add("is the air security system on");
for (String testUtterance : testUtterances){
System.out.println("understanding utterance: " + testUtterance);
yodaEnvironment.slu.process1BestAsr(testUtterance);
}
}
} | kperisetla/YODA | yoda/src/test/java/edu/cmu/sv/TestRegexPlusKeywordUnderstander.java | Java | gpl-3.0 | 7,088 | [
30522,
7427,
3968,
2226,
1012,
4642,
2226,
1012,
17917,
1025,
12324,
3968,
2226,
1012,
4642,
2226,
1012,
17917,
1012,
7809,
1012,
3031,
6483,
1025,
12324,
3968,
2226,
1012,
4642,
2226,
1012,
17917,
1012,
13764,
8649,
1035,
2968,
1012,
13764... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html xml:lang="en-GB" lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head lang="en-GB">
<title>Ross Gammonโs Family Tree - LUCAS, Nathaniel Thomas</title>
<meta charset="UTF-8" />
<meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
<meta name ="apple-mobile-web-app-capable" content="yes" />
<meta name="generator" content="Gramps 4.2.8 http://gramps-project.org/" />
<meta name="author" content="" />
<link href="../../../images/favicon2.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../../css/narrative-screen.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../../../css/narrative-print.css" media="print" rel="stylesheet" type="text/css" />
<link href="../../../css/ancestortree.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1 id="SiteTitle">Ross Gammonโs Family Tree</h1>
</div>
<div class="wrapper" id="nav" role="navigation">
<div class="container">
<ul class="menu" id="dropmenu">
<li class = "CurrentSection"><a href="../../../individuals.html" title="Individuals">Individuals</a></li>
<li><a href="../../../index.html" title="Surnames">Surnames</a></li>
<li><a href="../../../families.html" title="Families">Families</a></li>
<li><a href="../../../events.html" title="Events">Events</a></li>
<li><a href="../../../places.html" title="Places">Places</a></li>
<li><a href="../../../sources.html" title="Sources">Sources</a></li>
<li><a href="../../../repositories.html" title="Repositories">Repositories</a></li>
<li><a href="../../../media.html" title="Media">Media</a></li>
<li><a href="../../../thumbnails.html" title="Thumbnails">Thumbnails</a></li>
</ul>
</div>
</div>
<div class="content" id="IndividualDetail">
<h3>LUCAS, Nathaniel Thomas<sup><small></small></sup></h3>
<div id="summaryarea">
<table class="infolist">
<tr>
<td class="ColumnAttribute">Birth Name</td>
<td class="ColumnValue">
LUCAS, Nathaniel Thomas <a href="#sref1a">1a</a>
</td>
</tr>
<tr>
<td class="ColumnAttribute">Gramps ID</td>
<td class="ColumnValue">I8564</td>
</tr>
<tr>
<td class="ColumnAttribute">Gender</td>
<td class="ColumnValue">male</td>
</tr>
<tr>
<td class="ColumnAttribute">Age at Death</td>
<td class="ColumnValue">71 years, 1 month</td>
</tr>
</table>
</div>
<div class="subsection" id="events">
<h4>Events</h4>
<table class="infolist eventlist">
<thead>
<tr>
<th class="ColumnEvent">Event</th>
<th class="ColumnDate">Date</th>
<th class="ColumnPlace">Place</th>
<th class="ColumnDescription">Description</th>
<th class="ColumnNotes">Notes</th>
<th class="ColumnSources">Sources</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ColumnEvent">
<a href="../../../evt/3/3/d15f601f8762fa25a51505e5933.html" title="Birth">
Birth
<span class="grampsid"> [E9328]</span>
</a>
</td>
<td class="ColumnDate">1855-12-01</td>
<td class="ColumnPlace">
<a href="../../../plc/1/2/d15f5fe3cec3032bff3c9926621.html" title="">
</a>
</td>
<td class="ColumnDescription"> </td>
<td class="ColumnNotes">
<div>
</div>
</td>
<td class="ColumnSources">
</td>
</tr>
<tr>
<td class="ColumnEvent">
<a href="../../../evt/1/8/d15f601f881b233abc7d1de481.html" title="Death">
Death
<span class="grampsid"> [E9329]</span>
</a>
</td>
<td class="ColumnDate">1927</td>
<td class="ColumnPlace">
<a href="../../../plc/1/2/d15f5fe3cec3032bff3c9926621.html" title="">
</a>
</td>
<td class="ColumnDescription"> </td>
<td class="ColumnNotes">
<div>
</div>
</td>
<td class="ColumnSources">
</td>
</tr>
</tbody>
</table>
</div>
<div class="subsection" id="parents">
<h4>Parents</h4>
<table class="infolist">
<thead>
<tr>
<th class="ColumnAttribute">Relation to main person</th>
<th class="ColumnValue">Name</th>
<th class="ColumnValue">Relation within this family (if not by birth)</th>
</tr>
</thead>
<tbody>
</tbody>
<tr>
<td class="ColumnAttribute">Father</td>
<td class="ColumnValue">
<a href="../../../ppl/1/7/d15f601f2eb507e7739f9fabd71.html">LUCAS, Nathaniel Thomas<span class="grampsid"> [I8535]</span></a>
</td>
</tr>
<tr>
<td class="ColumnAttribute">Mother</td>
<td class="ColumnValue">
<a href="../../../ppl/f/e/d15f601f35d48b7ea576b267bef.html">GROUNDS, Mary<span class="grampsid"> [I8536]</span></a>
</td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/c/a/d15f601f3ba688bbbb8f6eddac.html">LUCAS, Susannah<span class="grampsid"> [I8537]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/e/f/d15f601f3fa3102e77f7f3691fe.html">LUCAS, Eliza Jane<span class="grampsid"> [I8538]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/0/0/d15f601f43a36489d49facca800.html">LUCAS, Emma<span class="grampsid"> [I8539]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/d/2/d15f601f49c3b43b8f51decd32d.html">LUCAS, Louisa Mary<span class="grampsid"> [I8540]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> </td>
<td class="ColumnValue"> <a href="../../../ppl/f/c/d15f601f86c4559097dc6cf29cf.html">LUCAS, Nathaniel Thomas<span class="grampsid"> [I8564]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Brother</td>
<td class="ColumnValue"> <a href="../../../ppl/e/0/d15f601f8ac4b864175cc874e0e.html">LUCAS, Edwin Charles<span class="grampsid"> [I8565]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Brother</td>
<td class="ColumnValue"> <a href="../../../ppl/2/9/d15f601fed83e5ecbfa5fa97c92.html">LUCAS, Hamilton Hume<span class="grampsid"> [I8600]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Brother</td>
<td class="ColumnValue"> <a href="../../../ppl/9/a/d15f601ff2d5f5822e1ed0737a9.html">LUCAS, Alfred John<span class="grampsid"> [I8601]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/e/0/d15f601ff6d457df9e0f760970e.html">LUCAS, Mary<span class="grampsid"> [I8602]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Sister</td>
<td class="ColumnValue"> <a href="../../../ppl/0/b/d15f601ffa87e905338feb4b7b0.html">LUCAS, Margaret<span class="grampsid"> [I8603]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td class="ColumnAttribute">Father</td>
<td class="ColumnValue">
<a href="../../../ppl/1/7/d15f601f2eb507e7739f9fabd71.html">LUCAS, Nathaniel Thomas<span class="grampsid"> [I8535]</span></a>
</td>
</tr>
<tr>
<td class="ColumnAttribute">Stepmother</td>
<td class="ColumnValue">
<a href="../../../ppl/4/a/d15f601ffd4324529bb589f3ba4.html">HINES, Ellen<span class="grampsid"> [I8604]</span></a>
</td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-brother</td>
<td class="ColumnValue"> <a href="../../../ppl/a/5/d15f6020028db1adeb3afb585a.html">LUCAS, John<span class="grampsid"> [I8605]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-brother</td>
<td class="ColumnValue"> <a href="../../../ppl/2/c/d15f60200657f89ab726072b3c2.html">LUCAS, George William<span class="grampsid"> [I8606]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-brother</td>
<td class="ColumnValue"> <a href="../../../ppl/c/c/d15f60200a36878dc1854e9bfcc.html">LUCAS, John Vernon Nathaniel<span class="grampsid"> [I8607]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-brother</td>
<td class="ColumnValue"> <a href="../../../ppl/9/3/d15f602026247c8f6f83759ef39.html">LUCAS, Charles<span class="grampsid"> [I8616]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-sister</td>
<td class="ColumnValue"> <a href="../../../ppl/2/e/d15f60202f932b6424feaf284e2.html">LUCAS, Ada Elleanor<span class="grampsid"> [I8617]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-sister</td>
<td class="ColumnValue"> <a href="../../../ppl/5/9/d15f602033646e3d56ccdc04a95.html">LUCAS, Vera<span class="grampsid"> [I8618]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-sister</td>
<td class="ColumnValue"> <a href="../../../ppl/1/5/d15f6020387200189020189bb51.html">LUCAS, Mabel Velma<span class="grampsid"> [I8620]</span></a></td>
<td class="ColumnValue"></td>
</tr>
<tr>
<td class="ColumnAttribute"> Half-brother</td>
<td class="ColumnValue"> <a href="../../../ppl/1/1/d15f60203b3574c783b2252a511.html">LUCAS, Frederick Lindsay<span class="grampsid"> [I8621]</span></a></td>
<td class="ColumnValue"></td>
</tr>
</table>
</div>
<div class="subsection" id="families">
<h4>Families</h4>
<table class="infolist">
<tr class="BeginFamily">
<td class="ColumnType"> </td>
<td class="ColumnAttribute"> </td>
<td class="ColumnValue"><a href="../../../fam/8/f/d15f601f8975daf8e152f68af8.html" title="Family of LUCAS, Nathaniel Thomas">Family of LUCAS, Nathaniel Thomas<span class="grampsid"> [F4584]</span></a></td>
</tr>
<tr>
<td class="ColumnType"> </td>
<td class="ColumnAttribute">Attributes</td>
<td class="ColumnValue">
<table class="infolist attrlist">
<thead>
<tr>
<th class="ColumnType">Type</th>
<th class="ColumnValue">Value</th>
<th class="ColumnNotes">Notes</th>
<th class="ColumnSources">Sources</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ColumnType">_UID</td>
<td class="ColumnValue">89BB7A32A73BDF4FA5044BED098E6DF3D8D7</td>
<td class="ColumnNotes"><div></div></td>
<td class="ColumnSources"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</div>
<div class="subsection" id="attributes">
<h4>Attributes</h4>
<table class="infolist attrlist">
<thead>
<tr>
<th class="ColumnType">Type</th>
<th class="ColumnValue">Value</th>
<th class="ColumnNotes">Notes</th>
<th class="ColumnSources">Sources</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ColumnType">_UID</td>
<td class="ColumnValue">6421778B402C8449A8BDC8EB0F4ABD1D0BC0</td>
<td class="ColumnNotes"><div></div></td>
<td class="ColumnSources"> </td>
</tr>
</tbody>
</table>
</div>
<div class="subsection" id="pedigree">
<h4>Pedigree</h4>
<ol class="pedigreegen">
<li>
<a href="../../../ppl/1/7/d15f601f2eb507e7739f9fabd71.html">LUCAS, Nathaniel Thomas<span class="grampsid"> [I8535]</span></a>
<ol>
<li class="spouse">
<a href="../../../ppl/f/e/d15f601f35d48b7ea576b267bef.html">GROUNDS, Mary<span class="grampsid"> [I8536]</span></a>
<ol>
<li>
<a href="../../../ppl/c/a/d15f601f3ba688bbbb8f6eddac.html">LUCAS, Susannah<span class="grampsid"> [I8537]</span></a>
</li>
<li>
<a href="../../../ppl/e/f/d15f601f3fa3102e77f7f3691fe.html">LUCAS, Eliza Jane<span class="grampsid"> [I8538]</span></a>
</li>
<li>
<a href="../../../ppl/0/0/d15f601f43a36489d49facca800.html">LUCAS, Emma<span class="grampsid"> [I8539]</span></a>
</li>
<li>
<a href="../../../ppl/d/2/d15f601f49c3b43b8f51decd32d.html">LUCAS, Louisa Mary<span class="grampsid"> [I8540]</span></a>
</li>
<li class="thisperson">
LUCAS, Nathaniel Thomas
<ol class="spouselist">
<li class="spouse">
</li>
</ol>
</li>
<li>
<a href="../../../ppl/e/0/d15f601f8ac4b864175cc874e0e.html">LUCAS, Edwin Charles<span class="grampsid"> [I8565]</span></a>
</li>
<li>
<a href="../../../ppl/2/9/d15f601fed83e5ecbfa5fa97c92.html">LUCAS, Hamilton Hume<span class="grampsid"> [I8600]</span></a>
</li>
<li>
<a href="../../../ppl/9/a/d15f601ff2d5f5822e1ed0737a9.html">LUCAS, Alfred John<span class="grampsid"> [I8601]</span></a>
</li>
<li>
<a href="../../../ppl/e/0/d15f601ff6d457df9e0f760970e.html">LUCAS, Mary<span class="grampsid"> [I8602]</span></a>
</li>
<li>
<a href="../../../ppl/0/b/d15f601ffa87e905338feb4b7b0.html">LUCAS, Margaret<span class="grampsid"> [I8603]</span></a>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</div>
<div class="subsection" id="tree">
<h4>Ancestors</h4>
<div id="treeContainer" style="width:735px; height:602px;">
<div class="boxbg male AncCol0" style="top: 269px; left: 6px;">
<a class="noThumb" href="../../../ppl/f/c/d15f601f86c4559097dc6cf29cf.html">
LUCAS, Nathaniel Thomas
</a>
</div>
<div class="shadow" style="top: 274px; left: 10px;"></div>
<div class="bvline" style="top: 301px; left: 165px; width: 15px"></div>
<div class="gvline" style="top: 306px; left: 165px; width: 20px"></div>
<div class="boxbg male AncCol1" style="top: 119px; left: 196px;">
<a class="noThumb" href="../../../ppl/1/7/d15f601f2eb507e7739f9fabd71.html">
LUCAS, Nathaniel Thomas
</a>
</div>
<div class="shadow" style="top: 124px; left: 200px;"></div>
<div class="bvline" style="top: 151px; left: 180px; width: 15px;"></div>
<div class="gvline" style="top: 156px; left: 185px; width: 20px;"></div>
<div class="bhline" style="top: 151px; left: 180px; height: 150px;"></div>
<div class="gvline" style="top: 156px; left: 185px; height: 150px;"></div>
<div class="bvline" style="top: 151px; left: 355px; width: 15px"></div>
<div class="gvline" style="top: 156px; left: 355px; width: 20px"></div>
<div class="boxbg male AncCol2" style="top: 44px; left: 386px;">
<a class="noThumb" href="../../../ppl/8/c/d15f601132eecb4ceb906e1c8.html">
LUCAS, John
</a>
</div>
<div class="shadow" style="top: 49px; left: 390px;"></div>
<div class="bvline" style="top: 76px; left: 370px; width: 15px;"></div>
<div class="gvline" style="top: 81px; left: 375px; width: 20px;"></div>
<div class="bhline" style="top: 76px; left: 370px; height: 75px;"></div>
<div class="gvline" style="top: 81px; left: 375px; height: 75px;"></div>
<div class="bvline" style="top: 76px; left: 545px; width: 15px"></div>
<div class="gvline" style="top: 81px; left: 545px; width: 20px"></div>
<div class="boxbg male AncCol3" style="top: 7px; left: 576px;">
<a class="noThumb" href="../../../ppl/a/3/d15f5fb962f11f46775d411d23a.html">
LUCAS, Nathaniel
</a>
</div>
<div class="shadow" style="top: 12px; left: 580px;"></div>
<div class="bvline" style="top: 39px; left: 560px; width: 15px;"></div>
<div class="gvline" style="top: 44px; left: 565px; width: 20px;"></div>
<div class="bhline" style="top: 39px; left: 560px; height: 37px;"></div>
<div class="gvline" style="top: 44px; left: 565px; height: 37px;"></div>
<div class="boxbg female AncCol3" style="top: 81px; left: 576px;">
<a class="noThumb" href="../../../ppl/6/8/d15f5fb965a7bfcfae4d7c1e486.html">
GASCOYNE, Olivia
</a>
</div>
<div class="shadow" style="top: 86px; left: 580px;"></div>
<div class="bvline" style="top: 113px; left: 560px; width: 15px;"></div>
<div class="gvline" style="top: 118px; left: 565px; width: 20px;"></div>
<div class="bhline" style="top: 76px; left: 560px; height: 37px;"></div>
<div class="gvline" style="top: 81px; left: 565px; height: 37px;"></div>
<div class="boxbg female AncCol2" style="top: 194px; left: 386px;">
<a class="noThumb" href="../../../ppl/7/2/d15f601dc4b6f59179d65623627.html">
ROWLEY, Mary
</a>
</div>
<div class="shadow" style="top: 199px; left: 390px;"></div>
<div class="bvline" style="top: 226px; left: 370px; width: 15px;"></div>
<div class="gvline" style="top: 231px; left: 375px; width: 20px;"></div>
<div class="bhline" style="top: 151px; left: 370px; height: 75px;"></div>
<div class="gvline" style="top: 156px; left: 375px; height: 75px;"></div>
<div class="boxbg female AncCol1" style="top: 419px; left: 196px;">
<a class="noThumb" href="../../../ppl/f/e/d15f601f35d48b7ea576b267bef.html">
GROUNDS, Mary
</a>
</div>
<div class="shadow" style="top: 424px; left: 200px;"></div>
<div class="bvline" style="top: 451px; left: 180px; width: 15px;"></div>
<div class="gvline" style="top: 456px; left: 185px; width: 20px;"></div>
<div class="bhline" style="top: 301px; left: 180px; height: 150px;"></div>
<div class="gvline" style="top: 306px; left: 185px; height: 150px;"></div>
</div>
</div>
<div class="subsection" id="sourcerefs">
<h4>Source References</h4>
<ol>
<li>
<a href="../../../src/c/8/d15f60113322279b33b3d17668c.html" title="Frank Lee: GEDCOM File : JohnLUCAS.ged" name ="sref1">
Frank Lee: GEDCOM File : JohnLUCAS.ged
<span class="grampsid"> [S0297]</span>
</a>
<ol>
<li id="sref1a">
<ul>
<li>
Confidence: Low
</li>
</ul>
</li>
</ol>
</li>
</ol>
</div>
</div>
<div class="fullclear"></div>
<div id="footer">
<p id="createdate">
Generated by <a href="http://gramps-project.org/">Gramps</a> 4.2.8<br />Last change was the 2015-08-05 19:54:39<br />Created for <a href="../../../ppl/9/e/d15f5fb48902c4fc1b421d249e9.html">GAMMON, Francis</a>
</p>
<p id="copyright">
</p>
</div>
</body>
</html>
| RossGammon/the-gammons.net | RossFamilyTree/ppl/f/c/d15f601f86c4559097dc6cf29cf.html | HTML | gpl-3.0 | 19,760 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
20950,
1024,
11374,
1027,
1000,
4372,
1011,
16351,
1000,
11374,
1027,
1000,
4372,
1011,
16351,
1000,
20950,
3619,
1027,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
891... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import warnings
import unittest
import sys
from nose.tools import assert_raises
from gplearn.skutils.testing import (
_assert_less,
_assert_greater,
assert_less_equal,
assert_greater_equal,
assert_warns,
assert_no_warnings,
assert_equal,
set_random_state,
assert_raise_message)
from sklearn.tree import DecisionTreeClassifier
from sklearn.lda import LDA
try:
from nose.tools import assert_less
def test_assert_less():
# Check that the nose implementation of assert_less gives the
# same thing as the scikit's
assert_less(0, 1)
_assert_less(0, 1)
assert_raises(AssertionError, assert_less, 1, 0)
assert_raises(AssertionError, _assert_less, 1, 0)
except ImportError:
pass
try:
from nose.tools import assert_greater
def test_assert_greater():
# Check that the nose implementation of assert_less gives the
# same thing as the scikit's
assert_greater(1, 0)
_assert_greater(1, 0)
assert_raises(AssertionError, assert_greater, 0, 1)
assert_raises(AssertionError, _assert_greater, 0, 1)
except ImportError:
pass
def test_assert_less_equal():
assert_less_equal(0, 1)
assert_less_equal(1, 1)
assert_raises(AssertionError, assert_less_equal, 1, 0)
def test_assert_greater_equal():
assert_greater_equal(1, 0)
assert_greater_equal(1, 1)
assert_raises(AssertionError, assert_greater_equal, 0, 1)
def test_set_random_state():
lda = LDA()
tree = DecisionTreeClassifier()
# LDA doesn't have random state: smoke test
set_random_state(lda, 3)
set_random_state(tree, 3)
assert_equal(tree.random_state, 3)
def test_assert_raise_message():
def _raise_ValueError(message):
raise ValueError(message)
assert_raise_message(ValueError, "test",
_raise_ValueError, "test")
assert_raises(AssertionError,
assert_raise_message, ValueError, "something else",
_raise_ValueError, "test")
assert_raises(ValueError,
assert_raise_message, TypeError, "something else",
_raise_ValueError, "test")
# This class is inspired from numpy 1.7 with an alteration to check
# the reset warning filters after calls to assert_warns.
# This assert_warns behavior is specific to scikit-learn because
#`clean_warning_registry()` is called internally by assert_warns
# and clears all previous filters.
class TestWarns(unittest.TestCase):
def test_warn(self):
def f():
warnings.warn("yo")
return 3
# Test that assert_warns is not impacted by externally set
# filters and is reset internally.
# This is because `clean_warning_registry()` is called internally by
# assert_warns and clears all previous filters.
warnings.simplefilter("ignore", UserWarning)
assert_equal(assert_warns(UserWarning, f), 3)
# Test that the warning registry is empty after assert_warns
assert_equal(sys.modules['warnings'].filters, [])
assert_raises(AssertionError, assert_no_warnings, f)
assert_equal(assert_no_warnings(lambda x: x, 1), 1)
def test_warn_wrong_warning(self):
def f():
warnings.warn("yo", DeprecationWarning)
failed = False
filters = sys.modules['warnings'].filters[:]
try:
try:
# Should raise an AssertionError
assert_warns(UserWarning, f)
failed = True
except AssertionError:
pass
finally:
sys.modules['warnings'].filters = filters
if failed:
raise AssertionError("wrong warning caught by assert_warn")
| danbob123/gplearn | gplearn/skutils/tests/test_testing.py | Python | bsd-3-clause | 3,785 | [
30522,
12324,
16234,
12324,
3131,
22199,
12324,
25353,
2015,
2013,
4451,
1012,
5906,
12324,
20865,
1035,
13275,
2013,
14246,
19738,
6826,
1012,
15315,
21823,
4877,
1012,
5604,
12324,
1006,
1035,
20865,
1035,
2625,
1010,
1035,
20865,
1035,
361... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
enum asmop {
ASNOP = 0,
ASSTB,
ASSTH,
ASSTW,
ASSTL,
ASSTM,
ASSTS,
ASSTD,
ASLDSB,
ASLDUB,
ASLDSH,
ASLDUH,
ASLDSW,
ASLDUW,
ASLDL,
ASLDS,
ASLDD,
ASADDW,
ASSUBW,
ASMULW,
ASMODW,
ASUMODW,
ASDIVW,
ASUDIVW,
ASSHLW,
ASSHRW,
ASUSHRW,
ASLTW,
ASULTW,
ASGTW,
ASUGTW,
ASLEW,
ASULEW,
ASGEW,
ASUGEW,
ASEQW,
ASNEW,
ASBANDW,
ASBORW,
ASBXORW,
ASADDL,
ASSUBL,
ASMULL,
ASMODL,
ASUMODL,
ASDIVL,
ASUDIVL,
ASSHLL,
ASSHRL,
ASUSHRL,
ASLTL,
ASULTL,
ASGTL,
ASUGTL,
ASLEL,
ASULEL,
ASGEL,
ASUGEL,
ASEQL,
ASNEL,
ASBANDL,
ASBORL,
ASBXORL,
ASADDS,
ASSUBS,
ASMULS,
ASDIVS,
ASLTS,
ASGTS,
ASLES,
ASGES,
ASEQS,
ASNES,
ASADDD,
ASSUBD,
ASMULD,
ASDIVD,
ASLTD,
ASGTD,
ASLED,
ASGED,
ASEQD,
ASNED,
ASEXTBW,
ASUEXTBW,
ASEXTBL,
ASUEXTBL,
ASEXTHW,
ASUEXTHW,
ASEXTHL,
ASUEXTHL,
ASEXTWL,
ASUEXTWL,
ASSTOL,
ASSTOW,
ASDTOL,
ASDTOW,
ASSWTOD,
ASSWTOS,
ASSLTOD,
ASSLTOS,
ASEXTS,
ASTRUNCD,
ASJMP,
ASBRANCH,
ASRET,
ASCALL,
ASCALLE,
ASCALLEX,
ASPAR,
ASPARE,
ASALLOC,
ASFORM,
ASCOPYB,
ASCOPYH,
ASCOPYW,
ASCOPYL,
ASCOPYS,
ASCOPYD,
ASVSTAR,
ASVARG,
};
| k0gaMSX/scc | cc2/target/qbe/arch.h | C | isc | 1,127 | [
30522,
4372,
2819,
2004,
5302,
2361,
1063,
2004,
3630,
2361,
1027,
1014,
1010,
4632,
2102,
2497,
1010,
4632,
2705,
1010,
4632,
2102,
2860,
1010,
4632,
19646,
1010,
4632,
21246,
1010,
4632,
3215,
1010,
4632,
2102,
2094,
1010,
2004,
6392,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// '########'########::'######:::'##::: ##'########'########:'#######:::'#####:::
// ..... ##: ##.... ##'##... ##:: ###:: ## ##.....:..... ##:'##.... ##:'##.. ##::
// :::: ##:: ##:::: ## ##:::..::: ####: ## ##:::::::::: ##:: ##:::: ##'##:::: ##:
// ::: ##::: ##:::: ##. ######::: ## ## ## ######::::: ##:::: #######: ##:::: ##:
// :: ##:::: ##:::: ##:..... ##:: ##. #### ##...::::: ##::::'##.... ## ##:::: ##:
// : ##::::: ##:::: ##'##::: ##:: ##:. ### ##::::::: ##::::: ##:::: ##. ##:: ##::
// ######## ########:. ######::: ##::. ## ######## ########. #######::. #####:::
// ........:........:::......::::..::::..:........:........::.......::::.....::::
//
// Sysbios C interface library
// P.Betti <pbetti@lpconsul.eu>
//
// Module: c_bios
//
// HISTORY:
// -[Date]- -[Who]------------- -[What]---------------------------------------
// 27.09.18 Piergiorgio Betti Creation date
//
#include <cpm.h>
void delay(uint16_t msec) __naked
{
msec;
__asm
push iy
ld iy,#4
add iy,sp
ld e, 0 (iy) ;
ld d, 1 (iy) ; DE = msec #
;;
;; DELAY
;;
;; This routine generate a delay from 1 to 65535 milliseconds.
;;
mscnt .equ 246
push bc ; 11 c.
push af ; 11 c.
00001$:
ld c, #mscnt ; 7 c. (assume de = 1 = 1msec.)
00002$:
dec c ; 4 c. * MSCNT
jr nz, 00002$ ; 7/12 c. * MSCNT
dec de ; 6 c.
ld a, d ; 4 c.
or e ; 4 c.
jr nz, 00001$ ; 7/12 c.
pop af ; 10 c.
pop bc ; 10 c.
pop iy
ret
__endasm;
}
| pbetti/ZDS | syslibs/cpm/delay.c | C | gpl-3.0 | 1,456 | [
30522,
1013,
1013,
1013,
1013,
1005,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1005,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1024,
1024,
1005,
1001,
1001,
1001,
1001,
1001,
1001,
1024,
1024,
1024,
1005,
1001,
1001,
1024,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***************************************************************************
qgspropertyoverridebutton.h
---------------------------
Date : January 2017
Copyright : (C) 2017 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPROPERTYOVERRIDEBUTTON_H
#define QGSPROPERTYOVERRIDEBUTTON_H
#include "qgis_gui.h"
#include "qgis_sip.h"
#include <QDialog>
#include <QFlags>
#include <QMap>
#include <QPointer>
#include <QToolButton>
#include "qgsproperty.h"
#include "qgspropertycollection.h"
#include "qgsexpressioncontext.h"
#include "qgsexpressioncontextgenerator.h"
class QgsVectorLayer;
class QgsMapCanvas;
/**
* \ingroup gui
* \class QgsPropertyOverrideButton
* A button for controlling property overrides which may apply to a widget.
*
* QgsPropertyOverrideButton is designed to be used alongside the QGIS
* properties framework (QgsProperty, QgsPropertyDefinition
* and QgsPropertyCollection).
*
* It allows users to specify field or expression based overrides
* which should be applied to a property of an object. Eg, this widget
* is used for controlling data defined overrides in symbology, labeling
* and composer.
* \since QGIS 3.0
*/
class GUI_EXPORT QgsPropertyOverrideButton: public QToolButton
{
Q_OBJECT
Q_PROPERTY( QString usageInfo READ usageInfo WRITE setUsageInfo )
Q_PROPERTY( bool active READ isActive WRITE setActive )
public:
/**
* Constructor for QgsPropertyOverrideButton.
* \param parent parent widget
* \param layer associated vector layer
*/
QgsPropertyOverrideButton( QWidget *parent SIP_TRANSFERTHIS = nullptr,
const QgsVectorLayer *layer = nullptr );
/**
* Initialize a newly constructed property button (useful if button was included in a UI layout).
* \param propertyKey key for corresponding property
* \param property initial value of associated property to show in widget
* \param definitions properties definitions for corresponding collection
* \param layer associated vector layer
* \param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
*/
void init( int propertyKey,
const QgsProperty &property,
const QgsPropertiesDefinition &definitions,
const QgsVectorLayer *layer = nullptr,
bool auxiliaryStorageEnabled = false );
/**
* Initialize a newly constructed property button (useful if button was included in a UI layout).
* \param propertyKey key for corresponding property
* \param collection associated property collection
* \param definitions properties definitions for collection
* \param layer associated vector layer
* \param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
*/
void init( int propertyKey,
const QgsAbstractPropertyCollection &collection,
const QgsPropertiesDefinition &definitions,
const QgsVectorLayer *layer = nullptr,
bool auxiliaryStorageEnabled = false );
/**
* Returns a QgsProperty object encapsulating the current state of the
* widget.
* \see setToProperty()
*/
QgsProperty toProperty() const;
/**
* Sets the widget to reflect the current state of a QgsProperty.
*/
void setToProperty( const QgsProperty &property );
/**
* Returns the property key linked to the button.
*/
int propertyKey() const { return mPropertyKey; }
/**
* Returns true if the button has an active property.
*/
bool isActive() const { return mProperty && mProperty.isActive(); }
/**
* Returns the data type which the widget will accept. This is used to filter
* out fields from the associated vector layer to only show fields which
* are compatible with the property.
*/
QgsPropertyDefinition::DataType validDataType() const { return mDataTypes; }
/**
* Returns the full definition description and current definition
* (internally generated on a contextual basis).
*/
QString fullDescription() const { return mFullDescription; }
/**
* Returns usage information for the property.
* \see setUsageInfo()
*/
QString usageInfo() const { return mUsageInfo; }
/**
* Set the usage information for the property.
* \see usageInfo()
*/
void setUsageInfo( const QString &info ) { mUsageInfo = info; updateGui(); }
/**
* Sets the vector layer associated with the button. This controls which fields are
* displayed within the widget's pop up menu.
* \see vectorLayer()
*/
void setVectorLayer( const QgsVectorLayer *layer );
/**
* Returns the vector layer associated with the button. This controls which fields are
* displayed within the widget's pop up menu.
* \see setVectorLayer()
*/
const QgsVectorLayer *vectorLayer() const { return mVectorLayer; }
/**
* Register a sibling \a widget that gets checked when the property is active.
* if \a natural is false, widget gets unchecked when the property is active.
* \note this should be called after calling init() to be correctly initialized.
*/
void registerCheckedWidget( QWidget *widget, bool natural = true );
/**
* Register a sibling \a widget that gets enabled when the property is active, and disabled when the property is inactive.
* if \a natural is false, widget gets disabled when the property is active, and enabled when the property is inactive.
* \note this should be called after calling init() to be correctly initialized.
*/
void registerEnabledWidget( QWidget *widget, bool natural = true );
/**
* Register a sibling \a widget that gets visible when the property is active, and hidden when the property is inactive.
* if \a natural is false, widget gets hidden when the property is active, and visible when the property is inactive.
* \note this should be called after calling init() to be correctly initialized.
*/
void registerVisibleWidget( QWidget *widget, bool natural = true );
/**
* Register a sibling \a widget (line edit, text edit) that will receive the property as an expression
* \note this should be called after calling init() to be correctly initialized.
*/
void registerExpressionWidget( QWidget *widget );
/**
* Register an expression context generator class that will be used to retrieve
* an expression context for the button when required.
*/
void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
/**
* Updates list of fields.
*
* \since QGIS 3.0
*/
void updateFieldLists();
/**
* Sets a symbol which can be used for previews inside the widget or in any dialog created
* by the widget. If not specified, a default created symbol will be used instead.
* \note not available in Python bindings
*/
void setSymbol( std::shared_ptr< QgsSymbol > symbol ) { mSymbol = symbol; } SIP_SKIP
public slots:
/**
* Set whether the current property override definition is to be used
*/
void setActive( bool active );
signals:
//! Emitted when property definition changes
void changed();
//! Emitted when the activated status of the widget changes
void activated( bool isActive );
//! Emitted when creating a new auxiliary field
void createAuxiliaryField();
protected:
void mouseReleaseEvent( QMouseEvent *event ) override;
private:
void showDescriptionDialog();
void showExpressionDialog();
void showAssistant();
void updateGui();
/**
* Sets the active status, emitting the activated signal where necessary (but never emitting the changed signal!).
* Call this when you know you'll later be emitting the changed signal and want to avoid duplicate signals.
*/
void setActivePrivate( bool active );
int mPropertyKey = -1;
const QgsVectorLayer *mVectorLayer = nullptr;
QStringList mFieldNameList;
QStringList mFieldTypeList;
QString mExpressionString;
QString mFieldName;
QMenu *mDefineMenu = nullptr;
QAction *mActionDataTypes = nullptr;
QMenu *mFieldsMenu = nullptr;
QMenu *mVariablesMenu = nullptr;
QAction *mActionVariables = nullptr;
QAction *mActionActive = nullptr;
QAction *mActionDescription = nullptr;
QAction *mActionExpDialog = nullptr;
QAction *mActionExpression = nullptr;
QAction *mActionPasteExpr = nullptr;
QAction *mActionCopyExpr = nullptr;
QAction *mActionClearExpr = nullptr;
QAction *mActionAssistant = nullptr;
QAction *mActionCreateAuxiliaryField = nullptr;
QgsPropertyDefinition mDefinition;
QgsPropertyDefinition::DataType mDataTypes = QgsPropertyDefinition::DataTypeString;
QString mDataTypesString;
QString mInputDescription;
QString mFullDescription;
QString mUsageInfo;
QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
enum SiblingType
{
SiblingCheckState,
SiblingEnableState,
SiblingVisibility,
SiblingExpressionText,
};
struct SiblingWidget
{
SiblingWidget( QPointer<QWidget> widgetPointer, SiblingType siblingType, bool natural = true )
: mWidgetPointer( widgetPointer )
, mSiblingType( siblingType )
, mNatural( natural )
{}
QPointer<QWidget> mWidgetPointer;
SiblingType mSiblingType;
bool mNatural;
};
QList< SiblingWidget > mSiblingWidgets;
//! Internal property used for storing state of widget
QgsProperty mProperty;
bool mAuxiliaryStorageEnabled = false;
std::shared_ptr< QgsSymbol > mSymbol;
private slots:
void aboutToShowMenu();
void menuActionTriggered( QAction *action );
void updateSiblingWidgets( bool state );
};
#endif // QGSPROPERTYOVERRIDEBUTTON_H
| nirvn/QGIS | src/gui/qgspropertyoverridebutton.h | C | gpl-2.0 | 10,741 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="twelve columns alpha">
<h3 class="headline">Descriรงรฃo do Projeto</h3><span class="line"></span><div class="clearfix"></div>
<p>A casa de energia de Itaipu foi em busca de um sistema de gerenciamento de documentos (DMS) para acompanhar a documentaรงรฃo de seus projetos. Em seguida, eles nos contatou e foram apresentados a eles algumas soluรงรตes possรญveis.</p>
<p>Uma das possรญveis soluรงรตes foi o OpenKM entre outros. E este software completamente cumprido as suas necessidades.</p>
<p>OpenKM รฉ um aplicativo de gerenciamento de documentos baseado na web que usam padrรตes e tecnologias Open Source. OpenKM Fornece recursos de gerenciamento de documento completo, incluindo acompanhamento e histรณrico de versรฃo de arquivo, metadados, digitalizaรงรฃo, fluxo de trabalho, pesquisa e muito mais.</p>
<p>O celtab ajudou a migrar para esta plataforma e atualmente รฉ responsรกvel pela manutenรงรฃo de software.</p>
<p><strong>Pesquisador:</strong> Mario Villagra</p>
</div>
<!-- Job Description -->
<div class="four columns omega">
<h3 class="headline">Detalhes do Projeto</h3><span class="line"></span><div class="clearfix"></div>
<ul style="margin: 2px 0 18px 0;" class="list-3">
<li>JavaEE</li>
<li>Tomcat</li>
</ul>
<div class="clearfix"></div>
</div> | IngCarlosColman/SiteCeltab | CONTENIDOS/Portugues/Proyectos/OpenKM-Itaipรบ.php | PHP | gpl-2.0 | 1,324 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
4376,
7753,
6541,
1000,
1028,
1026,
30524,
8873,
2595,
1000,
1028,
1026,
1013,
4487,
2615,
1028,
1026,
1052,
1028,
1037,
14124,
2139,
4372,
2121,
10440,
2139,
2009,
4886,
14289,
1042,
10448,
7861,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import setupStore from 'dummy/tests/helpers/store';
import Ember from 'ember';
import {module, test} from 'qunit';
import DS from 'ember-data';
var env, store;
var attr = DS.attr;
var hasMany = DS.hasMany;
var belongsTo = DS.belongsTo;
var run = Ember.run;
var Post, Tag;
module("unit/many_array - DS.ManyArray", {
beforeEach() {
Post = DS.Model.extend({
title: attr('string'),
tags: hasMany('tag', { async: false })
});
Tag = DS.Model.extend({
name: attr('string'),
post: belongsTo('post', { async: false })
});
env = setupStore({
post: Post,
tag: Tag
});
store = env.store;
},
afterEach() {
run(function() {
store.destroy();
});
}
});
test("manyArray.save() calls save() on all records", function(assert) {
assert.expect(3);
run(function() {
Tag.reopen({
save() {
assert.ok(true, 'record.save() was called');
return Ember.RSVP.resolve();
}
});
store.push({
data: [{
type: 'tag',
id: '1',
attributes: {
name: 'Ember.js'
}
}, {
type: 'tag',
id: '2',
attributes: {
name: 'Tomster'
}
}, {
type: 'post',
id: '3',
attributes: {
title: 'A framework for creating ambitious web applications'
},
relationships: {
tags: {
data: [
{ type: 'tag', id: '1' },
{ type: 'tag', id: '2' }
]
}
}
}]
});
var post = store.peekRecord('post', 3);
post.get('tags').save().then(function() {
assert.ok(true, 'manyArray.save() promise resolved');
});
});
});
test("manyArray trigger arrayContentChange functions with the correct values", function(assert) {
assert.expect(12);
var willChangeStartIdx;
var willChangeRemoveAmt;
var willChangeAddAmt;
var originalArrayContentWillChange = DS.ManyArray.prototype.arrayContentWillChange;
var originalArrayContentDidChange = DS.ManyArray.prototype.arrayContentDidChange;
DS.ManyArray.reopen({
arrayContentWillChange(startIdx, removeAmt, addAmt) {
willChangeStartIdx = startIdx;
willChangeRemoveAmt = removeAmt;
willChangeAddAmt = addAmt;
return this._super.apply(this, arguments);
},
arrayContentDidChange(startIdx, removeAmt, addAmt) {
assert.equal(startIdx, willChangeStartIdx, 'WillChange and DidChange startIdx should match');
assert.equal(removeAmt, willChangeRemoveAmt, 'WillChange and DidChange removeAmt should match');
assert.equal(addAmt, willChangeAddAmt, 'WillChange and DidChange addAmt should match');
return this._super.apply(this, arguments);
}
});
run(function() {
store.push({
data: [{
type: 'tag',
id: '1',
attributes: {
name: 'Ember.js'
}
}, {
type: 'tag',
id: '2',
attributes: {
name: 'Tomster'
}
}, {
type: 'post',
id: '3',
attributes: {
title: 'A framework for creating ambitious web applications'
},
relationships: {
tags: {
data: [
{ type: 'tag', id: '1' }
]
}
}
}]
});
store.peekRecord('post', 3);
store.push({
data: {
type: 'post',
id: '3',
attributes: {
title: 'A framework for creating ambitious web applications'
},
relationships: {
tags: {
data: [
{ type: 'tag', id: '1' },
{ type: 'tag', id: '2' }
]
}
}
}
});
store.peekRecord('post', 3);
});
DS.ManyArray.reopen({
arrayContentWillChange: originalArrayContentWillChange,
arrayContentDidChange: originalArrayContentDidChange
});
});
| nickiaconis/data | tests/unit/many-array-test.js | JavaScript | mit | 3,924 | [
30522,
12324,
16437,
23809,
2063,
2013,
1005,
24369,
1013,
5852,
1013,
2393,
2545,
1013,
3573,
1005,
1025,
12324,
7861,
5677,
2013,
1005,
7861,
5677,
1005,
1025,
12324,
1063,
11336,
1010,
3231,
1065,
2013,
1005,
24209,
3490,
2102,
1005,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# AUTOGENERATED FILE
FROM balenalib/jetson-nano-ubuntu:disco-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.5.10
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& echo "423a72fecef7a888c7121199426c96cda6b0c9c6a6dde4bf156e75ab21713aa9 Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.8
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Ubuntu disco \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.5.10, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/python/jetson-nano/ubuntu/disco/3.5.10/build/Dockerfile | Dockerfile | apache-2.0 | 4,832 | [
30522,
1001,
8285,
6914,
16848,
5371,
2013,
28352,
8189,
29521,
1013,
9924,
2239,
1011,
28991,
1011,
1057,
8569,
3372,
2226,
1024,
12532,
1011,
3857,
1001,
6366,
2195,
10279,
1997,
2139,
15599,
18750,
2448,
26794,
1011,
2131,
24694,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{
"date": "2018-02-19",
"type": "post",
"title": "Report for Monday 19th of February 2018",
"slug": "2018\/02\/19",
"categories": [
"Daily report"
],
"images": [],
"health": {
"weight": 79.6,
"height": 173,
"age": 13578
},
"nutrition": {
"calories": 1939.89,
"fat": 142.55,
"carbohydrates": 101.78,
"protein": 65.78
},
"exercise": {
"pushups": 0,
"crunches": 0,
"steps": 12906
},
"media": {
"books": [],
"podcast": [],
"youtube": [],
"movies": [],
"photos": []
}
}
Today I am <strong>13578 days</strong> old and my weight is <strong>79.6 kg</strong>. During the day, I consumed <strong>1939.89 kcal</strong> coming from <strong>142.55 g</strong> fat, <strong>101.78 g</strong> carbohydrates and <strong>65.78 g</strong> protein. Managed to do <strong>0 push-ups</strong>, <strong>0 crunches</strong> and walked <strong>12906 steps</strong> during the day which is approximately <strong>9.83 km</strong>. | aquilax/quantified.avtobiografia.com | content/post/2018-02-19.md | Markdown | mit | 1,092 | [
30522,
1063,
1000,
3058,
1000,
1024,
1000,
2760,
1011,
6185,
1011,
2539,
1000,
1010,
1000,
2828,
1000,
1024,
1000,
2695,
1000,
1010,
1000,
2516,
1000,
1024,
1000,
3189,
2005,
6928,
3708,
1997,
2337,
2760,
1000,
1010,
1000,
23667,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <bits/stdc++.h>
using namespace std;
#ifndef int64
#define int64 long long
#endif
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int64 h1, h2, a, b;
cin >> h1 >> h2 >> a >> b;
h1 += a * 8;
if (a <= b && h1 < h2) {
puts("-1");
} else if (h1 >= h2) {
puts("0");
} else {
int64 y = 12 * (a - b);
int64 i = (h2 - h1) / y;
if (h1 + i * y < h2)
i++;
cout << i << endl;
}
return 0;
} | bolatov/contests | codeforces.ru/contest652/a.cpp | C++ | mit | 514 | [
30522,
1001,
2421,
1026,
9017,
1013,
2358,
16409,
1009,
1009,
1012,
1044,
1028,
2478,
3415,
15327,
2358,
2094,
1025,
1001,
2065,
13629,
2546,
20014,
21084,
1001,
9375,
20014,
21084,
2146,
2146,
1001,
2203,
10128,
20014,
2364,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package club.myfpl.model;
/**
* User: Saket
* Date: 25/11/16
* Time: 12:10 AM
*/
public enum ElementType {
GKP(1L, "Goalkeeper", "GKP", "Goalkeepers", "GKP"),
DEF(2L, "Defender", "DEF", "Defenders", "DEF"),
MID(3L, "Midfielder", "MID", "Midfielders", "MID"),
FWD(4L, "Forward", "FWD", "Forwards", "FWD");
private Long id;
private String singularName;
private String singularShortName;
private String pluralName;
private String pluralShortName;
ElementType(Long id, String singularName, String singularShortName, String pluralName, String pluralShortName) {
this.id = id;
this.singularName = singularName;
this.singularShortName = singularShortName;
this.pluralName = pluralName;
this.pluralShortName = pluralShortName;
}
public static ElementType getElementTypeFromId(Long id) {
if (id.equals(1L)) {
return ElementType.GKP;
} else if (id.equals(2L)) {
return ElementType.DEF;
} else if (id.equals(3L)) {
return ElementType.MID;
} else if (id.equals(4L)) {
return ElementType.FWD;
}
return null;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSingularName() {
return singularName;
}
public void setSingularName(String singularName) {
this.singularName = singularName;
}
public String getSingularShortName() {
return singularShortName;
}
public void setSingularShortName(String singularShortName) {
this.singularShortName = singularShortName;
}
public String getPluralName() {
return pluralName;
}
public void setPluralName(String pluralName) {
this.pluralName = pluralName;
}
public String getPluralShortName() {
return pluralShortName;
}
public void setPluralShortName(String pluralShortName) {
this.pluralShortName = pluralShortName;
}
}
| saketmehta/myfpl | backend/src/main/java/club/myfpl/model/ElementType.java | Java | gpl-3.0 | 2,059 | [
30522,
7427,
2252,
1012,
2026,
22540,
2140,
1012,
2944,
1025,
1013,
1008,
1008,
1008,
5310,
1024,
8739,
2102,
1008,
3058,
1024,
2423,
1013,
2340,
1013,
2385,
1008,
2051,
1024,
2260,
1024,
2184,
2572,
1008,
1013,
2270,
4372,
2819,
5783,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.syncope.types;
public enum CipherAlgorithm {
MD5("MD5"),
SHA1("SHA-1"),
SHA256("SHA-256"),
AES("AES");
final private String algorithm;
CipherAlgorithm(String algorithm) {
this.algorithm = algorithm;
}
public final String getAlgorithm() {
return algorithm;
}
}
| ilgrosso/oldSyncopeIdM | client/src/main/java/org/syncope/types/CipherAlgorithm.java | Java | apache-2.0 | 1,137 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
6095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*****************************************************************************
* xa.c : xa file demux module for vlc
*****************************************************************************
* Copyright (C) 2005 Rรฉmi Denis-Courmont
* $Id$
*
* Authors: Rรฉmi Denis-Courmont <rem # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
vlc_module_begin ()
set_description( N_("XA demuxer") )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
set_capability( "demux", 10 )
set_callbacks( Open, Close )
vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Demux ( demux_t * );
static int Control( demux_t *, int i_query, va_list args );
struct demux_sys_t
{
es_out_id_t *p_es;
int64_t i_data_offset;
unsigned int i_data_size;
unsigned int i_block_frames;
unsigned int i_frame_size;
unsigned int i_bitrate;
date_t pts;
};
typedef struct xa_header_t
{
char xa_id[4];
uint32_t iSize;
uint16_t wFormatTag;
uint16_t nChannels;
uint32_t nSamplesPerSec;
uint32_t nAvgBytesPerSec;
uint16_t nBlockAlign;
uint16_t wBitsPerSample;
} xa_header_t;
static_assert(offsetof(xa_header_t, wBitsPerSample) == 22, "Bad padding");
#define FRAME_LENGTH 28 /* samples per frame */
/*****************************************************************************
* Open: check file and initializes structures
*****************************************************************************/
static int Open( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t*)p_this;
const uint8_t *peek;
/* XA file heuristic */
if( vlc_stream_Peek( p_demux->s, &peek, 10 ) < 10 )
return VLC_EGENERIC;
if( memcmp( peek, "XAI", 4 ) && memcmp( peek, "XAJ", 4 ) )
return VLC_EGENERIC;
if( GetWLE( peek + 8 ) != 1 ) /* format tag */
return VLC_EGENERIC;
demux_sys_t *p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely( p_sys == NULL ) )
return VLC_ENOMEM;
/* read XA header*/
xa_header_t xa;
if( vlc_stream_Read( p_demux->s, &xa, 24 ) < 24 )
{
free( p_sys );
return VLC_EGENERIC;
}
es_format_t fmt;
es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('X','A','J',0) );
msg_Dbg( p_demux, "assuming EA ADPCM audio codec" );
fmt.audio.i_rate = GetDWLE( &xa.nSamplesPerSec );
fmt.audio.i_bytes_per_frame = 15 * GetWLE( &xa.nChannels );
fmt.audio.i_frame_length = FRAME_LENGTH;
fmt.audio.i_channels = GetWLE ( &xa.nChannels );
fmt.audio.i_blockalign = fmt.audio.i_bytes_per_frame;
fmt.audio.i_bitspersample = GetWLE( &xa.wBitsPerSample );
fmt.i_bitrate = (fmt.audio.i_rate * fmt.audio.i_bytes_per_frame * 8)
/ fmt.audio.i_frame_length;
p_sys->i_data_offset = vlc_stream_Tell( p_demux->s );
/* FIXME: better computation */
p_sys->i_data_size = xa.iSize * 15 / 56;
/* How many frames per block (1:1 is too CPU intensive) */
p_sys->i_block_frames = fmt.audio.i_rate / (FRAME_LENGTH * 20) + 1;
p_sys->i_frame_size = fmt.audio.i_bytes_per_frame;
p_sys->i_bitrate = fmt.i_bitrate;
msg_Dbg( p_demux, "fourcc: %4.4s, channels: %d, "
"freq: %d Hz, bitrate: %dKo/s, blockalign: %d",
(char *)&fmt.i_codec, fmt.audio.i_channels, fmt.audio.i_rate,
fmt.i_bitrate / 8192, fmt.audio.i_blockalign );
if( fmt.audio.i_rate == 0 || fmt.audio.i_channels == 0
|| fmt.audio.i_bitspersample != 16 )
{
free( p_sys );
return VLC_EGENERIC;
}
p_sys->p_es = es_out_Add( p_demux->out, &fmt );
date_Init( &p_sys->pts, fmt.audio.i_rate, 1 );
date_Set( &p_sys->pts, VLC_TS_0 );
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys;
return VLC_SUCCESS;
}
/*****************************************************************************
* Demux: read packet and send them to decoders
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block;
int64_t i_offset;
unsigned i_frames = p_sys->i_block_frames;
i_offset = vlc_stream_Tell( p_demux->s );
if( p_sys->i_data_size > 0 &&
i_offset >= p_sys->i_data_offset + p_sys->i_data_size )
{
/* EOF */
return 0;
}
p_block = vlc_stream_Block( p_demux->s, p_sys->i_frame_size * i_frames );
if( p_block == NULL )
{
msg_Warn( p_demux, "cannot read data" );
return 0;
}
i_frames = p_block->i_buffer / p_sys->i_frame_size;
p_block->i_dts = p_block->i_pts = date_Get( &p_sys->pts );
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
es_out_Send( p_demux->out, p_sys->p_es, p_block );
date_Increment( &p_sys->pts, i_frames * FRAME_LENGTH );
return 1;
}
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
static void Close ( vlc_object_t * p_this )
{
demux_sys_t *p_sys = ((demux_t *)p_this)->p_sys;
free( p_sys );
}
/*****************************************************************************
* Control:
*****************************************************************************/
static int Control( demux_t *p_demux, int i_query, va_list args )
{
demux_sys_t *p_sys = p_demux->p_sys;
return demux_vaControlHelper( p_demux->s, p_sys->i_data_offset,
p_sys->i_data_size ? p_sys->i_data_offset
+ p_sys->i_data_size : -1,
p_sys->i_bitrate, p_sys->i_frame_size,
i_query, args );
}
| r1k/vlc | modules/demux/xa.c | C | gpl-2.0 | 7,523 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
cd ~/Sites/sgdialer/docs
sphinx-apidoc --full -H "sgdialer" -A "Michael Andrew" -V "1.0" -R "RC1" -o . ../src
make clean
make html | HAZARDU5/sgdialer | docs/generate.sh | Shell | mit | 142 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
3729,
1066,
1013,
4573,
1013,
22214,
27184,
2121,
1013,
9986,
2015,
27311,
1011,
17928,
3527,
2278,
1011,
1011,
2440,
1011,
1044,
1000,
22214,
27184,
2121,
1000,
1011,
1037,
1000,
2745,
4080,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Collections.Generic;
namespace Core.DomainModel.ItContract
{
/// <summary>
/// It contract payment freqency option.
/// </summary>
public class PaymentFreqencyType : OptionEntity<ItContract>, IOptionReference<ItContract>
{
public virtual ICollection<ItContract> References { get; set; } = new HashSet<ItContract>();
}
}
| os2kitos/kitos | Core.DomainModel/ItContract/PaymentFreqencyType.cs | C# | mpl-2.0 | 366 | [
30522,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
3415,
15327,
4563,
1012,
5884,
5302,
9247,
1012,
2009,
8663,
6494,
6593,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
2009,
3206,
7909,
10424,
2063,
4160,
11916,
5724,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
exports.forward = require('./forward');
exports.respond = require('./respond');
| umissthestars/nproxy | lib/middlewares/index.js | JavaScript | mit | 80 | [
30522,
14338,
1012,
2830,
1027,
5478,
1006,
1005,
1012,
1013,
2830,
1005,
1007,
1025,
14338,
1012,
6869,
1027,
5478,
1006,
1005,
1012,
1013,
6869,
1005,
1007,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
package org.pentaho.di.core.row;
import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.row.value.ValueMetaBoolean;
import org.pentaho.di.core.row.value.ValueMetaDate;
import org.pentaho.di.core.row.value.ValueMetaInteger;
import org.pentaho.di.core.row.value.ValueMetaNumber;
import org.pentaho.di.core.row.value.ValueMetaString;
import org.pentaho.di.core.util.StringUtil;
public class SpeedTest {
private static final Log log = LogFactory.getLog( SpeedTest.class );
private Object[] rowString10;
private Object[] rowString100;
private Object[] rowString1000;
private Object[] rowMixed10;
private Object[] rowMixed100;
private Object[] rowMixed1000;
private RowMetaInterface metaString10;
private RowMetaInterface metaMixed10;
private RowMetaInterface metaString100;
private RowMetaInterface metaMixed100;
private RowMetaInterface metaString1000;
private RowMetaInterface metaMixed1000;
public SpeedTest() {
rowString10 = new Object[10];
rowString100 = new Object[100];
rowString1000 = new Object[1000];
rowMixed10 = new Object[50];
rowMixed100 = new Object[500];
rowMixed1000 = new Object[5000];
metaString10 = new RowMeta();
metaMixed10 = new RowMeta();
metaString100 = new RowMeta();
metaMixed100 = new RowMeta();
metaString1000 = new RowMeta();
metaMixed1000 = new RowMeta();
for ( int i = 0; i < 10; i++ ) {
populateMetaAndData( i, rowString10, metaString10, rowMixed10, metaMixed10 );
}
for ( int i = 0; i < 100; i++ ) {
populateMetaAndData( i, rowString100, metaString100, rowMixed100, metaMixed100 );
}
for ( int i = 0; i < 1000; i++ ) {
populateMetaAndData( i, rowString1000, metaString1000, rowMixed1000, metaMixed1000 );
}
}
private static void populateMetaAndData( int i, Object[] rowString10, RowMetaInterface metaString10,
Object[] rowMixed10, RowMetaInterface metaMixed10 ) {
String strNamePrefix = "String";
rowString10[i] = StringUtil.generateRandomString( 20, "", "", false );
ValueMetaInterface meta = new ValueMetaString( strNamePrefix + ( i + 1 ), 20, 0 );
metaString10.addValueMeta( meta );
rowMixed10[i * 5 + 0] = StringUtil.generateRandomString( 20, "", "", false );
ValueMetaInterface meta0 = new ValueMetaString( strNamePrefix + ( i * 5 + 1 ), 20, 0 );
metaMixed10.addValueMeta( meta0 );
rowMixed10[i * 5 + 1] = new Date();
ValueMetaInterface meta1 = new ValueMetaDate( strNamePrefix + ( i * 5 + 1 ) );
metaMixed10.addValueMeta( meta1 );
rowMixed10[i * 5 + 2] = Double.valueOf( Math.random() * 1000000 );
ValueMetaInterface meta2 = new ValueMetaNumber( strNamePrefix + ( i * 5 + 1 ), 12, 4 );
metaMixed10.addValueMeta( meta2 );
rowMixed10[i * 5 + 3] = Long.valueOf( (long) ( Math.random() * 1000000 ) );
ValueMetaInterface meta3 = new ValueMetaInteger( strNamePrefix + ( i * 5 + 1 ), 8, 0 );
metaMixed10.addValueMeta( meta3 );
rowMixed10[i * 5 + 4] = Boolean.valueOf( Math.random() > 0.5 );
ValueMetaInterface meta4 = new ValueMetaBoolean( strNamePrefix + ( i * 5 + 1 ) );
metaMixed10.addValueMeta( meta4 );
}
public long runTestStrings10( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaString10.cloneRow( rowString10 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public long runTestMixed10( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaMixed10.cloneRow( rowMixed10 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public long runTestStrings100( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaString100.cloneRow( rowString100 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public long runTestMixed100( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaMixed100.cloneRow( rowMixed100 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public long runTestStrings1000( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaString1000.cloneRow( rowString1000 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public long runTestMixed1000( int iterations ) throws KettleValueException {
long startTime = System.currentTimeMillis();
for ( int i = 0; i < iterations; i++ ) {
metaMixed1000.cloneRow( rowMixed1000 );
}
long stopTime = System.currentTimeMillis();
return stopTime - startTime;
}
public static final int ITERATIONS = 1000000;
public static void main( String[] args ) throws KettleValueException {
SpeedTest speedTest = new SpeedTest();
String strTimesPrefix = " times : ";
String strMsPrefix = " ms (";
String strRowPerSec = " r/s)\n";
// Found a speed boost in adding to a string builder, then logging rather than logging each time.
StringBuilder runtimeTestMessage = new StringBuilder();
long timeString10 = speedTest.runTestStrings10( ITERATIONS );
runtimeTestMessage.append( "\nTime to run 'String10' test "
+ ITERATIONS + strTimesPrefix + timeString10 + strMsPrefix + ( 1000 * ITERATIONS / timeString10 ) + strRowPerSec );
long timeMixed10 = speedTest.runTestMixed10( ITERATIONS );
runtimeTestMessage.append( "Time to run 'Mixed10' test "
+ ITERATIONS + strTimesPrefix + timeMixed10 + strMsPrefix + ( 1000 * ITERATIONS / timeMixed10 ) + strRowPerSec );
long timeString100 = speedTest.runTestStrings100( ITERATIONS );
runtimeTestMessage.append( "Time to run 'String100' test "
+ ITERATIONS + strTimesPrefix + timeString100 + strMsPrefix + ( 1000 * ITERATIONS / timeString100 ) + strRowPerSec );
long timeMixed100 = speedTest.runTestMixed100( ITERATIONS );
runtimeTestMessage.append( "Time to run 'Mixed100' test "
+ ITERATIONS + strTimesPrefix + timeMixed100 + strMsPrefix + ( 1000 * ITERATIONS / timeMixed100 ) + strRowPerSec );
long timeString1000 = speedTest.runTestStrings1000( ITERATIONS );
runtimeTestMessage.append( "Time to run 'String1000' test "
+ ITERATIONS + strTimesPrefix + timeString1000 + strMsPrefix + ( 1000 * ITERATIONS / timeString1000 ) + strRowPerSec );
long timeMixed1000 = speedTest.runTestMixed1000( ITERATIONS );
runtimeTestMessage.append( "Time to run 'Mixed1000' test "
+ ITERATIONS + strTimesPrefix + timeMixed1000 + strMsPrefix + ( 1000 * ITERATIONS / timeMixed1000 ) + strRowPerSec );
log.info( runtimeTestMessage );
}
}
| tkafalas/pentaho-kettle | core/src/main/java/org/pentaho/di/core/row/SpeedTest.java | Java | apache-2.0 | 8,136 | [
30522,
1013,
1008,
999,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
np.random.seed(0)
n_samples = 30
degrees = [1, 4, 15]
true_fun = lambda X: np.cos(1.5 * np.pi * X)
X = np.sort(np.random.rand(n_samples))
y = true_fun(X) + np.random.randn(n_samples) * 0.1
plot_titles = ['Underfit', 'Just right', 'Overfit']
plt.figure(figsize=(14, 5))
for i in range(len(degrees)):
ax = plt.subplot(1, len(degrees), i + 1)
plt.setp(ax, xticks=(), yticks=())
polynomial_features = PolynomialFeatures(degree=degrees[i],
include_bias=False)
linear_regression = LinearRegression()
pipeline = Pipeline([("polynomial_features", polynomial_features),
("linear_regression", linear_regression)])
pipeline.fit(X[:, np.newaxis], y)
# Evaluate the models using crossvalidation
scores = cross_val_score(pipeline, X[:, np.newaxis], y,
scoring="neg_mean_squared_error", cv=10)
X_test = np.linspace(0, 1, 100)
plt.plot(X_test, pipeline.predict(X_test[:, np.newaxis]), label="Model")
#plt.plot(X_test, true_fun(X_test), label="True function")
plt.scatter(X, y, c='k', label="Samples")
plt.xlabel("x with degree: {}".format(degrees[i]))
plt.ylabel("y")
plt.xlim((0, 1))
plt.ylim((-2, 2))
plt.legend(loc="best")
plt.title(plot_titles[i])
#plt.show()
plt.savefig('images/overfit_underfit.png') | bhzunami/Immo | immo/scikit/scripts/Overfit_underfit.py | Python | mit | 1,611 | [
30522,
12324,
16371,
8737,
2100,
2004,
27937,
12324,
13523,
24759,
4140,
29521,
1012,
1052,
22571,
10994,
2004,
20228,
2102,
2013,
15315,
19738,
6826,
1012,
13117,
12324,
13117,
2013,
15315,
19738,
6826,
1012,
17463,
3217,
9623,
7741,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
I am SizeMismatch, an exception indicating that an operation was attempted
on two or more collections that don't match in size. | vineetreddyrajula/pharo | src/Collections-Abstract.package/SizeMismatch.class/README.md | Markdown | mit | 128 | [
30522,
1045,
2572,
2946,
26725,
4017,
2818,
1010,
2019,
6453,
8131,
2008,
2019,
3169,
2001,
4692,
2006,
2048,
2030,
2062,
6407,
2008,
2123,
1005,
1056,
2674,
1999,
2946,
1012,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.example;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Bar {
@XmlAttribute
private String name;
@XmlAttribute
private String value;
public Bar() {
}
public void setName(String name) {
this.name = name;
}
public void setValue(String value) {
this.value = value;
}
public String getName() {
return name;
}
public String getValue() {
return value;
}
}
| CandleCandle/camel | components/camel-jaxb/src/test/java/org/apache/camel/example/Bar.java | Java | apache-2.0 | 1,514 | [
30522,
1013,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% highlight js %}
$.ajax({
type:"GET",
url:"https://app.ticketmaster.com/discovery/v2/classifications/genres/KnvZfZ7vA71.json?apikey={apikey}",
async:true,
dataType: "json",
success: function(json) {
console.log(json);
// Parse the response.
// Do other things.
},
error: function(xhr, status, err) {
// This time, we do not end up here!
}
});
{% endhighlight %}
{% highlight bash %}
curl \
--include 'https://app.ticketmaster.com/discovery/v2/classifications/genres/KnvZfZ7vA71.json?apikey={apikey}'
{% endhighlight %} | ticketmaster-api/ticketmaster-api.github.io | _includes/apis-code-examples/discovery-api/code-get-genre.md | Markdown | mit | 612 | [
30522,
1063,
1003,
12944,
1046,
2015,
1003,
1065,
1002,
1012,
18176,
1006,
1063,
2828,
1024,
1000,
2131,
1000,
1010,
24471,
2140,
1024,
1000,
16770,
1024,
1013,
1013,
10439,
1012,
7281,
8706,
1012,
4012,
1013,
5456,
1013,
1058,
2475,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
๏ปฟ// Copyright (c) 2017 Jan Pluskal, Martin Mares, Martin Kmet
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.SqlClient;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using AlphaChiTech.Virtualization;
using AlphaChiTech.VirtualizingCollection.Interfaces;
using Castle.Windsor;
using Netfox.Core.Database;
using Netfox.Core.Interfaces;
using Netfox.Core.Interfaces.ViewModels;
using Netfox.Core.Models;
using Netfox.Detective.Interfaces.Models.Base;
using Netfox.Detective.Models.Conversations;
using Netfox.Detective.Models.Exports;
using Netfox.Framework.Models;
using Netfox.Framework.Models.Interfaces;
using Netfox.Framework.Models.PmLib.Captures;
using Netfox.Framework.Models.PmLib.Frames;
using Netfox.Framework.Models.Snoopers;
using Netfox.Persistence;
using PostSharp.Patterns.Model;
using Component = Castle.MicroKernel.Registration.Component;
namespace Netfox.Detective.Models.Base
{
/// <summary>
/// ConversationsVm of investigation.
/// </summary>
[NotifyPropertyChanged]
public class Investigation : IInvestigation
{
private IObservableCollection<PmFrameBase> _allFrames;
private IObservableCollection<PmCaptureBase> _captures;
private IObservableCollection<ConversationsGroup> _conversationsGroups;
private IObservableCollection<ExportGroup> _exportsGroups;
private IObservableCollection<PmFrameBase> _frames;
private IObservableCollection<L3Conversation> _l3Conversations;
private IObservableCollection<L4Conversation> _l4Conversations;
private IObservableCollection<L7Conversation> _l7Conversations;
private ConcurrentIObservableVirtualizingObservableCollection<OperationLog> _operationLogs;
private IObservableCollection<SnooperExportBase> _snooperExports;
private IObservableCollection<SourceLog.SourceLog> _sourceLogs;
public Investigation(IInvestigationInfo investigationInfo)
{
this.InvestigationInfo = investigationInfo;
this.InvestigationInfo.LastRecentlyUsed = DateTime.UtcNow;
this.OperationLogs = new ConcurrentIObservableVirtualizingObservableCollection<OperationLog>();
}
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<PmCaptureBase> Captures
=> this._captures ?? (this._captures = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<PmCaptureBase>>());
[DataMember]
public IInvestigationInfo InvestigationInfo { get; }
[NotMapped]
public ConcurrentIObservableVirtualizingObservableCollection<OperationLog> OperationLogs
{
get { return this._operationLogs; }
set
{
this._operationLogs = value;
this.OnPropertyChanged();
}
}
[IgnoreAutoChangeNotification]
[NotMapped]
public IObservableCollection<ConversationsGroup> ConversationsGroups
=>
this._conversationsGroups
?? (this._conversationsGroups = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<ConversationsGroup>>());
[IgnoreAutoChangeNotification]
[NotMapped]
public IObservableCollection<ExportGroup> ExportsGroups
=> this._exportsGroups ?? (this._exportsGroups = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<ExportGroup>>());
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<PmFrameBase> AllFrames
=> this._allFrames ?? (this._allFrames = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<PmFrameBase>>());
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<SourceLog.SourceLog> SourceLogs
=> this._sourceLogs ?? (this._sourceLogs = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<SourceLog.SourceLog>>());
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<PmFrameBase> Frames
=> this._frames ?? (this._frames = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<PmFrameBase>>());
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<L3Conversation> L3Conversations
=> this._l3Conversations ?? (this._l3Conversations = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<L3Conversation>>(new
{
eagerLoadProperties = new[]
{
nameof(L3Conversation.ConversationFlowStatistics)
}
}));
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<L4Conversation> L4Conversations
=> this._l4Conversations ?? (this._l4Conversations = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<L4Conversation>>(new
{
eagerLoadProperties = new[]
{
nameof(L4Conversation.ConversationFlowStatistics)
}
}));
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<L7Conversation> L7Conversations
=> this._l7Conversations ?? (this._l7Conversations = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<L7Conversation>>(new
{
eagerLoadProperties = new[]
{
nameof(L7Conversation.UnorderedL7PDUs),
nameof(L7Conversation.ConversationFlowStatistics),
nameof(L7Conversation.L4Conversation),
$"{nameof(L7Conversation.UnorderedL7PDUs)}.{nameof(L7PDU.UnorderedFrameList)}"
}
}));
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<SnooperExportBase> SnooperExports
=> this._snooperExports ?? (this._snooperExports = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<SnooperExportBase>>());
[NotMapped]
[IgnoreAutoChangeNotification]
public IObservableCollection<ISnooper> UsedSnoopers { get; } = new ConcurrentIObservableVirtualizingObservableCollection<ISnooper>();
public async Task Initialize()
{
await Task.Run(() =>
{
this.InitializeDatabase();
this._captures = this.InvestigationWindsorContainer.Resolve<VirtualizingObservableDBSetPagedCollection<PmCaptureBase>>();
});
}
public event PropertyChangedEventHandler PropertyChanged;
[NotMapped]
public IWindsorContainer InvestigationWindsorContainer { get; set; }
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void InitializeDatabase()
{
this.InvestigationWindsorContainer.Register(Component.For<SqlConnectionStringBuilder>().Instance(this.InvestigationInfo.SqlConnectionStringBuilder).LifestyleSingleton());
if(this.InvestigationInfo.IsInMemory)
{
this.InvestigationWindsorContainer.Register(Component.For<NetfoxDbContext, NetfoxDbContextInMemory>().LifestyleSingleton());
this.InvestigationWindsorContainer.Register(
Component.For<IObservableNetfoxDBContext>().ImplementedBy<NetfoxDbContextInMemory>().Named(nameof(IObservableNetfoxDBContext)).LifestyleSingleton());
}
else
{
this.InvestigationWindsorContainer.Register(Component.For<NetfoxDbContext>().ImplementedBy<NetfoxDbContext>().LifestyleTransient());
this.InvestigationWindsorContainer.Register(
Component.For<IObservableNetfoxDBContext>().ImplementedBy<NetfoxDbContext>().Named(nameof(IObservableNetfoxDBContext)).LifestyleSingleton());
}
var iObservableNetfoxDBContext = this.InvestigationWindsorContainer.Resolve<IObservableNetfoxDBContext>();
iObservableNetfoxDBContext.RegisterDbSetTypes();
iObservableNetfoxDBContext.RegisterVirtualizingObservableDBSetPagedCollections();
using(var dbx = this.InvestigationWindsorContainer.Resolve<NetfoxDbContext>()) { dbx.CheckCreateDatabase(); }
}
}
} | nesfit/NetfoxDetective | GUI/Netfox.Detective/Models/Base/Investigation.cs | C# | apache-2.0 | 9,394 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2418,
5553,
4606,
12902,
1010,
3235,
11941,
2015,
1010,
3235,
2463,
3388,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Craft;
/**
* The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_migrationName
*/
class m150918_000001_add_colspan_to_widgets extends BaseMigration
{
/**
* Any migration code in here is wrapped inside of a transaction.
*
* @return bool
*/
public function safeUp()
{
// Allow transforms to have a format
$this->addColumnAfter('widgets', 'colspan', array(AttributeType::Number, 'column' => ColumnType::TinyInt, 'unsigned' => true), 'sortOrder');
return true;
}
}
| delaneymethod/delaneymethod | craft/app/migrations/m150918_000001_add_colspan_to_widgets.php | PHP | mit | 516 | [
30522,
1026,
1029,
25718,
3415,
15327,
7477,
1025,
1013,
1008,
1008,
1008,
1996,
2465,
2171,
2003,
1996,
11396,
2335,
15464,
2361,
1999,
1996,
4289,
1997,
2026,
24335,
26876,
2094,
1035,
1044,
14227,
5244,
2015,
1035,
9230,
18442,
1008,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php namespace Trainingstats;
class Activity {
/**
* The time when the activity started
*
* @var \DateTime
*/
protected $startTime;
/**
* Points
*
* @var array
*/
protected $points = array();
/**
* Lap summaries
*
* @var array
*/
protected $laps = array();
protected $totalDistance = 0;
protected $movementDuration = 0;
protected $totalDuration = 0;
protected $maxHeartrate = 0;
protected $avgHeartrate = 0;
protected $avgPace = 0;
protected $maxPace = 0;
protected $kcal = 0;
protected $maxElevation = 0;
protected $minElevation = 0;
/**
* The constructor to create a new activity based on the xml node.
* @param $activityNode
*/
public function __construct($activityNode) {
date_default_timezone_set('Europe/Berlin');
$this->startTime = new \DateTime((string) $activityNode->Id);
foreach ($activityNode->Lap as $lapNode) {
$laps[] = $this->parseLap($lapNode);
}
if (count($laps) > 0) {
// Only set the laps if there is at least one
$this->setLaps($laps);
}
return $this;
}
/**
* Convert speed value from m/s to km/h
*
* @param float $speed The speed in m/s
* @return float The speed in km/h
*/
protected function convertSpeed($speed) {
return $speed * 3.6;
}
protected function parseLap(\SimpleXMLElement $lapNode) {
$startindex = count($this->getPoints());
$this->parseTrack($lapNode->Track);
$endindex = count($this->getPoints()) -1 ;
return new Lap($lapNode, $startindex, $endindex);
}
protected function parseTrack(\SimpleXMLElement $trackNode) {
foreach ($trackNode->Trackpoint as $trackpointNode) {
$point = $this->parseTrackpoint($trackpointNode);
if ($point) {
$this->addPoint($point);
}
}
}
protected function parseTrackpoint(\SimpleXMLElement $trackpointNode) {
// Skip the point if lat/lng not found
if (!isset($trackpointNode->Position->LatitudeDegrees) || !isset($trackpointNode->Position->LongitudeDegrees)) {
return;
}
$point = new Point();
$point->setElevation((float) $trackpointNode->AltitudeMeters);
$point->setDistance((float) $trackpointNode->DistanceMeters);
$point->setLatitude((float) $trackpointNode->Position->LatitudeDegrees);
$point->setLongitude((float) $trackpointNode->Position->LongitudeDegrees);
$point->getTime()->modify((string) $trackpointNode->Time);
if (isset($trackpointNode->HeartRateBpm->Value)) {
$point->setHeartRate((int) $trackpointNode->HeartRateBpm->Value);
}
if (isset($trackpointNode->Extensions->TPX->Speed)) {
$point->setSpeed($this->convertSpeed((float) $trackpointNode->Extensions->TPX->Speed));
} else {
// TODO If no speed is set, we can calculate it from the point before.
}
return $point;
}
public function addPoint(Point $point) {
$this->points[] = $point;
}
public function setPoints(array $points) {
$this->points = array();
foreach ($points as $point) {
$this->addPoint($point);
}
}
public function getPoints() {
return $this->points;
}
public function addLap(Lap $lap) {
$this->laps[] = $lap;
}
public function setLaps(array $laps) {
$this->laps = array();
foreach ($laps as $lap) {
$this->addLap($lap);
}
}
public function getLap($index) {
return $this->laps[$index];
}
public function getLaps() {
return $this->laps;
}
public function getTotalDistance() {
return $this->totalDistance;
}
public function getTotalDuration() {
return $this->totalDuration;
}
public function getMovementDuration() {
return $this->movementDuration;
}
public function getAvgHeartrate() {
return $this->avgHeartrate;
}
public function getMaxHeartrate() {
return $this->maxHeartrate;
}
public function getAvgPace() {
return $this->avgPace;
}
public function getMaxPace() {
return $this->maxPace;
}
public function getKcal() {
return $this->kcal;
}
public function getMaxElevation() {
return $this->maxElevation;
}
public function getMinElevation() {
return $this->minElevation;
}
} | McGo/trainingstats | src/Activity.php | PHP | mit | 4,218 | [
30522,
1026,
1029,
25718,
3415,
15327,
2731,
9153,
3215,
1025,
2465,
4023,
1063,
1013,
1008,
1008,
1008,
1996,
2051,
2043,
1996,
4023,
2318,
1008,
1008,
1030,
13075,
1032,
3058,
7292,
1008,
1013,
5123,
1002,
2707,
7292,
1025,
1013,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Matrix
class MainMatrix < Matrix::Base
attr_reader :result
def accumulate_by sub_matrix
current_value = 0
sub_matrix.each do |element|
x = element.x_index
y = element.y_index
@rows[y] ||= []
main_element_value = @rows[y][x].to_i
current_value += main_element_value
set x: x, y: y, value: current_value
end
@result = current_value
@result_matrix
end
def set options={}
@result_matrix ||= @rows.clone
@result_matrix[options[:y]][options[:x]] = options[:value]
end
end
end | ZackYang/matrix | lib/matrix/main_matrix.rb | Ruby | mit | 606 | [
30522,
11336,
8185,
2465,
2364,
18900,
17682,
1026,
8185,
1024,
1024,
2918,
2012,
16344,
1035,
8068,
1024,
2765,
13366,
27598,
1035,
2011,
4942,
1035,
8185,
2783,
1035,
3643,
1027,
1014,
4942,
1035,
8185,
1012,
2169,
2079,
1064,
5783,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Chaetoceros furca Cleve SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Chromista/Ochrophyta/Coscinodiscophyceae/Chaetocerotales/Chaetocerotaceae/Chaetoceros/Chaetoceros messanense/ Syn. Chaetoceros furca/README.md | Markdown | apache-2.0 | 180 | [
30522,
1001,
15775,
18903,
17119,
2891,
6519,
3540,
18856,
18697,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- title: erpnext.accounts.print_format.payment_receipt_voucher --><div class="dev-header">
<a class="btn btn-default btn-sm" disabled style="margin-bottom: 10px;">
Version 6.x.x</a>
<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/print_format/payment_receipt_voucher.py"
target="_blank" style="margin-left: 10px; margin-bottom: 10px;"><i class="octicon octicon-mark-github"></i> Source</a>
</div>
<!-- autodoc --> | mbauskar/helpdesk-erpnext | erpnext/docs/current/api/accounts/print_format/payment_receipt_voucher/erpnext.accounts.print_format.payment_receipt_voucher.html | HTML | agpl-3.0 | 487 | [
30522,
1026,
999,
1011,
1011,
2516,
1024,
9413,
2361,
2638,
18413,
1012,
6115,
1012,
6140,
1035,
4289,
1012,
7909,
1035,
24306,
1035,
29536,
22368,
1011,
1011,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
16475,
1011,
20346,
1000,
1028,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SoundCity Prototyp: Klassen-Elemente</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Erzeugt von Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Hauptseite</span></a></li>
<li><a href="pages.html"><span>Zusรคtzliche Informationen</span></a></li>
<li class="current"><a href="annotated.html"><span>Klassen</span></a></li>
<li><a href="files.html"><span>Dateien</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Auflistung der Klassen</span></a></li>
<li><a href="hierarchy.html"><span>Klassenhierarchie</span></a></li>
<li class="current"><a href="functions.html"><span>Klassen-Elemente</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li class="current"><a href="functions.html"><span>Alle</span></a></li>
<li><a href="functions_func.html"><span>Funktionen</span></a></li>
<li><a href="functions_vars.html"><span>Variablen</span></a></li>
<li><a href="functions_prop.html"><span>Propertys</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="functions.html#index__"><span>_</span></a></li>
<li><a href="functions_0x61.html#index_a"><span>a</span></a></li>
<li><a href="functions_0x62.html#index_b"><span>b</span></a></li>
<li><a href="functions_0x63.html#index_c"><span>c</span></a></li>
<li><a href="functions_0x64.html#index_d"><span>d</span></a></li>
<li><a href="functions_0x65.html#index_e"><span>e</span></a></li>
<li class="current"><a href="functions_0x66.html#index_f"><span>f</span></a></li>
<li><a href="functions_0x67.html#index_g"><span>g</span></a></li>
<li><a href="functions_0x68.html#index_h"><span>h</span></a></li>
<li><a href="functions_0x69.html#index_i"><span>i</span></a></li>
<li><a href="functions_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="functions_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="functions_0x6e.html#index_n"><span>n</span></a></li>
<li><a href="functions_0x6f.html#index_o"><span>o</span></a></li>
<li><a href="functions_0x70.html#index_p"><span>p</span></a></li>
<li><a href="functions_0x72.html#index_r"><span>r</span></a></li>
<li><a href="functions_0x73.html#index_s"><span>s</span></a></li>
<li><a href="functions_0x74.html#index_t"><span>t</span></a></li>
<li><a href="functions_0x75.html#index_u"><span>u</span></a></li>
<li><a href="functions_0x76.html#index_v"><span>v</span></a></li>
<li><a href="functions_0x77.html#index_w"><span>w</span></a></li>
</ul>
</div>
</div>
<div class="contents">
Hier folgt die Aufzรคhlung aller Klassenelemente mit Verweisen auf die zugehรถrigen Klassen:
<h3><a class="anchor" id="index_f">- f -</a></h3><ul>
<li>fitMapToRegion
: <a class="el" href="interface_map_view_controller.html#a518a53d75a01058fcbb9f32362504103">MapViewController</a>
, <a class="el" href="interface_track_route_view_controller.html#a318fa1634b09695c451368949fd6b7d8">TrackRouteViewController</a>
</li>
<li>footerView
: <a class="el" href="interface_p_o_i_details_view_controller.html#a5b670e066edf54f1f94ff6c521aafad1">POIDetailsViewController</a>
</li>
<li>foundPOI
: <a class="el" href="interface_map_view_controller.html#ac4ce9dd86dc3db11a6573ae2bccfecc6">MapViewController</a>
</li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Erzeugt am Thu Nov 12 17:19:33 2009 fรผr SoundCity Prototyp von
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>
| soraxdesign/SoundCity | Docs/html/functions_0x66.html | HTML | mit | 4,069 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
The Proprietà associativa della congiuzione
parameters will be replaced with the
document title extracted from the <h1> element or
file name, if there is no <h1> heading
-->
<title>Proprietà associativa della congiuzione
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-1.8.0.js"></script>
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js">
MathJax.Hub.Config({
config: ["TeX-AMS-MML_HTMLorMML.js"],
extensions: ["[a11y]/accessibility-menu.js"],
menuSettings: {
collapsible: true,
autocollapse: true,
explorer: false
}
});
</script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="content/style.css" />
<script src="content/tips.js" type="text/javascript"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container" >
<div class="row" style="margin-top:30px;">
<div class="span1"></div>
<div class="span10" id="main">
<h1>Proprietà associativa della congiuzione</h1>
<p><span class="math">\(\forall p\ q.\ p \wedge (q \wedge r) \Leftrightarrow (p \wedge q) \wedge r\)</span></p>
<pre class="fssnip highlighted"><code lang="fsharp"><span onmouseout="hideTip(event, 'fs6', 8)" onmouseover="showTip(event, 'fs6', 8)" class="id">conj_assoc_thm</span>
<span class="c">// |- !p q r. p /\ (q /\ r) <=> (p /\ q) /\ r</span>
</code></pre>
<p>Backward proof with tree</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="pn">(</span><span class="pn">[</span><span class="pn">]</span><span class="pn">,</span><span class="s">"!p q r. p /\ (q /\ r) <=> (p /\ q) /\ r"</span><span class="pn">)</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs7', 9)" onmouseover="showTip(event, 'fs7', 9)" class="fn">start_proof</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs8', 10)" onmouseover="showTip(event, 'fs8', 10)" class="fn">list_gen_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs9', 11)" onmouseover="showTip(event, 'fs9', 11)" class="fn">deduct_antisym_rule_bk</span> <span class="pn">[</span><span class="pn">]</span> <span class="pn">[</span><span class="pn">]</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs10', 12)" onmouseover="showTip(event, 'fs10', 12)" class="fn">conj_rule_bk</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs11', 13)" onmouseover="showTip(event, 'fs11', 13)" class="fn">conjunct1_rule_bk</span> <span class="s">"q:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs11', 14)" onmouseover="showTip(event, 'fs11', 14)" class="fn">conjunct1_rule_bk</span> <span class="s">"r:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 15)" onmouseover="showTip(event, 'fs12', 15)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs10', 16)" onmouseover="showTip(event, 'fs10', 16)" class="fn">conj_rule_bk</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs13', 17)" onmouseover="showTip(event, 'fs13', 17)" class="fn">conjunct2_rule_bk</span> <span class="s">"p:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs11', 18)" onmouseover="showTip(event, 'fs11', 18)" class="fn">conjunct1_rule_bk</span> <span class="s">"r:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 19)" onmouseover="showTip(event, 'fs12', 19)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs13', 20)" onmouseover="showTip(event, 'fs13', 20)" class="fn">conjunct2_rule_bk</span> <span class="s">@"p /\ q"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 21)" onmouseover="showTip(event, 'fs12', 21)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs10', 22)" onmouseover="showTip(event, 'fs10', 22)" class="fn">conj_rule_bk</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs10', 23)" onmouseover="showTip(event, 'fs10', 23)" class="fn">conj_rule_bk</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span> <span class="pn">[</span><span class="n">0</span><span class="pn">]</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs11', 24)" onmouseover="showTip(event, 'fs11', 24)" class="fn">conjunct1_rule_bk</span> <span class="s">@"q /\ r"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 25)" onmouseover="showTip(event, 'fs12', 25)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs11', 26)" onmouseover="showTip(event, 'fs11', 26)" class="fn">conjunct1_rule_bk</span> <span class="s">@"r:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs13', 27)" onmouseover="showTip(event, 'fs13', 27)" class="fn">conjunct2_rule_bk</span> <span class="s">@"p:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 28)" onmouseover="showTip(event, 'fs12', 28)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs13', 29)" onmouseover="showTip(event, 'fs13', 29)" class="fn">conjunct2_rule_bk</span> <span class="s">@"q:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs13', 30)" onmouseover="showTip(event, 'fs13', 30)" class="fn">conjunct2_rule_bk</span> <span class="s">@"p:bool"</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs12', 31)" onmouseover="showTip(event, 'fs12', 31)" class="fn">assume_rule_bk</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs14', 32)" onmouseover="showTip(event, 'fs14', 32)" class="fn">view</span>
</code></pre>
<p><span class="math">\(\small{ \color{green}{\dfrac
{[p:bool;q:bool;r:bool]
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{(p\ \wedge\ q)\ \wedge\ r}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ assume_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ p\ \wedge\ q}
\textsf{ conjunct1_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ p}
\textsf{ conjunct1_rule}}
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{(p\ \wedge\ q)\ \wedge\ r}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ assume_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ p\ \wedge\ q}
\textsf{ conjunct1_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ q}
\textsf{ conjunct2_rule}}
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{(p\ \wedge\ q)\ \wedge\ r}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ assume_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ r}
\textsf{ conjunct2_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ q\ \wedge\ r}
\textsf{ conj_rule}}}
{(p\ \wedge\ q)\ \wedge\ r\ \vdash\ p\ \wedge\ q\ \wedge\ r}
\textsf{ conj_rule}}
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{p\ \wedge\ q\ \wedge\ r}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ p\ \wedge\ q\ \wedge\ r}
\textsf{ assume_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ p}
\textsf{ conjunct1_rule}}
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{p\ \wedge\ q\ \wedge\ r}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ p\ \wedge\ q\ \wedge\ r}
\textsf{ assume_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ q\ \wedge\ r}
\textsf{ conjunct2_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ q}
\textsf{ conjunct1_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ p\ \wedge\ q}
\textsf{ conj_rule}}
\qquad
\color{green}{\dfrac
{\color{green}{\dfrac
{\color{green}{\dfrac
{p\ \wedge\ q\ \wedge\ r}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ p\ \wedge\ q\ \wedge\ r}
\textsf{ assume_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ q\ \wedge\ r}
\textsf{ conjunct2_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ r}
\textsf{ conjunct2_rule}}}
{p\ \wedge\ q\ \wedge\ r\ \vdash\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ conj_rule}}}
{\vdash\ p\ \wedge\ q\ \wedge\ r\ \Leftrightarrow\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ deduct_antisym_rule}}}
{\vdash\ \forall\ p\ q\ r.\ p\ \wedge\ q\ \wedge\ r\ \Leftrightarrow\ (p\ \wedge\ q)\ \wedge\ r}
\textsf{ list_gen_rule}} }\)</span></p>
<p>Forward proof with tree</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">let</span> <span onmouseout="hideTip(event, 'fs15', 33)" onmouseover="showTip(event, 'fs15', 33)" class="id">th1</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs16', 34)" onmouseover="showTip(event, 'fs16', 34)" class="fn">assume_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs17', 35)" onmouseover="showTip(event, 'fs17', 35)" class="fn">parse_term</span><span class="pn">(</span><span class="s">@"p /\ (q /\ r)"</span><span class="pn">)</span><span class="pn">)</span> <span class="k">in</span>
<span class="k">let</span> <span onmouseout="hideTip(event, 'fs18', 36)" onmouseover="showTip(event, 'fs18', 36)" class="id">th2</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs16', 37)" onmouseover="showTip(event, 'fs16', 37)" class="fn">assume_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs17', 38)" onmouseover="showTip(event, 'fs17', 38)" class="fn">parse_term</span><span class="pn">(</span><span class="s">@"(p /\ q) /\ r"</span><span class="pn">)</span><span class="pn">)</span> <span class="k">in</span>
<span onmouseout="hideTip(event, 'fs19', 39)" onmouseover="showTip(event, 'fs19', 39)" class="fn">list_gen_rule_fd</span> <span class="pn">[</span><span onmouseout="hideTip(event, 'fs20', 40)" onmouseover="showTip(event, 'fs20', 40)" class="id">p</span><span class="pn">;</span><span onmouseout="hideTip(event, 'fs21', 41)" onmouseover="showTip(event, 'fs21', 41)" class="id">q</span><span class="pn">;</span><span onmouseout="hideTip(event, 'fs22', 42)" onmouseover="showTip(event, 'fs22', 42)" class="id">r</span><span class="pn">]</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs23', 43)" onmouseover="showTip(event, 'fs23', 43)" class="fn">deduct_antisym_rule_fd</span>
<span class="c">(* (p /\ q) /\ r |- p /\ (q /\ r) *)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs24', 44)" onmouseover="showTip(event, 'fs24', 44)" class="fn">conj_rule_fd</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs25', 45)" onmouseover="showTip(event, 'fs25', 45)" class="fn">conjunct1_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs25', 46)" onmouseover="showTip(event, 'fs25', 46)" class="fn">conjunct1_rule_fd</span> <span onmouseout="hideTip(event, 'fs18', 47)" onmouseover="showTip(event, 'fs18', 47)" class="id">th2</span><span class="pn">)</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs24', 48)" onmouseover="showTip(event, 'fs24', 48)" class="fn">conj_rule_fd</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs26', 49)" onmouseover="showTip(event, 'fs26', 49)" class="fn">conjunct2_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs25', 50)" onmouseover="showTip(event, 'fs25', 50)" class="fn">conjunct1_rule_fd</span> <span onmouseout="hideTip(event, 'fs18', 51)" onmouseover="showTip(event, 'fs18', 51)" class="id">th2</span><span class="pn">)</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs26', 52)" onmouseover="showTip(event, 'fs26', 52)" class="fn">conjunct2_rule_fd</span> <span onmouseout="hideTip(event, 'fs18', 53)" onmouseover="showTip(event, 'fs18', 53)" class="id">th2</span><span class="pn">)</span> <span class="pn">)</span><span class="pn">)</span>
<span class="c">(* (p /\ q) /\ r |- (p /\ q) /\ r *)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs24', 54)" onmouseover="showTip(event, 'fs24', 54)" class="fn">conj_rule_fd</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs24', 55)" onmouseover="showTip(event, 'fs24', 55)" class="fn">conj_rule_fd</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs25', 56)" onmouseover="showTip(event, 'fs25', 56)" class="fn">conjunct1_rule_fd</span> <span onmouseout="hideTip(event, 'fs15', 57)" onmouseover="showTip(event, 'fs15', 57)" class="id">th1</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs25', 58)" onmouseover="showTip(event, 'fs25', 58)" class="fn">conjunct1_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs26', 59)" onmouseover="showTip(event, 'fs26', 59)" class="fn">conjunct2_rule_fd</span> <span onmouseout="hideTip(event, 'fs15', 60)" onmouseover="showTip(event, 'fs15', 60)" class="id">th1</span><span class="pn">)</span><span class="pn">)</span> <span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs26', 61)" onmouseover="showTip(event, 'fs26', 61)" class="fn">conjunct2_rule_fd</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs26', 62)" onmouseover="showTip(event, 'fs26', 62)" class="fn">conjunct2_rule_fd</span> <span onmouseout="hideTip(event, 'fs15', 63)" onmouseover="showTip(event, 'fs15', 63)" class="id">th1</span><span class="pn">)</span><span class="pn">)</span> <span class="pn">)</span><span class="pn">)</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs27', 64)" onmouseover="showTip(event, 'fs27', 64)" class="fn">zipper</span>
<span class="o">|></span> <span onmouseout="hideTip(event, 'fs14', 65)" onmouseover="showTip(event, 'fs14', 65)" class="fn">view</span>
</code></pre>
<p>Classic forward proof without tree</p>
<pre class="fssnip highlighted"><code lang="fsharp"><span class="k">let</span> <span onmouseout="hideTip(event, 'fs28', 66)" onmouseover="showTip(event, 'fs28', 66)" class="id">th1'</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs29', 67)" onmouseover="showTip(event, 'fs29', 67)" class="fn">assume_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs17', 68)" onmouseover="showTip(event, 'fs17', 68)" class="fn">parse_term</span><span class="pn">(</span><span class="s">@"p /\ (q /\ r)"</span><span class="pn">)</span><span class="pn">)</span> <span class="k">in</span>
<span class="k">let</span> <span onmouseout="hideTip(event, 'fs30', 69)" onmouseover="showTip(event, 'fs30', 69)" class="id">th2'</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fs29', 70)" onmouseover="showTip(event, 'fs29', 70)" class="fn">assume_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs17', 71)" onmouseover="showTip(event, 'fs17', 71)" class="fn">parse_term</span><span class="pn">(</span><span class="s">@"(p /\ q) /\ r"</span><span class="pn">)</span><span class="pn">)</span> <span class="k">in</span>
<span onmouseout="hideTip(event, 'fs31', 72)" onmouseover="showTip(event, 'fs31', 72)" class="fn">list_gen_rule</span> <span class="pn">[</span><span onmouseout="hideTip(event, 'fs20', 73)" onmouseover="showTip(event, 'fs20', 73)" class="id">p</span><span class="pn">;</span><span onmouseout="hideTip(event, 'fs21', 74)" onmouseover="showTip(event, 'fs21', 74)" class="id">q</span><span class="pn">;</span><span onmouseout="hideTip(event, 'fs22', 75)" onmouseover="showTip(event, 'fs22', 75)" class="id">r</span><span class="pn">]</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs32', 76)" onmouseover="showTip(event, 'fs32', 76)" class="fn">deduct_antisym_rule</span>
<span class="c">(* (p /\ q) /\ r |- p /\ (q /\ r) *)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs33', 77)" onmouseover="showTip(event, 'fs33', 77)" class="fn">conj_rule</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs34', 78)" onmouseover="showTip(event, 'fs34', 78)" class="fn">conjunct1_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs34', 79)" onmouseover="showTip(event, 'fs34', 79)" class="fn">conjunct1_rule</span> <span onmouseout="hideTip(event, 'fs30', 80)" onmouseover="showTip(event, 'fs30', 80)" class="id">th2'</span><span class="pn">)</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs33', 81)" onmouseover="showTip(event, 'fs33', 81)" class="fn">conj_rule</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs35', 82)" onmouseover="showTip(event, 'fs35', 82)" class="fn">conjunct2_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs34', 83)" onmouseover="showTip(event, 'fs34', 83)" class="fn">conjunct1_rule</span> <span onmouseout="hideTip(event, 'fs30', 84)" onmouseover="showTip(event, 'fs30', 84)" class="id">th2'</span><span class="pn">)</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs35', 85)" onmouseover="showTip(event, 'fs35', 85)" class="fn">conjunct2_rule</span> <span onmouseout="hideTip(event, 'fs30', 86)" onmouseover="showTip(event, 'fs30', 86)" class="id">th2'</span><span class="pn">)</span> <span class="pn">)</span><span class="pn">)</span>
<span class="c">(* (p /\ q) /\ r |- (p /\ q) /\ r *)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs33', 87)" onmouseover="showTip(event, 'fs33', 87)" class="fn">conj_rule</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs33', 88)" onmouseover="showTip(event, 'fs33', 88)" class="fn">conj_rule</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs34', 89)" onmouseover="showTip(event, 'fs34', 89)" class="fn">conjunct1_rule</span> <span onmouseout="hideTip(event, 'fs28', 90)" onmouseover="showTip(event, 'fs28', 90)" class="id">th1'</span><span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs34', 91)" onmouseover="showTip(event, 'fs34', 91)" class="fn">conjunct1_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs35', 92)" onmouseover="showTip(event, 'fs35', 92)" class="fn">conjunct2_rule</span> <span onmouseout="hideTip(event, 'fs28', 93)" onmouseover="showTip(event, 'fs28', 93)" class="id">th1'</span><span class="pn">)</span><span class="pn">)</span> <span class="pn">)</span>
<span class="pn">(</span><span onmouseout="hideTip(event, 'fs35', 94)" onmouseover="showTip(event, 'fs35', 94)" class="fn">conjunct2_rule</span> <span class="pn">(</span><span onmouseout="hideTip(event, 'fs35', 95)" onmouseover="showTip(event, 'fs35', 95)" class="fn">conjunct2_rule</span> <span onmouseout="hideTip(event, 'fs28', 96)" onmouseover="showTip(event, 'fs28', 96)" class="id">th1'</span><span class="pn">)</span><span class="pn">)</span> <span class="pn">)</span><span class="pn">)</span>
</code></pre>
<div class="tip" id="fs1">namespace HOL</div>
<div class="tip" id="fs2">module CoreThry<br /><br />from HOL</div>
<div class="tip" id="fs3">val load : (string * thm) list</div>
<div class="tip" id="fs4">module Equal<br /><br />from HOL</div>
<div class="tip" id="fs5">module Bool<br /><br />from HOL</div>
<div class="tip" id="fs6">val conj_assoc_thm : thm</div>
<div class="tip" id="fs7">val start_proof : xs:string list * s:string -> Proof Location</div>
<div class="tip" id="fs8">val list_gen_rule_bk : loc:(Exp * string * InfRule) Location -> (Exp * string * InfRule) Location</div>
<div class="tip" id="fs9">val deduct_antisym_rule_bk : ind1:int list -> ind2:int list -> loc:(Exp * string * InfRule) Location -> (Exp * string * InfRule) Location</div>
<div class="tip" id="fs10">val conj_rule_bk : ind1:int list -> ind2:int list -> loc:(Exp * string * InfRule) Location -> (Exp * string * InfRule) Location</div>
<div class="tip" id="fs11">val conjunct1_rule_bk : t2:string -> loc:Proof Location -> Proof Location</div>
<div class="tip" id="fs12">val assume_rule_bk : loc:Proof Location -> Proof Location</div>
<div class="tip" id="fs13">val conjunct2_rule_bk : t1:string -> loc:Proof Location -> Proof Location</div>
<div class="tip" id="fs14">val view : loc:Proof Location -> Proof Location</div>
<div class="tip" id="fs15">val th1 : Proof Tree</div>
<div class="tip" id="fs16">val assume_rule_fd : t:term -> Proof Tree</div>
<div class="tip" id="fs17">val parse_term : x:string -> term</div>
<div class="tip" id="fs18">val th2 : Proof Tree</div>
<div class="tip" id="fs19">val list_gen_rule_fd : (term list -> Proof Tree -> Proof Tree)</div>
<div class="tip" id="fs20">val p : term</div>
<div class="tip" id="fs21">val q : term</div>
<div class="tip" id="fs22">val r : term</div>
<div class="tip" id="fs23">val deduct_antisym_rule_fd : t1:Proof Tree -> t2:Proof Tree -> Proof Tree</div>
<div class="tip" id="fs24">val conj_rule_fd : (Proof Tree -> Proof Tree -> Proof Tree)</div>
<div class="tip" id="fs25">val conjunct1_rule_fd : (Proof Tree -> Proof Tree)</div>
<div class="tip" id="fs26">val conjunct2_rule_fd : (Proof Tree -> Proof Tree)</div>
<div class="tip" id="fs27">val zipper : t:'a Tree -> 'a Location</div>
<div class="tip" id="fs28">val th1' : thm</div>
<div class="tip" id="fs29">val assume_rule : tm:term -> thm</div>
<div class="tip" id="fs30">val th2' : thm</div>
<div class="tip" id="fs31">val list_gen_rule : tms:term list -> th:thm -> thm</div>
<div class="tip" id="fs32">val deduct_antisym_rule : th01:thm -> th02:thm -> thm</div>
<div class="tip" id="fs33">val conj_rule : th01:thm -> th02:thm -> thm</div>
<div class="tip" id="fs34">val conjunct1_rule : th:thm -> thm</div>
<div class="tip" id="fs35">val conjunct2_rule : th:thm -> thm</div>
</div>
<div class="span1"></div>
</div>
</div>
</body>
</html>
| domasin/NHolZ | docs/0011_conj_assoc.html | HTML | gpl-3.0 | 23,204 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
999,
1011,
1011,
1996,
17678,
7373,
2102,
1004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
"""
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
# 6367 km is the radius of the Earth
km = 6367 * c
return km
| anduslim/codex | codex_project/actors/haversine.py | Python | mit | 554 | [
30522,
2013,
8785,
12324,
10958,
11692,
2015,
1010,
2522,
2015,
1010,
8254,
1010,
2004,
2378,
1010,
5490,
5339,
13366,
2031,
2869,
3170,
1006,
8840,
2078,
2487,
1010,
2474,
2102,
2487,
1010,
8840,
2078,
2475,
1010,
2474,
2102,
2475,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// AppDelegate.h
// ios-WK-UI-Webview
//
// Created by Emiliano Barbosa on 9/15/15.
// Copyright ยฉ 2015 Bocamuchas. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
| emilianoeloi/ios-WK-UI-WebView | ios-WK-UI-Webview/AppDelegate.h | C | mit | 653 | [
30522,
1013,
1013,
1013,
1013,
10439,
9247,
29107,
2618,
1012,
1044,
1013,
1013,
16380,
1011,
1059,
2243,
1011,
21318,
1011,
4773,
8584,
1013,
1013,
1013,
1013,
2580,
2011,
20417,
3630,
3347,
15853,
2050,
2006,
1023,
1013,
2321,
1013,
2321,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/IncrementalClearCOMRuleArray.h"
#include <algorithm> // For std::min
#include "nsCycleCollector.h"
#include "mozilla/DeferredFinalize.h"
#include "nsTArray.h"
#include "nsCCUncollectableMarker.h"
using namespace mozilla;
typedef nsCOMArray<css::Rule> RuleArray;
typedef nsTArray<RuleArray> RuleArrayArray;
// These methods are based on those in DeferredFinalizerImpl.
static void*
AppendRulesArrayPointer(void* aData, void* aObject)
{
RuleArrayArray* rulesArray = static_cast<RuleArrayArray*>(aData);
RuleArray* oldRules = static_cast<RuleArray*>(aObject);
if (!rulesArray) {
rulesArray = new RuleArrayArray();
}
RuleArray* newRules = rulesArray->AppendElement();
newRules->SwapElements(*oldRules);
return rulesArray;
}
// Remove up to |aSliceBudget| css::Rules from the arrays, starting at
// the end of the last array.
static bool
DeferredFinalizeRulesArray(uint32_t aSliceBudget, void* aData)
{
MOZ_ASSERT(aSliceBudget > 0, "nonsensical/useless call with aSliceBudget == 0");
RuleArrayArray* rulesArray = static_cast<RuleArrayArray*>(aData);
size_t newOuterLen = rulesArray->Length();
while (aSliceBudget > 0 && newOuterLen > 0) {
RuleArray& lastArray = rulesArray->ElementAt(newOuterLen - 1);
uint32_t innerLen = lastArray.Length();
uint32_t currSlice = std::min(innerLen, aSliceBudget);
uint32_t newInnerLen = innerLen - currSlice;
lastArray.TruncateLength(newInnerLen);
aSliceBudget -= currSlice;
if (newInnerLen == 0) {
newOuterLen -= 1;
}
}
rulesArray->TruncateLength(newOuterLen);
if (newOuterLen == 0) {
delete rulesArray;
return true;
}
return false;
}
void
IncrementalClearCOMRuleArray::Clear()
{
// Destroy the array incrementally if it is long and we
// haven't started shutting down.
if (Length() > 10 && nsCCUncollectableMarker::sGeneration) {
DeferredFinalize(AppendRulesArrayPointer, DeferredFinalizeRulesArray, this);
} else {
nsCOMArray<css::Rule>::Clear();
}
MOZ_ASSERT(Length() == 0);
}
| Yukarumya/Yukarum-Redfoxes | layout/style/IncrementalClearCOMRuleArray.cpp | C++ | mpl-2.0 | 2,371 | [
30522,
1013,
1008,
1011,
1008,
1011,
5549,
1024,
1039,
1009,
1009,
1025,
21628,
1011,
9381,
1024,
1022,
1025,
27427,
30524,
1008,
1011,
1008,
1013,
1013,
1008,
6819,
2213,
1024,
2275,
24529,
1027,
1022,
8541,
1027,
1016,
3802,
25430,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Module util.js
* Its static common helpers methods
*/
(function (window) {
if (!Array.isArray) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
var util = {};
/**
* Deeply extends two objects
* @param {Object} destination The destination object, This object will change
* @param {Object} source The custom options to extend destination by
* @return {Object} The desination object
*/
util.extend = function (destination, source) {
var property;
for (property in source) {
if (source[property] && source[property].constructor && source[property].constructor === Object) {
destination[property] = destination[property] || {};
util.extend(destination[property], source[property]);
} else {
destination[property] = source[property];
}
}
return destination;
};
/**
* Clone object
* @param {Object} source
* @returns {*}
*/
util.objClone = function (source) {
if (source === null || typeof source !== 'object') return source;
var temp = source.constructor();
for (var key in source)
temp[key] = util.objClone(source[key]);
return temp;
};
/**
* Count object length
* @param {Object} source
* @returns {number}
*/
util.objLen = function (source) {
var it = 0;
for (var k in source) it++;
return it;
};
/**
* Merge an object `src` into the object `objectBase`
* @param objectBase main object of merge
* @param src the elements of this object will be added/replaced to main object `obj`
* @returns {*} object result
*/
util.objMerge = function (objectBase, src) {
if (typeof objectBase !== 'object' || typeof src !== 'object')
return false;
if (Object.key) {
Object.keys(src).forEach(function (key) {
objectBase[key] = src[key];
});
return objectBase;
} else {
for (var key in src)
if (src.hasOwnProperty(key)) objectBase[key] = src[key];
return objectBase;
}
};
/**
* Merge objects if `objectBase` key not exists
* @param objectBase
* @param src
* @returns {*}
*/
util.objMergeNotExists = function (objectBase, src) {
for (var key in src)
if (objectBase[key] === undefined)
objectBase[key] = src[key];
return objectBase;
};
/**
* Merge objects if `objectBase` key is exists
* @param objectBase
* @param src
* @returns {*}
*/
util.objMergeOnlyExists = function (objectBase, src) {
for (var key in src)
if (objectBase[key] !== undefined)
objectBase[key] = src[key];
return objectBase;
};
/**
* Merge an array `src` into the array `arrBase`
* @param arrBase
* @param src
* @returns {*}
*/
util.arrMerge = function (arrBase, src) {
if (!Array.isArray(arrBase) || !Array.isArray(src))
return false;
for (var i = 0; i < src.length; i++)
arrBase.push(src[i])
return arrBase;
};
/**
* Computes the difference of arrays
* Compares arr1 against one or more other arrays and returns the values in arr1
* that are not present in any of the other arrays.
* @param arr1
* @param arr2
* @returns {*}
*/
util.arrDiff = function (arr1, arr2) {
if (util.isArr(arr1) && util.isArr(arr2)) {
return arr1.slice(0).filter(function (item) {
return arr2.indexOf(item) === -1;
})
}
return false;
};
util.objToArr = function (obj) {
return [].slice.call(obj);
};
util.realObjToArr = function (obj) {
var arr = [];
for (var key in obj)
arr.push(obj[key])
return arr;
};
util.cloneFunction = function (func) {
var temp = function temporary() {
return func.apply(this, arguments);
};
for (var key in this) {
if (this.hasOwnProperty(key)) {
temp[key] = this[key];
}
}
return temp;
};
/**
* Check on typeof is string a param
* @param param
* @returns {boolean}
*/
util.isStr = function (param) {
return typeof param === 'string';
};
/**
* Check on typeof is array a param
* @param param
* @returns {boolean}
*/
util.isArr = function (param) {
return Array.isArray(param);
};
/**
* Check on typeof is object a param
* @param param
* @returns {boolean}
*/
util.isObj = function (param) {
return (param !== null && typeof param == 'object');
};
/**
* Determine param is a number or a numeric string
* @param param
* @returns {boolean}
*/
util.isNum = function (param) {
return !isNaN(param);
};
// Determine whether a variable is empty
util.isEmpty = function (param) {
return (param === "" || param === 0 || param === "0" || param === null || param === undefined || param === false || (util.isArr(param) && param.length === 0));
};
util.isHtml = function (param) {
if (util.isNode(param)) return true;
return util.isNode(util.html2node(param));
};
util.isNode = function (param) {
var types = [1, 9, 11];
if (typeof param === 'object' && types.indexOf(param.nodeType) !== -1) return true;
else return false;
};
/**
*
* Node.ELEMENT_NODE - 1 - ELEMENT
* Node.TEXT_NODE - 3 - TEXT
* Node.PROCESSING_INSTRUCTION_NODE - 7 - PROCESSING
* Node.COMMENT_NODE - 8 - COMMENT
* Node.DOCUMENT_NODE - 9 - DOCUMENT
* Node.DOCUMENT_TYPE_NODE - 10 - DOCUMENT_TYPE
* Node.DOCUMENT_FRAGMENT_NODE - 11 - FRAGMENT
* Uses: Util.isNodeType(elem, 'element')
*/
util.isNodeType = function (param, type) {
type = String((type ? type : 1)).toUpperCase();
if (typeof param === 'object') {
switch (type) {
case '1':
case 'ELEMENT':
return param.nodeType === Node.ELEMENT_NODE;
break;
case '3':
case 'TEXT':
return param.nodeType === Node.TEXT_NODE;
break;
case '7':
case 'PROCESSING':
return param.nodeType === Node.PROCESSING_INSTRUCTION_NODE;
break;
case '8':
case 'COMMENT':
return param.nodeType === Node.COMMENT_NODE;
break;
case '9':
case 'DOCUMENT':
return param.nodeType === Node.DOCUMENT_NODE;
break;
case '10':
case 'DOCUMENT_TYPE':
return param.nodeType === Node.DOCUMENT_TYPE_NODE;
break;
case '11':
case 'FRAGMENT':
return param.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
break;
default:
return false;
}
}
else return false;
};
/**
* Determine param to undefined type
* @param param
* @returns {boolean}
*/
util.defined = function (param) {
return typeof(param) != 'undefined';
};
/**
* Javascript object to JSON data
* @param data
*/
util.objToJson = function (data) {
return JSON.stringify(data);
};
/**
* JSON data to Javascript object
* @param data
*/
util.jsonToObj = function (data) {
return JSON.parse(data);
};
/**
* Cleans the array of empty elements
* @param src
* @returns {Array}
*/
util.cleanArr = function (src) {
var arr = [];
for (var i = 0; i < src.length; i++)
if (src[i]) arr.push(src[i]);
return arr;
};
/**
* Return type of data as name object "Array", "Object", "String", "Number", "Function"
* @param data
* @returns {string}
*/
util.typeOf = function (data) {
return Object.prototype.toString.call(data).slice(8, -1);
};
/**
* Convert HTML form to encode URI string
* @param form
* @param asObject
* @returns {*}
*/
util.formData = function (form, asObject) {
var obj = {}, str = '';
for (var i = 0; i < form.length; i++) {
var f = form[i];
if (f.type == 'submit' || f.type == 'button') continue;
if ((f.type == 'radio' || f.type == 'checkbox') && f.checked == false) continue;
var fName = f.nodeName.toLowerCase();
if (fName == 'input' || fName == 'select' || fName == 'textarea') {
obj[f.name] = f.value;
str += ((str == '') ? '' : '&') + f.name + '=' + encodeURIComponent(f.value);
}
}
return (asObject === true) ? obj : str;
};
/**
* HTML string convert to DOM Elements Object
* @param data
* @returns {*}
*/
util.toNode = function (data) {
var parser = new DOMParser();
var node = parser.parseFromString(data, "text/xml");
console.log(node);
if (typeof node == 'object' && node.firstChild.nodeType == Node.ELEMENT_NODE)
return node.firstChild;
else return false;
};
/**
* Removes duplicate values from an array
* @param arr
* @returns {Array}
*/
util.uniqueArr = function (arr) {
var tmp = [];
for (var i = 0; i < arr.length; i++) {
if (tmp.indexOf(arr[i]) == "-1") tmp.push(arr[i]);
}
return tmp;
};
/**
* Reads entire file into a string, synchronously
* This function uses XmlHttpRequest and cannot retrieve resource from different domain.
* @param url
* @returns {*|string|null|string}
*/
util.fileGetContents = function (url) {
var req = null;
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
try {
req = new XMLHttpRequest();
} catch (e) {
}
}
}
if (req == null) throw new Error('XMLHttpRequest not supported');
req.open("GET", url, false);
req.send(null);
return req.responseText;
};
/**
* Calculates the position and size of elements.
*
* @param elem
* @returns {{y: number, x: number, width: number, height: number}}
*/
util.getPosition = function (elem) {
var top = 0, left = 0;
if (elem.getBoundingClientRect) {
var box = elem.getBoundingClientRect();
var body = document.body;
var docElem = document.documentElement;
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
var clientTop = docElem.clientTop || body.clientTop || 0;
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
top = box.top + scrollTop - clientTop;
left = box.left + scrollLeft - clientLeft;
return {y: Math.round(top), x: Math.round(left), width: elem.offsetWidth, height: elem.offsetHeight};
} else { //fallback to naive approach
while (elem) {
top = top + parseInt(elem.offsetTop, 10);
left = left + parseInt(elem.offsetLeft, 10);
elem = elem.offsetParent;
}
return {x: left, y: top, width: elem.offsetWidth, height: elem.offsetHeight};
}
};
/**
* Returns the coordinates of the mouse on any element
* @param event
* @param element
* @returns {{x: number, y: number}}
*/
util.getMousePosition = function (event, element) {
var positions = {x: 0, y: 0};
element = element || document.body;
if (element instanceof HTMLElement && event instanceof MouseEvent) {
if (element.getBoundingClientRect) {
var rect = element.getBoundingClientRect();
positions.x = event.clientX - rect.left;
positions.y = event.clientY - rect.top;
} else {
positions.x = event.pageX - element.offsetLeft;
positions.y = event.pageY - element.offsetTop;
}
}
return positions;
};
/**
* Creator of styles, return style-element or style-text.
*
* <pre>var style = createStyle('body','font-size:10px');
*style.add('body','font-size:10px') // added style
*style.add( {'background-color':'red'} ) // added style
*style.getString() // style-text
*style.getObject() // style-element</pre>
*
* @param selector name of selector styles
* @param property string "display:object" or object {'background-color':'red'}
* @returns {*} return object with methods : getString(), getObject(), add()
*/
util.createStyle = function (selector, property) {
var o = {
content: '',
getString: function () {
return '<style rel="stylesheet">' + "\n" + o.content + "\n" + '</style>';
},
getObject: function () {
var st = document.createElement('style');
st.setAttribute('rel', 'stylesheet');
st.textContent = o.content;
return st;
},
add: function (select, prop) {
if (typeof prop === 'string') {
o.content += select + "{" + ( (prop.substr(-1) == ';') ? prop : prop + ';' ) + "}";
} else if (typeof prop === 'object') {
o.content += select + "{";
for (var key in prop)
o.content += key + ':' + prop[key] + ';';
o.content += "}";
}
return this;
}
};
return o.add(selector, property);
};
/**
* Create new NodeElement
* @param tag element tag name 'p, div, h3 ... other'
* @param attrs object with attributes key=value
* @param inner text, html or NodeElement
* @returns {Element}
*/
util.createElement = function (tag, attrs, inner) {
var elem = document.createElement(tag);
if (typeof attrs === 'object') {
for (var key in attrs)
elem.setAttribute(key, attrs[key]);
}
if (typeof inner === 'string') {
elem.innerHTML = inner;
} else if (typeof inner === 'object') {
elem.appendChild(elem);
}
return elem;
};
/**
* Returns a random integer between min, max, if not specified the default of 0 to 100
* @param min
* @param max
* @returns {number}
*/
util.rand = function (min, max) {
min = min || 0;
max = max || 100;
return Math.floor(Math.random() * (max - min + 1) + min);
};
/**
* Returns random string color, HEX format
* @returns {string}
*/
util.randColor = function () {
var letters = '0123456789ABCDEF'.split(''),
color = '#';
for (var i = 0; i < 6; i++)
color += letters[Math.floor(Math.random() * 16)];
return color;
};
/**
* Converts degrees to radians
* @param deg
* @returns {number}
*/
util.degreesToRadians = function (deg) {
return (deg * Math.PI) / 180;
};
/**
* Converts radians to degrees
* @param rad
* @returns {number}
*/
util.radiansToDegrees = function (rad) {
return (rad * 180) / Math.PI;
};
/**
* The calculation of the distance between points
* The point is an object with properties `x` and `y` {x:100,y:100}
* @param point1
* @param point2
* @returns {number}
*/
util.distanceBetween = function (point1, point2) {
var dx = point2.x - point1.x;
var dy = point2.y - point1.y;
return Math.sqrt(dx * dx + dy * dy);
};
/**
* Encode URI params
* @param data Object key=value
* @returns {*} query string
*/
util.encodeData = function (data) {
if (typeof data === 'string') return data;
if (typeof data !== 'object') return '';
var convertData = [];
Object.keys(data).forEach(function (key) {
convertData.push(key + '=' + encodeURIComponent(data[key]));
});
return convertData.join('&');
};
/**
* Parse URI Request data into object
* @param url
* @returns {{}}
*/
util.parseGet = function (url) {
url = url || document.location;
var params = {};
var parser = document.createElement('a');
parser.href = url;
if (parser.search.length > 1) {
parser.search.substr(1).split('&').forEach(function (part) {
var item = part.split('=');
params[item[0]] = decodeURIComponent(item[1]);
});
}
return params;
};
/**
* Parse Url string/location into object
* @param url
* @returns {{}}
*/
util.parseUrl = function (url) {
url = url || document.location;
var params = {};
var parser = document.createElement('a');
parser.href = url;
params.protocol = parser.protocol;
params.host = parser.host;
params.hostname = parser.hostname;
params.port = parser.port;
params.pathname = parser.pathname;
params.hash = parser.hash;
params.search = parser.search;
params.get = util.parseGet(parser.search);
return params;
};
util.each = function (data, callback) {
if (util.isArr(data)) {
for (var i = 0; i < data.length; i++) callback.call(null, data[i]);
} else if (util.isObj(data)) {
for (var k in data) callback.call(null, k, data[k]);
} else return false;
};
util.ucfirst = function (string) {
return string && string[0].toUpperCase() + string.slice(1);
};
util.node2html = function (element) {
var container = document.createElement("div");
container.appendChild(element.cloneNode(true));
return container.innerHTML;
};
util.html2node = function (string) {
var i, fragment = document.createDocumentFragment(), container = document.createElement("div");
container.innerHTML = string;
while (i = container.firstChild) fragment.appendChild(i);
return fragment.childNodes.length === 1 ? fragment.firstChild : fragment;
};
util.base64encode = function (str) {
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var b64encoded = '';
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
for (var i = 0; i < str.length;) {
chr1 = str.charCodeAt(i++);
chr2 = str.charCodeAt(i++);
chr3 = str.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = isNaN(chr2) ? 64 : (((chr2 & 15) << 2) | (chr3 >> 6));
enc4 = isNaN(chr3) ? 64 : (chr3 & 63);
b64encoded += b64chars.charAt(enc1) + b64chars.charAt(enc2) +
b64chars.charAt(enc3) + b64chars.charAt(enc4);
}
return b64encoded;
};
util.base64decode = function (str) {
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var b64decoded = '';
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
str = str.replace(/[^a-z0-9\+\/\=]/gi, '');
for (var i = 0; i < str.length;) {
enc1 = b64chars.indexOf(str.charAt(i++));
enc2 = b64chars.indexOf(str.charAt(i++));
enc3 = b64chars.indexOf(str.charAt(i++));
enc4 = b64chars.indexOf(str.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
b64decoded = b64decoded + String.fromCharCode(chr1);
if (enc3 < 64) {
b64decoded += String.fromCharCode(chr2);
}
if (enc4 < 64) {
b64decoded += String.fromCharCode(chr3);
}
}
return b64decoded;
};
/**
* Cross-browser function for the character of the event keypress:
* @param event event.type must keypress
* @returns {*}
*/
util.getChar = function (event) {
if (event.which == null) {
if (event.keyCode < 32) return null;
return String.fromCharCode(event.keyCode)
}
if (event.which != 0 && event.charCode != 0) {
if (event.which < 32) return null;
return String.fromCharCode(event.which);
}
return null;
};
util.Date = function () {
};
util.Date.time = function (date) {
"use strict";
return date instanceof Date ? date.getTime() : (new Date).getTime();
};
/**
* Add days to some date
* @param day number of days. 0.04 - 1 hour, 0.5 - 12 hour, 1 - 1 day
* @param startDate type Date, start date
* @returns {*} type Date
*/
util.Date.addDays = function (day, startDate) {
var date = startDate ? new Date(startDate) : new Date();
date.setTime(date.getTime() + (day * 86400000));
return date;
};
util.Date.daysBetween = function (date1, date2) {
var ONE_DAY = 86400000,
date1_ms = date1.getTime(),
date2_ms = date2.getTime();
return Math.round((Math.abs(date1_ms - date2_ms)) / ONE_DAY)
};
util.Storage = function (name, value) {
if (!name) {
return false;
} else if (value === undefined) {
return util.Storage.get(name);
} else if (!value) {
return util.Storage.remove(name);
} else {
return util.Storage.set(name, value);
}
};
util.Storage.set = function (name, value) {
try {
value = JSON.stringify(value)
} catch (error) {
}
return window.localStorage.setItem(name, value);
};
util.Storage.get = function (name) {
var value = window.localStorage.getItem(name);
if (value)
try {
value = JSON.parse(value)
} catch (error) {
}
return value;
};
util.Storage.remove = function (name) {
return window.localStorage.removeItem(name);
};
util.Storage.key = function (name) {
return window.localStorage.key(key);
};
// when invoked, will empty all keys out of the storage.
util.Storage.clear = function () {
return window.localStorage.clear();
};
// returns an integer representing the number of data items stored in the Storage object.
util.Storage.length = function () {
return window.localStorage.length;
};
/**
* ะฒะพะทะฒัะฐัะฐะตั cookie ั ะธะผะตะฝะตะผ name, ะตัะปะธ ะตััั, ะตัะปะธ ะฝะตั, ัะพ undefined
* @param name
* @param value
*/
util.Cookie = function (name, value) {
"use strict";
if (value === undefined) {
return util.Cookie.get(name);
}
else if (value === false || value === null) {
util.Cookie.delete(name);
} else {
util.Cookie.set(name, value);
}
};
util.Cookie.get = function (name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
};
/**
*
* @param name
* @param value
* @param {{}} options {expires: 0, path: '/', domain: 'site.com', secure: false}
* expires - ms, Date, -1, 0
*/
util.Cookie.set = function (name, value, options) {
options = options || {};
var expires = options.expires;
if (typeof expires == "number" && expires) {
var d = new Date();
d.setTime(d.getTime() + expires * 1000);
expires = options.expires = d;
}
if (expires && expires.toUTCString) {
options.expires = expires.toUTCString();
}
value = encodeURIComponent(value);
var updatedCookie = name + "=" + value;
for (var propName in options) {
updatedCookie += "; " + propName;
var propValue = options[propName];
if (propValue !== true) {
updatedCookie += "=" + propValue;
}
}
document.cookie = updatedCookie;
};
util.Cookie.delete = util.Cookie.remove = function (name, option) {
"use strict";
option = typeof option === 'object' ? option : {};
option.expires = -1;
util.Cookie.set(name, "", option);
};
util.getURLParameter = function (name) {
var reg = (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1];
return reg === null ? undefined : decodeURI(reg);
};
/**
* An asynchronous for-each loop
*
* @param {Array} array The array to loop through
*
* @param {function} done Callback function (when the loop is finished or an error occurs)
*
* @param {function} iterator
* The logic for each iteration. Signature is `function(item, index, next)`.
* Call `next()` to continue to the next item. Call `next(Error)` to throw an error and cancel the loop.
* Or don't call `next` at all to break out of the loop.
*/
util.asyncForEach = function (array, done, iterator) {
var i = 0;
next();
function next(err) {
if (err)
done(err);
else if (i >= array.length)
done();
else if (i < array.length) {
var item = array[i++];
setTimeout(function () {
iterator(item, i - 1, next);
}, 0);
}
}
};
/**
* Calls the callback in a given interval until it returns true
* @param {function} callback
* @param {number} interval in milliseconds
*/
util.waitFor = function (callback, interval) {
var internalCallback = function () {
if (callback() !== true) {
setTimeout(internalCallback, interval);
}
};
internalCallback();
};
/**
* Remove item from array
* @param item
* @param stack
* @returns {Array}
*/
util.rmInArray = function (item, stack) {
var newStack = [];
for (var i = 0; i < stack.length; i++) {
if (stack[i] && stack[i] != item)
newStack.push(stack[i]);
}
return newStack;
};
/**
* @param text
* @returns {string|void|XML}
*/
util.toTranslit = function (text) {
return text.replace(/([ะฐ-ัั])|([\s_-])|([^a-z\d])/gi,
function (all, ch, space, words, i) {
if (space || words)
return space ? '-' : '';
var code = ch.charCodeAt(0),
index = code == 1025 || code == 1105 ? 0 : code > 1071 ? code - 1071 : code - 1039,
t = ['yo', 'a', 'b', 'v', 'g', 'd', 'e', 'zh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'shch', '', 'y', '', 'e', 'yu', 'ya'];
return t[index];
});
};
window.Util = util;
})(window);
| raceface2nd/owncollab | owncollab_talks/js/libs/util.js | JavaScript | agpl-3.0 | 28,701 | [
30522,
1013,
1008,
1008,
1008,
11336,
21183,
4014,
1012,
1046,
2015,
1008,
2049,
10763,
2691,
2393,
2545,
4725,
1008,
1013,
1006,
3853,
1006,
3332,
1007,
1063,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1007,
1063,
9140,
1012,
18061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2008 Andreas Gaida
Copyright (C) 2008 Ralph Schreyer
Copyright (C) 2008 Klaus Spanderen
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file secondordermixedderivativeop.hpp
\brief second order mixed derivative linear operator
*/
#ifndef quantlib_second_order_mixed_derivative_hpp
#define quantlib_second_order_mixed_derivative_hpp
#include <ql/methods/finitedifferences/operators/ninepointlinearop.hpp>
namespace QuantLib {
class SecondOrderMixedDerivativeOp : public NinePointLinearOp {
public:
SecondOrderMixedDerivativeOp(
Size d0, Size d1, const boost::shared_ptr<FdmMesher>& mesher);
};
}
#endif
| EuroPlusFinance/Software | Quantum Trading Platforms/QuantLib-1.4/ql/methods/finitedifferences/operators/secondordermixedderivativeop.hpp | C++ | gpl-2.0 | 1,383 | [
30522,
1013,
1008,
1011,
1008,
1011,
5549,
1024,
1039,
1009,
1009,
1025,
21628,
1011,
9381,
1024,
1018,
1025,
27427,
4765,
1011,
21628,
2015,
1011,
5549,
1024,
9152,
2140,
1025,
1039,
1011,
3937,
1011,
16396,
1024,
1018,
1011,
1008,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright 2013 Red Hat, Inc. and/or its affiliates.
This file is part of lightblue.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.redhat.lightblue.config;
import org.junit.Assert;
import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.redhat.lightblue.Request;
import com.redhat.lightblue.crud.DeleteRequest;
import com.redhat.lightblue.util.test.FileUtil;
import static com.redhat.lightblue.util.JsonUtils.json;
public class CrudValidationTest {
@Test
public void testValidInputWithNonValidating() throws Exception {
LightblueFactory lbf = new LightblueFactory(new DataSourcesConfiguration());
// Emulate configuration
lbf.getJsonTranslator().setValidation(Request.class, false);
String jsonString = FileUtil.readFile("valid-deletion-req.json");
JsonNode node = json(jsonString);
DeleteRequest req = lbf.getJsonTranslator().parse(DeleteRequest.class, node);
Assert.assertNotNull(req);
}
@Test
public void testInvalidInputWithNonValidating() throws Exception {
LightblueFactory lbf = new LightblueFactory(new DataSourcesConfiguration());
// Emulate configuration
lbf.getJsonTranslator().setValidation(Request.class, false);
String jsonString = FileUtil.readFile("invalid-deletion-req.json");
JsonNode node = json(jsonString);
DeleteRequest req = lbf.getJsonTranslator().parse(DeleteRequest.class, node);
Assert.assertNotNull(req);
}
@Test
public void testValidInputWithValidating() throws Exception {
LightblueFactory lbf = new LightblueFactory(new DataSourcesConfiguration());
// Emulate configuration
lbf.getJsonTranslator().setValidation(Request.class, true);
String jsonString = FileUtil.readFile("valid-deletion-req.json");
JsonNode node = json(jsonString);
DeleteRequest req = lbf.getJsonTranslator().parse(DeleteRequest.class, node);
Assert.assertNotNull(req);
}
@Test
public void testInvalidInputWithValidating() throws Exception {
LightblueFactory lbf = new LightblueFactory(new DataSourcesConfiguration());
// Emulate configuration
lbf.getJsonTranslator().setValidation(Request.class, true);
String jsonString = FileUtil.readFile("invalid-deletion-req.json");
JsonNode node = json(jsonString);
try {
lbf.getJsonTranslator().parse(DeleteRequest.class, node);
Assert.fail();
} catch (Exception e) {
System.out.println(e);
}
}
}
| bserdar/lightblue-core | config/src/test/java/com/redhat/lightblue/config/CrudValidationTest.java | Java | gpl-3.0 | 3,200 | [
30522,
1013,
1008,
9385,
2286,
2417,
6045,
1010,
4297,
1012,
1998,
1013,
2030,
2049,
18460,
1012,
2023,
5371,
2003,
2112,
1997,
2422,
16558,
5657,
1012,
2023,
2565,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
; void p_forward_list_clear_fastcall(p_forward_list_t *list)
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC _p_forward_list_clear_fastcall
EXTERN asm_p_forward_list_clear
defc _p_forward_list_clear_fastcall = asm_p_forward_list_clear
| bitfixer/bitfixer | dg/z88dk/libsrc/_DEVELOPMENT/adt/p_forward_list/c/sdcc_iy/p_forward_list_clear_fastcall.asm | Assembly | gpl-2.0 | 249 | [
30522,
1025,
11675,
1052,
1035,
2830,
1035,
2862,
1035,
3154,
1035,
3435,
9289,
2140,
1006,
1052,
1035,
2830,
1035,
2862,
1035,
1056,
1008,
2862,
1007,
2930,
3642,
1035,
18856,
12322,
2930,
3642,
1035,
4748,
2102,
1035,
1052,
1035,
2830,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/******/ (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] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = 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;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/assets/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(36);
var _Member = __webpack_require__(182);
var _MemberList = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"./components/ui/MemberList\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// import routes from './routes'
window.React = _react2.default;
(0, _reactDom.render)(_react2.default.createElement(_MemberList.MemberList, null), document.getElementById('react-container')
// <Member admin={true}
// name="Edna Welch"
// email="edna.welch88@example.com"
// thumbnail="https://randomuser.me/api/portraits/women/90.jpg"
// makeAdmin={(email) => console.log(email)}/>
);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(2);
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var ReactChildren = __webpack_require__(5);
var ReactComponent = __webpack_require__(18);
var ReactPureComponent = __webpack_require__(21);
var ReactClass = __webpack_require__(22);
var ReactDOMFactories = __webpack_require__(24);
var ReactElement = __webpack_require__(9);
var ReactPropTypes = __webpack_require__(29);
var ReactVersion = __webpack_require__(34);
var onlyChild = __webpack_require__(35);
var warning = __webpack_require__(11);
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if (process.env.NODE_ENV !== 'production') {
var canDefineProperty = __webpack_require__(13);
var ReactElementValidator = __webpack_require__(25);
var didWarnPropTypesDeprecated = false;
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var __spread = _assign;
if (process.env.NODE_ENV !== 'production') {
var warned = false;
__spread = function () {
process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
warned = true;
return _assign.apply(null, arguments);
};
}
var React = {
// Modern
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild
},
Component: ReactComponent,
PureComponent: ReactPureComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement.isValidElement,
// Classic
PropTypes: ReactPropTypes,
createClass: ReactClass.createClass,
createFactory: createFactory,
createMixin: function (mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
DOM: ReactDOMFactories,
version: ReactVersion,
// Deprecated hook for JSX spread, don't use this for anything.
__spread: __spread
};
// TODO: Fix tests so that this deprecation warning doesn't cause failures.
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperty(React, 'PropTypes', {
get: function () {
process.env.NODE_ENV !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0;
didWarnPropTypesDeprecated = true;
return ReactPropTypes;
}
});
}
}
module.exports = React;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 3 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 4 */
/***/ (function(module, exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var PooledClass = __webpack_require__(6);
var ReactElement = __webpack_require__(9);
var emptyFunction = __webpack_require__(12);
var traverseAllChildren = __webpack_require__(15);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.func = forEachFunction;
this.context = forEachContext;
this.count = 0;
}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func,
context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result,
keyPrefix = bookKeeping.keyPrefix,
func = bookKeeping.func,
context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7);
var invariant = __webpack_require__(8);
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances.
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
// Casting as any so that flow ignores the actual implementation and trusts
// it to match the type we declared
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler
};
module.exports = PooledClass;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/**
* 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 strict';
/**
* 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;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* 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 strict';
/**
* 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 (process.env.NODE_ENV !== 'production') {
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;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var _assign = __webpack_require__(4);
var ReactCurrentOwner = __webpack_require__(10);
var warning = __webpack_require__(11);
var canDefineProperty = __webpack_require__(13);
var hasOwnProperty = Object.prototype.hasOwnProperty;
var REACT_ELEMENT_TYPE = __webpack_require__(14);
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var specialPropKeyWarningShown, specialPropRefWarningShown;
function hasValidRef(config) {
if (process.env.NODE_ENV !== 'production') {
if (hasOwnProperty.call(config, 'ref')) {
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
if (process.env.NODE_ENV !== 'production') {
if (hasOwnProperty.call(config, 'key')) {
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function defineKeyPropWarningGetter(props, displayName) {
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true
});
}
function defineRefPropWarningGetter(props, displayName) {
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, 'ref', {
get: warnAboutAccessingRef,
configurable: true
});
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, no instanceof check
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
if (process.env.NODE_ENV !== 'production') {
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
};
/**
* Create and return a new ReactElement of the given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
*/
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
if (hasValidRef(config)) {
ref = config.ref;
}
if (hasValidKey(config)) {
key = '' + config.key;
}
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
if (process.env.NODE_ENV !== 'production') {
if (Object.freeze) {
Object.freeze(childArray);
}
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
if (process.env.NODE_ENV !== 'production') {
if (key || ref) {
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
/**
* Return a function that produces ReactElements of a given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
*/
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
factory.type = type;
return factory;
};
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
/**
* Clone and return a new ReactElement using element as the starting point.
* See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
*/
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
var props = _assign({}, element.props);
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (hasValidRef(config)) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (hasValidKey(config)) {
key = '' + config.key;
}
// Remaining properties override existing props
var defaultProps;
if (element.type && element.type.defaultProps) {
defaultProps = element.type.defaultProps;
}
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
if (config[propName] === undefined && defaultProps !== undefined) {
// Resolve default props
props[propName] = defaultProps[propName];
} else {
props[propName] = config[propName];
}
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
* Verifies the object is a ReactElement.
* See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function (object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 10 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-2015, 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 strict';
var emptyFunction = __webpack_require__(12);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 12 */
/***/ (function(module, exports) {
"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.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var canDefineProperty = false;
if (process.env.NODE_ENV !== 'production') {
try {
// $FlowFixMe https://github.com/facebook/flow/issues/285
Object.defineProperty({}, 'x', { get: function () {} });
canDefineProperty = true;
} catch (x) {
// IE will fail on defineProperty
}
}
module.exports = canDefineProperty;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 14 */
/***/ (function(module, exports) {
/**
* Copyright 2014-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 strict';
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
module.exports = REACT_ELEMENT_TYPE;
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7);
var ReactCurrentOwner = __webpack_require__(10);
var REACT_ELEMENT_TYPE = __webpack_require__(14);
var getIteratorFn = __webpack_require__(16);
var invariant = __webpack_require__(8);
var KeyEscapeUtils = __webpack_require__(17);
var warning = __webpack_require__(11);
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
/**
* This is inlined from ReactElement since this file is shared between
* isomorphic and renderers. We could extract this to a
*
*/
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var didWarnAboutMaps = false;
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (component && typeof component === 'object' && component.key != null) {
// Explicit key
return KeyEscapeUtils.escape(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' ||
// The following is inlined from ReactElement. This means we can optimize
// some checks. React Fiber also inlines this logic for similar purposes.
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
var iterator = iteratorFn.call(children);
var step;
if (iteratorFn !== children.entries) {
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
if (process.env.NODE_ENV !== 'production') {
var mapsAsChildrenAddendum = '';
if (ReactCurrentOwner.current) {
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
if (mapsAsChildrenOwnerName) {
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
}
}
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
child = entry[1];
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
if (children._isReactElement) {
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
}
}
var childrenString = String(children);
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 16 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
/***/ }),
/* 17 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Escape and wrap key so it is safe to use as a reactid
*
* @param {string} key to be escaped.
* @return {string} the escaped key.
*/
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
/**
* Unescape and unwrap key for human-readable display
*
* @param {string} key to unescape.
* @return {string} the unescaped key.
*/
function unescape(key) {
var unescapeRegex = /(=0|=2)/g;
var unescaperLookup = {
'=0': '=',
'=2': ':'
};
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
return ('' + keySubstring).replace(unescapeRegex, function (match) {
return unescaperLookup[match];
});
}
var KeyEscapeUtils = {
escape: escape,
unescape: unescape
};
module.exports = KeyEscapeUtils;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7);
var ReactNoopUpdateQueue = __webpack_require__(19);
var canDefineProperty = __webpack_require__(13);
var emptyObject = __webpack_require__(20);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
ReactComponent.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
this.updater.enqueueSetState(this, partialState);
if (callback) {
this.updater.enqueueCallback(this, callback, 'setState');
}
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this);
if (callback) {
this.updater.enqueueCallback(this, callback, 'forceUpdate');
}
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
if (process.env.NODE_ENV !== 'production') {
var deprecatedAPIs = {
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
};
var defineDeprecationWarning = function (methodName, info) {
if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
return undefined;
}
});
}
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
module.exports = ReactComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2015-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 strict';
var warning = __webpack_require__(11);
function warnNoop(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
var constructor = publicInstance.constructor;
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
warnNoop(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
warnNoop(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
warnNoop(publicInstance, 'setState');
}
};
module.exports = ReactNoopUpdateQueue;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* 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 strict';
var emptyObject = {};
if (process.env.NODE_ENV !== 'production') {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var ReactComponent = __webpack_require__(18);
var ReactNoopUpdateQueue = __webpack_require__(19);
var emptyObject = __webpack_require__(20);
/**
* Base class helpers for the updating state of a component.
*/
function ReactPureComponent(props, context, updater) {
// Duplicated from ReactComponent.
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
function ComponentDummy() {}
ComponentDummy.prototype = ReactComponent.prototype;
ReactPureComponent.prototype = new ComponentDummy();
ReactPureComponent.prototype.constructor = ReactPureComponent;
// Avoid an extra prototype jump for these methods.
_assign(ReactPureComponent.prototype, ReactComponent.prototype);
ReactPureComponent.prototype.isPureReactComponent = true;
module.exports = ReactPureComponent;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7),
_assign = __webpack_require__(4);
var ReactComponent = __webpack_require__(18);
var ReactElement = __webpack_require__(9);
var ReactPropTypeLocationNames = __webpack_require__(23);
var ReactNoopUpdateQueue = __webpack_require__(19);
var emptyObject = __webpack_require__(20);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var MIXINS_KEY = 'mixins';
// Helper function to allow the creation of anonymous functions which do not
// have .name set to the name of the variable being assigned to.
function identity(fn) {
return fn;
}
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var injectedMixins = [];
/**
* Composite components are higher-level components that compose other composite
* or host components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: 'DEFINE_MANY',
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: 'DEFINE_MANY',
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: 'DEFINE_MANY',
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: 'DEFINE_MANY',
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: 'DEFINE_MANY',
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: 'DEFINE_MANY_MERGED',
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: 'DEFINE_MANY_MERGED',
/**
* @return {object}
* @optional
*/
getChildContext: 'DEFINE_MANY_MERGED',
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @required
*/
render: 'DEFINE_ONCE',
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: 'DEFINE_MANY',
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: 'DEFINE_MANY',
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: 'DEFINE_MANY',
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: 'DEFINE_ONCE',
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: 'DEFINE_MANY',
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: 'DEFINE_MANY',
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: 'DEFINE_MANY',
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: 'OVERRIDE_BASE'
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function (Constructor, childContextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, childContextTypes, 'childContext');
}
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, contextTypes, 'context');
}
Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function (Constructor, propTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, propTypes, 'prop');
}
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function () {} };
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but only in __DEV__
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
}
}
}
function validateMethodOverride(isAlreadyDefined, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
!(specPolicy === 'OVERRIDE_BASE') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
}
// Disallow defining methods more than once unless explicitly allowed.
if (isAlreadyDefined) {
!(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classes.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
if (process.env.NODE_ENV !== 'production') {
var typeofSpec = typeof spec;
var isMixinValid = typeofSpec === 'object' && spec !== null;
process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
}
return;
}
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
var proto = Constructor.prototype;
var autoBindPairs = proto.__reactAutoBindPairs;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
var isAlreadyDefined = proto.hasOwnProperty(name);
validateMethodOverride(isAlreadyDefined, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
autoBindPairs.push(name, property);
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
!(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === 'DEFINE_MANY_MERGED') {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === 'DEFINE_MANY') {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if (process.env.NODE_ENV !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = name in RESERVED_SPEC_KEYS;
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
var isInherited = name in Constructor;
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
for (var key in two) {
if (two.hasOwnProperty(key)) {
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if (process.env.NODE_ENV !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
} else if (!args.length) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
var pairs = component.__reactAutoBindPairs;
for (var i = 0; i < pairs.length; i += 2) {
var autoBindKey = pairs[i];
var method = pairs[i + 1];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState);
if (callback) {
this.updater.enqueueCallback(this, callback, 'replaceState');
}
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function () {
return this.updater.isMounted(this);
}
};
var ReactClassComponent = function () {};
_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
var didWarnDeprecated = false;
/**
* Module for creating composite components.
*
* @class ReactClass
*/
var ReactClass = {
/**
* Creates a composite component class given a class specification.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function (spec) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0;
didWarnDeprecated = true;
}
// To keep our warnings more understandable, we'll use a little hack here to
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
// unnecessarily identify a class without displayName as 'Constructor'.
var Constructor = identity(function (props, context, updater) {
// This constructor gets overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
}
// Wire up auto-binding
if (this.__reactAutoBindPairs.length) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (initialState === undefined && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
this.state = initialState;
});
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
Constructor.prototype.__reactAutoBindPairs = [];
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if (process.env.NODE_ENV !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
},
injection: {
injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactClass;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var ReactPropTypeLocationNames = {};
if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var ReactElement = __webpack_require__(9);
/**
* Create a factory that creates HTML tag elements.
*
* @private
*/
var createDOMFactory = ReactElement.createFactory;
if (process.env.NODE_ENV !== 'production') {
var ReactElementValidator = __webpack_require__(25);
createDOMFactory = ReactElementValidator.createFactory;
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOMFactories = {
a: createDOMFactory('a'),
abbr: createDOMFactory('abbr'),
address: createDOMFactory('address'),
area: createDOMFactory('area'),
article: createDOMFactory('article'),
aside: createDOMFactory('aside'),
audio: createDOMFactory('audio'),
b: createDOMFactory('b'),
base: createDOMFactory('base'),
bdi: createDOMFactory('bdi'),
bdo: createDOMFactory('bdo'),
big: createDOMFactory('big'),
blockquote: createDOMFactory('blockquote'),
body: createDOMFactory('body'),
br: createDOMFactory('br'),
button: createDOMFactory('button'),
canvas: createDOMFactory('canvas'),
caption: createDOMFactory('caption'),
cite: createDOMFactory('cite'),
code: createDOMFactory('code'),
col: createDOMFactory('col'),
colgroup: createDOMFactory('colgroup'),
data: createDOMFactory('data'),
datalist: createDOMFactory('datalist'),
dd: createDOMFactory('dd'),
del: createDOMFactory('del'),
details: createDOMFactory('details'),
dfn: createDOMFactory('dfn'),
dialog: createDOMFactory('dialog'),
div: createDOMFactory('div'),
dl: createDOMFactory('dl'),
dt: createDOMFactory('dt'),
em: createDOMFactory('em'),
embed: createDOMFactory('embed'),
fieldset: createDOMFactory('fieldset'),
figcaption: createDOMFactory('figcaption'),
figure: createDOMFactory('figure'),
footer: createDOMFactory('footer'),
form: createDOMFactory('form'),
h1: createDOMFactory('h1'),
h2: createDOMFactory('h2'),
h3: createDOMFactory('h3'),
h4: createDOMFactory('h4'),
h5: createDOMFactory('h5'),
h6: createDOMFactory('h6'),
head: createDOMFactory('head'),
header: createDOMFactory('header'),
hgroup: createDOMFactory('hgroup'),
hr: createDOMFactory('hr'),
html: createDOMFactory('html'),
i: createDOMFactory('i'),
iframe: createDOMFactory('iframe'),
img: createDOMFactory('img'),
input: createDOMFactory('input'),
ins: createDOMFactory('ins'),
kbd: createDOMFactory('kbd'),
keygen: createDOMFactory('keygen'),
label: createDOMFactory('label'),
legend: createDOMFactory('legend'),
li: createDOMFactory('li'),
link: createDOMFactory('link'),
main: createDOMFactory('main'),
map: createDOMFactory('map'),
mark: createDOMFactory('mark'),
menu: createDOMFactory('menu'),
menuitem: createDOMFactory('menuitem'),
meta: createDOMFactory('meta'),
meter: createDOMFactory('meter'),
nav: createDOMFactory('nav'),
noscript: createDOMFactory('noscript'),
object: createDOMFactory('object'),
ol: createDOMFactory('ol'),
optgroup: createDOMFactory('optgroup'),
option: createDOMFactory('option'),
output: createDOMFactory('output'),
p: createDOMFactory('p'),
param: createDOMFactory('param'),
picture: createDOMFactory('picture'),
pre: createDOMFactory('pre'),
progress: createDOMFactory('progress'),
q: createDOMFactory('q'),
rp: createDOMFactory('rp'),
rt: createDOMFactory('rt'),
ruby: createDOMFactory('ruby'),
s: createDOMFactory('s'),
samp: createDOMFactory('samp'),
script: createDOMFactory('script'),
section: createDOMFactory('section'),
select: createDOMFactory('select'),
small: createDOMFactory('small'),
source: createDOMFactory('source'),
span: createDOMFactory('span'),
strong: createDOMFactory('strong'),
style: createDOMFactory('style'),
sub: createDOMFactory('sub'),
summary: createDOMFactory('summary'),
sup: createDOMFactory('sup'),
table: createDOMFactory('table'),
tbody: createDOMFactory('tbody'),
td: createDOMFactory('td'),
textarea: createDOMFactory('textarea'),
tfoot: createDOMFactory('tfoot'),
th: createDOMFactory('th'),
thead: createDOMFactory('thead'),
time: createDOMFactory('time'),
title: createDOMFactory('title'),
tr: createDOMFactory('tr'),
track: createDOMFactory('track'),
u: createDOMFactory('u'),
ul: createDOMFactory('ul'),
'var': createDOMFactory('var'),
video: createDOMFactory('video'),
wbr: createDOMFactory('wbr'),
// SVG
circle: createDOMFactory('circle'),
clipPath: createDOMFactory('clipPath'),
defs: createDOMFactory('defs'),
ellipse: createDOMFactory('ellipse'),
g: createDOMFactory('g'),
image: createDOMFactory('image'),
line: createDOMFactory('line'),
linearGradient: createDOMFactory('linearGradient'),
mask: createDOMFactory('mask'),
path: createDOMFactory('path'),
pattern: createDOMFactory('pattern'),
polygon: createDOMFactory('polygon'),
polyline: createDOMFactory('polyline'),
radialGradient: createDOMFactory('radialGradient'),
rect: createDOMFactory('rect'),
stop: createDOMFactory('stop'),
svg: createDOMFactory('svg'),
text: createDOMFactory('text'),
tspan: createDOMFactory('tspan')
};
module.exports = ReactDOMFactories;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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.
*
*/
/**
* ReactElementValidator provides a wrapper around a element factory
* which validates the props passed to the element. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
'use strict';
var ReactCurrentOwner = __webpack_require__(10);
var ReactComponentTreeHook = __webpack_require__(26);
var ReactElement = __webpack_require__(9);
var checkReactTypeSpec = __webpack_require__(27);
var canDefineProperty = __webpack_require__(13);
var getIteratorFn = __webpack_require__(16);
var warning = __webpack_require__(11);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
function getSourceInfoErrorAddendum(elementProps) {
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
var source = elementProps.__source;
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
var lineNumber = source.lineNumber;
return ' Check your code at ' + fileName + ':' + lineNumber + '.';
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
function getCurrentComponentErrorInfo(parentType) {
var info = getDeclarationErrorAddendum();
if (!info) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
info = ' Check the top-level render call using <' + parentName + '>.';
}
}
return info;
}
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it. Error statuses are cached so a warning
* will only be shown once.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
if (memoizer[currentComponentErrorInfo]) {
return;
}
memoizer[currentComponentErrorInfo] = true;
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
var childOwner = '';
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
if (iteratorFn) {
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
}
if (typeof componentClass.getDefaultProps === 'function') {
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
}
}
var ReactElementValidator = {
createElement: function (type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {
if (typeof type !== 'function' && typeof type !== 'string') {
var info = '';
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
}
var sourceInfo = getSourceInfoErrorAddendum(props);
if (sourceInfo) {
info += sourceInfo;
} else {
info += getDeclarationErrorAddendum();
}
info += ReactComponentTreeHook.getCurrentStackAddendum();
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0;
}
}
var element = ReactElement.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
// Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
validatePropTypes(element);
return element;
},
createFactory: function (type) {
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
}
}
return validatedFactory;
},
cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
};
module.exports = ReactElementValidator;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-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 strict';
var _prodInvariant = __webpack_require__(7);
var ReactCurrentOwner = __webpack_require__(10);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
function isNative(fn) {
// Based on isNative() from Lodash
var funcToString = Function.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var reIsNative = RegExp('^' + funcToString
// Take an example native function source for comparison
.call(hasOwnProperty)
// Strip regex characters so we can use it for regex
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
// Remove hasOwnProperty from the template to make it generic
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
try {
var source = funcToString.call(fn);
return reIsNative.test(source);
} catch (err) {
return false;
}
}
var canUseCollections =
// Array.from
typeof Array.from === 'function' &&
// Map
typeof Map === 'function' && isNative(Map) &&
// Map.prototype.keys
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
// Set
typeof Set === 'function' && isNative(Set) &&
// Set.prototype.keys
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
var setItem;
var getItem;
var removeItem;
var getItemIDs;
var addRoot;
var removeRoot;
var getRootIDs;
if (canUseCollections) {
var itemMap = new Map();
var rootIDSet = new Set();
setItem = function (id, item) {
itemMap.set(id, item);
};
getItem = function (id) {
return itemMap.get(id);
};
removeItem = function (id) {
itemMap['delete'](id);
};
getItemIDs = function () {
return Array.from(itemMap.keys());
};
addRoot = function (id) {
rootIDSet.add(id);
};
removeRoot = function (id) {
rootIDSet['delete'](id);
};
getRootIDs = function () {
return Array.from(rootIDSet.keys());
};
} else {
var itemByKey = {};
var rootByKey = {};
// Use non-numeric keys to prevent V8 performance issues:
// https://github.com/facebook/react/pull/7232
var getKeyFromID = function (id) {
return '.' + id;
};
var getIDFromKey = function (key) {
return parseInt(key.substr(1), 10);
};
setItem = function (id, item) {
var key = getKeyFromID(id);
itemByKey[key] = item;
};
getItem = function (id) {
var key = getKeyFromID(id);
return itemByKey[key];
};
removeItem = function (id) {
var key = getKeyFromID(id);
delete itemByKey[key];
};
getItemIDs = function () {
return Object.keys(itemByKey).map(getIDFromKey);
};
addRoot = function (id) {
var key = getKeyFromID(id);
rootByKey[key] = true;
};
removeRoot = function (id) {
var key = getKeyFromID(id);
delete rootByKey[key];
};
getRootIDs = function () {
return Object.keys(rootByKey).map(getIDFromKey);
};
}
var unmountedIDs = [];
function purgeDeep(id) {
var item = getItem(id);
if (item) {
var childIDs = item.childIDs;
removeItem(id);
childIDs.forEach(purgeDeep);
}
}
function describeComponentFrame(name, source, ownerName) {
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
}
function getDisplayName(element) {
if (element == null) {
return '#empty';
} else if (typeof element === 'string' || typeof element === 'number') {
return '#text';
} else if (typeof element.type === 'string') {
return element.type;
} else {
return element.type.displayName || element.type.name || 'Unknown';
}
}
function describeID(id) {
var name = ReactComponentTreeHook.getDisplayName(id);
var element = ReactComponentTreeHook.getElement(id);
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var ownerName;
if (ownerID) {
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
}
process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
return describeComponentFrame(name, element && element._source, ownerName);
}
var ReactComponentTreeHook = {
onSetChildren: function (id, nextChildIDs) {
var item = getItem(id);
!item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
item.childIDs = nextChildIDs;
for (var i = 0; i < nextChildIDs.length; i++) {
var nextChildID = nextChildIDs[i];
var nextChild = getItem(nextChildID);
!nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
!nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
if (nextChild.parentID == null) {
nextChild.parentID = id;
// TODO: This shouldn't be necessary but mounting a new root during in
// componentWillMount currently causes not-yet-mounted components to
// be purged from our tree data so their parent id is missing.
}
!(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
}
},
onBeforeMountComponent: function (id, element, parentID) {
var item = {
element: element,
parentID: parentID,
text: null,
childIDs: [],
isMounted: false,
updateCount: 0
};
setItem(id, item);
},
onBeforeUpdateComponent: function (id, element) {
var item = getItem(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.element = element;
},
onMountComponent: function (id) {
var item = getItem(id);
!item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
item.isMounted = true;
var isRoot = item.parentID === 0;
if (isRoot) {
addRoot(id);
}
},
onUpdateComponent: function (id) {
var item = getItem(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.updateCount++;
},
onUnmountComponent: function (id) {
var item = getItem(id);
if (item) {
// We need to check if it exists.
// `item` might not exist if it is inside an error boundary, and a sibling
// error boundary child threw while mounting. Then this instance never
// got a chance to mount, but it still gets an unmounting event during
// the error boundary cleanup.
item.isMounted = false;
var isRoot = item.parentID === 0;
if (isRoot) {
removeRoot(id);
}
}
unmountedIDs.push(id);
},
purgeUnmountedComponents: function () {
if (ReactComponentTreeHook._preventPurging) {
// Should only be used for testing.
return;
}
for (var i = 0; i < unmountedIDs.length; i++) {
var id = unmountedIDs[i];
purgeDeep(id);
}
unmountedIDs.length = 0;
},
isMounted: function (id) {
var item = getItem(id);
return item ? item.isMounted : false;
},
getCurrentStackAddendum: function (topElement) {
var info = '';
if (topElement) {
var name = getDisplayName(topElement);
var owner = topElement._owner;
info += describeComponentFrame(name, topElement._source, owner && owner.getName());
}
var currentOwner = ReactCurrentOwner.current;
var id = currentOwner && currentOwner._debugID;
info += ReactComponentTreeHook.getStackAddendumByID(id);
return info;
},
getStackAddendumByID: function (id) {
var info = '';
while (id) {
info += describeID(id);
id = ReactComponentTreeHook.getParentID(id);
}
return info;
},
getChildIDs: function (id) {
var item = getItem(id);
return item ? item.childIDs : [];
},
getDisplayName: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element) {
return null;
}
return getDisplayName(element);
},
getElement: function (id) {
var item = getItem(id);
return item ? item.element : null;
},
getOwnerID: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element || !element._owner) {
return null;
}
return element._owner._debugID;
},
getParentID: function (id) {
var item = getItem(id);
return item ? item.parentID : null;
},
getSource: function (id) {
var item = getItem(id);
var element = item ? item.element : null;
var source = element != null ? element._source : null;
return source;
},
getText: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (typeof element === 'string') {
return element;
} else if (typeof element === 'number') {
return '' + element;
} else {
return null;
}
},
getUpdateCount: function (id) {
var item = getItem(id);
return item ? item.updateCount : 0;
},
getRootIDs: getRootIDs,
getRegisteredIDs: getItemIDs
};
module.exports = ReactComponentTreeHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7);
var ReactPropTypeLocationNames = __webpack_require__(23);
var ReactPropTypesSecret = __webpack_require__(28);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactComponentTreeHook;
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
// Temporary hack.
// Inline requires don't work well with Jest:
// https://github.com/facebook/react/issues/7240
// Remove the inline requires when we don't need them anymore:
// https://github.com/facebook/react/pull/7178
ReactComponentTreeHook = __webpack_require__(26);
}
var loggedTypeFailures = {};
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?object} element The React element that is being type-checked
* @param {?number} debugID The React component instance that is being type-checked
* @private
*/
function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var componentStackInfo = '';
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = __webpack_require__(26);
}
if (debugID !== null) {
componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
}
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
}
}
}
}
module.exports = checkReactTypeSpec;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 28 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _require = __webpack_require__(9),
isValidElement = _require.isValidElement;
var factory = __webpack_require__(30);
module.exports = factory(isValidElement);
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
// React 15.5 references this module, and assumes PropTypes are still callable in production.
// Therefore we re-export development-only version with all the PropTypes checks here.
// However if one is migrating to the `prop-types` npm library, they will go through the
// `index.js` entry point, and it will branch depending on the environment.
var factory = __webpack_require__(31);
module.exports = function(isValidElement) {
// It is still allowed in 15.5.
var throwOnDirectAccess = false;
return factory(isValidElement, throwOnDirectAccess);
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var emptyFunction = __webpack_require__(12);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactPropTypesSecret = __webpack_require__(32);
var checkPropTypes = __webpack_require__(33);
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== 'production') {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning(
false,
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 32 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
if (process.env.NODE_ENV !== 'production') {
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactPropTypesSecret = __webpack_require__(32);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (process.env.NODE_ENV !== 'production') {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 34 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
module.exports = '15.5.4';
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(7);
var ReactElement = __webpack_require__(9);
var invariant = __webpack_require__(8);
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
*
* The current implementation of this function assumes that a single child gets
* passed without a wrapper, but the purpose of this helper function is to
* abstract away the particular structure of children.
*
* @param {?object} children Child collection structure.
* @return {ReactElement} The first and only `ReactElement` contained in the
* structure.
*/
function onlyChild(children) {
!ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
return children;
}
module.exports = onlyChild;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(37);
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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.
*
*/
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDefaultInjection = __webpack_require__(42);
var ReactMount = __webpack_require__(170);
var ReactReconciler = __webpack_require__(63);
var ReactUpdates = __webpack_require__(60);
var ReactVersion = __webpack_require__(175);
var findDOMNode = __webpack_require__(176);
var getHostComponentFromComposite = __webpack_require__(177);
var renderSubtreeIntoContainer = __webpack_require__(178);
var warning = __webpack_require__(11);
ReactDefaultInjection.inject();
var ReactDOM = {
findDOMNode: findDOMNode,
render: ReactMount.render,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
version: ReactVersion,
/* eslint-disable camelcase */
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
ComponentTree: {
getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
getNodeFromInstance: function (inst) {
// inst is an internal instance (but could be a composite)
if (inst._renderedComponent) {
inst = getHostComponentFromComposite(inst);
}
if (inst) {
return ReactDOMComponentTree.getNodeFromInstance(inst);
} else {
return null;
}
}
},
Mount: ReactMount,
Reconciler: ReactReconciler
});
}
if (process.env.NODE_ENV !== 'production') {
var ExecutionEnvironment = __webpack_require__(52);
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
// First check if devtools is not installed
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
// Firefox does not have the issue with devtools loaded over file://
var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
var testFunc = function testFn() {};
process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
var expectedFeatures = [
// shims
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
break;
}
}
}
}
if (process.env.NODE_ENV !== 'production') {
var ReactInstrumentation = __webpack_require__(66);
var ReactDOMUnknownPropertyHook = __webpack_require__(179);
var ReactDOMNullInputValuePropHook = __webpack_require__(180);
var ReactDOMInvalidARIAHook = __webpack_require__(181);
ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
}
module.exports = ReactDOM;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var DOMProperty = __webpack_require__(40);
var ReactDOMComponentFlags = __webpack_require__(41);
var invariant = __webpack_require__(8);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var Flags = ReactDOMComponentFlags;
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
/**
* Check if a given node should be cached.
*/
function shouldPrecacheNode(node, nodeID) {
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
}
/**
* Drill down (through composites and empty components) until we get a host or
* host text component.
*
* This is pretty polymorphic but unavoidable with the current structure we have
* for `_renderedChildren`.
*/
function getRenderedHostOrTextFromComponent(component) {
var rendered;
while (rendered = component._renderedComponent) {
component = rendered;
}
return component;
}
/**
* Populate `_hostNode` on the rendered host/text component with the given
* DOM node. The passed `inst` can be a composite.
*/
function precacheNode(inst, node) {
var hostInst = getRenderedHostOrTextFromComponent(inst);
hostInst._hostNode = node;
node[internalInstanceKey] = hostInst;
}
function uncacheNode(inst) {
var node = inst._hostNode;
if (node) {
delete node[internalInstanceKey];
inst._hostNode = null;
}
}
/**
* Populate `_hostNode` on each child of `inst`, assuming that the children
* match up with the DOM (element) children of `node`.
*
* We cache entire levels at once to avoid an n^2 problem where we access the
* children of a node sequentially and have to walk from the start to our target
* node every time.
*
* Since we update `_renderedChildren` and the actual DOM at (slightly)
* different times, we could race here and see a newer `_renderedChildren` than
* the DOM nodes we see. To avoid this, ReactMultiChild calls
* `prepareToManageChildren` before we change `_renderedChildren`, at which
* time the container's child nodes are always cached (until it unmounts).
*/
function precacheChildNodes(inst, node) {
if (inst._flags & Flags.hasCachedChildNodes) {
return;
}
var children = inst._renderedChildren;
var childNode = node.firstChild;
outer: for (var name in children) {
if (!children.hasOwnProperty(name)) {
continue;
}
var childInst = children[name];
var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
if (childID === 0) {
// We're currently unmounting this child in ReactMultiChild; skip it.
continue;
}
// We assume the child nodes are in the same order as the child instances.
for (; childNode !== null; childNode = childNode.nextSibling) {
if (shouldPrecacheNode(childNode, childID)) {
precacheNode(childInst, childNode);
continue outer;
}
}
// We reached the end of the DOM children without finding an ID match.
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
}
inst._flags |= Flags.hasCachedChildNodes;
}
/**
* Given a DOM node, return the closest ReactDOMComponent or
* ReactDOMTextComponent instance ancestor.
*/
function getClosestInstanceFromNode(node) {
if (node[internalInstanceKey]) {
return node[internalInstanceKey];
}
// Walk up the tree until we find an ancestor whose instance we have cached.
var parents = [];
while (!node[internalInstanceKey]) {
parents.push(node);
if (node.parentNode) {
node = node.parentNode;
} else {
// Top of the tree. This node must not be part of a React tree (or is
// unmounted, potentially).
return null;
}
}
var closest;
var inst;
for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
closest = inst;
if (parents.length) {
precacheChildNodes(inst, node);
}
}
return closest;
}
/**
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
* instance, or null if the node was not rendered by this React.
*/
function getInstanceFromNode(node) {
var inst = getClosestInstanceFromNode(node);
if (inst != null && inst._hostNode === node) {
return inst;
} else {
return null;
}
}
/**
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
* DOM node.
*/
function getNodeFromInstance(inst) {
// Without this first invariant, passing a non-DOM-component triggers the next
// invariant for a missing parent, which is super confusing.
!(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
if (inst._hostNode) {
return inst._hostNode;
}
// Walk up the tree until we find an ancestor whose DOM node we have cached.
var parents = [];
while (!inst._hostNode) {
parents.push(inst);
!inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
inst = inst._hostParent;
}
// Now parents contains each ancestor that does *not* have a cached native
// node, and `inst` is the deepest ancestor that does.
for (; parents.length; inst = parents.pop()) {
precacheChildNodes(inst, inst._hostNode);
}
return inst._hostNode;
}
var ReactDOMComponentTree = {
getClosestInstanceFromNode: getClosestInstanceFromNode,
getInstanceFromNode: getInstanceFromNode,
getNodeFromInstance: getNodeFromInstance,
precacheChildNodes: precacheChildNodes,
precacheNode: precacheNode,
uncacheNode: uncacheNode
};
module.exports = ReactDOMComponentTree;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 39 */
/***/ (function(module, exports) {
/**
* 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 strict';
/**
* 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;
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
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) ? process.env.NODE_ENV !== 'production' ? 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) ? process.env.NODE_ENV !== 'production' ? 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 (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
}
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
propertyInfo.attributeName = attributeName;
if (process.env.NODE_ENV !== 'production') {
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: process.env.NODE_ENV !== 'production' ? { 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;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 41 */
/***/ (function(module, exports) {
/**
* Copyright 2015-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 strict';
var ReactDOMComponentFlags = {
hasCachedChildNodes: 1 << 0
};
module.exports = ReactDOMComponentFlags;
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ARIADOMPropertyConfig = __webpack_require__(43);
var BeforeInputEventPlugin = __webpack_require__(44);
var ChangeEventPlugin = __webpack_require__(59);
var DefaultEventPluginOrder = __webpack_require__(76);
var EnterLeaveEventPlugin = __webpack_require__(77);
var HTMLDOMPropertyConfig = __webpack_require__(82);
var ReactComponentBrowserEnvironment = __webpack_require__(83);
var ReactDOMComponent = __webpack_require__(96);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDOMEmptyComponent = __webpack_require__(141);
var ReactDOMTreeTraversal = __webpack_require__(142);
var ReactDOMTextComponent = __webpack_require__(143);
var ReactDefaultBatchingStrategy = __webpack_require__(144);
var ReactEventListener = __webpack_require__(145);
var ReactInjection = __webpack_require__(148);
var ReactReconcileTransaction = __webpack_require__(149);
var SVGDOMPropertyConfig = __webpack_require__(157);
var SelectEventPlugin = __webpack_require__(158);
var SimpleEventPlugin = __webpack_require__(159);
var alreadyInjected = false;
function inject() {
if (alreadyInjected) {
// TODO: This is currently true because these injections are shared between
// the client and the server package. They should be built independently
// and not share any injection state. Then this problem will be solved.
return;
}
alreadyInjected = true;
ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
return new ReactDOMEmptyComponent(instantiate);
});
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
}
module.exports = {
inject: inject
};
/***/ }),
/* 43 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ARIADOMPropertyConfig = {
Properties: {
// Global States and Properties
'aria-current': 0, // state
'aria-details': 0,
'aria-disabled': 0, // state
'aria-hidden': 0, // state
'aria-invalid': 0, // state
'aria-keyshortcuts': 0,
'aria-label': 0,
'aria-roledescription': 0,
// Widget Attributes
'aria-autocomplete': 0,
'aria-checked': 0,
'aria-expanded': 0,
'aria-haspopup': 0,
'aria-level': 0,
'aria-modal': 0,
'aria-multiline': 0,
'aria-multiselectable': 0,
'aria-orientation': 0,
'aria-placeholder': 0,
'aria-pressed': 0,
'aria-readonly': 0,
'aria-required': 0,
'aria-selected': 0,
'aria-sort': 0,
'aria-valuemax': 0,
'aria-valuemin': 0,
'aria-valuenow': 0,
'aria-valuetext': 0,
// Live Region Attributes
'aria-atomic': 0,
'aria-busy': 0,
'aria-live': 0,
'aria-relevant': 0,
// Drag-and-Drop Attributes
'aria-dropeffect': 0,
'aria-grabbed': 0,
// Relationship Attributes
'aria-activedescendant': 0,
'aria-colcount': 0,
'aria-colindex': 0,
'aria-colspan': 0,
'aria-controls': 0,
'aria-describedby': 0,
'aria-errormessage': 0,
'aria-flowto': 0,
'aria-labelledby': 0,
'aria-owns': 0,
'aria-posinset': 0,
'aria-rowcount': 0,
'aria-rowindex': 0,
'aria-rowspan': 0,
'aria-setsize': 0
},
DOMAttributeNames: {},
DOMPropertyNames: {}
};
module.exports = ARIADOMPropertyConfig;
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var EventPropagators = __webpack_require__(45);
var ExecutionEnvironment = __webpack_require__(52);
var FallbackCompositionState = __webpack_require__(53);
var SyntheticCompositionEvent = __webpack_require__(56);
var SyntheticInputEvent = __webpack_require__(58);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: 'onBeforeInput',
captured: 'onBeforeInputCapture'
},
dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: 'onCompositionEnd',
captured: 'onCompositionEndCapture'
},
dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
},
compositionStart: {
phasedRegistrationNames: {
bubbled: 'onCompositionStart',
captured: 'onCompositionStartCapture'
},
dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: 'onCompositionUpdate',
captured: 'onCompositionUpdateCapture'
},
dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
}
};
// Track whether we've ever handled a keypress on the space key.
var hasSpaceKeypress = false;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey);
}
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case 'topCompositionStart':
return eventTypes.compositionStart;
case 'topCompositionEnd':
return eventTypes.compositionEnd;
case 'topCompositionUpdate':
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case 'topKeyUp':
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case 'topKeyDown':
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return nativeEvent.keyCode !== START_KEYCODE;
case 'topKeyPress':
case 'topMouseDown':
case 'topBlur':
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Google Input Tools provides composition data via a CustomEvent,
* with the `data` property populated in the `detail` object. If this
* is available on the event object, use it. If not, this is a plain
* composition event and we have nothing special to extract.
*
* @param {object} nativeEvent
* @return {?string}
*/
function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if (typeof detail === 'object' && 'data' in detail) {
return detail.data;
}
return null;
}
// Track the current IME composition fallback object, if any.
var currentComposition = null;
/**
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
}
}
}
var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = fallbackData;
} else {
var customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
event.data = customData;
}
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
case 'topCompositionEnd':
return getDataFromCustomEvent(nativeEvent);
case 'topKeyPress':
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return null;
}
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
case 'topTextInput':
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
// doesn't give us keycodes, so we need to blacklist it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
return chars;
default:
// For other native event types, do nothing.
return null;
}
}
/**
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
// If composition event is available, we extract a string only at
// compositionevent, otherwise extract it at fallback events.
if (currentComposition) {
if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
return chars;
}
return null;
}
switch (topLevelType) {
case 'topPaste':
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
case 'topKeyPress':
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
return String.fromCharCode(nativeEvent.which);
}
return null;
case 'topCompositionEnd':
return useFallbackCompositionData ? null : nativeEvent.data;
default:
return null;
}
}
/**
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return null;
}
var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*
* This plugin is also responsible for emitting `composition` events, thus
* allowing us to share composition fallback code for both `beforeInput` and
* `composition` event types.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var EventPluginHub = __webpack_require__(46);
var EventPluginUtils = __webpack_require__(48);
var accumulateInto = __webpack_require__(50);
var forEachAccumulated = __webpack_require__(51);
var warning = __webpack_require__(11);
var getListener = EventPluginHub.getListener;
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(inst, registrationName);
}
/**
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
* here, allows us to not have to bind or create functions for each event.
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(inst, phase, event) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0;
}
var listener = listenerAtPhase(inst, event, phase);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
}
}
/**
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
*/
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
var targetInst = event._targetInst;
var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null;
EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
}
}
/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
function accumulateDispatches(inst, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(inst, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event._targetInst, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateTwoPhaseDispatchesSkipTarget(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
function accumulateEnterLeaveDispatches(leave, enter, from, to) {
EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
/**
* A small set of propagation patterns, each of which will accept a small amount
* of information, and generate a set of "dispatch ready event objects" - which
* are sets of events that have already been annotated with a set of dispatched
* listener functions/ids. The API is designed this way to discourage these
* propagation strategies from actually executing the dispatches, since we
* always want to collect the entire set of dispatches before executing event a
* single one.
*
* @constructor EventPropagators
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var EventPluginRegistry = __webpack_require__(47);
var EventPluginUtils = __webpack_require__(48);
var ReactErrorUtils = __webpack_require__(49);
var accumulateInto = __webpack_require__(50);
var forEachAccumulated = __webpack_require__(51);
var invariant = __webpack_require__(8);
/**
* Internal store for event listeners
*/
var listenerBank = {};
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
var executeDispatchesAndReleaseSimulated = function (e) {
return executeDispatchesAndRelease(e, true);
};
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e, false);
};
var getDictionaryKey = function (inst) {
// Prevents V8 performance issue:
// https://github.com/facebook/react/pull/7232
return '.' + inst._rootNodeID;
};
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
function shouldPreventMouseEvent(name, type, props) {
switch (name) {
case 'onClick':
case 'onClickCapture':
case 'onDoubleClick':
case 'onDoubleClickCapture':
case 'onMouseDown':
case 'onMouseDownCapture':
case 'onMouseMove':
case 'onMouseMoveCapture':
case 'onMouseUp':
case 'onMouseUpCapture':
return !!(props.disabled && isInteractive(type));
default:
return false;
}
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
var EventPluginHub = {
/**
* Methods for injecting dependencies.
*/
injection: {
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
/**
* Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
*
* @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {function} listener The callback to store.
*/
putListener: function (inst, registrationName, listener) {
!(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
var key = getDictionaryKey(inst);
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[key] = listener;
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.didPutListener) {
PluginModule.didPutListener(inst, registrationName, listener);
}
},
/**
* @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function (inst, registrationName) {
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
var bankForRegistrationName = listenerBank[registrationName];
if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) {
return null;
}
var key = getDictionaryKey(inst);
return bankForRegistrationName && bankForRegistrationName[key];
},
/**
* Deletes a listener from the registration bank.
*
* @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function (inst, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(inst, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName];
// TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
var key = getDictionaryKey(inst);
delete bankForRegistrationName[key];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {object} inst The instance, which is the source of events.
*/
deleteAllListeners: function (inst) {
var key = getDictionaryKey(inst);
for (var registrationName in listenerBank) {
if (!listenerBank.hasOwnProperty(registrationName)) {
continue;
}
if (!listenerBank[registrationName][key]) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(inst, registrationName);
}
delete listenerBank[registrationName][key];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
return events;
},
/**
* Enqueues a synthetic event that should be dispatched when
* `processEventQueue` is invoked.
*
* @param {*} events An accumulation of synthetic events.
* @internal
*/
enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
if (simulated) {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
} else {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
}
!!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function () {
listenerBank = {};
},
__getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
/**
* Injectable ordering of event plugins.
*/
var eventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!eventPluginOrder) {
// Wait until an `eventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var pluginModule = namesToPlugins[pluginName];
var pluginIndex = eventPluginOrder.indexOf(pluginName);
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
!pluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0;
EventPluginRegistry.plugins[pluginIndex] = pluginModule;
var publishedEvents = pluginModule.eventTypes;
for (var eventName in publishedEvents) {
!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0;
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events and
* can be used with `EventPluginHub.putListener` to register listeners.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, pluginModule, eventName) {
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0;
EventPluginRegistry.registrationNameModules[registrationName] = pluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
if (process.env.NODE_ENV !== 'production') {
var lowerCasedName = registrationName.toLowerCase();
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName;
if (registrationName === 'onDoubleClick') {
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
}
}
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from event name to dispatch config
*/
eventNameDispatchConfigs: {},
/**
* Mapping from registration name to plugin module
*/
registrationNameModules: {},
/**
* Mapping from registration name to event name
*/
registrationNameDependencies: {},
/**
* Mapping from lowercase registration names to the properly cased version,
* used to warn in the case of missing event handlers. Available
* only in __DEV__.
* @type {Object}
*/
possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null,
// Trust the developer to only use possibleRegistrationNames in __DEV__
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function (injectedEventPluginOrder) {
!!eventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0;
// Clone the ordering so it cannot be dynamically mutated.
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
recomputePluginOrdering();
},
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var pluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0;
namesToPlugins[pluginName] = pluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
},
/**
* Looks up the plugin for the supplied event.
*
* @param {object} event A synthetic event.
* @return {?object} The plugin that created the supplied event.
* @internal
*/
getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
if (dispatchConfig.phasedRegistrationNames !== undefined) {
// pulling phasedRegistrationNames out of dispatchConfig helps Flow see
// that it is not undefined.
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
for (var phase in phasedRegistrationNames) {
if (!phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]];
if (pluginModule) {
return pluginModule;
}
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function () {
eventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
for (var eventName in eventNameDispatchConfigs) {
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
delete eventNameDispatchConfigs[eventName];
}
}
var registrationNameModules = EventPluginRegistry.registrationNameModules;
for (var registrationName in registrationNameModules) {
if (registrationNameModules.hasOwnProperty(registrationName)) {
delete registrationNameModules[registrationName];
}
}
if (process.env.NODE_ENV !== 'production') {
var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames;
for (var lowerCasedName in possibleRegistrationNames) {
if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) {
delete possibleRegistrationNames[lowerCasedName];
}
}
}
}
};
module.exports = EventPluginRegistry;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactErrorUtils = __webpack_require__(49);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
/**
* Injected dependencies:
*/
/**
* - `ComponentTree`: [required] Module that can convert between React instances
* and actual node references.
*/
var ComponentTree;
var TreeTraversal;
var injection = {
injectComponentTree: function (Injected) {
ComponentTree = Injected;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
}
},
injectTreeTraversal: function (Injected) {
TreeTraversal = Injected;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0;
}
}
};
function isEndish(topLevelType) {
return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
}
function isMoveish(topLevelType) {
return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
}
function isStartish(topLevelType) {
return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
}
var validateEventDispatches;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
var listenersIsArr = Array.isArray(dispatchListeners);
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
var instancesIsArr = Array.isArray(dispatchInstances);
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @param {function} listener Application-level callback
* @param {*} inst Internal component instance
*/
function executeDispatch(event, simulated, listener, inst) {
var type = event.type || 'unknown-event';
event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
if (simulated) {
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event);
} else {
ReactErrorUtils.invokeGuardedCallback(type, listener, event);
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and Instances are two parallel arrays that are always in sync.
executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
}
event._dispatchListeners = null;
event._dispatchInstances = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return {?string} id of the first dispatch execution who's listener returns
* true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and Instances are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchInstances[i])) {
return dispatchInstances[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchInstances)) {
return dispatchInstances;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchInstances = null;
event._dispatchListeners = null;
return ret;
}
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchInstance = event._dispatchInstances;
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0;
event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null;
var res = dispatchListener ? dispatchListener(event) : null;
event.currentTarget = null;
event._dispatchListeners = null;
event._dispatchInstances = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
}
/**
* General utilities that are useful in creating custom Event Plugins.
*/
var EventPluginUtils = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
getInstanceFromNode: function (node) {
return ComponentTree.getInstanceFromNode(node);
},
getNodeFromInstance: function (node) {
return ComponentTree.getNodeFromInstance(node);
},
isAncestor: function (a, b) {
return TreeTraversal.isAncestor(a, b);
},
getLowestCommonAncestor: function (a, b) {
return TreeTraversal.getLowestCommonAncestor(a, b);
},
getParentInstance: function (inst) {
return TreeTraversal.getParentInstance(inst);
},
traverseTwoPhase: function (target, fn, arg) {
return TreeTraversal.traverseTwoPhase(target, fn, arg);
},
traverseEnterLeave: function (from, to, fn, argFrom, argTo) {
return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo);
},
injection: injection
};
module.exports = EventPluginUtils;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var caughtError = null;
/**
* Call a function while guarding against errors that happens within it.
*
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} a First argument
* @param {*} b Second argument
*/
function invokeGuardedCallback(name, func, a) {
try {
func(a);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
}
}
var ReactErrorUtils = {
invokeGuardedCallback: invokeGuardedCallback,
/**
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
* handler are sure to be rethrown by rethrowCaughtError.
*/
invokeGuardedCallbackWithCatch: invokeGuardedCallback,
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
rethrowCaughtError: function () {
if (caughtError) {
var error = caughtError;
caughtError = null;
throw error;
}
}
};
if (process.env.NODE_ENV !== 'production') {
/**
* To help development we can get better devtools integration by simulating a
* real browser event.
*/
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function (name, func, a) {
var boundFunc = func.bind(null, a);
var evtType = 'react-' + name;
fakeNode.addEventListener(evtType, boundFunc, false);
var evt = document.createEvent('Event');
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
fakeNode.removeEventListener(evtType, boundFunc, false);
};
}
}
module.exports = ReactErrorUtils;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
/**
* Accumulates items that must not be null or undefined into the first one. This
* is used to conserve memory by avoiding array allocations, and thus sacrifices
* API cleanness. Since `current` can be null before being passed in and not
* null after this function, make sure to assign it back to `current`:
*
* `a = accumulateInto(a, b);`
*
* This API should be sparingly used. Try `accumulate` for something cleaner.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulateInto(current, next) {
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
if (current == null) {
return next;
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
if (Array.isArray(current)) {
if (Array.isArray(next)) {
current.push.apply(current, next);
return current;
}
current.push(next);
return current;
}
if (Array.isArray(next)) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulateInto;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 51 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
function forEachAccumulated(arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
}
module.exports = forEachAccumulated;
/***/ }),
/* 52 */
/***/ (function(module, exports) {
/**
* 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 strict';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var PooledClass = __webpack_require__(54);
var getTextContentAccessor = __webpack_require__(55);
/**
* This helper class stores information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
* both its text content and its current position in the DOM. Since the
* browser may natively replace the target node during composition, we can
* use its position to find its replacement.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this._root = root;
this._startText = this.getText();
this._fallbackText = null;
}
_assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
this._fallbackText = null;
},
/**
* Get current text of input.
*
* @return {string}
*/
getText: function () {
if ('value' in this._root) {
return this._root.value;
}
return this._root[getTextContentAccessor()];
},
/**
* Determine the differing substring between the initially stored
* text content and the current content.
*
* @return {string}
*/
getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
var start;
var startValue = this._startText;
var startLength = startValue.length;
var end;
var endValue = this.getText();
var endLength = endValue.length;
for (start = 0; start < startLength; start++) {
if (startValue[start] !== endValue[start]) {
break;
}
}
var minEnd = startLength - start;
for (end = 1; end <= minEnd; end++) {
if (startValue[startLength - end] !== endValue[endLength - end]) {
break;
}
}
var sliceTail = end > 1 ? 1 - end : undefined;
this._fallbackText = endValue.slice(start, sliceTail);
return this._fallbackText;
}
});
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances.
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
// Casting as any so that flow ignores the actual implementation and trusts
// it to match the type we declared
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler
};
module.exports = PooledClass;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
var contentKey = null;
/**
* Gets the key used to access text content on a DOM node.
*
* @return {?string} Key used to access text content.
* @internal
*/
function getTextContentAccessor() {
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var PooledClass = __webpack_require__(54);
var emptyFunction = __webpack_require__(12);
var warning = __webpack_require__(11);
var didWarnForAddedNewProperty = false;
var isProxySupported = typeof Proxy === 'function';
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
target: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {*} targetInst Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @param {DOMEventTarget} nativeEventTarget Target node.
*/
function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
if (process.env.NODE_ENV !== 'production') {
// these have a getter/setter for warnings
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
}
this.dispatchConfig = dispatchConfig;
this._targetInst = targetInst;
this.nativeEvent = nativeEvent;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
delete this[propName]; // this has a getter/setter for warnings
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
if (propName === 'target') {
this.target = nativeEventTarget;
} else {
this[propName] = nativeEvent[propName];
}
}
}
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
return this;
}
_assign(SyntheticEvent.prototype, {
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault();
} else if (typeof event.returnValue !== 'unknown') {
// eslint-disable-line valid-typeof
event.returnValue = false;
}
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function () {
var event = this.nativeEvent;
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation();
} else if (typeof event.cancelBubble !== 'unknown') {
// eslint-disable-line valid-typeof
// The ChangeEventPlugin registers a "propertychange" event for
// IE. This event does not support bubbling or cancelling, and
// any references to cancelBubble throw "Member not found". A
// typeof check of "unknown" circumvents this issue (and is also
// IE specific).
event.cancelBubble = true;
}
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},
/**
* We release all dispatched `SyntheticEvent`s after each event loop, adding
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: emptyFunction.thatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (process.env.NODE_ENV !== 'production') {
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
} else {
this[propName] = null;
}
}
for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
this[shouldBeReleasedProperties[i]] = null;
}
if (process.env.NODE_ENV !== 'production') {
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
}
}
});
SyntheticEvent.Interface = EventInterface;
if (process.env.NODE_ENV !== 'production') {
if (isProxySupported) {
/*eslint-disable no-func-assign */
SyntheticEvent = new Proxy(SyntheticEvent, {
construct: function (target, args) {
return this.apply(target, Object.create(target.prototype), args);
},
apply: function (constructor, that, args) {
return new Proxy(constructor.apply(that, args), {
set: function (target, prop, value) {
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
didWarnForAddedNewProperty = true;
}
target[prop] = value;
return true;
}
});
}
});
/*eslint-enable no-func-assign */
}
}
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();
_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
/**
* Helper to nullify syntheticEvent instance properties when destructing
*
* @param {object} SyntheticEvent
* @param {String} propName
* @return {object} defineProperty object
*/
function getPooledWarningPropertyDefinition(propName, getVal) {
var isFunction = typeof getVal === 'function';
return {
configurable: true,
set: set,
get: get
};
function set(val) {
var action = isFunction ? 'setting the method' : 'setting the property';
warn(action, 'This is effectively a no-op');
return val;
}
function get() {
var action = isFunction ? 'accessing the method' : 'accessing the property';
var result = isFunction ? 'This is a no-op function' : 'This is set to null';
warn(action, result);
return getVal;
}
function warn(action, result) {
var warningCondition = false;
process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var EventPluginHub = __webpack_require__(46);
var EventPropagators = __webpack_require__(45);
var ExecutionEnvironment = __webpack_require__(52);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactUpdates = __webpack_require__(60);
var SyntheticEvent = __webpack_require__(57);
var getEventTarget = __webpack_require__(73);
var isEventSupported = __webpack_require__(74);
var isTextInputElement = __webpack_require__(75);
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: 'onChange',
captured: 'onChangeCapture'
},
dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementInst = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetInst) {
activeElement = target;
activeElementInst = targetInst;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementInst = null;
}
function getTargetInstForChangeEvent(topLevelType, targetInst) {
if (topLevelType === 'topChange') {
return targetInst;
}
}
function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
if (topLevelType === 'topFocus') {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(target, targetInst);
} else if (topLevelType === 'topBlur') {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events.
// IE10+ fire input events to often, such when a placeholder
// changes or when an input with a placeholder is focused.
isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
}
/**
* (For IE <=11) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function () {
return activeElementValueProp.get.call(this);
},
set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For IE <=11) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetInst) {
activeElement = target;
activeElementInst = targetInst;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
// Not guarded in a canDefineProperty check: IE8 supports defineProperty only
// on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
if (activeElement.attachEvent) {
activeElement.attachEvent('onpropertychange', handlePropertyChange);
} else {
activeElement.addEventListener('propertychange', handlePropertyChange, false);
}
}
/**
* (For IE <=11) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
if (activeElement.detachEvent) {
activeElement.detachEvent('onpropertychange', handlePropertyChange);
} else {
activeElement.removeEventListener('propertychange', handlePropertyChange, false);
}
activeElement = null;
activeElementInst = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For IE <=11) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetInstForInputEvent(topLevelType, targetInst) {
if (topLevelType === 'topInput') {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return targetInst;
}
}
function handleEventsForInputEventIE(topLevelType, target, targetInst) {
if (topLevelType === 'topFocus') {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9-11, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(target, targetInst);
} else if (topLevelType === 'topBlur') {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetInstForInputEventIE(topLevelType, targetInst) {
if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementInst;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
function getTargetInstForClickEvent(topLevelType, targetInst) {
if (topLevelType === 'topClick') {
return targetInst;
}
}
function handleControlledInputBlur(inst, node) {
// TODO: In IE, inst is occasionally null. Why?
if (inst == null) {
return;
}
// Fiber and ReactDOM keep wrapper state in separate places
var state = inst._wrapperState || node._wrapperState;
if (!state || !state.controlled || node.type !== 'number') {
return;
}
// If controlled, assign the value attribute to the current value on blur
var value = '' + node.value;
if (node.getAttribute('value') !== value) {
node.setAttribute('value', value);
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
var getTargetInstFunc, handleEventFunc;
if (shouldUseChangeEvent(targetNode)) {
if (doesChangeEventBubble) {
getTargetInstFunc = getTargetInstForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(targetNode)) {
if (isInputEventSupported) {
getTargetInstFunc = getTargetInstForInputEvent;
} else {
getTargetInstFunc = getTargetInstForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(targetNode)) {
getTargetInstFunc = getTargetInstForClickEvent;
}
if (getTargetInstFunc) {
var inst = getTargetInstFunc(topLevelType, targetInst);
if (inst) {
var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(topLevelType, targetNode, targetInst);
}
// When blurring, set the value attribute for number inputs
if (topLevelType === 'topBlur') {
handleControlledInputBlur(targetInst, targetNode);
}
}
};
module.exports = ChangeEventPlugin;
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var CallbackQueue = __webpack_require__(61);
var PooledClass = __webpack_require__(54);
var ReactFeatureFlags = __webpack_require__(62);
var ReactReconciler = __webpack_require__(63);
var Transaction = __webpack_require__(72);
var invariant = __webpack_require__(8);
var dirtyComponents = [];
var updateBatchNumber = 0;
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
}
var NESTED_UPDATES = {
initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function () {
this.callbackQueue.reset();
},
close: function () {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */true);
}
_assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
* Array comparator for ReactComponents by mount ordering.
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountOrderComparator(c1, c2) {
return c1._mountOrder - c2._mountOrder;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
// Any updates enqueued while reconciling must be performed after this entire
// batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
// C, B could update twice in a single batch if C's render enqueues an update
// to B (since B would have already updated, we should skip it, and the only
// way we can know to do so is by checking the batch counter).
updateBatchNumber++;
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, it will still
// be here, but we assume that it has cleared its _pendingCallbacks and
// that performUpdateIfNecessary is a noop.
var component = dirtyComponents[i];
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
var markerName;
if (ReactFeatureFlags.logTopLevelRenders) {
var namedComponent = component;
// Duck type TopLevelWrapper. This is probably always true.
if (component._currentElement.type.isReactTopLevelWrapper) {
namedComponent = component._renderedComponent;
}
markerName = 'React update: ' + namedComponent.getName();
console.time(markerName);
}
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
if (markerName) {
console.timeEnd(markerName);
}
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
// updates enqueued by setState callbacks and asap calls.
while (dirtyComponents.length || asapEnqueued) {
if (dirtyComponents.length) {
var transaction = ReactUpdatesFlushTransaction.getPooled();
transaction.perform(runBatchedUpdates, null, transaction);
ReactUpdatesFlushTransaction.release(transaction);
}
if (asapEnqueued) {
asapEnqueued = false;
var queue = asapCallbackQueue;
asapCallbackQueue = CallbackQueue.getPooled();
queue.notifyAll();
CallbackQueue.release(queue);
}
}
};
/**
* Mark a component as needing a rerender, adding an optional callback to a
* list of functions which will be executed once the rerender occurs.
*/
function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
return;
}
dirtyComponents.push(component);
if (component._updateBatchNumber == null) {
component._updateBatchNumber = updateBatchNumber + 1;
}
}
/**
* Enqueue a callback to be run at the end of the current batching cycle. Throws
* if no updates are currently being performed.
*/
function asap(callback, context) {
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function (ReconcileTransaction) {
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function (_batchingStrategy) {
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction: null,
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection,
asap: asap
};
module.exports = ReactUpdates;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var PooledClass = __webpack_require__(54);
var invariant = __webpack_require__(8);
/**
* A specialized pseudo-event module to help keep track of components waiting to
* be notified when their DOM representations are available for use.
*
* This implements `PooledClass`, so you should never need to instantiate this.
* Instead, use `CallbackQueue.getPooled()`.
*
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
var CallbackQueue = function () {
function CallbackQueue(arg) {
_classCallCheck(this, CallbackQueue);
this._callbacks = null;
this._contexts = null;
this._arg = arg;
}
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
*
* @param {function} callback Invoked when `notifyAll` is invoked.
* @param {?object} context Context to call `callback` with.
* @internal
*/
CallbackQueue.prototype.enqueue = function enqueue(callback, context) {
this._callbacks = this._callbacks || [];
this._callbacks.push(callback);
this._contexts = this._contexts || [];
this._contexts.push(context);
};
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
CallbackQueue.prototype.notifyAll = function notifyAll() {
var callbacks = this._callbacks;
var contexts = this._contexts;
var arg = this._arg;
if (callbacks && contexts) {
!(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0;
this._callbacks = null;
this._contexts = null;
for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i], arg);
}
callbacks.length = 0;
contexts.length = 0;
}
};
CallbackQueue.prototype.checkpoint = function checkpoint() {
return this._callbacks ? this._callbacks.length : 0;
};
CallbackQueue.prototype.rollback = function rollback(len) {
if (this._callbacks && this._contexts) {
this._callbacks.length = len;
this._contexts.length = len;
}
};
/**
* Resets the internal queue.
*
* @internal
*/
CallbackQueue.prototype.reset = function reset() {
this._callbacks = null;
this._contexts = null;
};
/**
* `PooledClass` looks for this.
*/
CallbackQueue.prototype.destructor = function destructor() {
this.reset();
};
return CallbackQueue;
}();
module.exports = PooledClass.addPoolingTo(CallbackQueue);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 62 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactFeatureFlags = {
// When true, call console.time() before and .timeEnd() after each top-level
// render (both initial renders and updates). Useful when looking at prod-mode
// timeline profiles in Chrome, for example.
logTopLevelRenders: false
};
module.exports = ReactFeatureFlags;
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var ReactRef = __webpack_require__(64);
var ReactInstrumentation = __webpack_require__(66);
var warning = __webpack_require__(11);
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
* to avoid allocations in the transaction mount-ready queue.
*/
function attachRefs() {
ReactRef.attachRefs(this, this._currentElement);
}
var ReactReconciler = {
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {?object} the containing host component instance
* @param {?object} info about the host container
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
) {
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
}
}
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
}
}
return markup;
},
/**
* Returns a value that can be passed to
* ReactComponentEnvironment.replaceNodeWithMarkup.
*/
getHostNode: function (internalInstance) {
return internalInstance.getHostNode();
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (internalInstance, safely) {
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
}
}
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent(safely);
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
}
}
},
/**
* Update a component using a new element.
*
* @param {ReactComponent} internalInstance
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @internal
*/
receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
}
}
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
}
internalInstance.receiveComponent(nextElement, transaction, context);
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
}
}
},
/**
* Flush any dirty changes in a component.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) {
if (internalInstance._updateBatchNumber !== updateBatchNumber) {
// The component's enqueued batch number should always be the current
// batch or the following one.
process.env.NODE_ENV !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
return;
}
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
}
}
internalInstance.performUpdateIfNecessary(transaction);
if (process.env.NODE_ENV !== 'production') {
if (internalInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
}
}
}
};
module.exports = ReactReconciler;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ReactOwner = __webpack_require__(65);
var ReactRef = {};
function attachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(component.getPublicInstance());
} else {
// Legacy ref
ReactOwner.addComponentAsRefTo(component, ref, owner);
}
}
function detachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(null);
} else {
// Legacy ref
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
}
}
ReactRef.attachRefs = function (instance, element) {
if (element === null || typeof element !== 'object') {
return;
}
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the element.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
var prevRef = null;
var prevOwner = null;
if (prevElement !== null && typeof prevElement === 'object') {
prevRef = prevElement.ref;
prevOwner = prevElement._owner;
}
var nextRef = null;
var nextOwner = null;
if (nextElement !== null && typeof nextElement === 'object') {
nextRef = nextElement.ref;
nextOwner = nextElement._owner;
}
return prevRef !== nextRef ||
// If owner changes but we have an unchanged function ref, don't update refs
typeof nextRef === 'string' && nextOwner !== prevOwner;
};
ReactRef.detachRefs = function (instance, element) {
if (element === null || typeof element !== 'object') {
return;
}
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
}
};
module.exports = ReactRef;
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
function isValidOwner(object) {
return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
}
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
!isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
!isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;
var ownerPublicInstance = owner.getPublicInstance();
// Check that `component`'s owner is still alive and that `component` is still the current ref
// because we do not want to detach the ref if another component stole it.
if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-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 strict';
// Trust the developer to only use ReactInstrumentation with a __DEV__ check
var debugTool = null;
if (process.env.NODE_ENV !== 'production') {
var ReactDebugTool = __webpack_require__(67);
debugTool = ReactDebugTool;
}
module.exports = { debugTool: debugTool };
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-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 strict';
var ReactInvalidSetStateWarningHook = __webpack_require__(68);
var ReactHostOperationHistoryHook = __webpack_require__(69);
var ReactComponentTreeHook = __webpack_require__(26);
var ExecutionEnvironment = __webpack_require__(52);
var performanceNow = __webpack_require__(70);
var warning = __webpack_require__(11);
var hooks = [];
var didHookThrowForEvent = {};
function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
try {
fn.call(context, arg1, arg2, arg3, arg4, arg5);
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
didHookThrowForEvent[event] = true;
}
}
function emitEvent(event, arg1, arg2, arg3, arg4, arg5) {
for (var i = 0; i < hooks.length; i++) {
var hook = hooks[i];
var fn = hook[event];
if (fn) {
callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
}
}
}
var isProfiling = false;
var flushHistory = [];
var lifeCycleTimerStack = [];
var currentFlushNesting = 0;
var currentFlushMeasurements = [];
var currentFlushStartTime = 0;
var currentTimerDebugID = null;
var currentTimerStartTime = 0;
var currentTimerNestedFlushDuration = 0;
var currentTimerType = null;
var lifeCycleTimerHasWarned = false;
function clearHistory() {
ReactComponentTreeHook.purgeUnmountedComponents();
ReactHostOperationHistoryHook.clearHistory();
}
function getTreeSnapshot(registeredIDs) {
return registeredIDs.reduce(function (tree, id) {
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var parentID = ReactComponentTreeHook.getParentID(id);
tree[id] = {
displayName: ReactComponentTreeHook.getDisplayName(id),
text: ReactComponentTreeHook.getText(id),
updateCount: ReactComponentTreeHook.getUpdateCount(id),
childIDs: ReactComponentTreeHook.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0,
parentID: parentID
};
return tree;
}, {});
}
function resetMeasurements() {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements;
var previousOperations = ReactHostOperationHistoryHook.getHistory();
if (currentFlushNesting === 0) {
currentFlushStartTime = 0;
currentFlushMeasurements = [];
clearHistory();
return;
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
}
function checkDebugID(debugID) {
var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (allowRoot && debugID === 0) {
return;
}
if (!debugID) {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
}
}
function beginLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
currentTimerStartTime = performanceNow();
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
function endLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
}
function pauseCurrentLifeCycleTimer() {
var currentTimer = {
startTime: currentTimerStartTime,
nestedFlushStartTime: performanceNow(),
debugID: currentTimerDebugID,
timerType: currentTimerType
};
lifeCycleTimerStack.push(currentTimer);
currentTimerStartTime = 0;
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = null;
currentTimerType = null;
}
function resumeCurrentLifeCycleTimer() {
var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),
startTime = _lifeCycleTimerStack$.startTime,
nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,
debugID = _lifeCycleTimerStack$.debugID,
timerType = _lifeCycleTimerStack$.timerType;
var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
currentTimerStartTime = startTime;
currentTimerNestedFlushDuration += nestedFlushDuration;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
var lastMarkTimeStamp = 0;
var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
function shouldMark(debugID) {
if (!isProfiling || !canUsePerformanceMeasure) {
return false;
}
var element = ReactComponentTreeHook.getElement(debugID);
if (element == null || typeof element !== 'object') {
return false;
}
var isHostElement = typeof element.type === 'string';
if (isHostElement) {
return false;
}
return true;
}
function markBegin(debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
var markName = debugID + '::' + markType;
lastMarkTimeStamp = performanceNow();
performance.mark(markName);
}
function markEnd(debugID, markType) {
if (!shouldMark(debugID)) {
return;
}
var markName = debugID + '::' + markType;
var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';
// Chrome has an issue of dropping markers recorded too fast:
// https://bugs.chromium.org/p/chromium/issues/detail?id=640652
// To work around this, we will not report very small measurements.
// I determined the magic number by tweaking it back and forth.
// 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe.
// When the bug is fixed, we can `measure()` unconditionally if we want to.
var timeStamp = performanceNow();
if (timeStamp - lastMarkTimeStamp > 0.1) {
var measurementName = displayName + ' [' + markType + ']';
performance.measure(measurementName, markName);
}
performance.clearMarks(markName);
performance.clearMeasures(measurementName);
}
var ReactDebugTool = {
addHook: function (hook) {
hooks.push(hook);
},
removeHook: function (hook) {
for (var i = 0; i < hooks.length; i++) {
if (hooks[i] === hook) {
hooks.splice(i, 1);
i--;
}
}
},
isProfiling: function () {
return isProfiling;
},
beginProfiling: function () {
if (isProfiling) {
return;
}
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addHook(ReactHostOperationHistoryHook);
},
endProfiling: function () {
if (!isProfiling) {
return;
}
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
},
getFlushHistory: function () {
return flushHistory;
},
onBeginFlush: function () {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');
},
onBeginLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginLifeCycleTimer', debugID, timerType);
markBegin(debugID, timerType);
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
endLifeCycleTimer(debugID, timerType);
markEnd(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);
},
onBeginProcessingChildContext: function () {
emitEvent('onBeginProcessingChildContext');
},
onEndProcessingChildContext: function () {
emitEvent('onEndProcessingChildContext');
},
onHostOperation: function (operation) {
checkDebugID(operation.instanceID);
emitEvent('onHostOperation', operation);
},
onSetState: function () {
emitEvent('onSetState');
},
onSetChildren: function (debugID, childDebugIDs) {
checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);
},
onBeforeMountComponent: function (debugID, element, parentDebugID) {
checkDebugID(debugID);
checkDebugID(parentDebugID, true);
emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
markBegin(debugID, 'mount');
},
onMountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'mount');
emitEvent('onMountComponent', debugID);
},
onBeforeUpdateComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeUpdateComponent', debugID, element);
markBegin(debugID, 'update');
},
onUpdateComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'update');
emitEvent('onUpdateComponent', debugID);
},
onBeforeUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onBeforeUnmountComponent', debugID);
markBegin(debugID, 'unmount');
},
onUnmountComponent: function (debugID) {
checkDebugID(debugID);
markEnd(debugID, 'unmount');
emitEvent('onUnmountComponent', debugID);
},
onTestEvent: function () {
emitEvent('onTestEvent');
}
};
// TODO remove these when RN/www gets updated
ReactDebugTool.addDevtool = ReactDebugTool.addHook;
ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
ReactDebugTool.addHook(ReactComponentTreeHook);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
module.exports = ReactDebugTool;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-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 strict';
var warning = __webpack_require__(11);
if (process.env.NODE_ENV !== 'production') {
var processingChildContext = false;
var warnInvalidSetState = function () {
process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
};
}
var ReactInvalidSetStateWarningHook = {
onBeginProcessingChildContext: function () {
processingChildContext = true;
},
onEndProcessingChildContext: function () {
processingChildContext = false;
},
onSetState: function () {
warnInvalidSetState();
}
};
module.exports = ReactInvalidSetStateWarningHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 69 */
/***/ (function(module, exports) {
/**
* Copyright 2016-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 strict';
var history = [];
var ReactHostOperationHistoryHook = {
onHostOperation: function (operation) {
history.push(operation);
},
clearHistory: function () {
if (ReactHostOperationHistoryHook._preventClearing) {
// Should only be used for tests.
return;
}
history = [];
},
getHistory: function () {
return history;
}
};
module.exports = ReactHostOperationHistoryHook;
/***/ }),
/* 70 */
/***/ (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.
*
* @typechecks
*/
var performance = __webpack_require__(71);
var performanceNow;
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (performance.now) {
performanceNow = function performanceNow() {
return performance.now();
};
} else {
performanceNow = function performanceNow() {
return Date.now();
};
}
module.exports = performanceNow;
/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {
/**
* 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.
*
* @typechecks
*/
'use strict';
var ExecutionEnvironment = __webpack_require__(52);
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.msPerformance || window.webkitPerformance;
}
module.exports = performance || {};
/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
var OBSERVED_ERROR = {};
/**
* `Transaction` creates a black box that is able to wrap any method such that
* certain invariants are maintained before and after the method is invoked
* (Even if an exception is thrown while invoking the wrapped method). Whoever
* instantiates a transaction can provide enforcers of the invariants at
* creation time. The `Transaction` class itself will supply one additional
* automatic invariant for you - the invariant that any transaction instance
* should not be run while it is already being run. You would typically create a
* single instance of a `Transaction` for reuse multiple times, that potentially
* is used to wrap several different methods. Wrappers are extremely simple -
* they only require implementing two methods.
*
* <pre>
* wrappers (injected at creation time)
* + +
* | |
* +-----------------|--------|--------------+
* | v | |
* | +---------------+ | |
* | +--| wrapper1 |---|----+ |
* | | +---------------+ v | |
* | | +-------------+ | |
* | | +----| wrapper2 |--------+ |
* | | | +-------------+ | | |
* | | | | | |
* | v v v v | wrapper
* | +---+ +---+ +---------+ +---+ +---+ | invariants
* perform(anyMethod) | | | | | | | | | | | | maintained
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ |
* | initialize close |
* +-----------------------------------------+
* </pre>
*
* Use cases:
* - Preserving the input selection ranges before/after reconciliation.
* Restoring selection even in the event of an unexpected error.
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
* while guaranteeing that afterwards, the event system is reactivated.
* - Flushing a queue of collected DOM mutations to the main UI thread after a
* reconciliation takes place in a worker thread.
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
* content.
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
* to preserve the `scrollTop` (an automatic scroll aware DOM).
* - (Future use case): Layout calculations before and after DOM updates.
*
* Transactional plugin API:
* - A module that has an `initialize` method that returns any precomputation.
* - and a `close` method that accepts the precomputation. `close` is invoked
* when the wrapped process is completed, or has failed.
*
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
* that implement `initialize` and `close`.
* @return {Transaction} Single transaction for reuse in thread.
*
* @class Transaction
*/
var TransactionImpl = {
/**
* Sets up this instance so that it is prepared for collecting metrics. Does
* so such that this setup method may be used on an instance that is already
* initialized, in a way that does not consume additional memory upon reuse.
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
} else {
this.wrapperInitData = [];
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
* need to be safety checked. The optional arguments helps prevent the need
* to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} a Argument to pass to the method.
* @param {Object?=} b Argument to pass to the method.
* @param {Object?=} c Argument to pass to the method.
* @param {Object?=} d Argument to pass to the method.
* @param {Object?=} e Argument to pass to the method.
* @param {Object?=} f Argument to pass to the method.
*
* @return {*} Return value from `method`.
*/
perform: function (method, scope, a, b, c, d, e, f) {
!!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
var errorThrown;
var ret;
try {
this._isInTransaction = true;
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// one of these calls threw.
errorThrown = true;
this.initializeAll(0);
ret = method.call(scope, a, b, c, d, e, f);
errorThrown = false;
} finally {
try {
if (errorThrown) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
try {
this.closeAll(0);
} catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
this.closeAll(0);
}
} finally {
this._isInTransaction = false;
}
}
return ret;
},
initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
try {
// Catching errors makes debugging more difficult, so we start with the
// OBSERVED_ERROR state before overwriting it with the real return value
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
// remaining wrappers but silence any exceptions from them to ensure
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
} catch (err) {}
}
}
}
},
/**
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
* them the respective return values of `this.transactionWrappers.init[i]`
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
closeAll: function (startIndex) {
!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var initData = this.wrapperInitData[i];
var errorThrown;
try {
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// wrapper.close threw.
errorThrown = true;
if (initData !== OBSERVED_ERROR && wrapper.close) {
wrapper.close.call(this, initData);
}
errorThrown = false;
} finally {
if (errorThrown) {
// The closer for wrapper i threw an error; close the remaining
// wrappers but silence any exceptions from them to ensure that the
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
} catch (e) {}
}
}
}
this.wrapperInitData.length = 0;
}
};
module.exports = TransactionImpl;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 73 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Normalize SVG <use> element events #4963
if (target.correspondingUseElement) {
target = target.correspondingUseElement;
}
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
}
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = eventName in document;
if (!isSupported) {
var element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
}
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
// This is the only way to test support for the `wheel` event in IE9+.
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
}
return isSupported;
}
module.exports = isEventSupported;
/***/ }),
/* 75 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
var supportedInputTypes = {
'color': true,
'date': true,
'datetime': true,
'datetime-local': true,
'email': true,
'month': true,
'number': true,
'password': true,
'range': true,
'search': true,
'tel': true,
'text': true,
'time': true,
'url': true,
'week': true
};
function isTextInputElement(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
if (nodeName === 'input') {
return !!supportedInputTypes[elem.type];
}
if (nodeName === 'textarea') {
return true;
}
return false;
}
module.exports = isTextInputElement;
/***/ }),
/* 76 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
module.exports = DefaultEventPluginOrder;
/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var EventPropagators = __webpack_require__(45);
var ReactDOMComponentTree = __webpack_require__(38);
var SyntheticMouseEvent = __webpack_require__(78);
var eventTypes = {
mouseEnter: {
registrationName: 'onMouseEnter',
dependencies: ['topMouseOut', 'topMouseOver']
},
mouseLeave: {
registrationName: 'onMouseLeave',
dependencies: ['topMouseOut', 'topMouseOver']
}
};
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*/
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (nativeEventTarget.window === nativeEventTarget) {
// `nativeEventTarget` is probably a window object.
win = nativeEventTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = nativeEventTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from;
var to;
if (topLevelType === 'topMouseOut') {
from = targetInst;
var related = nativeEvent.relatedTarget || nativeEvent.toElement;
to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
} else {
// Moving to a node from outside the window.
from = null;
to = targetInst;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = fromNode;
leave.relatedTarget = toNode;
var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = toNode;
enter.relatedTarget = fromNode;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
return [leave, enter];
}
};
module.exports = EnterLeaveEventPlugin;
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticUIEvent = __webpack_require__(79);
var ViewportMetrics = __webpack_require__(80);
var getEventModifierState = __webpack_require__(81);
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = {
screenX: null,
screenY: null,
clientX: null,
clientY: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
var button = event.button;
if ('which' in event) {
return button;
}
// IE<9
// which: undefined
// button: 0 0 0
// button: 1 4 2 (onmouseup)
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
relatedTarget: function (event) {
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
pageX: function (event) {
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function (event) {
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
var getEventTarget = __webpack_require__(73);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function (event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target.window === target) {
// target is a window object
return target;
}
var doc = target.ownerDocument;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
},
detail: function (event) {
return event.detail || 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
/***/ }),
/* 80 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
/***/ }),
/* 81 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
'Alt': 'altKey',
'Control': 'ctrlKey',
'Meta': 'metaKey',
'Shift': 'shiftKey'
};
// IE8 does not implement getModifierState so we simply map it to the only
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
module.exports = getEventModifierState;
/***/ }),
/* 82 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var DOMProperty = __webpack_require__(40);
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,
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;
/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var DOMChildrenOperations = __webpack_require__(84);
var ReactDOMIDOperations = __webpack_require__(95);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
* the browser context. TODO: These callers should be refactored to avoid the
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup
};
module.exports = ReactComponentBrowserEnvironment;
/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var DOMLazyTree = __webpack_require__(85);
var Danger = __webpack_require__(91);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactInstrumentation = __webpack_require__(66);
var createMicrosoftUnsafeLocalFunction = __webpack_require__(88);
var setInnerHTML = __webpack_require__(87);
var setTextContent = __webpack_require__(89);
function getNodeAfter(parentNode, node) {
// Special case for text components, which return [open, close] comments
// from getHostNode.
if (Array.isArray(node)) {
node = node[1];
}
return node ? node.nextSibling : parentNode.firstChild;
}
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
*
* @param {DOMElement} parentNode Parent node in which to insert.
* @param {DOMElement} childNode Child node to insert.
* @param {number} index Index at which to insert the child.
* @internal
*/
var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
// We rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
// we are careful to use `null`.)
parentNode.insertBefore(childNode, referenceNode);
});
function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
}
function moveChild(parentNode, childNode, referenceNode) {
if (Array.isArray(childNode)) {
moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
} else {
insertChildAt(parentNode, childNode, referenceNode);
}
}
function removeChild(parentNode, childNode) {
if (Array.isArray(childNode)) {
var closingComment = childNode[1];
childNode = childNode[0];
removeDelimitedText(parentNode, childNode, closingComment);
parentNode.removeChild(closingComment);
}
parentNode.removeChild(childNode);
}
function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
var node = openingComment;
while (true) {
var nextNode = node.nextSibling;
insertChildAt(parentNode, node, referenceNode);
if (node === closingComment) {
break;
}
node = nextNode;
}
}
function removeDelimitedText(parentNode, startNode, closingComment) {
while (true) {
var node = startNode.nextSibling;
if (node === closingComment) {
// The closing comment is removed by ReactMultiChild.
break;
} else {
parentNode.removeChild(node);
}
}
}
function replaceDelimitedText(openingComment, closingComment, stringText) {
var parentNode = openingComment.parentNode;
var nodeAfterComment = openingComment.nextSibling;
if (nodeAfterComment === closingComment) {
// There are no text nodes between the opening and closing comments; insert
// a new one if stringText isn't empty.
if (stringText) {
insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
}
} else {
if (stringText) {
// Set the text content of the first node after the opening comment, and
// remove all following nodes up until the closing comment.
setTextContent(nodeAfterComment, stringText);
removeDelimitedText(parentNode, nodeAfterComment, closingComment);
} else {
removeDelimitedText(parentNode, openingComment, closingComment);
}
}
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID,
type: 'replace text',
payload: stringText
});
}
}
var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
if (process.env.NODE_ENV !== 'production') {
dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
if (prevInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: prevInstance._debugID,
type: 'replace with',
payload: markup.toString()
});
} else {
var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
if (nextInstance._debugID !== 0) {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: nextInstance._debugID,
type: 'mount',
payload: markup.toString()
});
}
}
};
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
replaceDelimitedText: replaceDelimitedText,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
* @internal
*/
processUpdates: function (parentNode, updates) {
if (process.env.NODE_ENV !== 'production') {
var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
}
for (var k = 0; k < updates.length; k++) {
var update = updates[k];
switch (update.type) {
case 'INSERT_MARKUP':
insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: parentNodeDebugID,
type: 'insert child',
payload: { toIndex: update.toIndex, content: update.content.toString() }
});
}
break;
case 'MOVE_EXISTING':
moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: parentNodeDebugID,
type: 'move child',
payload: { fromIndex: update.fromIndex, toIndex: update.toIndex }
});
}
break;
case 'SET_MARKUP':
setInnerHTML(parentNode, update.content);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: parentNodeDebugID,
type: 'replace children',
payload: update.content.toString()
});
}
break;
case 'TEXT_CONTENT':
setTextContent(parentNode, update.content);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: parentNodeDebugID,
type: 'replace text',
payload: update.content.toString()
});
}
break;
case 'REMOVE_NODE':
removeChild(parentNode, update.fromNode);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: parentNodeDebugID,
type: 'remove child',
payload: { fromIndex: update.fromIndex }
});
}
break;
}
}
}
};
module.exports = DOMChildrenOperations;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 85 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 2015-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 strict';
var DOMNamespaces = __webpack_require__(86);
var setInnerHTML = __webpack_require__(87);
var createMicrosoftUnsafeLocalFunction = __webpack_require__(88);
var setTextContent = __webpack_require__(89);
var ELEMENT_NODE_TYPE = 1;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* In IE (8-11) and Edge, appending nodes with no children is dramatically
* faster than appending a full subtree, so we essentially queue up the
* .appendChild calls here and apply them so each node is added to its parent
* before any children are added.
*
* In other browsers, doing so is slower or neutral compared to the other order
* (in Firefox, twice as slow) so we only do this inversion in IE.
*
* See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.
*/
var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent);
function insertTreeChildren(tree) {
if (!enableLazy) {
return;
}
var node = tree.node;
var children = tree.children;
if (children.length) {
for (var i = 0; i < children.length; i++) {
insertTreeBefore(node, children[i], null);
}
} else if (tree.html != null) {
setInnerHTML(node, tree.html);
} else if (tree.text != null) {
setTextContent(node, tree.text);
}
}
var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {
// DocumentFragments aren't actually part of the DOM after insertion so
// appending children won't update the DOM. We need to ensure the fragment
// is properly populated first, breaking out of our lazy approach for just
// this level. Also, some <object> plugins (like Flash Player) will read
// <param> nodes immediately upon insertion into the DOM, so <object>
// must also be populated prior to insertion into the DOM.
if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) {
insertTreeChildren(tree);
parentNode.insertBefore(tree.node, referenceNode);
} else {
parentNode.insertBefore(tree.node, referenceNode);
insertTreeChildren(tree);
}
});
function replaceChildWithTree(oldNode, newTree) {
oldNode.parentNode.replaceChild(newTree.node, oldNode);
insertTreeChildren(newTree);
}
function queueChild(parentTree, childTree) {
if (enableLazy) {
parentTree.children.push(childTree);
} else {
parentTree.node.appendChild(childTree.node);
}
}
function queueHTML(tree, html) {
if (enableLazy) {
tree.html = html;
} else {
setInnerHTML(tree.node, html);
}
}
function queueText(tree, text) {
if (enableLazy) {
tree.text = text;
} else {
setTextContent(tree.node, text);
}
}
function toString() {
return this.node.nodeName;
}
function DOMLazyTree(node) {
return {
node: node,
children: [],
html: null,
text: null,
toString: toString
};
}
DOMLazyTree.insertTreeBefore = insertTreeBefore;
DOMLazyTree.replaceChildWithTree = replaceChildWithTree;
DOMLazyTree.queueChild = queueChild;
DOMLazyTree.queueHTML = queueHTML;
DOMLazyTree.queueText = queueText;
module.exports = DOMLazyTree;
/***/ }),
/* 86 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var DOMNamespaces = {
html: 'http://www.w3.org/1999/xhtml',
mathml: 'http://www.w3.org/1998/Math/MathML',
svg: 'http://www.w3.org/2000/svg'
};
module.exports = DOMNamespaces;
/***/ }),
/* 87 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
var DOMNamespaces = __webpack_require__(86);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
var createMicrosoftUnsafeLocalFunction = __webpack_require__(88);
// SVG temp container for IE lacking innerHTML
var reusableSVGContainer;
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
// IE does not have innerHTML for SVG nodes, so instead we inject the
// new markup in a temp node and then move the child nodes across into
// the target node
if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
reusableSVGContainer = reusableSVGContainer || document.createElement('div');
reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
var svgNode = reusableSVGContainer.firstChild;
while (svgNode.firstChild) {
node.appendChild(svgNode.firstChild);
}
} else {
node.innerHTML = html;
}
});
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
// whitespace is removed. When updating an existing node with innerHTML
// whitespace in root TextNodes is also collapsed.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
// Feature detection; only IE8 is known to behave improperly like this.
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
// the initial and more favorable whitespace behavior.
// TODO: What to do on a detached node?
if (node.parentNode) {
node.parentNode.replaceChild(node, node);
}
// We also implement a workaround for non-visible tags disappearing into
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
// in hopes that this is preserved even if "\uFEFF" is transformed to
// the actual Unicode character (by Babel, for example).
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
var textNode = node.firstChild;
if (textNode.data.length === 1) {
node.removeChild(textNode);
} else {
textNode.deleteData(0, 1);
}
} else {
node.innerHTML = html;
}
};
}
testElement = null;
}
module.exports = setInnerHTML;
/***/ }),
/* 88 */
/***/ (function(module, exports) {
/**
* Copyright 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.
*
*/
/* globals MSApp */
'use strict';
/**
* Create a function which has 'unsafe' privileges (required by windows8 apps)
*/
var createMicrosoftUnsafeLocalFunction = function (func) {
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
return function (arg0, arg1, arg2, arg3) {
MSApp.execUnsafeLocalFunction(function () {
return func(arg0, arg1, arg2, arg3);
});
};
} else {
return func;
}
};
module.exports = createMicrosoftUnsafeLocalFunction;
/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
var escapeTextContentForBrowser = __webpack_require__(90);
var setInnerHTML = __webpack_require__(87);
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
* even in IE8. innerText is a poor substitute for textContent and, among many
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves
* as it should.
*
* @param {DOMElement} node
* @param {string} text
* @internal
*/
var setTextContent = function (node, text) {
if (text) {
var firstChild = node.firstChild;
if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
firstChild.nodeValue = text;
return;
}
}
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function (node, text) {
if (node.nodeType === 3) {
node.nodeValue = text;
return;
}
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
/***/ }),
/* 90 */
/***/ (function(module, exports) {
/**
* Copyright 2016-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.
*
* Based on the escape-html library, which is used under the MIT License below:
*
* Copyright (c) 2012-2013 TJ Holowaychuk
* Copyright (c) 2015 Andreas Lubbe
* Copyright (c) 2015 Tiancheng "Timothy" Gu
*
* 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.
*
*/
'use strict';
// code copied and modified from escape-html
/**
* Module variables.
* @private
*/
var matchHtmlRegExp = /["'&<>]/;
/**
* Escape special characters in the given string of html.
*
* @param {string} string The string to escape for inserting into HTML
* @return {string}
* @public
*/
function escapeHtml(string) {
var str = '' + string;
var match = matchHtmlRegExp.exec(str);
if (!match) {
return str;
}
var escape;
var html = '';
var index = 0;
var lastIndex = 0;
for (index = match.index; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34:
// "
escape = '"';
break;
case 38:
// &
escape = '&';
break;
case 39:
// '
escape = '''; // modified from escape-html; used to be '''
break;
case 60:
// <
escape = '<';
break;
case 62:
// >
escape = '>';
break;
default:
continue;
}
if (lastIndex !== index) {
html += str.substring(lastIndex, index);
}
lastIndex = index + 1;
html += escape;
}
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
}
// end code copied and modified from escape-html
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextContentForBrowser(text) {
if (typeof text === 'boolean' || typeof text === 'number') {
// this shortcircuit helps perf for types that we know will never have
// special characters, especially given that this function is used often
// for numeric dom ids.
return '' + text;
}
return escapeHtml(text);
}
module.exports = escapeTextContentForBrowser;
/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var DOMLazyTree = __webpack_require__(85);
var ExecutionEnvironment = __webpack_require__(52);
var createNodesFromMarkup = __webpack_require__(92);
var emptyFunction = __webpack_require__(12);
var invariant = __webpack_require__(8);
var Danger = {
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0;
!markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
!(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0;
if (typeof markup === 'string') {
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
oldChild.parentNode.replaceChild(newChild, oldChild);
} else {
DOMLazyTree.replaceChildWithTree(oldChild, markup);
}
}
};
module.exports = Danger;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'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.
*
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
var ExecutionEnvironment = __webpack_require__(52);
var createArrayFromMixed = __webpack_require__(93);
var getMarkupWrap = __webpack_require__(94);
var invariant = __webpack_require__(8);
/**
* Dummy container used to render all markup.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
!handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = Array.from(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 93 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'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.
*
* @typechecks
*/
var invariant = __webpack_require__(8);
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFromMixed.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browsers builtin objects can report typeof 'function' (e.g. NodeList
// in old versions of Safari).
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;
!(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;
!(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;
!(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return (
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
typeof obj.nodeType != 'number' && (
// a real array
Array.isArray(obj) ||
// arguments
'callee' in obj ||
// HTMLCollection/NodeList
'item' in obj)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFromMixed = require('createArrayFromMixed');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFromMixed(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFromMixed(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFromMixed;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'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.
*
*/
/*eslint-disable fb-www/unsafe-html */
var ExecutionEnvironment = __webpack_require__(52);
var invariant = __webpack_require__(8);
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap
};
// Initialize the SVG elements since we know they'll always need to be wrapped
// consistently. If they are created inside a <div> they will be initialized in
// the wrong namespace (and will not display).
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
svgElements.forEach(function (nodeName) {
markupWrap[nodeName] = svgWrap;
shouldWrap[nodeName] = true;
});
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 95 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var DOMChildrenOperations = __webpack_require__(84);
var ReactDOMComponentTree = __webpack_require__(38);
/**
* Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @internal
*/
dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
DOMChildrenOperations.processUpdates(node, updates);
}
};
module.exports = ReactDOMIDOperations;
/***/ }),
/* 96 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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.
*
*/
/* global hasOwnProperty:true */
'use strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var AutoFocusUtils = __webpack_require__(97);
var CSSPropertyOperations = __webpack_require__(99);
var DOMLazyTree = __webpack_require__(85);
var DOMNamespaces = __webpack_require__(86);
var DOMProperty = __webpack_require__(40);
var DOMPropertyOperations = __webpack_require__(107);
var EventPluginHub = __webpack_require__(46);
var EventPluginRegistry = __webpack_require__(47);
var ReactBrowserEventEmitter = __webpack_require__(109);
var ReactDOMComponentFlags = __webpack_require__(41);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDOMInput = __webpack_require__(112);
var ReactDOMOption = __webpack_require__(115);
var ReactDOMSelect = __webpack_require__(116);
var ReactDOMTextarea = __webpack_require__(117);
var ReactInstrumentation = __webpack_require__(66);
var ReactMultiChild = __webpack_require__(118);
var ReactServerRenderingTransaction = __webpack_require__(137);
var emptyFunction = __webpack_require__(12);
var escapeTextContentForBrowser = __webpack_require__(90);
var invariant = __webpack_require__(8);
var isEventSupported = __webpack_require__(74);
var shallowEqual = __webpack_require__(127);
var validateDOMNesting = __webpack_require__(140);
var warning = __webpack_require__(11);
var Flags = ReactDOMComponentFlags;
var deleteListener = EventPluginHub.deleteListener;
var getNode = ReactDOMComponentTree.getNodeFromInstance;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = EventPluginRegistry.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = { 'string': true, 'number': true };
var STYLE = 'style';
var HTML = '__html';
var RESERVED_PROPS = {
children: null,
dangerouslySetInnerHTML: null,
suppressContentEditableWarning: null
};
// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
var DOC_FRAGMENT_TYPE = 11;
function getDeclarationErrorAddendum(internalInstance) {
if (internalInstance) {
var owner = internalInstance._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' This DOM node was rendered by `' + name + '`.';
}
}
}
return '';
}
function friendlyStringify(obj) {
if (typeof obj === 'object') {
if (Array.isArray(obj)) {
return '[' + obj.map(friendlyStringify).join(', ') + ']';
} else {
var pairs = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
}
}
return '{' + pairs.join(', ') + '}';
}
} else if (typeof obj === 'string') {
return JSON.stringify(obj);
} else if (typeof obj === 'function') {
return '[function object]';
}
// Differs from JSON.stringify in that undefined because undefined and that
// inf and nan don't become null
return String(obj);
}
var styleMutationWarning = {};
function checkAndWarnForMutatedStyle(style1, style2, component) {
if (style1 == null || style2 == null) {
return;
}
if (shallowEqual(style1, style2)) {
return;
}
var componentName = component._tag;
var owner = component._currentElement._owner;
var ownerName;
if (owner) {
ownerName = owner.getName();
}
var hash = ownerName + '|' + componentName;
if (styleMutationWarning.hasOwnProperty(hash)) {
return;
}
styleMutationWarning[hash] = true;
process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
}
/**
* @param {object} component
* @param {?object} props
*/
function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (voidElementTags[component._tag]) {
!(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0;
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
}
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0;
}
function enqueuePutListener(inst, registrationName, listener, transaction) {
if (transaction instanceof ReactServerRenderingTransaction) {
return;
}
if (process.env.NODE_ENV !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
}
var containerInfo = inst._hostContainerInfo;
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
listenTo(registrationName, doc);
transaction.getReactMountReady().enqueue(putListener, {
inst: inst,
registrationName: registrationName,
listener: listener
});
}
function putListener() {
var listenerToPut = this;
EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
}
function inputPostMount() {
var inst = this;
ReactDOMInput.postMountWrapper(inst);
}
function textareaPostMount() {
var inst = this;
ReactDOMTextarea.postMountWrapper(inst);
}
function optionPostMount() {
var inst = this;
ReactDOMOption.postMountWrapper(inst);
}
var setAndValidateContentChildDev = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev = function (content) {
var hasExistingContent = this._contentDebugID != null;
var debugID = this._debugID;
// This ID represents the inlined child that has no backing instance:
var contentDebugID = -debugID;
if (content == null) {
if (hasExistingContent) {
ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
}
this._contentDebugID = null;
return;
}
validateDOMNesting(null, String(content), this, this._ancestorInfo);
this._contentDebugID = contentDebugID;
if (hasExistingContent) {
ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID);
} else {
ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID);
ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
}
};
}
// There are so many media events, it makes sense to just
// maintain a list rather than create a `trapBubbledEvent` for each
var mediaEvents = {
topAbort: 'abort',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topSeeked: 'seeked',
topSeeking: 'seeking',
topStalled: 'stalled',
topSuspend: 'suspend',
topTimeUpdate: 'timeupdate',
topVolumeChange: 'volumechange',
topWaiting: 'waiting'
};
function trapBubbledEventsLocal() {
var inst = this;
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0;
var node = getNode(inst);
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0;
switch (inst._tag) {
case 'iframe':
case 'object':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
break;
case 'video':
case 'audio':
inst._wrapperState.listeners = [];
// Create listener for each media event
for (var event in mediaEvents) {
if (mediaEvents.hasOwnProperty(event)) {
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node));
}
}
break;
case 'source':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)];
break;
case 'img':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)];
break;
case 'form':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)];
break;
case 'input':
case 'select':
case 'textarea':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)];
break;
}
}
function postUpdateSelectWrapper() {
ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special-case tags.
var omittedCloseTags = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
};
var newlineEatingTags = {
'listing': true,
'pre': true,
'textarea': true
};
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
var voidElementTags = _assign({
'menuitem': true
}, omittedCloseTags);
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
var hasOwnProperty = {}.hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0;
validatedTagCache[tag] = true;
}
}
function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}
var globalIdCounter = 1;
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(element) {
var tag = element.type;
validateDangerousTag(tag);
this._currentElement = element;
this._tag = tag.toLowerCase();
this._namespaceURI = null;
this._renderedChildren = null;
this._previousStyle = null;
this._previousStyleCopy = null;
this._hostNode = null;
this._hostParent = null;
this._rootNodeID = 0;
this._domID = 0;
this._hostContainerInfo = null;
this._wrapperState = null;
this._topLevelWrapper = null;
this._flags = 0;
if (process.env.NODE_ENV !== 'production') {
this._ancestorInfo = null;
setAndValidateContentChildDev.call(this, null);
}
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {?ReactDOMComponent} the parent component instance
* @param {?object} info about the host container
* @param {object} context
* @return {string} The computed markup.
*/
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
this._rootNodeID = globalIdCounter++;
this._domID = hostContainerInfo._idCounter++;
this._hostParent = hostParent;
this._hostContainerInfo = hostContainerInfo;
var props = this._currentElement.props;
switch (this._tag) {
case 'audio':
case 'form':
case 'iframe':
case 'img':
case 'link':
case 'object':
case 'source':
case 'video':
this._wrapperState = {
listeners: null
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'input':
ReactDOMInput.mountWrapper(this, props, hostParent);
props = ReactDOMInput.getHostProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'option':
ReactDOMOption.mountWrapper(this, props, hostParent);
props = ReactDOMOption.getHostProps(this, props);
break;
case 'select':
ReactDOMSelect.mountWrapper(this, props, hostParent);
props = ReactDOMSelect.getHostProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'textarea':
ReactDOMTextarea.mountWrapper(this, props, hostParent);
props = ReactDOMTextarea.getHostProps(this, props);
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
}
assertValidProps(this, props);
// We create tags in the namespace of their parent container, except HTML
// tags get no namespace.
var namespaceURI;
var parentTag;
if (hostParent != null) {
namespaceURI = hostParent._namespaceURI;
parentTag = hostParent._tag;
} else if (hostContainerInfo._tag) {
namespaceURI = hostContainerInfo._namespaceURI;
parentTag = hostContainerInfo._tag;
}
if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') {
namespaceURI = DOMNamespaces.html;
}
if (namespaceURI === DOMNamespaces.html) {
if (this._tag === 'svg') {
namespaceURI = DOMNamespaces.svg;
} else if (this._tag === 'math') {
namespaceURI = DOMNamespaces.mathml;
}
}
this._namespaceURI = namespaceURI;
if (process.env.NODE_ENV !== 'production') {
var parentInfo;
if (hostParent != null) {
parentInfo = hostParent._ancestorInfo;
} else if (hostContainerInfo._tag) {
parentInfo = hostContainerInfo._ancestorInfo;
}
if (parentInfo) {
// parentInfo should always be present except for the top-level
// component when server rendering
validateDOMNesting(this._tag, null, this, parentInfo);
}
this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
}
var mountImage;
if (transaction.useCreateElement) {
var ownerDocument = hostContainerInfo._ownerDocument;
var el;
if (namespaceURI === DOMNamespaces.html) {
if (this._tag === 'script') {
// Create the script via .innerHTML so its "parser-inserted" flag is
// set to true and it does not execute
var div = ownerDocument.createElement('div');
var type = this._currentElement.type;
div.innerHTML = '<' + type + '></' + type + '>';
el = div.removeChild(div.firstChild);
} else if (props.is) {
el = ownerDocument.createElement(this._currentElement.type, props.is);
} else {
// Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug.
// See discussion in https://github.com/facebook/react/pull/6896
// and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
el = ownerDocument.createElement(this._currentElement.type);
}
} else {
el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
}
ReactDOMComponentTree.precacheNode(this, el);
this._flags |= Flags.hasCachedChildNodes;
if (!this._hostParent) {
DOMPropertyOperations.setAttributeForRoot(el);
}
this._updateDOMProperties(null, props, transaction);
var lazyTree = DOMLazyTree(el);
this._createInitialChildren(transaction, props, context, lazyTree);
mountImage = lazyTree;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
if (!tagContent && omittedCloseTags[this._tag]) {
mountImage = tagOpen + '/>';
} else {
mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
}
}
switch (this._tag) {
case 'input':
transaction.getReactMountReady().enqueue(inputPostMount, this);
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
case 'textarea':
transaction.getReactMountReady().enqueue(textareaPostMount, this);
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
case 'select':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
case 'button':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
case 'option':
transaction.getReactMountReady().enqueue(optionPostMount, this);
break;
}
return mountImage;
},
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function (transaction, props) {
var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
if (propValue) {
enqueuePutListener(this, propKey, propValue, transaction);
}
} else {
if (propKey === STYLE) {
if (propValue) {
if (process.env.NODE_ENV !== 'production') {
// See `_updateDOMProperties`. style block
this._previousStyle = propValue;
}
propValue = this._previousStyleCopy = _assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
}
var markup = null;
if (this._tag != null && isCustomComponent(this._tag, props)) {
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
}
} else {
markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
}
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret;
}
if (!this._hostParent) {
ret += ' ' + DOMPropertyOperations.createMarkupForRoot();
}
ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID);
return ret;
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
_createContentMarkup: function (transaction, props, context) {
var ret = '';
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
ret = innerHTML.__html;
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
ret = escapeTextContentForBrowser(contentToUse);
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev.call(this, contentToUse);
}
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
ret = mountImages.join('');
}
}
if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
// text/html ignores the first character in these tags if it's a newline
// Prefer to break application/xml over text/html (for now) by adding
// a newline specifically to get eaten by the parser. (Alternately for
// textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
// \r is normalized out by HTMLTextAreaElement#value.)
// See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
// See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
// See: <http://www.w3.org/TR/html5/syntax.html#newlines>
// See: Parsing of "textarea" "listing" and "pre" elements
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
return '\n' + ret;
} else {
return ret;
}
},
_createInitialChildren: function (transaction, props, context, lazyTree) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
DOMLazyTree.queueHTML(lazyTree, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
// TODO: Validate that text is allowed as a child of this node
if (contentToUse != null) {
// Avoid setting textContent when the text is empty. In IE11 setting
// textContent on a text area will cause the placeholder to not
// show within the textarea until it has been focused and blurred again.
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
if (contentToUse !== '') {
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev.call(this, contentToUse);
}
DOMLazyTree.queueText(lazyTree, contentToUse);
}
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
for (var i = 0; i < mountImages.length; i++) {
DOMLazyTree.queueChild(lazyTree, mountImages[i]);
}
}
}
},
/**
* Receives a next element and updates the component.
*
* @internal
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
*/
receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
},
/**
* Updates a DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevElement
* @param {ReactElement} nextElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevElement, nextElement, context) {
var lastProps = prevElement.props;
var nextProps = this._currentElement.props;
switch (this._tag) {
case 'input':
lastProps = ReactDOMInput.getHostProps(this, lastProps);
nextProps = ReactDOMInput.getHostProps(this, nextProps);
break;
case 'option':
lastProps = ReactDOMOption.getHostProps(this, lastProps);
nextProps = ReactDOMOption.getHostProps(this, nextProps);
break;
case 'select':
lastProps = ReactDOMSelect.getHostProps(this, lastProps);
nextProps = ReactDOMSelect.getHostProps(this, nextProps);
break;
case 'textarea':
lastProps = ReactDOMTextarea.getHostProps(this, lastProps);
nextProps = ReactDOMTextarea.getHostProps(this, nextProps);
break;
}
assertValidProps(this, nextProps);
this._updateDOMProperties(lastProps, nextProps, transaction);
this._updateDOMChildren(lastProps, nextProps, transaction, context);
switch (this._tag) {
case 'input':
// Update the wrapper around inputs *after* updating props. This has to
// happen after `_updateDOMProperties`. Otherwise HTML5 input validations
// raise warnings and prevent the new value from being assigned.
ReactDOMInput.updateWrapper(this);
break;
case 'textarea':
ReactDOMTextarea.updateWrapper(this);
break;
case 'select':
// <select> value update needs to occur after <option> children
// reconciliation
transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
break;
}
},
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {object} nextProps
* @param {?DOMElement} node
*/
_updateDOMProperties: function (lastProps, nextProps, transaction) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
continue;
}
if (propKey === STYLE) {
var lastStyle = this._previousStyleCopy;
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (lastProps[propKey]) {
// Only call deleteListener if there was a listener previously or
// else willDeleteListener gets called when there wasn't actually a
// listener (e.g., onClick={null})
deleteListener(this, propKey);
}
} else if (isCustomComponent(this._tag, lastProps)) {
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined;
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
if (process.env.NODE_ENV !== 'production') {
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
this._previousStyle = nextProp;
}
nextProp = this._previousStyleCopy = _assign({}, nextProp);
} else {
this._previousStyleCopy = null;
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (nextProp) {
enqueuePutListener(this, propKey, nextProp, transaction);
} else if (lastProp) {
deleteListener(this, propKey);
}
} else if (isCustomComponent(this._tag, nextProps)) {
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
var node = getNode(this);
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertently setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
} else {
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
}
if (styleUpdates) {
CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {object} context
*/
_updateDOMChildren: function (lastProps, nextProps, transaction, context) {
var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction, context);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
}
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev.call(this, nextContent);
}
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
this.updateMarkup('' + nextHtml);
}
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
}
} else if (nextChildren != null) {
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev.call(this, null);
}
this.updateChildren(nextChildren, transaction, context);
}
},
getHostNode: function () {
return getNode(this);
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function (safely) {
switch (this._tag) {
case 'audio':
case 'form':
case 'iframe':
case 'img':
case 'link':
case 'object':
case 'source':
case 'video':
var listeners = this._wrapperState.listeners;
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
listeners[i].remove();
}
}
break;
case 'html':
case 'head':
case 'body':
/**
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*/
true ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0;
break;
}
this.unmountChildren(safely);
ReactDOMComponentTree.uncacheNode(this);
EventPluginHub.deleteAllListeners(this);
this._rootNodeID = 0;
this._domID = 0;
this._wrapperState = null;
if (process.env.NODE_ENV !== 'production') {
setAndValidateContentChildDev.call(this, null);
}
},
getPublicInstance: function () {
return getNode(this);
}
};
_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 97 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ReactDOMComponentTree = __webpack_require__(38);
var focusNode = __webpack_require__(98);
var AutoFocusUtils = {
focusDOMComponent: function () {
focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
}
};
module.exports = AutoFocusUtils;
/***/ }),
/* 98 */
/***/ (function(module, exports) {
/**
* 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 strict';
/**
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
// reasons that are too expensive and fragile to test.
try {
node.focus();
} catch (e) {}
}
module.exports = focusNode;
/***/ }),
/* 99 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var CSSProperty = __webpack_require__(100);
var ExecutionEnvironment = __webpack_require__(52);
var ReactInstrumentation = __webpack_require__(66);
var camelizeStyleName = __webpack_require__(101);
var dangerousStyleValue = __webpack_require__(103);
var hyphenateStyleName = __webpack_require__(104);
var memoizeStringOnly = __webpack_require__(106);
var warning = __webpack_require__(11);
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if (process.env.NODE_ENV !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnedForNaNValue = false;
var warnHyphenatedStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
};
var warnBadVendoredStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
};
var warnStyleValueWithSemicolon = function (name, value, owner) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
};
var warnStyleValueIsNaN = function (name, value, owner) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
};
var checkRenderMessage = function (owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
};
/**
* @param {string} name
* @param {*} value
* @param {ReactDOMComponent} component
*/
var warnValidStyle = function (name, value, component) {
var owner;
if (component) {
owner = component._currentElement._owner;
}
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name, owner);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name, owner);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value, owner);
}
if (typeof value === 'number' && isNaN(value)) {
warnStyleValueIsNaN(name, value, owner);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @param {ReactDOMComponent} component
* @return {?string}
*/
createMarkupForStyles: function (styles, component) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styleValue, component);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
* @param {ReactDOMComponent} component
*/
setValueForStyles: function (node, styles, component) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: component._debugID,
type: 'update styles',
payload: styles
});
}
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styles[styleName], component);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
if (styleName === 'float' || styleName === 'cssFloat') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 100 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridColumn: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeDasharray: true,
strokeDashoffset: true,
strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {
/**
* 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.
*
* @typechecks
*/
'use strict';
var camelize = __webpack_require__(102);
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
/***/ }),
/* 102 */
/***/ (function(module, exports) {
"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.
*
* @typechecks
*/
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
/***/ }),
/* 103 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var CSSProperty = __webpack_require__(100);
var warning = __webpack_require__(11);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
var styleWarnings = {};
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @param {ReactDOMComponent} component
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value, component) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
if (process.env.NODE_ENV !== 'production') {
// Allow '0' to pass through without warning. 0 is already special and
// doesn't require units, so we don't need to warn about it.
if (component && value !== '0') {
var owner = component._currentElement._owner;
var ownerName = owner ? owner.getName() : null;
if (ownerName && !styleWarnings[ownerName]) {
styleWarnings[ownerName] = {};
}
var warned = false;
if (ownerName) {
var warnings = styleWarnings[ownerName];
warned = warnings[name];
if (!warned) {
warnings[name] = true;
}
}
if (!warned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
}
}
}
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 104 */
/***/ (function(module, exports, __webpack_require__) {
/**
* 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.
*
* @typechecks
*/
'use strict';
var hyphenate = __webpack_require__(105);
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
/***/ }),
/* 105 */
/***/ (function(module, exports) {
'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.
*
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
/***/ }),
/* 106 */
/***/ (function(module, exports) {
/**
* 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.
*
*
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var DOMProperty = __webpack_require__(40);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactInstrumentation = __webpack_require__(66);
var quoteAttributeValueForBrowser = __webpack_require__(108);
var warning = __webpack_require__(11);
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
function isAttributeNameSafe(attributeName) {
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
return true;
}
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
return false;
}
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
validatedAttributeNameCache[attributeName] = true;
return true;
}
illegalAttributeNameCache[attributeName] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0;
return false;
}
function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for the ID property.
*
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
createMarkupForID: function (id) {
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
},
setAttributeForID: function (node, id) {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
createMarkupForRoot: function () {
return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""';
},
setAttributeForRoot: function (node) {
node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, '');
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function (name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
var attributeName = propertyInfo.attributeName;
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
}
return null;
},
/**
* Creates markup for a custom property.
*
* @param {string} name
* @param {*} value
* @return {string} Markup string, or empty string if the property was invalid.
*/
createMarkupForCustomAttribute: function (name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function (node, name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
return;
} else if (propertyInfo.mustUseProperty) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propertyInfo.propertyName] = value;
} else {
var attributeName = propertyInfo.attributeName;
var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
if (namespace) {
node.setAttributeNS(namespace, attributeName, '' + value);
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
node.setAttribute(attributeName, '');
} else {
node.setAttribute(attributeName, '' + value);
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
DOMPropertyOperations.setValueForAttribute(node, name, value);
return;
}
if (process.env.NODE_ENV !== 'production') {
var payload = {};
payload[name] = value;
ReactInstrumentation.debugTool.onHostOperation({
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
type: 'update attribute',
payload: payload
});
}
},
setValueForAttribute: function (node, name, value) {
if (!isAttributeNameSafe(name)) {
return;
}
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
if (process.env.NODE_ENV !== 'production') {
var payload = {};
payload[name] = value;
ReactInstrumentation.debugTool.onHostOperation({
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
type: 'update attribute',
payload: payload
});
}
},
/**
* Deletes an attributes from a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForAttribute: function (node, name) {
node.removeAttribute(name);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
type: 'remove attribute',
payload: name
});
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function (node, name) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (propertyInfo.mustUseProperty) {
var propName = propertyInfo.propertyName;
if (propertyInfo.hasBooleanValue) {
node[propName] = false;
} else {
node[propName] = '';
}
} else {
node.removeAttribute(propertyInfo.attributeName);
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
}
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID,
type: 'remove attribute',
payload: name
});
}
}
};
module.exports = DOMPropertyOperations;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 108 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var escapeTextContentForBrowser = __webpack_require__(90);
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextContentForBrowser(value) + '"';
}
module.exports = quoteAttributeValueForBrowser;
/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var EventPluginRegistry = __webpack_require__(47);
var ReactEventEmitterMixin = __webpack_require__(110);
var ViewportMetrics = __webpack_require__(80);
var getVendorPrefixedEventName = __webpack_require__(111);
var isEventSupported = __webpack_require__(74);
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
* - Top-level delegation is used to trap most native browser events. This
* may only occur in the main thread and is the responsibility of
* ReactEventListener, which is injected and can therefore support pluggable
* event sources. This is the only work that occurs in the main thread.
*
* - We normalize and de-duplicate events to account for browser quirks. This
* may be done in the worker thread.
*
* - Forward these native events (with the associated top-level type used to
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
* to extract any synthetic events.
*
* - The `EventPluginHub` will then process each event by annotating them with
* "dispatches", a sequence of listeners and IDs that care about that event.
*
* - The `EventPluginHub` then dispatches the events.
*
* Overview of React and the event system:
*
* +------------+ .
* | DOM | .
* +------------+ .
* | .
* v .
* +------------+ .
* | ReactEvent | .
* | Listener | .
* +------------+ . +-----------+
* | . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.--->| | +------------+
* | | | . +--------------+
* +-----|------+ . ^ +-----------+
* | . | |Enter/Leave|
* + . +-------+|Plugin |
* +-------------+ . +-----------+
* | application | .
* |-------------| .
* | | .
* | | .
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
var hasEventPageXY;
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
// For events like 'submit' which don't consistently bubble (which we trap at a
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
topAbort: 'abort',
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
topCompositionStart: 'compositionstart',
topCompositionUpdate: 'compositionupdate',
topContextMenu: 'contextmenu',
topCopy: 'copy',
topCut: 'cut',
topDoubleClick: 'dblclick',
topDrag: 'drag',
topDragEnd: 'dragend',
topDragEnter: 'dragenter',
topDragExit: 'dragexit',
topDragLeave: 'dragleave',
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topScroll: 'scroll',
topSeeked: 'seeked',
topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
topStalled: 'stalled',
topSuspend: 'suspend',
topTextInput: 'textInput',
topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel'
};
/**
* To ensure no conflicts with other potential React instances on the page
*/
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
function getListeningForDocument(mountAt) {
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
// directly.
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
mountAt[topListenersIDKey] = reactTopListenersCounter++;
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
}
return alreadyListeningTo[mountAt[topListenersIDKey]];
}
/**
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
* EventPluginHub.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
*/
ReactEventListener: null,
injection: {
/**
* @param {object} ReactEventListener
*/
injectReactEventListener: function (ReactEventListener) {
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function () {
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
* We listen for bubbled touch events on the document object.
*
* Firefox v8.01 (and possibly others) exhibited strange behavior when
* mounting `onmousemove` events at some node that was not the document
* element. The symptoms were that if your mouse is not moving over something
* contained within that mount point (for example on the background) the
* top-level listeners for `onmousemove` won't be called. However, if you
* register the `mousemove` on the document object, then it will of course
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
* top-level listeners to the document object only, at least for these
* movement types of events and possibly all events.
*
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
*
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === 'topWheel') {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt);
}
} else if (dependency === 'topScroll') {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
} else if (dependency === 'topFocus' || dependency === 'topBlur') {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening.topBlur = true;
isListening.topFocus = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
* Protect against document.createEvent() returning null
* Some popup blocker extensions appear to do this:
* https://github.com/facebook/react/issues/6887
*/
supportsEventPageXY: function () {
if (!document.createEvent) {
return false;
}
var ev = document.createEvent('MouseEvent');
return ev != null && 'pageX' in ev;
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
* pageX/pageY isn't supported (legacy browsers).
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function () {
if (hasEventPageXY === undefined) {
hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
}
if (!hasEventPageXY && !isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
}
});
module.exports = ReactBrowserEventEmitter;
/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var EventPluginHub = __webpack_require__(46);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*/
handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
/**
* Generate a mapping of standard vendor prefixes using the defined style property and event name.
*
* @param {string} styleProp
* @param {string} eventName
* @returns {object}
*/
function makePrefixMap(styleProp, eventName) {
var prefixes = {};
prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
prefixes['Webkit' + styleProp] = 'webkit' + eventName;
prefixes['Moz' + styleProp] = 'moz' + eventName;
prefixes['ms' + styleProp] = 'MS' + eventName;
prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
return prefixes;
}
/**
* A list of event names to a configurable list of vendor prefixes.
*/
var vendorPrefixes = {
animationend: makePrefixMap('Animation', 'AnimationEnd'),
animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
animationstart: makePrefixMap('Animation', 'AnimationStart'),
transitionend: makePrefixMap('Transition', 'TransitionEnd')
};
/**
* Event names that have already been detected and prefixed (if applicable).
*/
var prefixedEventNames = {};
/**
* Element to check for prefixes on.
*/
var style = {};
/**
* Bootstrap if a DOM exists.
*/
if (ExecutionEnvironment.canUseDOM) {
style = document.createElement('div').style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are usable, and if not remove them from the map.
if (!('AnimationEvent' in window)) {
delete vendorPrefixes.animationend.animation;
delete vendorPrefixes.animationiteration.animation;
delete vendorPrefixes.animationstart.animation;
}
// Same as above
if (!('TransitionEvent' in window)) {
delete vendorPrefixes.transitionend.transition;
}
}
/**
* Attempts to determine the correct vendor prefixed event name.
*
* @param {string} eventName
* @returns {string}
*/
function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
} else if (!vendorPrefixes[eventName]) {
return eventName;
}
var prefixMap = vendorPrefixes[eventName];
for (var styleProp in prefixMap) {
if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
return prefixedEventNames[eventName] = prefixMap[styleProp];
}
}
return '';
}
module.exports = getVendorPrefixedEventName;
/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var DOMPropertyOperations = __webpack_require__(107);
var LinkedValueUtils = __webpack_require__(113);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactUpdates = __webpack_require__(60);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var didWarnValueLink = false;
var didWarnCheckedLink = false;
var didWarnValueDefaultValue = false;
var didWarnCheckedDefaultChecked = false;
var didWarnControlledToUncontrolled = false;
var didWarnUncontrolledToControlled = false;
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMInput.updateWrapper(this);
}
}
function isControlled(props) {
var usesChecked = props.type === 'checkbox' || props.type === 'radio';
return usesChecked ? props.checked != null : props.value != null;
}
/**
* Implements an <input> host component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = {
getHostProps: function (inst, props) {
var value = LinkedValueUtils.getValue(props);
var checked = LinkedValueUtils.getChecked(props);
var hostProps = _assign({
// Make sure we set .type before any other properties (setting .value
// before .type means .value is lost in IE11 and below)
type: undefined,
// Make sure we set .step before .value (setting .value before .step
// means .value is rounded on mount, based upon step precision)
step: undefined,
// Make sure we set .min & .max before .value (to ensure proper order
// in corner cases such as min or max deriving from value, e.g. Issue #7170)
min: undefined,
max: undefined
}, props, {
defaultChecked: undefined,
defaultValue: undefined,
value: value != null ? value : inst._wrapperState.initialValue,
checked: checked != null ? checked : inst._wrapperState.initialChecked,
onChange: inst._wrapperState.onChange
});
return hostProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
var owner = inst._currentElement._owner;
if (props.valueLink !== undefined && !didWarnValueLink) {
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
didWarnValueLink = true;
}
if (props.checkedLink !== undefined && !didWarnCheckedLink) {
process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
didWarnCheckedLink = true;
}
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
didWarnCheckedDefaultChecked = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
didWarnValueDefaultValue = true;
}
}
var defaultValue = props.defaultValue;
inst._wrapperState = {
initialChecked: props.checked != null ? props.checked : props.defaultChecked,
initialValue: props.value != null ? props.value : defaultValue,
listeners: null,
onChange: _handleChange.bind(inst),
controlled: isControlled(props)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
if (process.env.NODE_ENV !== 'production') {
var controlled = isControlled(props);
var owner = inst._currentElement._owner;
if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
didWarnUncontrolledToControlled = true;
}
if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
didWarnControlledToUncontrolled = true;
}
}
// TODO: Shouldn't this be getChecked(props)?
var checked = props.checked;
if (checked != null) {
DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
}
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
if (value === 0 && node.value === '') {
node.value = '0';
// Note: IE9 reports a number inputs as 'text', so check props instead.
} else if (props.type === 'number') {
// Simulate `input.valueAsNumber`. IE9 does not support it
var valueAsNumber = parseFloat(node.value, 10) || 0;
// eslint-disable-next-line
if (value != valueAsNumber) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
}
// eslint-disable-next-line
} else if (value != node.value) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
node.value = '' + value;
}
} else {
if (props.value == null && props.defaultValue != null) {
// In Chrome, assigning defaultValue to certain input types triggers input validation.
// For number inputs, the display value loses trailing decimal points. For email inputs,
// Chrome raises "The specified value <x> is not a valid email address".
//
// Here we check to see if the defaultValue has actually changed, avoiding these problems
// when the user is inputting text
//
// https://github.com/facebook/react/issues/7253
if (node.defaultValue !== '' + props.defaultValue) {
node.defaultValue = '' + props.defaultValue;
}
}
if (props.checked == null && props.defaultChecked != null) {
node.defaultChecked = !!props.defaultChecked;
}
}
},
postMountWrapper: function (inst) {
var props = inst._currentElement.props;
// This is in postMount because we need access to the DOM node, which is not
// available until after the component has mounted.
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
// Detach value from defaultValue. We won't do anything if we're working on
// submit or reset inputs as those values & defaultValues are linked. They
// are not resetable nodes so this operation doesn't matter and actually
// removes browser-default values (eg "Submit Query") when no value is
// provided.
switch (props.type) {
case 'submit':
case 'reset':
break;
case 'color':
case 'date':
case 'datetime':
case 'datetime-local':
case 'month':
case 'time':
case 'week':
// This fixes the no-show issue on iOS Safari and Android Chrome:
// https://github.com/facebook/react/issues/7233
node.value = '';
node.value = node.defaultValue;
break;
default:
node.value = node.value;
break;
}
// Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
// this is needed to work around a chrome bug where setting defaultChecked
// will sometimes influence the value of checked (even after detachment).
// Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
// We need to temporarily unset name to avoid disrupting radio button groups.
var name = node.name;
if (name !== '') {
node.name = '';
}
node.defaultChecked = !node.defaultChecked;
node.defaultChecked = !node.defaultChecked;
if (name !== '') {
node.name = name;
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
var name = props.name;
if (props.type === 'radio' && name != null) {
var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
// mixing React radio buttons with non-React ones.
var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
}
}
return returnValue;
}
module.exports = ReactDOMInput;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactPropTypesSecret = __webpack_require__(114);
var propTypesFactory = __webpack_require__(30);
var React = __webpack_require__(2);
var PropTypes = propTypesFactory(React.isValidElement);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(inputProps) {
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0;
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0;
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0;
}
var propTypes = {
value: function (props, propName, componentName) {
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
onChange: PropTypes.func
};
var loggedTypeFailures = {};
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
checkPropTypes: function (tagName, props, owner) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum(owner);
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0;
}
}
},
/**
* @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function (inputProps) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.value;
}
return inputProps.value;
},
/**
* @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function (inputProps) {
if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.value;
}
return inputProps.checked;
},
/**
* @param {object} inputProps Props for form component
* @param {SyntheticEvent} event change event to handle
*/
executeOnChange: function (inputProps, event) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.requestChange(event.target.value);
} else if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.requestChange(event.target.checked);
} else if (inputProps.onChange) {
return inputProps.onChange.call(undefined, event);
}
}
};
module.exports = LinkedValueUtils;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 114 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 115 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var React = __webpack_require__(2);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDOMSelect = __webpack_require__(116);
var warning = __webpack_require__(11);
var didWarnInvalidOptionChildren = false;
function flattenChildren(children) {
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
React.Children.forEach(children, function (child) {
if (child == null) {
return;
}
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else if (!didWarnInvalidOptionChildren) {
didWarnInvalidOptionChildren = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
}
});
return content;
}
/**
* Implements an <option> host component that warns when `selected` is set.
*/
var ReactDOMOption = {
mountWrapper: function (inst, props, hostParent) {
// TODO (yungsters): Remove support for `selected` in <option>.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
}
// Look up whether this option is 'selected'
var selectValue = null;
if (hostParent != null) {
var selectParent = hostParent;
if (selectParent._tag === 'optgroup') {
selectParent = selectParent._hostParent;
}
if (selectParent != null && selectParent._tag === 'select') {
selectValue = ReactDOMSelect.getSelectValueContext(selectParent);
}
}
// If the value is null (e.g., no specified value or after initial mount)
// or missing (e.g., for <datalist>), we don't change props.selected
var selected = null;
if (selectValue != null) {
var value;
if (props.value != null) {
value = props.value + '';
} else {
value = flattenChildren(props.children);
}
selected = false;
if (Array.isArray(selectValue)) {
// multiple
for (var i = 0; i < selectValue.length; i++) {
if ('' + selectValue[i] === value) {
selected = true;
break;
}
}
} else {
selected = '' + selectValue === value;
}
}
inst._wrapperState = { selected: selected };
},
postMountWrapper: function (inst) {
// value="" should make a value attribute (#6219)
var props = inst._currentElement.props;
if (props.value != null) {
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
node.setAttribute('value', props.value);
}
},
getHostProps: function (inst, props) {
var hostProps = _assign({ selected: undefined, children: undefined }, props);
// Read state only from initial mount because <select> updates value
// manually; we need the initial state only for server rendering
if (inst._wrapperState.selected != null) {
hostProps.selected = inst._wrapperState.selected;
}
var content = flattenChildren(props.children);
if (content) {
hostProps.children = content;
}
return hostProps;
}
};
module.exports = ReactDOMOption;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 116 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var LinkedValueUtils = __webpack_require__(113);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactUpdates = __webpack_require__(60);
var warning = __webpack_require__(11);
var didWarnValueLink = false;
var didWarnValueDefaultValue = false;
function updateOptionsIfPendingUpdateAndMounted() {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
this._wrapperState.pendingUpdate = false;
var props = this._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
updateOptions(this, Boolean(props.multiple), value);
}
}
}
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
var valuePropNames = ['value', 'defaultValue'];
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function checkSelectPropTypes(inst, props) {
var owner = inst._currentElement._owner;
LinkedValueUtils.checkPropTypes('select', props, owner);
if (props.valueLink !== undefined && !didWarnValueLink) {
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
didWarnValueLink = true;
}
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
if (props[propName] == null) {
continue;
}
var isArray = Array.isArray(props[propName]);
if (props.multiple && !isArray) {
process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
} else if (!props.multiple && isArray) {
process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
}
}
}
/**
* @param {ReactDOMComponent} inst
* @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
function updateOptions(inst, multiple, propValue) {
var selectedValue, i;
var options = ReactDOMComponentTree.getNodeFromInstance(inst).options;
if (multiple) {
selectedValue = {};
for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
}
}
} else {
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
}
}
if (options.length) {
options[0].selected = true;
}
}
}
/**
* Implements a <select> host component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* stringable. If `multiple` is true, the prop must be an array of stringables.
*
* If `value` is not supplied (or null/undefined), user actions that change the
* selected option will trigger updates to the rendered options.
*
* If it is supplied (and not null/undefined), the rendered options will not
* update in response to user actions. Instead, the `value` prop must change in
* order for the rendered options to update.
*
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
var ReactDOMSelect = {
getHostProps: function (inst, props) {
return _assign({}, props, {
onChange: inst._wrapperState.onChange,
value: undefined
});
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
checkSelectPropTypes(inst, props);
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
listeners: null,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple)
};
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
didWarnValueDefaultValue = true;
}
},
getSelectValueContext: function (inst) {
// ReactDOMOption looks at this initial value so the initial generated
// markup has correct `selected` attributes
return inst._wrapperState.initialValue;
},
postUpdateWrapper: function (inst) {
var props = inst._currentElement.props;
// After the initial mount, we control selected-ness manually so don't pass
// this value down
inst._wrapperState.initialValue = undefined;
var wasMultiple = inst._wrapperState.wasMultiple;
inst._wrapperState.wasMultiple = Boolean(props.multiple);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
inst._wrapperState.pendingUpdate = false;
updateOptions(inst, Boolean(props.multiple), value);
} else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
if (props.defaultValue != null) {
updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
if (this._rootNodeID) {
this._wrapperState.pendingUpdate = true;
}
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
module.exports = ReactDOMSelect;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 117 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var LinkedValueUtils = __webpack_require__(113);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactUpdates = __webpack_require__(60);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var didWarnValueLink = false;
var didWarnValDefaultVal = false;
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMTextarea.updateWrapper(this);
}
}
/**
* Implements a <textarea> host component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = {
getHostProps: function (inst, props) {
!(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated. We could add a check in setTextContent
// to only set the value if/when the value differs from the node value (which would
// completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution.
// The value can be a boolean or object so that's why it's forced to be a string.
var hostProps = _assign({}, props, {
value: undefined,
defaultValue: undefined,
children: '' + inst._wrapperState.initialValue,
onChange: inst._wrapperState.onChange
});
return hostProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
if (props.valueLink !== undefined && !didWarnValueLink) {
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0;
didWarnValueLink = true;
}
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
didWarnValDefaultVal = true;
}
}
var value = LinkedValueUtils.getValue(props);
var initialValue = value;
// Only bother fetching default value if we're going to use it
if (value == null) {
var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = props.children;
if (children != null) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0;
}
!(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0;
if (Array.isArray(children)) {
!(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0;
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
initialValue = defaultValue;
}
inst._wrapperState = {
initialValue: '' + initialValue,
listeners: null,
onChange: _handleChange.bind(inst)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
var newValue = '' + value;
// To avoid side effects (such as losing text selection), only set value if changed
if (newValue !== node.value) {
node.value = newValue;
}
if (props.defaultValue == null) {
node.defaultValue = newValue;
}
}
if (props.defaultValue != null) {
node.defaultValue = props.defaultValue;
}
},
postMountWrapper: function (inst) {
// This is in postMount because we need access to the DOM node, which is not
// available until after the component has mounted.
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
var textContent = node.textContent;
// Only set node.value if textContent is equal to the expected
// initial value. In IE10/IE11 there is a bug where the placeholder attribute
// will populate textContent as well.
// https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
if (textContent === inst._wrapperState.initialValue) {
node.value = textContent;
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
}
module.exports = ReactDOMTextarea;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactComponentEnvironment = __webpack_require__(119);
var ReactInstanceMap = __webpack_require__(120);
var ReactInstrumentation = __webpack_require__(66);
var ReactCurrentOwner = __webpack_require__(10);
var ReactReconciler = __webpack_require__(63);
var ReactChildReconciler = __webpack_require__(121);
var emptyFunction = __webpack_require__(12);
var flattenChildren = __webpack_require__(136);
var invariant = __webpack_require__(8);
/**
* Make an update for markup to be rendered and inserted at a supplied index.
*
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function makeInsertMarkup(markup, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: 'INSERT_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: toIndex,
afterNode: afterNode
};
}
/**
* Make an update for moving an existing element to another index.
*
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function makeMove(child, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: 'MOVE_EXISTING',
content: null,
fromIndex: child._mountIndex,
fromNode: ReactReconciler.getHostNode(child),
toIndex: toIndex,
afterNode: afterNode
};
}
/**
* Make an update for removing an element at an index.
*
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function makeRemove(child, node) {
// NOTE: Null values reduce hidden classes.
return {
type: 'REMOVE_NODE',
content: null,
fromIndex: child._mountIndex,
fromNode: node,
toIndex: null,
afterNode: null
};
}
/**
* Make an update for setting the markup of a node.
*
* @param {string} markup Markup that renders into an element.
* @private
*/
function makeSetMarkup(markup) {
// NOTE: Null values reduce hidden classes.
return {
type: 'SET_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
}
/**
* Make an update for setting the text content.
*
* @param {string} textContent Text content to set.
* @private
*/
function makeTextContent(textContent) {
// NOTE: Null values reduce hidden classes.
return {
type: 'TEXT_CONTENT',
content: textContent,
fromIndex: null,
fromNode: null,
toIndex: null,
afterNode: null
};
}
/**
* Push an update, if any, onto the queue. Creates a new queue if none is
* passed and always returns the queue. Mutative.
*/
function enqueue(queue, update) {
if (update) {
queue = queue || [];
queue.push(update);
}
return queue;
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue(inst, updateQueue) {
ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
}
var setChildrenForInstrumentation = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
var getDebugID = function (inst) {
if (!inst._debugID) {
// Check for ART-like instances. TODO: This is silly/gross.
var internal;
if (internal = ReactInstanceMap.get(inst)) {
inst = internal;
}
}
return inst._debugID;
};
setChildrenForInstrumentation = function (children) {
var debugID = getDebugID(this);
// TODO: React Native empty components are also multichild.
// This means they still get into this method but don't have _debugID.
if (debugID !== 0) {
ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
return children[key]._debugID;
}) : []);
}
};
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
var selfDebugID = getDebugID(this);
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
} finally {
ReactCurrentOwner.current = null;
}
}
}
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
var nextChildren;
var selfDebugID = 0;
if (process.env.NODE_ENV !== 'production') {
selfDebugID = getDebugID(this);
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
} finally {
ReactCurrentOwner.current = null;
}
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
return nextChildren;
}
}
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
return nextChildren;
},
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function (nestedChildren, transaction, context) {
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
var selfDebugID = 0;
if (process.env.NODE_ENV !== 'production') {
selfDebugID = getDebugID(this);
}
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
child._mountIndex = index++;
mountImages.push(mountImage);
}
}
if (process.env.NODE_ENV !== 'production') {
setChildrenForInstrumentation.call(this, children);
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function (nextContent) {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren, false);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
}
}
// Set new text content.
var updates = [makeTextContent(nextContent)];
processQueue(this, updates);
},
/**
* Replaces any rendered children with a markup string.
*
* @param {string} nextMarkup String of markup.
* @internal
*/
updateMarkup: function (nextMarkup) {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren, false);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
}
}
var updates = [makeSetMarkup(nextMarkup)];
processQueue(this, updates);
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function (nextNestedChildrenElements, transaction, context) {
// Hook used by React ART
this._updateChildren(nextNestedChildrenElements, transaction, context);
},
/**
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
var removedNodes = {};
var mountImages = [];
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
if (!nextChildren && !prevChildren) {
return;
}
var updates = null;
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var nextIndex = 0;
var lastIndex = 0;
// `nextMountIndex` will increment for each newly mounted child.
var nextMountIndex = 0;
var lastPlacedNode = null;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
// The `removedNodes` loop below will actually remove the child.
}
// The child must be instantiated before it's mounted.
updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
nextMountIndex++;
}
nextIndex++;
lastPlacedNode = ReactReconciler.getHostNode(nextChild);
}
// Remove children that are no longer present.
for (name in removedNodes) {
if (removedNodes.hasOwnProperty(name)) {
updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
}
}
if (updates) {
processQueue(this, updates);
}
this._renderedChildren = nextChildren;
if (process.env.NODE_ENV !== 'production') {
setChildrenForInstrumentation.call(this, nextChildren);
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted. It does not actually perform any
* backend operations.
*
* @internal
*/
unmountChildren: function (safely) {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren, safely);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function (child, afterNode, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
return makeMove(child, afterNode, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function (child, afterNode, mountImage) {
return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function (child, node) {
return makeRemove(child, node);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
child._mountIndex = index;
return this.createChild(child, afterNode, mountImage);
},
/**
* Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @private
*/
_unmountChild: function (child, node) {
var update = this.removeChild(child, node);
child._mountIndex = null;
return update;
}
}
};
module.exports = ReactMultiChild;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 119 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
var injected = false;
var ReactComponentEnvironment = {
/**
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
replaceNodeWithMarkup: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
* later move into MultiChildComponents.
*/
processChildrenUpdates: null,
injection: {
injectEnvironment: function (environment) {
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0;
ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
};
module.exports = ReactComponentEnvironment;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 120 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*/
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
var ReactInstanceMap = {
/**
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
remove: function (key) {
key._reactInternalInstance = undefined;
},
get: function (key) {
return key._reactInternalInstance;
},
has: function (key) {
return key._reactInternalInstance !== undefined;
},
set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
/***/ }),
/* 121 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var ReactReconciler = __webpack_require__(63);
var instantiateReactComponent = __webpack_require__(122);
var KeyEscapeUtils = __webpack_require__(132);
var shouldUpdateReactComponent = __webpack_require__(128);
var traverseAllChildren = __webpack_require__(133);
var warning = __webpack_require__(11);
var ReactComponentTreeHook;
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
// Temporary hack.
// Inline requires don't work well with Jest:
// https://github.com/facebook/react/issues/7240
// Remove the inline requires when we don't need them anymore:
// https://github.com/facebook/react/pull/7178
ReactComponentTreeHook = __webpack_require__(26);
}
function instantiateChild(childInstances, child, name, selfDebugID) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = __webpack_require__(26);
}
if (!keyUnique) {
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
}
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child, true);
}
}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
* children. Its output is suitable for passing it onto ReactMultiChild which
* does diffed reordering and insertion.
*/
var ReactChildReconciler = {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildNodes Nested child maps.
* @return {?object} A set of child instances.
* @internal
*/
instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // 0 in production and for roots
) {
if (nestedChildNodes == null) {
return null;
}
var childInstances = {};
if (process.env.NODE_ENV !== 'production') {
traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
return instantiateChild(childInsts, child, name, selfDebugID);
}, childInstances);
} else {
traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
}
return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID // 0 in production and for roots
) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
if (!nextChildren && !prevChildren) {
return;
}
var name;
var prevChild;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
removedNodes[name] = ReactReconciler.getHostNode(prevChild);
ReactReconciler.unmountComponent(prevChild, false);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextElement, true);
nextChildren[name] = nextChildInstance;
// Creating mount image now ensures refs are resolved in right order
// (see https://github.com/facebook/react/pull/7101 for explanation).
var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID);
mountImages.push(nextChildMountImage);
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
prevChild = prevChildren[name];
removedNodes[name] = ReactReconciler.getHostNode(prevChild);
ReactReconciler.unmountComponent(prevChild, false);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
unmountChildren: function (renderedChildren, safely) {
for (var name in renderedChildren) {
if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild, safely);
}
}
}
};
module.exports = ReactChildReconciler;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 122 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var ReactCompositeComponent = __webpack_require__(123);
var ReactEmptyComponent = __webpack_require__(129);
var ReactHostComponent = __webpack_require__(130);
var getNextDebugID = __webpack_require__(131);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
// To avoid a cyclic dependency, we create the final class in this module
var ReactCompositeComponentWrapper = function (element) {
this.construct(element);
};
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Check if the type reference is a known internal type. I.e. not a user
* provided composite type.
*
* @param {function} type
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
* @param {boolean} shouldHaveDebugID
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node, shouldHaveDebugID) {
var instance;
if (node === null || node === false) {
instance = ReactEmptyComponent.create(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;
var type = element.type;
if (typeof type !== 'function' && typeof type !== 'string') {
var info = '';
if (process.env.NODE_ENV !== 'production') {
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
}
}
info += getDeclarationErrorAddendum(element._owner);
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
}
// Special case string values
if (typeof element.type === 'string') {
instance = ReactHostComponent.createInternalComponent(element);
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
// representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
// We renamed this. Allow the old name for compat. :(
if (!instance.getHostNode) {
instance.getHostNode = instance.getNativeNode;
}
} else {
instance = new ReactCompositeComponentWrapper(element);
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactHostComponent.createInstanceForText(node);
} else {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
}
// These two fields are used by the DOM and ART diffing algorithms
// respectively. Instead of using expandos on components, we should be
// storing the state needed by the diffing algorithms elsewhere.
instance._mountIndex = 0;
instance._mountImage = null;
if (process.env.NODE_ENV !== 'production') {
instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
if (process.env.NODE_ENV !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
}
return instance;
}
_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, {
_instantiateReactComponent: instantiateReactComponent
});
module.exports = instantiateReactComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var React = __webpack_require__(2);
var ReactComponentEnvironment = __webpack_require__(119);
var ReactCurrentOwner = __webpack_require__(10);
var ReactErrorUtils = __webpack_require__(49);
var ReactInstanceMap = __webpack_require__(120);
var ReactInstrumentation = __webpack_require__(66);
var ReactNodeTypes = __webpack_require__(124);
var ReactReconciler = __webpack_require__(63);
if (process.env.NODE_ENV !== 'production') {
var checkReactTypeSpec = __webpack_require__(125);
}
var emptyObject = __webpack_require__(20);
var invariant = __webpack_require__(8);
var shallowEqual = __webpack_require__(127);
var shouldUpdateReactComponent = __webpack_require__(128);
var warning = __webpack_require__(11);
var CompositeTypes = {
ImpureClass: 0,
PureClass: 1,
StatelessFunctional: 2
};
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
var element = Component(this.props, this.context, this.updater);
warnIfInvalidElement(Component, element);
return element;
};
function warnIfInvalidElement(Component, element) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
}
}
function shouldConstruct(Component) {
return !!(Component.prototype && Component.prototype.isReactComponent);
}
function isPureComponent(Component) {
return !!(Component.prototype && Component.prototype.isPureReactComponent);
}
// Separated into a function to contain deoptimizations caused by try/finally.
function measureLifeCyclePerf(fn, debugID, timerType) {
if (debugID === 0) {
// Top-level wrappers (see ReactMount) and empty components (see
// ReactDOMEmptyComponent) are invisible to hooks and devtools.
// Both are implementation details that should go away in the future.
return fn();
}
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
try {
return fn();
} finally {
ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
}
}
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponent = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function (element) {
this._currentElement = element;
this._rootNodeID = 0;
this._compositeType = null;
this._instance = null;
this._hostParent = null;
this._hostContainerInfo = null;
// See ReactUpdateQueue
this._updateBatchNumber = null;
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedNodeType = null;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
// ComponentWillUnmount shall only be called once
this._calledComponentWillUnmount = false;
if (process.env.NODE_ENV !== 'production') {
this._warnedAboutRefsInRender = false;
}
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {?object} hostParent
* @param {?object} hostContainerInfo
* @param {?object} context
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
var _this = this;
this._context = context;
this._mountOrder = nextMountID++;
this._hostParent = hostParent;
this._hostContainerInfo = hostContainerInfo;
var publicProps = this._currentElement.props;
var publicContext = this._processContext(context);
var Component = this._currentElement.type;
var updateQueue = transaction.getUpdateQueue();
// Initialize the public class
var doConstruct = shouldConstruct(Component);
var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
var renderedElement;
// Support functional components
if (!doConstruct && (inst == null || inst.render == null)) {
renderedElement = inst;
warnIfInvalidElement(Component, renderedElement);
!(inst === null || inst === false || React.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
inst = new StatelessComponent(Component);
this._compositeType = CompositeTypes.StatelessFunctional;
} else {
if (isPureComponent(Component)) {
this._compositeType = CompositeTypes.PureClass;
} else {
this._compositeType = CompositeTypes.ImpureClass;
}
}
if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
}
var propsMutated = inst.props !== publicProps;
var componentName = Component.displayName || Component.name || 'Component';
process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
inst.updater = updateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if (process.env.NODE_ENV !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
var markup;
if (inst.unstable_handleError) {
markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
} else {
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
}
if (inst.componentDidMount) {
if (process.env.NODE_ENV !== 'production') {
transaction.getReactMountReady().enqueue(function () {
measureLifeCyclePerf(function () {
return inst.componentDidMount();
}, _this._debugID, 'componentDidMount');
});
} else {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
}
return markup;
},
_constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
}
},
_constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
var Component = this._currentElement.type;
if (doConstruct) {
if (process.env.NODE_ENV !== 'production') {
return measureLifeCyclePerf(function () {
return new Component(publicProps, publicContext, updateQueue);
}, this._debugID, 'ctor');
} else {
return new Component(publicProps, publicContext, updateQueue);
}
}
// This can still be an instance in case of factory components
// but we'll count this as time spent rendering as the more common case.
if (process.env.NODE_ENV !== 'production') {
return measureLifeCyclePerf(function () {
return Component(publicProps, publicContext, updateQueue);
}, this._debugID, 'render');
} else {
return Component(publicProps, publicContext, updateQueue);
}
},
performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
var markup;
var checkpoint = transaction.checkpoint();
try {
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
} catch (e) {
// Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
transaction.rollback(checkpoint);
this._instance.unstable_handleError(e);
if (this._pendingStateQueue) {
this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
}
checkpoint = transaction.checkpoint();
this._renderedComponent.unmountComponent(true);
transaction.rollback(checkpoint);
// Try again - we've informed the component about the error, so they can render an error message this time.
// If this throws again, the error will bubble up (and can be caught by a higher error boundary).
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
}
return markup;
},
performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
var inst = this._instance;
var debugID = 0;
if (process.env.NODE_ENV !== 'production') {
debugID = this._debugID;
}
if (inst.componentWillMount) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillMount();
}, debugID, 'componentWillMount');
} else {
inst.componentWillMount();
}
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}
var nodeType = ReactNodeTypes.getType(renderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;
var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
if (process.env.NODE_ENV !== 'production') {
if (debugID !== 0) {
var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
}
}
return markup;
},
getHostNode: function () {
return ReactReconciler.getHostNode(this._renderedComponent);
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (safely) {
if (!this._renderedComponent) {
return;
}
var inst = this._instance;
if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
inst._calledComponentWillUnmount = true;
if (safely) {
var name = this.getName() + '.componentWillUnmount()';
ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
} else {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillUnmount();
}, this._debugID, 'componentWillUnmount');
} else {
inst.componentWillUnmount();
}
}
}
if (this._renderedComponent) {
ReactReconciler.unmountComponent(this._renderedComponent, safely);
this._renderedNodeType = null;
this._renderedComponent = null;
this._instance = null;
}
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
// it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = 0;
this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function (context) {
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
var maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function (context) {
var maskedContext = this._maskContext(context);
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.contextTypes) {
this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
var childContext;
if (inst.getChildContext) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginProcessingChildContext();
try {
childContext = inst.getChildContext();
} finally {
ReactInstrumentation.debugTool.onEndProcessingChildContext();
}
} else {
childContext = inst.getChildContext();
}
}
if (childContext) {
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
if (process.env.NODE_ENV !== 'production') {
this._checkContextTypes(Component.childContextTypes, childContext, 'child context');
}
for (var name in childContext) {
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
}
return _assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Assert that the context types are valid
*
* @param {object} typeSpecs Map of context field to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkContextTypes: function (typeSpecs, values, location) {
if (process.env.NODE_ENV !== 'production') {
checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
}
},
receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
} else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
} else {
this._updateBatchNumber = null;
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0;
var willReceive = false;
var nextContext;
// Determine if the context has changed or not
if (this._context === nextUnmaskedContext) {
nextContext = inst.context;
} else {
nextContext = this._processContext(nextUnmaskedContext);
willReceive = true;
}
var prevProps = prevParentElement.props;
var nextProps = nextParentElement.props;
// Not a simple state update but a props update
if (prevParentElement !== nextParentElement) {
willReceive = true;
}
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (willReceive && inst.componentWillReceiveProps) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillReceiveProps(nextProps, nextContext);
}, this._debugID, 'componentWillReceiveProps');
} else {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate = true;
if (!this._pendingForceUpdate) {
if (inst.shouldComponentUpdate) {
if (process.env.NODE_ENV !== 'production') {
shouldUpdate = measureLifeCyclePerf(function () {
return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
}, this._debugID, 'shouldComponentUpdate');
} else {
shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
}
} else {
if (this._compositeType === CompositeTypes.PureClass) {
shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
}
}
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
}
this._updateBatchNumber = null;
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = _assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
_assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var _this2 = this;
var inst = this._instance;
var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
var prevProps;
var prevState;
var prevContext;
if (hasComponentDidUpdate) {
prevProps = inst.props;
prevState = inst.state;
prevContext = inst.context;
}
if (inst.componentWillUpdate) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillUpdate(nextProps, nextState, nextContext);
}, this._debugID, 'componentWillUpdate');
} else {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (hasComponentDidUpdate) {
if (process.env.NODE_ENV !== 'production') {
transaction.getReactMountReady().enqueue(function () {
measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
});
} else {
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
var debugID = 0;
if (process.env.NODE_ENV !== 'production') {
debugID = this._debugID;
}
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
ReactReconciler.unmountComponent(prevComponentInstance, false);
var nodeType = ReactNodeTypes.getType(nextRenderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;
var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
if (process.env.NODE_ENV !== 'production') {
if (debugID !== 0) {
var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
}
}
this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
}
},
/**
* Overridden in shallow rendering.
*
* @protected
*/
_replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedElement;
if (process.env.NODE_ENV !== 'production') {
renderedElement = measureLifeCyclePerf(function () {
return inst.render();
}, this._debugID, 'render');
} else {
renderedElement = inst.render();
}
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (renderedElement === undefined && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedElement = null;
}
}
return renderedElement;
},
/**
* @private
*/
_renderValidatedComponent: function () {
var renderedElement;
if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
ReactCurrentOwner.current = this;
try {
renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactCurrentOwner.current = null;
}
} else {
renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0;
return renderedElement;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
var publicComponentInstance = component.getPublicInstance();
if (process.env.NODE_ENV !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function () {
var inst = this._instance;
if (this._compositeType === CompositeTypes.StatelessFunctional) {
return null;
}
return inst;
},
// Stub
_instantiateReactComponent: null
};
module.exports = ReactCompositeComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 124 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var React = __webpack_require__(2);
var invariant = __webpack_require__(8);
var ReactNodeTypes = {
HOST: 0,
COMPOSITE: 1,
EMPTY: 2,
getType: function (node) {
if (node === null || node === false) {
return ReactNodeTypes.EMPTY;
} else if (React.isValidElement(node)) {
if (typeof node.type === 'function') {
return ReactNodeTypes.COMPOSITE;
} else {
return ReactNodeTypes.HOST;
}
}
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
}
};
module.exports = ReactNodeTypes;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 125 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactPropTypeLocationNames = __webpack_require__(126);
var ReactPropTypesSecret = __webpack_require__(114);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactComponentTreeHook;
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
// Temporary hack.
// Inline requires don't work well with Jest:
// https://github.com/facebook/react/issues/7240
// Remove the inline requires when we don't need them anymore:
// https://github.com/facebook/react/pull/7178
ReactComponentTreeHook = __webpack_require__(26);
}
var loggedTypeFailures = {};
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?object} element The React element that is being type-checked
* @param {?number} debugID The React component instance that is being type-checked
* @private
*/
function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var componentStackInfo = '';
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = __webpack_require__(26);
}
if (debugID !== null) {
componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
} else if (element !== null) {
componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
}
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
}
}
}
}
module.exports = checkReactTypeSpec;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 126 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var ReactPropTypeLocationNames = {};
if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 127 */
/***/ (function(module, exports) {
/**
* 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.
*
* @typechecks
*
*/
/*eslint-disable no-self-compare */
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ }),
/* 128 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
* instance. Both arguments are elements. This ensures that this logic can
* operate on stateless trees without any backing instance.
*
* @param {?object} prevElement
* @param {?object} nextElement
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
if (prevEmpty || nextEmpty) {
return prevEmpty === nextEmpty;
}
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
}
module.exports = shouldUpdateReactComponent;
/***/ }),
/* 129 */
/***/ (function(module, exports) {
/**
* Copyright 2014-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 strict';
var emptyComponentFactory;
var ReactEmptyComponentInjection = {
injectEmptyComponentFactory: function (factory) {
emptyComponentFactory = factory;
}
};
var ReactEmptyComponent = {
create: function (instantiate) {
return emptyComponentFactory(instantiate);
}
};
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;
/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
var genericComponentClass = null;
var textComponentClass = null;
var ReactHostComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
}
};
/**
* Get a host internal component class for a specific tag.
*
* @param {ReactElement} element The element to create.
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
return new genericComponentClass(element);
}
/**
* @param {ReactText} text
* @return {ReactComponent}
*/
function createInstanceForText(text) {
return new textComponentClass(text);
}
/**
* @param {ReactComponent} component
* @return {boolean}
*/
function isTextComponent(component) {
return component instanceof textComponentClass;
}
var ReactHostComponent = {
createInternalComponent: createInternalComponent,
createInstanceForText: createInstanceForText,
isTextComponent: isTextComponent,
injection: ReactHostComponentInjection
};
module.exports = ReactHostComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 131 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var nextDebugID = 1;
function getNextDebugID() {
return nextDebugID++;
}
module.exports = getNextDebugID;
/***/ }),
/* 132 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Escape and wrap key so it is safe to use as a reactid
*
* @param {string} key to be escaped.
* @return {string} the escaped key.
*/
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
/**
* Unescape and unwrap key for human-readable display
*
* @param {string} key to unescape.
* @return {string} the unescaped key.
*/
function unescape(key) {
var unescapeRegex = /(=0|=2)/g;
var unescaperLookup = {
'=0': '=',
'=2': ':'
};
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
return ('' + keySubstring).replace(unescapeRegex, function (match) {
return unescaperLookup[match];
});
}
var KeyEscapeUtils = {
escape: escape,
unescape: unescape
};
module.exports = KeyEscapeUtils;
/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactCurrentOwner = __webpack_require__(10);
var REACT_ELEMENT_TYPE = __webpack_require__(134);
var getIteratorFn = __webpack_require__(135);
var invariant = __webpack_require__(8);
var KeyEscapeUtils = __webpack_require__(132);
var warning = __webpack_require__(11);
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
/**
* This is inlined from ReactElement since this file is shared between
* isomorphic and renderers. We could extract this to a
*
*/
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var didWarnAboutMaps = false;
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (component && typeof component === 'object' && component.key != null) {
// Explicit key
return KeyEscapeUtils.escape(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' ||
// The following is inlined from ReactElement. This means we can optimize
// some checks. React Fiber also inlines this logic for similar purposes.
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
var iterator = iteratorFn.call(children);
var step;
if (iteratorFn !== children.entries) {
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
if (process.env.NODE_ENV !== 'production') {
var mapsAsChildrenAddendum = '';
if (ReactCurrentOwner.current) {
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
if (mapsAsChildrenOwnerName) {
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
}
}
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
child = entry[1];
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
if (children._isReactElement) {
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
}
}
var childrenString = String(children);
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 134 */
/***/ (function(module, exports) {
/**
* Copyright 2014-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 strict';
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
module.exports = REACT_ELEMENT_TYPE;
/***/ }),
/* 135 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var KeyEscapeUtils = __webpack_require__(132);
var traverseAllChildren = __webpack_require__(133);
var warning = __webpack_require__(11);
var ReactComponentTreeHook;
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
// Temporary hack.
// Inline requires don't work well with Jest:
// https://github.com/facebook/react/issues/7240
// Remove the inline requires when we don't need them anymore:
// https://github.com/facebook/react/pull/7178
ReactComponentTreeHook = __webpack_require__(26);
}
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
* @param {number=} selfDebugID Optional debugID of the current internal instance.
*/
function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
// We found a component instance.
if (traverseContext && typeof traverseContext === 'object') {
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
if (!ReactComponentTreeHook) {
ReactComponentTreeHook = __webpack_require__(26);
}
if (!keyUnique) {
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
}
}
if (keyUnique && child != null) {
result[name] = child;
}
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children, selfDebugID) {
if (children == null) {
return children;
}
var result = {};
if (process.env.NODE_ENV !== 'production') {
traverseAllChildren(children, function (traverseContext, child, name) {
return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID);
}, result);
} else {
traverseAllChildren(children, flattenSingleChildIntoContext, result);
}
return result;
}
module.exports = flattenChildren;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 137 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-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 strict';
var _assign = __webpack_require__(4);
var PooledClass = __webpack_require__(54);
var Transaction = __webpack_require__(72);
var ReactInstrumentation = __webpack_require__(66);
var ReactServerUpdateQueue = __webpack_require__(138);
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [];
if (process.env.NODE_ENV !== 'production') {
TRANSACTION_WRAPPERS.push({
initialize: ReactInstrumentation.debugTool.onBeginFlush,
close: ReactInstrumentation.debugTool.onEndFlush
});
}
var noopCallbackQueue = {
enqueue: function () {}
};
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.useCreateElement = false;
this.updateQueue = new ReactServerUpdateQueue(this);
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap procedures.
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return noopCallbackQueue;
},
/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return this.updateQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {},
checkpoint: function () {},
rollback: function () {}
};
_assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2015-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 strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ReactUpdateQueue = __webpack_require__(139);
var warning = __webpack_require__(11);
function warnNoop(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
var constructor = publicInstance.constructor;
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
}
}
/**
* This is the update queue used for server rendering.
* It delegates to ReactUpdateQueue while server rendering is in progress and
* switches to ReactNoopUpdateQueue after the transaction has completed.
* @class ReactServerUpdateQueue
* @param {Transaction} transaction
*/
var ReactServerUpdateQueue = function () {
function ReactServerUpdateQueue(transaction) {
_classCallCheck(this, ReactServerUpdateQueue);
this.transaction = transaction;
}
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
return false;
};
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
if (this.transaction.isInTransaction()) {
ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
}
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
if (this.transaction.isInTransaction()) {
ReactUpdateQueue.enqueueForceUpdate(publicInstance);
} else {
warnNoop(publicInstance, 'forceUpdate');
}
};
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object|function} completeState Next state.
* @internal
*/
ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
if (this.transaction.isInTransaction()) {
ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
} else {
warnNoop(publicInstance, 'replaceState');
}
};
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object|function} partialState Next partial state to be merged with state.
* @internal
*/
ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
if (this.transaction.isInTransaction()) {
ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
} else {
warnNoop(publicInstance, 'setState');
}
};
return ReactServerUpdateQueue;
}();
module.exports = ReactServerUpdateQueue;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 139 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2015-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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactCurrentOwner = __webpack_require__(10);
var ReactInstanceMap = __webpack_require__(120);
var ReactInstrumentation = __webpack_require__(66);
var ReactUpdates = __webpack_require__(60);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
function enqueueUpdate(internalInstance) {
ReactUpdates.enqueueUpdate(internalInstance);
}
function formatUnexpectedArgument(arg) {
var type = typeof arg;
if (type !== 'object') {
return type;
}
var displayName = arg.constructor && arg.constructor.name || type;
var keys = Object.keys(arg);
if (keys.length > 0 && keys.length < 20) {
return displayName + ' (keys: ' + keys.join(', ') + ')';
}
return displayName;
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
if (process.env.NODE_ENV !== 'production') {
var ctor = publicInstance.constructor;
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
}
return null;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
}
return internalInstance;
}
/**
* ReactUpdateQueue allows for state updates to be scheduled into a later
* reconciliation step.
*/
var ReactUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
var internalInstance = ReactInstanceMap.get(publicInstance);
if (internalInstance) {
// During componentWillMount and render this will still be null but after
// that will always render to something. At least for now. So we can use
// this hack.
return !!internalInstance._renderedComponent;
} else {
return false;
}
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @param {string} callerName Name of the calling function in the public API.
* @internal
*/
enqueueCallback: function (publicInstance, callback, callerName) {
ReactUpdateQueue.validateCallback(callback, callerName);
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
// instance. Since we want to make it a no-op instead, we mirror the same
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
if (!internalInstance) {
return null;
}
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
// TODO: The callback here is ignored when setState is called from
// componentWillMount. Either fix it or disallow doing so completely in
// favor of getInitialState. Alternatively, we can disallow
// componentWillMount during server-side rendering.
enqueueUpdate(internalInstance);
},
enqueueCallbackInternal: function (internalInstance, callback) {
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
enqueueUpdate(internalInstance);
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
}
internalInstance._pendingForceUpdate = true;
enqueueUpdate(internalInstance);
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState, callback) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
// Future-proof 15.5
if (callback !== undefined && callback !== null) {
ReactUpdateQueue.validateCallback(callback, 'replaceState');
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
}
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onSetState();
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
}
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
},
enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
internalInstance._pendingElement = nextElement;
// TODO: introduce _pendingContext instead of setting it directly.
internalInstance._context = nextContext;
enqueueUpdate(internalInstance);
},
validateCallback: function (callback, callerName) {
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
}
};
module.exports = ReactUpdateQueue;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 140 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2015-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 strict';
var _assign = __webpack_require__(4);
var emptyFunction = __webpack_require__(12);
var warning = __webpack_require__(11);
var validateDOMNesting = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
// This validation code was written based on the HTML5 parsing spec:
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
//
// Note: this does not catch all invalid nesting, nor does it try to (as it's
// not clear what practical benefit doing so provides); instead, we warn only
// for cases where the parser will give a parse tree differing from what React
// intended. For example, <b><div></div></b> is invalid but we don't warn
// because it still parses correctly; we do warn for other cases like nested
// <p> tags where the beginning of the second element implicitly closes the
// first, causing a confusing mess.
// https://html.spec.whatwg.org/multipage/syntax.html#special
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
// TODO: Distinguish by namespace here -- for <title>, including it here
// errs on the side of fewer warnings
'foreignObject', 'desc', 'title'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
var buttonScopeTags = inScopeTags.concat(['button']);
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
var emptyAncestorInfo = {
current: null,
formTag: null,
aTagInScope: null,
buttonTagInScope: null,
nobrTagInScope: null,
pTagInButtonScope: null,
listItemTagAutoclosing: null,
dlItemTagAutoclosing: null
};
var updatedAncestorInfo = function (oldInfo, tag, instance) {
var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
var info = { tag: tag, instance: instance };
if (inScopeTags.indexOf(tag) !== -1) {
ancestorInfo.aTagInScope = null;
ancestorInfo.buttonTagInScope = null;
ancestorInfo.nobrTagInScope = null;
}
if (buttonScopeTags.indexOf(tag) !== -1) {
ancestorInfo.pTagInButtonScope = null;
}
// See rules for 'li', 'dd', 'dt' start tags in
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
ancestorInfo.listItemTagAutoclosing = null;
ancestorInfo.dlItemTagAutoclosing = null;
}
ancestorInfo.current = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
}
if (tag === 'a') {
ancestorInfo.aTagInScope = info;
}
if (tag === 'button') {
ancestorInfo.buttonTagInScope = info;
}
if (tag === 'nobr') {
ancestorInfo.nobrTagInScope = info;
}
if (tag === 'p') {
ancestorInfo.pTagInButtonScope = info;
}
if (tag === 'li') {
ancestorInfo.listItemTagAutoclosing = info;
}
if (tag === 'dd' || tag === 'dt') {
ancestorInfo.dlItemTagAutoclosing = info;
}
return ancestorInfo;
};
/**
* Returns whether
*/
var isTagValidWithParent = function (tag, parentTag) {
// First, let's check if we're in an unusual parsing mode...
switch (parentTag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
// but
case 'option':
return tag === '#text';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
// No special behavior since these rules fall back to "in body" mode for
// all except special table nodes which cause bad parsing behavior anyway.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
case 'tr':
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
case 'tbody':
case 'thead':
case 'tfoot':
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
case 'colgroup':
return tag === 'col' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
case 'table':
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
case 'head':
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
case 'html':
return tag === 'head' || tag === 'body';
case '#document':
return tag === 'html';
}
// Probably in the "in body" parsing mode, so we outlaw only tag combos
// where the parsing rules cause implicit opens or closes to be added.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
switch (tag) {
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
case 'rp':
case 'rt':
return impliedEndTags.indexOf(parentTag) === -1;
case 'body':
case 'caption':
case 'col':
case 'colgroup':
case 'frame':
case 'head':
case 'html':
case 'tbody':
case 'td':
case 'tfoot':
case 'th':
case 'thead':
case 'tr':
// These tags are only valid with a few parents that have special child
// parsing rules -- if we're down here, then none of those matched and
// so we allow it only if we don't know what the parent is, as all other
// cases are invalid.
return parentTag == null;
}
return true;
};
/**
* Returns whether
*/
var findInvalidAncestorForTag = function (tag, ancestorInfo) {
switch (tag) {
case 'address':
case 'article':
case 'aside':
case 'blockquote':
case 'center':
case 'details':
case 'dialog':
case 'dir':
case 'div':
case 'dl':
case 'fieldset':
case 'figcaption':
case 'figure':
case 'footer':
case 'header':
case 'hgroup':
case 'main':
case 'menu':
case 'nav':
case 'ol':
case 'p':
case 'section':
case 'summary':
case 'ul':
case 'pre':
case 'listing':
case 'table':
case 'hr':
case 'xmp':
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return ancestorInfo.pTagInButtonScope;
case 'form':
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
case 'li':
return ancestorInfo.listItemTagAutoclosing;
case 'dd':
case 'dt':
return ancestorInfo.dlItemTagAutoclosing;
case 'button':
return ancestorInfo.buttonTagInScope;
case 'a':
// Spec says something about storing a list of markers, but it sounds
// equivalent to this check.
return ancestorInfo.aTagInScope;
case 'nobr':
return ancestorInfo.nobrTagInScope;
}
return null;
};
/**
* Given a ReactCompositeComponent instance, return a list of its recursive
* owners, starting at the root and ending with the instance itself.
*/
var findOwnerStack = function (instance) {
if (!instance) {
return [];
}
var stack = [];
do {
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
};
var didWarn = {};
validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.current;
var parentTag = parentInfo && parentInfo.tag;
if (childText != null) {
process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
childTag = '#text';
}
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
var problematic = invalidParent || invalidAncestor;
if (problematic) {
var ancestorTag = problematic.tag;
var ancestorInstance = problematic.instance;
var childOwner = childInstance && childInstance._currentElement._owner;
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
var childOwners = findOwnerStack(childOwner);
var ancestorOwners = findOwnerStack(ancestorOwner);
var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
var i;
var deepestCommon = -1;
for (i = 0; i < minStackLen; i++) {
if (childOwners[i] === ancestorOwners[i]) {
deepestCommon = i;
} else {
break;
}
}
var UNKNOWN = '(unknown)';
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ownerInfo = [].concat(
// If the parent and child instances have a common owner ancestor, start
// with that -- otherwise we just start with the parent's owners.
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
// If we're warning about an invalid (non-parent) ancestry, add '...'
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
if (didWarn[warnKey]) {
return;
}
didWarn[warnKey] = true;
var tagDisplayName = childTag;
var whitespaceInfo = '';
if (childTag === '#text') {
if (/\S/.test(childText)) {
tagDisplayName = 'Text nodes';
} else {
tagDisplayName = 'Whitespace text nodes';
whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
}
} else {
tagDisplayName = '<' + childTag + '>';
}
if (invalidParent) {
var info = '';
if (ancestorTag === 'table' && childTag === 'tr') {
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
}
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
}
}
};
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
// For testing
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.current;
var parentTag = parentInfo && parentInfo.tag;
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
};
}
module.exports = validateDOMNesting;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 141 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 2014-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 strict';
var _assign = __webpack_require__(4);
var DOMLazyTree = __webpack_require__(85);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDOMEmptyComponent = function (instantiate) {
// ReactCompositeComponent uses this:
this._currentElement = null;
// ReactDOMComponentTree uses these:
this._hostNode = null;
this._hostParent = null;
this._hostContainerInfo = null;
this._domID = 0;
};
_assign(ReactDOMEmptyComponent.prototype, {
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
var domID = hostContainerInfo._idCounter++;
this._domID = domID;
this._hostParent = hostParent;
this._hostContainerInfo = hostContainerInfo;
var nodeValue = ' react-empty: ' + this._domID + ' ';
if (transaction.useCreateElement) {
var ownerDocument = hostContainerInfo._ownerDocument;
var node = ownerDocument.createComment(nodeValue);
ReactDOMComponentTree.precacheNode(this, node);
return DOMLazyTree(node);
} else {
if (transaction.renderToStaticMarkup) {
// Normally we'd insert a comment node, but since this is a situation
// where React won't take over (static pages), we can simply return
// nothing.
return '';
}
return '<!--' + nodeValue + '-->';
}
},
receiveComponent: function () {},
getHostNode: function () {
return ReactDOMComponentTree.getNodeFromInstance(this);
},
unmountComponent: function () {
ReactDOMComponentTree.uncacheNode(this);
}
});
module.exports = ReactDOMEmptyComponent;
/***/ }),
/* 142 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2015-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 strict';
var _prodInvariant = __webpack_require__(39);
var invariant = __webpack_require__(8);
/**
* Return the lowest common ancestor of A and B, or null if they are in
* different trees.
*/
function getLowestCommonAncestor(instA, instB) {
!('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
!('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
var depthA = 0;
for (var tempA = instA; tempA; tempA = tempA._hostParent) {
depthA++;
}
var depthB = 0;
for (var tempB = instB; tempB; tempB = tempB._hostParent) {
depthB++;
}
// If A is deeper, crawl up.
while (depthA - depthB > 0) {
instA = instA._hostParent;
depthA--;
}
// If B is deeper, crawl up.
while (depthB - depthA > 0) {
instB = instB._hostParent;
depthB--;
}
// Walk in lockstep until we find a match.
var depth = depthA;
while (depth--) {
if (instA === instB) {
return instA;
}
instA = instA._hostParent;
instB = instB._hostParent;
}
return null;
}
/**
* Return if A is an ancestor of B.
*/
function isAncestor(instA, instB) {
!('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
!('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
while (instB) {
if (instB === instA) {
return true;
}
instB = instB._hostParent;
}
return false;
}
/**
* Return the parent instance of the passed-in instance.
*/
function getParentInstance(inst) {
!('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
return inst._hostParent;
}
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*/
function traverseTwoPhase(inst, fn, arg) {
var path = [];
while (inst) {
path.push(inst);
inst = inst._hostParent;
}
var i;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
for (i = 0; i < path.length; i++) {
fn(path[i], 'bubbled', arg);
}
}
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* Does not invoke the callback on the nearest common ancestor because nothing
* "entered" or "left" that element.
*/
function traverseEnterLeave(from, to, fn, argFrom, argTo) {
var common = from && to ? getLowestCommonAncestor(from, to) : null;
var pathFrom = [];
while (from && from !== common) {
pathFrom.push(from);
from = from._hostParent;
}
var pathTo = [];
while (to && to !== common) {
pathTo.push(to);
to = to._hostParent;
}
var i;
for (i = 0; i < pathFrom.length; i++) {
fn(pathFrom[i], 'bubbled', argFrom);
}
for (i = pathTo.length; i-- > 0;) {
fn(pathTo[i], 'captured', argTo);
}
}
module.exports = {
isAncestor: isAncestor,
getLowestCommonAncestor: getLowestCommonAncestor,
getParentInstance: getParentInstance,
traverseTwoPhase: traverseTwoPhase,
traverseEnterLeave: traverseEnterLeave
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 143 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39),
_assign = __webpack_require__(4);
var DOMChildrenOperations = __webpack_require__(84);
var DOMLazyTree = __webpack_require__(85);
var ReactDOMComponentTree = __webpack_require__(38);
var escapeTextContentForBrowser = __webpack_require__(90);
var invariant = __webpack_require__(8);
var validateDOMNesting = __webpack_require__(140);
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings between comment nodes so that they
* can undergo the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactDOMTextComponent
* @extends ReactComponent
* @internal
*/
var ReactDOMTextComponent = function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// ReactDOMComponentTree uses these:
this._hostNode = null;
this._hostParent = null;
// Properties
this._domID = 0;
this._mountIndex = 0;
this._closingComment = null;
this._commentNodes = null;
};
_assign(ReactDOMTextComponent.prototype, {
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
if (process.env.NODE_ENV !== 'production') {
var parentInfo;
if (hostParent != null) {
parentInfo = hostParent._ancestorInfo;
} else if (hostContainerInfo != null) {
parentInfo = hostContainerInfo._ancestorInfo;
}
if (parentInfo) {
// parentInfo should always be present except for the top-level
// component when server rendering
validateDOMNesting(null, this._stringText, this, parentInfo);
}
}
var domID = hostContainerInfo._idCounter++;
var openingValue = ' react-text: ' + domID + ' ';
var closingValue = ' /react-text ';
this._domID = domID;
this._hostParent = hostParent;
if (transaction.useCreateElement) {
var ownerDocument = hostContainerInfo._ownerDocument;
var openingComment = ownerDocument.createComment(openingValue);
var closingComment = ownerDocument.createComment(closingValue);
var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment());
DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment));
if (this._stringText) {
DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText)));
}
DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment));
ReactDOMComponentTree.precacheNode(this, openingComment);
this._closingComment = closingComment;
return lazyTree;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this between comment nodes for the reasons stated
// above, but since this is a situation where React won't take over
// (static pages), we can simply return the text as it is.
return escapedText;
}
return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->';
}
},
/**
* Updates this component by updating the text content.
*
* @param {ReactText} nextText The next text content
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
if (nextStringText !== this._stringText) {
// TODO: Save this as pending props and use performUpdateIfNecessary
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
var commentNodes = this.getHostNode();
DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
}
}
},
getHostNode: function () {
var hostNode = this._commentNodes;
if (hostNode) {
return hostNode;
}
if (!this._closingComment) {
var openingComment = ReactDOMComponentTree.getNodeFromInstance(this);
var node = openingComment.nextSibling;
while (true) {
!(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0;
if (node.nodeType === 8 && node.nodeValue === ' /react-text ') {
this._closingComment = node;
break;
}
node = node.nextSibling;
}
}
hostNode = [this._hostNode, this._closingComment];
this._commentNodes = hostNode;
return hostNode;
},
unmountComponent: function () {
this._closingComment = null;
this._commentNodes = null;
ReactDOMComponentTree.uncacheNode(this);
}
});
module.exports = ReactDOMTextComponent;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var ReactUpdates = __webpack_require__(60);
var Transaction = __webpack_require__(72);
var emptyFunction = __webpack_require__(12);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
_assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
return callback(a, b, c, d, e);
} else {
return transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
/***/ }),
/* 145 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var EventListener = __webpack_require__(146);
var ExecutionEnvironment = __webpack_require__(52);
var PooledClass = __webpack_require__(54);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactUpdates = __webpack_require__(60);
var getEventTarget = __webpack_require__(73);
var getUnboundedScrollPosition = __webpack_require__(147);
/**
* Find the deepest React component completely containing the root of the
* passed-in instance (for use when entire React trees are nested within each
* other). If React trees are not nested, returns null.
*/
function findParent(inst) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
while (inst._hostParent) {
inst = inst._hostParent;
}
var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
var container = rootNode.parentNode;
return ReactDOMComponentTree.getClosestInstanceFromNode(container);
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
_assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = targetInst;
do {
bookKeeping.ancestors.push(ancestor);
ancestor = ancestor && findParent(ancestor);
} while (ancestor);
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
targetInst = bookKeeping.ancestors[i];
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function () {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} element Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} element Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
if (!element) {
return null;
}
return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
/***/ }),
/* 146 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks
*/
var emptyFunction = __webpack_require__(12);
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function listen(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function remove() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function remove() {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function capture(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function remove() {
target.removeEventListener(eventType, callback, true);
}
};
} else {
if (process.env.NODE_ENV !== 'production') {
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
}
return {
remove: emptyFunction
};
}
},
registerDefault: function registerDefault() {}
};
module.exports = EventListener;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 147 */
/***/ (function(module, exports) {
/**
* 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.
*
* @typechecks
*/
'use strict';
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable.Window && scrollable instanceof scrollable.Window) {
return {
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
/***/ }),
/* 148 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var DOMProperty = __webpack_require__(40);
var EventPluginHub = __webpack_require__(46);
var EventPluginUtils = __webpack_require__(48);
var ReactComponentEnvironment = __webpack_require__(119);
var ReactEmptyComponent = __webpack_require__(129);
var ReactBrowserEventEmitter = __webpack_require__(109);
var ReactHostComponent = __webpack_require__(130);
var ReactUpdates = __webpack_require__(60);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
EventPluginUtils: EventPluginUtils.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
HostComponent: ReactHostComponent.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
/***/ }),
/* 149 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _assign = __webpack_require__(4);
var CallbackQueue = __webpack_require__(61);
var PooledClass = __webpack_require__(54);
var ReactBrowserEventEmitter = __webpack_require__(109);
var ReactInputSelection = __webpack_require__(150);
var ReactInstrumentation = __webpack_require__(66);
var Transaction = __webpack_require__(72);
var ReactUpdateQueue = __webpack_require__(139);
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function () {
this.reactMountReady.notifyAll();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
if (process.env.NODE_ENV !== 'production') {
TRANSACTION_WRAPPERS.push({
initialize: ReactInstrumentation.debugTool.onBeginFlush,
close: ReactInstrumentation.debugTool.onEndFlush
});
}
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction(useCreateElement) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactDOMTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = useCreateElement;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* @return {object} The queue to collect React async events.
*/
getUpdateQueue: function () {
return ReactUpdateQueue;
},
/**
* Save current transaction state -- if the return value from this method is
* passed to `rollback`, the transaction will be reset to that state.
*/
checkpoint: function () {
// reactMountReady is the our only stateful wrapper
return this.reactMountReady.checkpoint();
},
rollback: function (checkpoint) {
this.reactMountReady.rollback(checkpoint);
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
_assign(ReactReconcileTransaction.prototype, Transaction, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 150 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ReactDOMSelection = __webpack_require__(151);
var containsNode = __webpack_require__(153);
var focusNode = __webpack_require__(98);
var getActiveElement = __webpack_require__(156);
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
/**
* @ReactInputSelection: React input selection module. Based on Selection.js,
* but modified to be suitable for react and has a couple of bug fixes (doesn't
* assume buttons have range selections allowed).
* Input selection module for React.
*/
var ReactInputSelection = {
hasSelectionCapabilities: function (elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
/**
* @restoreSelection: If any selection information was potentially lost,
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
},
/**
* @getSelection: Gets the selection bounds of a focused textarea, input or
* contentEditable node.
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
// Modern browser with input or textarea.
selection = {
start: input.selectionStart,
end: input.selectionEnd
};
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
// be in our element.
if (range.parentElement() === input) {
selection = {
start: -range.moveStart('character', -input.value.length),
end: -range.moveEnd('character', -input.value.length)
};
}
} else {
// Content editable or old IE textarea.
selection = ReactDOMSelection.getOffsets(input);
}
return selection || { start: 0, end: 0 };
},
/**
* @setSelection: Sets the selection bounds of a textarea or input and focuses
* the input.
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (end === undefined) {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
} else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
range.moveEnd('character', end - start);
range.select();
} else {
ReactDOMSelection.setOffsets(input, offsets);
}
}
};
module.exports = ReactInputSelection;
/***/ }),
/* 151 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ExecutionEnvironment = __webpack_require__(52);
var getNodeForCharacterOffset = __webpack_require__(152);
var getTextContentAccessor = __webpack_require__(55);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection && window.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// In Firefox, range.startContainer and range.endContainer can be "anonymous
// divs", e.g. the up/down buttons on an <input type="number">. Anonymous
// divs do not seem to expose properties, triggering a "Permission denied
// error" if any of its properties are accessed. The only seemingly possible
// way to avoid erroring is to access a property that typically works for
// non-anonymous divs and catch any error that may otherwise arise. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427
try {
/* eslint-disable no-unused-expressions */
currentRange.startContainer.nodeType;
currentRange.endContainer.nodeType;
/* eslint-enable no-unused-expressions */
} catch (e) {
return null;
}
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (offsets.end === undefined) {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programmatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
}
var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
/***/ }),
/* 152 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
/***/ }),
/* 153 */
/***/ (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.
*
*
*/
var isTextNode = __webpack_require__(154);
/*eslint-disable no-bitwise */
/**
* Checks if a given DOM node contains or is another DOM node.
*/
function containsNode(outerNode, innerNode) {
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
return containsNode(outerNode, innerNode.parentNode);
} else if ('contains' in outerNode) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
module.exports = containsNode;
/***/ }),
/* 154 */
/***/ (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.
*
* @typechecks
*/
var isNode = __webpack_require__(155);
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
/***/ }),
/* 155 */
/***/ (function(module, exports) {
'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.
*
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
function isNode(object) {
var doc = object ? object.ownerDocument || object : document;
var defaultView = doc.defaultView || window;
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
/***/ }),
/* 156 */
/***/ (function(module, exports) {
'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.
*
* @typechecks
*/
/* eslint-disable fb-www/typeof-undefined */
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not
* yet defined.
*
* @param {?DOMDocument} doc Defaults to current document.
* @return {?DOMElement}
*/
function getActiveElement(doc) /*?DOMElement*/{
doc = doc || (typeof document !== 'undefined' ? document : undefined);
if (typeof doc === 'undefined') {
return null;
}
try {
return doc.activeElement || doc.body;
} catch (e) {
return doc.body;
}
}
module.exports = getActiveElement;
/***/ }),
/* 157 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
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;
/***/ }),
/* 158 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var EventPropagators = __webpack_require__(45);
var ExecutionEnvironment = __webpack_require__(52);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactInputSelection = __webpack_require__(150);
var SyntheticEvent = __webpack_require__(57);
var getActiveElement = __webpack_require__(156);
var isTextInputElement = __webpack_require__(75);
var shallowEqual = __webpack_require__(127);
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: 'onSelect',
captured: 'onSelectCapture'
},
dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
}
};
var activeElement = null;
var activeElementInst = null;
var lastSelection = null;
var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
// not extract events. See #3639.
var hasListener = false;
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @return {object}
*/
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
if (!hasListener) {
return null;
}
var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
switch (topLevelType) {
// Track the input node that has focus.
case 'topFocus':
if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
activeElement = targetNode;
activeElementInst = targetInst;
lastSelection = null;
}
break;
case 'topBlur':
activeElement = null;
activeElementInst = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case 'topMouseDown':
mouseDown = true;
break;
case 'topContextMenu':
case 'topMouseUp':
mouseDown = false;
return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case 'topSelectionChange':
if (skipSelectionChangeEvent) {
break;
}
// falls through
case 'topKeyDown':
case 'topKeyUp':
return constructSelectEvent(nativeEvent, nativeEventTarget);
}
return null;
},
didPutListener: function (inst, registrationName, listener) {
if (registrationName === 'onSelect') {
hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var EventListener = __webpack_require__(146);
var EventPropagators = __webpack_require__(45);
var ReactDOMComponentTree = __webpack_require__(38);
var SyntheticAnimationEvent = __webpack_require__(160);
var SyntheticClipboardEvent = __webpack_require__(161);
var SyntheticEvent = __webpack_require__(57);
var SyntheticFocusEvent = __webpack_require__(162);
var SyntheticKeyboardEvent = __webpack_require__(163);
var SyntheticMouseEvent = __webpack_require__(78);
var SyntheticDragEvent = __webpack_require__(166);
var SyntheticTouchEvent = __webpack_require__(167);
var SyntheticTransitionEvent = __webpack_require__(168);
var SyntheticUIEvent = __webpack_require__(79);
var SyntheticWheelEvent = __webpack_require__(169);
var emptyFunction = __webpack_require__(12);
var getEventCharCode = __webpack_require__(164);
var invariant = __webpack_require__(8);
/**
* Turns
* ['abort', ...]
* into
* eventTypes = {
* 'abort': {
* phasedRegistrationNames: {
* bubbled: 'onAbort',
* captured: 'onAbortCapture',
* },
* dependencies: ['topAbort'],
* },
* ...
* };
* topLevelEventsToDispatchConfig = {
* 'topAbort': { sameConfig }
* };
*/
var eventTypes = {};
var topLevelEventsToDispatchConfig = {};
['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) {
var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
var onEvent = 'on' + capitalizedEvent;
var topEvent = 'top' + capitalizedEvent;
var type = {
phasedRegistrationNames: {
bubbled: onEvent,
captured: onEvent + 'Capture'
},
dependencies: [topEvent]
};
eventTypes[event] = type;
topLevelEventsToDispatchConfig[topEvent] = type;
});
var onClickListeners = {};
function getDictionaryKey(inst) {
// Prevents V8 performance issue:
// https://github.com/facebook/react/pull/7232
return '.' + inst._rootNodeID;
}
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
var SimpleEventPlugin = {
eventTypes: eventTypes,
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case 'topAbort':
case 'topCanPlay':
case 'topCanPlayThrough':
case 'topDurationChange':
case 'topEmptied':
case 'topEncrypted':
case 'topEnded':
case 'topError':
case 'topInput':
case 'topInvalid':
case 'topLoad':
case 'topLoadedData':
case 'topLoadedMetadata':
case 'topLoadStart':
case 'topPause':
case 'topPlay':
case 'topPlaying':
case 'topProgress':
case 'topRateChange':
case 'topReset':
case 'topSeeked':
case 'topSeeking':
case 'topStalled':
case 'topSubmit':
case 'topSuspend':
case 'topTimeUpdate':
case 'topVolumeChange':
case 'topWaiting':
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case 'topKeyPress':
// Firefox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
if (getEventCharCode(nativeEvent) === 0) {
return null;
}
/* falls through */
case 'topKeyDown':
case 'topKeyUp':
EventConstructor = SyntheticKeyboardEvent;
break;
case 'topBlur':
case 'topFocus':
EventConstructor = SyntheticFocusEvent;
break;
case 'topClick':
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case 'topDoubleClick':
case 'topMouseDown':
case 'topMouseMove':
case 'topMouseUp':
// TODO: Disabled elements should not respond to mouse events
/* falls through */
case 'topMouseOut':
case 'topMouseOver':
case 'topContextMenu':
EventConstructor = SyntheticMouseEvent;
break;
case 'topDrag':
case 'topDragEnd':
case 'topDragEnter':
case 'topDragExit':
case 'topDragLeave':
case 'topDragOver':
case 'topDragStart':
case 'topDrop':
EventConstructor = SyntheticDragEvent;
break;
case 'topTouchCancel':
case 'topTouchEnd':
case 'topTouchMove':
case 'topTouchStart':
EventConstructor = SyntheticTouchEvent;
break;
case 'topAnimationEnd':
case 'topAnimationIteration':
case 'topAnimationStart':
EventConstructor = SyntheticAnimationEvent;
break;
case 'topTransitionEnd':
EventConstructor = SyntheticTransitionEvent;
break;
case 'topScroll':
EventConstructor = SyntheticUIEvent;
break;
case 'topWheel':
EventConstructor = SyntheticWheelEvent;
break;
case 'topCopy':
case 'topCut':
case 'topPaste':
EventConstructor = SyntheticClipboardEvent;
break;
}
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
},
didPutListener: function (inst, registrationName, listener) {
// Mobile Safari does not fire properly bubble click events on
// non-interactive elements, which means delegated click listeners do not
// fire. The workaround for this bug involves attaching an empty click
// listener on the target node.
// http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
var key = getDictionaryKey(inst);
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
if (!onClickListeners[key]) {
onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
}
}
},
willDeleteListener: function (inst, registrationName) {
if (registrationName === 'onClick' && !isInteractive(inst._tag)) {
var key = getDictionaryKey(inst);
onClickListeners[key].remove();
delete onClickListeners[key];
}
}
};
module.exports = SimpleEventPlugin;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
/**
* @interface Event
* @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
*/
var AnimationEventInterface = {
animationName: null,
elapsedTime: null,
pseudoElement: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
module.exports = SyntheticAnimationEvent;
/***/ }),
/* 161 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticUIEvent = __webpack_require__(79);
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
/***/ }),
/* 163 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticUIEvent = __webpack_require__(79);
var getEventCharCode = __webpack_require__(164);
var getEventKey = __webpack_require__(165);
var getEventModifierState = __webpack_require__(81);
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
/***/ }),
/* 164 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
}
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
module.exports = getEventCharCode;
/***/ }),
/* 165 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var getEventCharCode = __webpack_require__(164);
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
module.exports = getEventKey;
/***/ }),
/* 166 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticMouseEvent = __webpack_require__(78);
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
/***/ }),
/* 167 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticUIEvent = __webpack_require__(79);
var getEventModifierState = __webpack_require__(81);
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
/***/ }),
/* 168 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticEvent = __webpack_require__(57);
/**
* @interface Event
* @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
* @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
*/
var TransitionEventInterface = {
propertyName: null,
elapsedTime: null,
pseudoElement: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface);
module.exports = SyntheticTransitionEvent;
/***/ }),
/* 169 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var SyntheticMouseEvent = __webpack_require__(78);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function (event) {
return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
deltaY: function (event) {
return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
/***/ }),
/* 170 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var DOMLazyTree = __webpack_require__(85);
var DOMProperty = __webpack_require__(40);
var React = __webpack_require__(2);
var ReactBrowserEventEmitter = __webpack_require__(109);
var ReactCurrentOwner = __webpack_require__(10);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactDOMContainerInfo = __webpack_require__(171);
var ReactDOMFeatureFlags = __webpack_require__(172);
var ReactFeatureFlags = __webpack_require__(62);
var ReactInstanceMap = __webpack_require__(120);
var ReactInstrumentation = __webpack_require__(66);
var ReactMarkupChecksum = __webpack_require__(173);
var ReactReconciler = __webpack_require__(63);
var ReactUpdateQueue = __webpack_require__(139);
var ReactUpdates = __webpack_require__(60);
var emptyObject = __webpack_require__(20);
var instantiateReactComponent = __webpack_require__(122);
var invariant = __webpack_require__(8);
var setInnerHTML = __webpack_require__(87);
var shouldUpdateReactComponent = __webpack_require__(128);
var warning = __webpack_require__(11);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME;
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
var instancesByReactRootID = {};
/**
* Finds the index of the first character
* that's not common between the two given strings.
*
* @return {number} the index of the character where the strings diverge
*/
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
}
/**
* @param {DOMElement|DOMDocument} container DOM element that may contain
* a React component
* @return {?*} DOM element that may have the reactRoot ID, or null.
*/
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
var markerName;
if (ReactFeatureFlags.logTopLevelRenders) {
var wrappedElement = wrapperInstance._currentElement.props.child;
var type = wrappedElement.type;
markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
console.time(markerName);
}
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
);
if (markerName) {
console.timeEnd(markerName);
}
wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
* Unmounts a component and removes it from the DOM.
*
* @param {ReactComponent} instance React component instance.
* @param {DOMElement} container DOM element to unmount from.
* @final
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
function unmountComponentFromNode(instance, container, safely) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
ReactReconciler.unmountComponent(instance, safely);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onEndFlush();
}
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
}
/**
* True if the supplied DOM node has a direct React-rendered child that is
* not a React root element. Useful for warning in `render`,
* `unmountComponentAtNode`, etc.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM element contains a direct child that was
* rendered by React but is not a root element.
* @internal
*/
function hasNonRootReactChild(container) {
var rootEl = getReactRootElementInContainer(container);
if (rootEl) {
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
return !!(inst && inst._hostParent);
}
}
/**
* True if the supplied DOM node is a React DOM element and
* it has been rendered by another copy of React.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM has been rendered by another copy of React
* @internal
*/
function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
}
/**
* True if the supplied DOM node is a valid node element.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM is a valid DOM node.
* @internal
*/
function isValidContainer(node) {
return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
}
/**
* True if the supplied DOM node is a valid React node element.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM is a valid React DOM node.
* @internal
*/
function isReactNode(node) {
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
}
function getHostRootInstanceInContainer(container) {
var rootEl = getReactRootElementInContainer(container);
var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
}
function getTopLevelWrapperInContainer(container) {
var root = getHostRootInstanceInContainer(container);
return root ? root._hostContainerInfo._topLevelWrapper : null;
}
/**
* Temporary (?) hack so that we can store all top-level pending updates on
* composites instead of having to worry about different types of components
* here.
*/
var topLevelRootCounter = 1;
var TopLevelWrapper = function () {
this.rootID = topLevelRootCounter++;
};
TopLevelWrapper.prototype.isReactComponent = {};
if (process.env.NODE_ENV !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function () {
return this.props.child;
};
TopLevelWrapper.isReactTopLevelWrapper = true;
/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.render(
* component,
* document.getElementById('container')
* );
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".3"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
TopLevelWrapper: TopLevelWrapper,
/**
* Used by devtools. The keys are not important.
*/
_instancesByReactRootID: instancesByReactRootID,
/**
* This is a hook provided to support rendering React components while
* ensuring that the apparent scroll position of its `container` does not
* change.
*
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
scrollMonitor: function (container, renderCallback) {
renderCallback();
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactElement} nextElement component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) {
ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
return prevComponent;
},
/**
* Render a new component into the DOM. Hooked by hooks!
*
* @param {ReactElement} nextElement element to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var componentInstance = instantiateReactComponent(nextElement, false);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);
var wrapperID = componentInstance._instance.rootID;
instancesByReactRootID[wrapperID] = componentInstance;
return componentInstance;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
},
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
!React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
// Check if it quacks like an element
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement });
var nextContext;
if (parentComponent) {
var parentInst = ReactInstanceMap.get(parentComponent);
nextContext = parentInst._processChildContext(parentInst._context);
} else {
nextContext = emptyObject;
}
var prevComponent = getTopLevelWrapperInContainer(container);
if (prevComponent) {
var prevWrappedElement = prevComponent._currentElement;
var prevElement = prevWrappedElement.props.child;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
var publicInst = prevComponent._renderedComponent.getPublicInstance();
var updatedCallback = callback && function () {
callback.call(publicInst);
};
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);
return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (internalGetID(rootElementSibling)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0;
break;
}
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
return component;
},
/**
* Renders a React component into the DOM in the supplied `container`.
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
render: function (nextElement, container, callback) {
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
* Unmounts and destroys the React component rendered in the `container`.
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0;
}
var prevComponent = getTopLevelWrapperInContainer(container);
if (!prevComponent) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
}
return false;
}
delete instancesByReactRootID[prevComponent._instance.rootID];
ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);
return true;
},
_mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
ReactDOMComponentTree.precacheNode(instance, rootElement);
return;
} else {
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
var normalizedMarkup = markup;
if (process.env.NODE_ENV !== 'production') {
// because rootMarkup is retrieved from the DOM, various normalizations
// will have occurred which will not be present in `markup`. Here,
// insert markup into a <div> or <iframe> depending on the container
// type to perform the same normalizations before comparing.
var normalizer;
if (container.nodeType === ELEMENT_NODE_TYPE) {
normalizer = document.createElement('div');
normalizer.innerHTML = markup;
normalizedMarkup = normalizer.innerHTML;
} else {
normalizer = document.createElement('iframe');
document.body.appendChild(normalizer);
normalizer.contentDocument.write(markup);
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
document.body.removeChild(normalizer);
}
}
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
}
}
}
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0;
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
DOMLazyTree.insertTreeBefore(container, markup, null);
} else {
setInnerHTML(container, markup);
ReactDOMComponentTree.precacheNode(instance, container.firstChild);
}
if (process.env.NODE_ENV !== 'production') {
var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
if (hostNode._debugID !== 0) {
ReactInstrumentation.debugTool.onHostOperation({
instanceID: hostNode._debugID,
type: 'mount',
payload: markup.toString()
});
}
}
}
};
module.exports = ReactMount;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var validateDOMNesting = __webpack_require__(140);
var DOC_NODE_TYPE = 9;
function ReactDOMContainerInfo(topLevelWrapper, node) {
var info = {
_topLevelWrapper: topLevelWrapper,
_idCounter: 1,
_ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
_node: node,
_tag: node ? node.nodeName.toLowerCase() : null,
_namespaceURI: node ? node.namespaceURI : null
};
if (process.env.NODE_ENV !== 'production') {
info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
}
return info;
}
module.exports = ReactDOMContainerInfo;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 172 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactDOMFeatureFlags = {
useCreateElement: true,
useFiber: false
};
module.exports = ReactDOMFeatureFlags;
/***/ }),
/* 173 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var adler32 = __webpack_require__(174);
var TAG_END = /\/?>/;
var COMMENT_START = /^<\!\-\-/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
// Add checksum (handle both parent tags, comments and self-closing tags)
if (COMMENT_START.test(markup)) {
return markup;
} else {
return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
}
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function (markup, element) {
var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
/***/ }),
/* 174 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var MOD = 65521;
// adler32 is not cryptographically strong, and is only used to sanity check that
// markup generated on the server matches the markup generated on the client.
// This implementation (a modified version of the SheetJS version) has been optimized
// for our use case, at the expense of conforming to the adler32 specification
// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
var i = 0;
var l = data.length;
var m = l & ~0x3;
while (i < m) {
var n = Math.min(i + 4096, m);
for (; i < n; i += 4) {
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
}
a %= MOD;
b %= MOD;
}
for (; i < l; i++) {
b += a += data.charCodeAt(i);
}
a %= MOD;
b %= MOD;
return a | b << 16;
}
module.exports = adler32;
/***/ }),
/* 175 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
module.exports = '15.5.4';
/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var _prodInvariant = __webpack_require__(39);
var ReactCurrentOwner = __webpack_require__(10);
var ReactDOMComponentTree = __webpack_require__(38);
var ReactInstanceMap = __webpack_require__(120);
var getHostComponentFromComposite = __webpack_require__(177);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
/**
* Returns the DOM node rendered by this element.
*
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
*
* @param {ReactComponent|DOMElement} componentOrElement
* @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
var inst = ReactInstanceMap.get(componentOrElement);
if (inst) {
inst = getHostComponentFromComposite(inst);
return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
}
if (typeof componentOrElement.render === 'function') {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
} else {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
}
}
module.exports = findDOMNode;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 177 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ReactNodeTypes = __webpack_require__(124);
function getHostComponentFromComposite(inst) {
var type;
while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
inst = inst._renderedComponent;
}
if (type === ReactNodeTypes.HOST) {
return inst._renderedComponent;
} else if (type === ReactNodeTypes.EMPTY) {
return null;
}
}
module.exports = getHostComponentFromComposite;
/***/ }),
/* 178 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var ReactMount = __webpack_require__(170);
module.exports = ReactMount.renderSubtreeIntoContainer;
/***/ }),
/* 179 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var DOMProperty = __webpack_require__(40);
var EventPluginRegistry = __webpack_require__(47);
var ReactComponentTreeHook = __webpack_require__(26);
var warning = __webpack_require__(11);
if (process.env.NODE_ENV !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true,
autoFocus: true,
defaultValue: true,
valueLink: true,
defaultChecked: true,
checkedLink: true,
innerHTML: true,
suppressContentEditableWarning: true,
onFocusIn: true,
onFocusOut: true
};
var warnedProperties = {};
var validateProperty = function (tagName, name, debugID) {
if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
return true;
}
if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return true;
}
if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) {
return true;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
if (standardName != null) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
return true;
} else if (registrationName != null) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
return true;
} else {
// We were unable to guess which prop the user intended.
// It is likely that the user was just blindly spreading/forwarding props
// Components should be careful to only render valid props/attributes.
// Warning will be invoked in warnUnknownProperties to allow grouping.
return false;
}
};
}
var warnUnknownProperties = function (debugID, element) {
var unknownProps = [];
for (var key in element.props) {
var isValid = validateProperty(element.type, key, debugID);
if (!isValid) {
unknownProps.push(key);
}
}
var unknownPropString = unknownProps.map(function (prop) {
return '`' + prop + '`';
}).join(', ');
if (unknownProps.length === 1) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
} else if (unknownProps.length > 1) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
}
};
function handleElement(debugID, element) {
if (element == null || typeof element.type !== 'string') {
return;
}
if (element.type.indexOf('-') >= 0 || element.props.is) {
return;
}
warnUnknownProperties(debugID, element);
}
var ReactDOMUnknownPropertyHook = {
onBeforeMountComponent: function (debugID, element) {
handleElement(debugID, element);
},
onBeforeUpdateComponent: function (debugID, element) {
handleElement(debugID, element);
}
};
module.exports = ReactDOMUnknownPropertyHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 180 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var ReactComponentTreeHook = __webpack_require__(26);
var warning = __webpack_require__(11);
var didWarnValueNull = false;
function handleElement(debugID, element) {
if (element == null) {
return;
}
if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') {
return;
}
if (element.props != null && element.props.value === null && !didWarnValueNull) {
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
didWarnValueNull = true;
}
}
var ReactDOMNullInputValuePropHook = {
onBeforeMountComponent: function (debugID, element) {
handleElement(debugID, element);
},
onBeforeUpdateComponent: function (debugID, element) {
handleElement(debugID, element);
}
};
module.exports = ReactDOMNullInputValuePropHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 181 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var DOMProperty = __webpack_require__(40);
var ReactComponentTreeHook = __webpack_require__(26);
var warning = __webpack_require__(11);
var warnedProperties = {};
var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$');
function validateProperty(tagName, name, debugID) {
if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return true;
}
if (rARIA.test(name)) {
var lowerCasedName = name.toLowerCase();
var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (standardName == null) {
warnedProperties[name] = true;
return false;
}
// aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== standardName) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
warnedProperties[name] = true;
return true;
}
}
return true;
}
function warnInvalidARIAProps(debugID, element) {
var invalidProps = [];
for (var key in element.props) {
var isValid = validateProperty(element.type, key, debugID);
if (!isValid) {
invalidProps.push(key);
}
}
var unknownPropString = invalidProps.map(function (prop) {
return '`' + prop + '`';
}).join(', ');
if (invalidProps.length === 1) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
} else if (invalidProps.length > 1) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
}
}
function handleElement(debugID, element) {
if (element == null || typeof element.type !== 'string') {
return;
}
if (element.type.indexOf('-') >= 0 || element.props.is) {
return;
}
warnInvalidARIAProps(debugID, element);
}
var ReactDOMInvalidARIAHook = {
onBeforeMountComponent: function (debugID, element) {
if (process.env.NODE_ENV !== 'production') {
handleElement(debugID, element);
}
},
onBeforeUpdateComponent: function (debugID, element) {
if (process.env.NODE_ENV !== 'production') {
handleElement(debugID, element);
}
}
};
module.exports = ReactDOMInvalidARIAHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 182 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _shield = __webpack_require__(183);
var _shield2 = _interopRequireDefault(_shield);
var _react = __webpack_require__(1);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Member = function (_Component) {
_inherits(Member, _Component);
function Member() {
_classCallCheck(this, Member);
return _possibleConstructorReturn(this, (Member.__proto__ || Object.getPrototypeOf(Member)).apply(this, arguments));
}
_createClass(Member, [{
key: 'render',
value: function render() {
var _props = this.props,
name = _props.name,
thumbnail = _props.thumbnail,
email = _props.email,
admin = _props.admin,
makeAdmin = _props.makeAdmin;
return React.createElement(
'div',
{ className: 'member' },
React.createElement(
'h1',
null,
name,
' ',
admin ? React.createElement(_shield2.default, null) : null
),
React.createElement(
'a',
{ onClick: makeAdmin },
'Make admin '
),
React.createElement('img', { src: thumbnail, alt: 'profile picture' }),
React.createElement(
'p',
null,
React.createElement(
'a',
{ href: 'mailto:' + rmail },
email
)
)
);
}
}]);
return Member;
}(_react.Component);
exports.default = Member;
/***/ }),
/* 183 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactIconBase = __webpack_require__(184);
var _reactIconBase2 = _interopRequireDefault(_reactIconBase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var FaShield = function FaShield(props) {
return _react2.default.createElement(
_reactIconBase2.default,
_extends({ viewBox: '0 0 40 40' }, props),
_react2.default.createElement(
'g',
null,
_react2.default.createElement('path', { d: 'm29.8 21.4v-14.3h-10v25.4q2.6-1.4 4.7-3 5.3-4.1 5.3-8.1z m4.3-17.1v17.1q0 2-0.8 3.8t-1.8 3.4-2.7 2.8-2.8 2.3-2.7 1.8-2 1.1-0.9 0.4q-0.3 0.1-0.6 0.1t-0.6-0.1q-0.4-0.2-0.9-0.4t-2-1.1-2.7-1.8-2.9-2.3-2.6-2.8-1.9-3.4-0.7-3.8v-17.1q0-0.6 0.4-1t1-0.4h25.7q0.6 0 1 0.4t0.5 1z' })
)
);
};
exports.default = FaShield;
module.exports = exports['default'];
/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(185);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var IconBase = function IconBase(_ref, _ref2) {
var children = _ref.children;
var color = _ref.color;
var size = _ref.size;
var style = _ref.style;
var props = _objectWithoutProperties(_ref, ['children', 'color', 'size', 'style']);
var _ref2$reactIconBase = _ref2.reactIconBase;
var reactIconBase = _ref2$reactIconBase === undefined ? {} : _ref2$reactIconBase;
var computedSize = size || reactIconBase.size || '1em';
return _react2.default.createElement('svg', _extends({
children: children,
fill: 'currentColor',
preserveAspectRatio: 'xMidYMid meet',
height: computedSize,
width: computedSize
}, reactIconBase, props, {
style: _extends({
verticalAlign: 'middle',
color: color || reactIconBase.color
}, reactIconBase.style || {}, style)
}));
};
IconBase.propTypes = {
color: _propTypes2.default.string,
size: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
style: _propTypes2.default.object
};
IconBase.contextTypes = {
reactIconBase: _propTypes2.default.shape(IconBase.propTypes)
};
exports.default = IconBase;
module.exports = exports['default'];
/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(186)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(189)();
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
var emptyFunction = __webpack_require__(12);
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactPropTypesSecret = __webpack_require__(187);
var checkPropTypes = __webpack_require__(188);
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== 'production') {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 187 */
/***/ (function(module, exports) {
/**
* Copyright 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 strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 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 strict';
if (process.env.NODE_ENV !== 'production') {
var invariant = __webpack_require__(8);
var warning = __webpack_require__(11);
var ReactPropTypesSecret = __webpack_require__(187);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (process.env.NODE_ENV !== 'production') {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 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 strict';
var emptyFunction = __webpack_require__(12);
var invariant = __webpack_require__(8);
module.exports = function() {
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
function shim() {
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
};
shim.isRequired = shim;
function getShim() {
return shim;
};
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ })
/******/ ]); | Raziyehbazargan/React.js_Essential_Training | Ch07/07_01/start/dist/assets/bundle.min.js | JavaScript | mit | 786,062 | [
30522,
1013,
1008,
30524,
1025,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1013,
1013,
1013,
1996,
5478,
3853,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1013,
3853,
1035,
1035,
4773,
23947,
1035,
5478,
1035,
1035,
1006,
11336,
3593,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var game = new Phaser.Game(450, 350, Phaser.CANVAS, '', { preload: preload, create: create, update: update });
function preload(){
game.stage.backgroundColor='#000066';
game.load.image('correct','assets/correct.png');
game.load.image('incorrect','assets/incorrect.png');
game.load.spritesheet('greenbutton','assets/greenbutton.png',186,43);
game.load.audio('correct',['assets/correct.mp3','assets/correct.ogg']);
game.load.audio('incorrect',['assets/incorrect.mp3','assets/incorrect.ogg']);
game.load.audio('button',['assets/buttonclick.mp3','assets/buttonclick.ogg']);
game.load.audio('beep',['assets/beep.mp3','assets/beep.ogg']);
game.load.audio('pop1',['assets/pop1.mp3','assets/pop1.ogg']);
};
var round = [];
var sceneIndex = 0;
var inScene = false;
var inRound = -1;
var titleFontStyle = {font:'26px Arial',fill:'#FFFFFF',align:'center'};
var buttonFontStyle= {font:'20px Arial',fill:'#FFFFFF',align:'center'};
var bodyFontStyle = {font:'15px Arial',fill:'#FFFFFF',align:'center'};
var scoreFontStyle = {font:'18px Arial',fill:'#FFFFFF',align:'right'};
var titleText;
var bodyText;
var goButton;
var goButtonText;
var timerInterval;
var buttonSound;
var beepSound;
var roundTimerText;
var roundTimerValue = 30;
var roundTimerInterval;
var roundTitleText;
var button1;
var button2;
var button3;
var button1Text;
var button2Text;
var button3Text;
var isDisplaying = false;
var displayWordObject;
var displayWordText;
var correctIcon;
var incorrectIcon;
var correctSound;
var incorrectSound;
var roundStarted = false;
var score=0;
var roundScore=0;
var resultTimeLeftText;
var resultScoreText;
var resultTotalText;
var nextRoundButton;
var nextRoundButtonText;
var roundCompleteText;
var ul1;
var ul2;
var questionsRight=0;
var questionsWrong=0;
var secondsUsed=0;
var totalQuestions=0;
var finalTitleText;
var finalQRightText;
var finalQWrongText;
var finalSecondsUsedText;
var finalAccuracyText;
var finalSpeedText;
var finalScoreText
var finalGroup;
var readyForNext = false;
var noGuessesLeft= false;
var numberOfQuestions=0;
var roundsLeft;
var resetButton;
var resetButtonText;
function create(){
Phaser.Canvas.setSmoothingEnabled(game.context, false);
buttonSound = game.add.audio('button');
beepSound = game.add.audio('beep');
pop1Sound = game.add.audio('pop1');
correctSound = game.add.audio('correct');
incorrectSound = game.add.audio('incorrect');
};
function introduction(){
titleText = game.add.text(game.world.centerX,((game.world.height/7)*2),'Guess the Category!',titleFontStyle);
titleText.anchor.setTo(0.5,0.5);
bodyText = game.add.text(game.world.centerX,((game.world.height/7)*3.25),'Instructions: Words and phrases will appear \n on the screen. Guess the category the word\n or phrase belongs to before time runs out!',bodyFontStyle);
bodyText.anchor.setTo(0.5,0.5);
goButton = game.add.button(game.world.centerX,((game.world.height/7)*5),'greenbutton',nextScene,this,0,1,2);
goButton.anchor.setTo(0.5,0.5);
goButtonText = game.add.text(goButton.x,goButton.y,'Let\'s Go!',titleFontStyle);
goButtonText.anchor.setTo(0.5,0.5);
setQuestions();
};
function introductionFadeOut(){
buttonSound.play();
var tw1 = game.add.tween(titleText).to( { alpha: 0 }, 750, Phaser.Easing.Linear.None, true, 0, 0, false);
tw1.onCompleteCallback(nextScene);
game.add.tween(bodyText).to( { alpha: 0 }, 750, Phaser.Easing.Linear.None, true, 0, 0, false);
game.add.tween(goButton).to( { alpha: 0 }, 750, Phaser.Easing.Linear.None, true, 0, 0, false);
game.add.tween(goButtonText).to( { alpha: 0 }, 750, Phaser.Easing.Linear.None, true, 0, 0, false);
};
function setReady(){
readyForNext = true;
};
function roundCountdown(roundText){
readyForNext=false;
roundTitleText = game.add.text(game.world.centerX,100,roundText,titleFontStyle);
roundTitleText.anchor.setTo(0.5,0.5);
var timerValue = 3;
var timerText = game.add.text(game.world.centerX,game.world.centerY,timerValue,{font:'50px Arial',fill:'#FFFFFF',align:'center'});
timerText.anchor.setTo(0.5,0.5);
this.countdown = function(){
beepSound.play();
timerValue--;
timerText.setText(timerValue);
if(timerValue<=0){
game.add.tween(roundTitleText).to({x:10,y:20},750,Phaser.Easing.Quadratic.Out,true,0,0,false)
game.add.tween(timerText).to({alpha:0},750,Phaser.Easing.Linear.None,true,0,0,false);
roundTitleText.anchor.setTo(0,0.5);
clearInterval(timerInterval);
readyForNext=true;
nextScene();
};
};
timerInterval = setInterval(this.countdown,1000);
beepSound.play();
};
function nextScene(){
if(!readyForNext){
return;
};
sceneIndex++;
inScene = false;
};
function startRound(roundData){
noGuessesLeft=false;
readyForNext=false;
roundTimerText = game.add.text(game.world.width-60,20,'Time: '+roundTimerValue,titleFontStyle);
roundTimerText.alpha = 0;
roundTimerText.anchor.setTo(0.5,0.5);
var timerFadeIn = game.add.tween(roundTimerText).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
timerFadeIn.onCompleteCallback(function(){roundTimerInterval = setInterval(countDown,1000)});
var categories = [];
for(var questions in roundData){
if(categories.indexOf(roundData[questions].category)==-1){
categories.push(roundData[questions].category);
};
};
button1 = game.add.button(105,game.world.height-50,'greenbutton',guess,button1,0,1,2);
button1.category = categories[0];
button1.anchor.setTo(0.5,0.5);
button1Text = game.add.text(button1.x,button1.y,categories[0],buttonFontStyle);
button1Text.anchor.setTo(0.5,0.5);
button1.alpha = 0;
button1Text.alpha = 0;
game.add.tween(button1).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
game.add.tween(button1Text).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
button2 = game.add.button(game.world.width-110,game.world.height-50,'greenbutton',guess,button2,0,1,2);
button2.category = categories[1];
button2.anchor.setTo(0.5,0.5);
button2Text = game.add.text(button2.x,button2.y,categories[1],buttonFontStyle);
button2Text.anchor.setTo(0.5,0.5);
button2.alpha = 0;
button2Text.alpha=0;
game.add.tween(button2).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
game.add.tween(button2Text).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
if(categories.length===3){
button3 = game.add.button(game.world.centerX,game.world.height-100,'greenbutton',guess,button3,0,1,2);
button3.category = categories[2];
button3.anchor.setTo(0.5,0.5);
button3Text = game.add.text(button3.x,button3.y,categories[2],buttonFontStyle);
button3Text.anchor.setTo(0.5,0.5);
button3.alpha=0;
button3Text.alpha =0;
game.add.tween(button3).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
game.add.tween(button3Text).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false);
};
};
function guess(button){
if(noGuessesLeft){
return;
};
totalQuestions++;
if(button.category === displayWordObject.category){
//console.log("Correct!")
questionsRight++;
roundScore++;
correctIcon = game.add.sprite(game.world.centerX,game.world.centerY-100,'correct');
correctIcon.anchor.setTo(0.5,0.5);
correctSound.play();
game.add.tween(correctIcon).to({alpha:0},750,Phaser.Easing.Linear.None,true,0,0,false);
}else{
//console.log("Incorrect!")
questionsWrong++;
incorrectIcon = game.add.sprite(game.world.centerX,game.world.centerY-100,'incorrect');
incorrectIcon.anchor.setTo(0.5,0.5);
incorrectSound.play();
game.add.tween(incorrectIcon).to({alpha:0},750,Phaser.Easing.Linear.None,true,0,0,false);
};
for(var k=0;k<round[inRound].length;k++){
var obj = round[inRound][k];
if(obj == displayWordObject){
round[inRound].splice(k,1);
break;
};
};
var dt = game.add.tween(displayWordText).to({alpha:0},500,Phaser.Easing.Linear.None,true,0,0,false);
dt.onCompleteCallback(killWord);
};
function killWord(){
displayWordText.destroy();
isDisplaying=false;
};
function displayWord(roundData){
if(noGuessesLeft){
return;
};
//console.log("inRound="+inRound);
//console.log(roundData)
if(roundData.length==0){
readyForNext=true;
noGuessesLeft=true;
nextScene();
return;
};
pop1Sound.play();
var randomNumber = Math.floor(Math.random()*roundData.length);
displayWordObject = roundData[randomNumber];
displayWordText=game.add.text(game.world.centerX,game.world.centerY-25,displayWordObject.text,titleFontStyle);
displayWordText.anchor.setTo(0.5,0.5);
displayWordText.scale.x = 0;
displayWordText.scale.y = 0;
game.add.tween(displayWordText.scale).to({x:1,y:1},500,Phaser.Easing.Elastic.Out,true,0,0,false);
};
function setQuestions(){
round = [];
round.push([{text:"Prosecuted by the state",category:"Crime"},
{text:"Punished by the state",category:"Crime"},
{text:"Violation of a\n written (codified) law",category:"Crime"},
{text:"Violation of social\n norms or expectations",category:"Deviance"},
{text:"Punished by social\n exclusion, stigmatization",category:"Deviance"}]);
round.push([{text:"Bad or evil in itself",category:"Mala in Se"},
{text:"Murder, robbery,\n sexual assault",category:"Mala in Se"},
{text:"Most societies have\n criminal prohibitions",category:"Mala in Se"},
{text:"Widespread agreement\n between cultures and societies",category:"Mala in Se"},
{text:"Most people would recognize\n the behaviour as wrong, even \nwithout a law prohibiting it",category:"Mala in Se"},
{text:"Bad because itโs prohibited",category:"Mala Prohibita"},
{text:"Differs from society to\n society and culture to culture",category:"Mala Prohibita"},
{text:"Polygamy",category:"Mala Prohibita"},
{text:"Homosexuality",category:"Mala Prohibita"},
{text:"May be illegal at some\n times, but not at other times",category:"Mala Prohibita"}]);
round.push([{text:"Ordered by judge at\n time of sentencing",category:"Probation"},
{text:"Cannot exceed three years",category:"Probation"},
{text:"Is a sentence in itself",category:"Probation"},
{text:"May be combined with\n community service",category:"Probation"},
{text:"Usual eligibility date\n at one-third of sentence",category:"Parole"},
{text:"Granted by parole board",category:"Parole"},
{text:"Imprisoned offender must\n apply for release",category:"Parole"},
{text:"Eligibility date of 10-25\n years for murder",category:"Parole"},
{text:"Automatic at two-thirds\n of sentence",category:"Statuatory Release"},
{text:"Parole board cannot deny\n without a compelling reason",category:"Statuatory Release"}]);
roundsLeft = round.length;
for(var i=0;i<round.length;i++){
numberOfQuestions+=round[i].length;
};
setReady();
};
function countDown(){
if(!roundStarted){
inRound++;
roundStarted=true;
isDisplaying=false;
};
roundTimerValue--;
secondsUsed++;
if(roundTimerValue>5){
roundTimerText.setText("Time: "+roundTimerValue);
}else if(roundTimerValue<=5&&roundTimerValue>=0){
beepSound.play();
roundTimerText.setText("Time: "+roundTimerValue);
};
if(roundTimerValue<0){
noGuessesLeft=true;
clearInterval(roundTimerInterval);
game.add.tween(displayWordText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false);
readyForNext=true;
roundTimerValue=0;
nextScene();
};
};
function roundResults(){
readyForNext=false;
//console.log("Rounds Left: "+roundsLeft);
roundsLeft--;
roundCompleteText = game.add.text(game.world.centerX,game.world.centerY,"Round Complete!",titleFontStyle);
roundCompleteText.anchor.setTo(0.5,0.5);
roundCompleteText.alpha=0;
game.add.tween(roundCompleteText).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false).to({y:100},1000,Phaser.Easing.Quadratic.Out,true,0,0,false);
ul1 = game.add.graphics(25,62);
ul1.lineStyle(1.5,0xffff00,1);
ul1.beginFill();
ul1.moveTo(25,62);
ul1.lineTo(375,62);
ul1.endFill();
ul1.alpha = 0;
game.add.tween(ul1).to({alpha:1},500,Phaser.Easing.Linear.None).delay(1750).start();
resultScoreText = game.add.text(game.world.centerX+160,game.world.centerY-25,"Score: "+roundScore+" answers x 1000 = "+(roundScore*1000)+" points",scoreFontStyle);
resultScoreText.anchor.setTo(1,0.5);
resultScoreText.alpha=0;
game.add.tween(resultScoreText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(2000).start();
resultTimeLeftText = game.add.text(game.world.centerX+160,game.world.centerY,"Time Left: "+roundTimerValue+' x 100 = '+(roundTimerValue*100)+' points',scoreFontStyle);
resultTimeLeftText.anchor.setTo(1,0.5);
resultTimeLeftText.alpha=0;
game.add.tween(resultTimeLeftText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(2500).start();
ul2 = game.add.graphics(25,100);
ul2.lineStyle(1.5,0xFFFF00,1);
ul2.beginFill();
ul2.moveTo(25,100);
ul2.lineTo(375,100);
ul2.endFill();
ul2.alpha=0;
game.add.tween(ul2).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(3000).start();
var roundTotal = (roundScore*1000)+(roundTimerValue*100);
score+=roundTotal;
resultTotalText = game.add.text(game.world.centerX,game.world.centerY+50,"Round Score: "+roundTotal,titleFontStyle);
resultTotalText.anchor.setTo(0.5,0.5);
resultTotalText.alpha = 0;
game.add.tween(resultTotalText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(4000).start();
nextRoundButton = game.add.button(game.world.centerX,300,'greenbutton',nextScene,this,0,1,2);
nextRoundButton.anchor.setTo(0.5,0.5);
nextRoundButton.alpha = 0;
if(roundsLeft >1){
nextRoundButtonText = game.add.text(nextRoundButton.x,nextRoundButton.y,"Next Round",titleFontStyle);
}else if(roundsLeft == 1){
nextRoundButtonText = game.add.text(nextRoundButton.x,nextRoundButton.y,"Final Round",titleFontStyle);
}else if(roundsLeft == 0){
nextRoundButtonText = game.add.text(nextRoundButton.x,nextRoundButton.y,"Get Results",titleFontStyle);
};
nextRoundButtonText.anchor.setTo(0.5,0.5);
nextRoundButtonText.alpha=0;
game.add.tween(nextRoundButton).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(4500).start();
game.add.tween(nextRoundButtonText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(4500).start();
roundScore=0;
roundTimerValue=30;
roundStarted=false;
setTimeout(setReady,5500);
};
function resultsFadeOut(){
buttonSound.play();
game.add.tween(ul1).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(ul2).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(resultScoreText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(resultTimeLeftText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(resultTotalText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(nextRoundButton).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(roundCompleteText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
var nb = game.add.tween(nextRoundButtonText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
nb.onCompleteCallback(nextScene);
};
function roundFadeOut(){
noGuessesLeft=true;
clearInterval(roundTimerInterval);
var t1= game.add.tween(button1).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(button2).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
if(button3!=null || button3!=undefined){
game.add.tween(button3).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(button3Text).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
};
game.add.tween(button1Text).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(button2Text).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(roundTimerText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
game.add.tween(roundTitleText).to({alpha:0},1000,Phaser.Easing.Linear.None,true,0,0,false)
t1.onCompleteCallback(nextScene);
};
function finalResults(){
finalGroup = game.add.group();
finalTitleText = game.add.text(game.world.centerX,game.world.centerY,"Your Statistics",titleFontStyle);
finalTitleText.anchor.setTo(0.5,0.5);
finalTitleText.alpha=0;
finalGroup.add(finalTitleText);
ul1 = game.add.graphics(25,47);
ul1.lineStyle(1.5,0xffff00,1);
ul1.beginFill();
ul1.moveTo(25,47);
ul1.lineTo(375,47);
ul1.endFill();
ul1.alpha = 0;
finalGroup.add(ul1);
finalQRightText = game.add.text(game.world.centerX,game.world.centerY-50,"Questions Right: "+questionsRight,scoreFontStyle);
finalQRightText.anchor.setTo(0.5,0.5);
finalQRightText.alpha=0;
finalGroup.add(finalQRightText);
finalQWrongText = game.add.text(game.world.centerX,game.world.centerY-25,"Questions Wrong: "+questionsWrong,scoreFontStyle);
finalQWrongText.anchor.setTo(0.5,0.5);
finalQWrongText.alpha=0;
finalGroup.add(finalQWrongText);
var acc = Math.round((questionsRight/totalQuestions)*100);
finalAccuracyText = game.add.text(game.world.centerX,game.world.centerY,"Accuracy: "+acc+"%",scoreFontStyle);
finalAccuracyText.anchor.setTo(0.5,0.5);
finalAccuracyText.alpha=0;
finalGroup.add(finalAccuracyText);
ul2 = game.add.graphics(25,115);
ul2.lineStyle(1.5,0xFFFF00,1);
ul2.beginFill();
ul2.moveTo(25,115);
ul2.lineTo(375,115);
ul2.endFill();
ul2.alpha=0;
finalGroup.add(ul2);
finalScoreText = game.add.text(game.world.centerX,game.world.centerY+75,"Final Score: "+score,titleFontStyle);
finalScoreText.anchor.setTo(0.5,0.5);
finalScoreText.alpha =0;
finalGroup.add(finalScoreText);
var qps =Math.round((numberOfQuestions/secondsUsed)*100)/100;
finalSpeedText = game.add.text(game.world.centerX,game.world.centerY+25,"Speed: "+qps+" questions per second",scoreFontStyle);
finalSpeedText.anchor.setTo(0.5,0.5);
finalSpeedText.alpha=0;
finalGroup.add(finalSpeedText);
game.add.tween(finalTitleText).to({alpha:1},1000,Phaser.Easing.Linear.None,true,0,0,false).to({y:75},1000,Phaser.Easing.Quadratic.Out,true,0,0,false);
game.add.tween(ul1).to({alpha:1},500,Phaser.Easing.Linear.None).delay(1500).start();
game.add.tween(finalQRightText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(2000).start();
game.add.tween(finalQWrongText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(2500).start();
game.add.tween(finalAccuracyText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(3000).start();
game.add.tween(finalSpeedText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(3500).start();
game.add.tween(ul2).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(4000).start();
game.add.tween(finalScoreText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(4500).start();
resetButton = game.add.button(game.world.centerX,game.world.centerY+125,'greenbutton',nextScene,this,0,1,2);
resetButton.anchor.setTo(0.5,0.5);
resetButton.alpha =0;
game.add.tween(resetButton).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(5000).start();
finalGroup.add(resetButton);
resetButtonText = game.add.text(resetButton.x,resetButton.y,"Play Again",titleFontStyle);
resetButtonText.anchor.setTo(0.5,0.5);
resetButtonText.alpha=0;
game.add.tween(resetButtonText).to({alpha:1},1000,Phaser.Easing.Linear.None).delay(5000).start();
finalGroup.add(resetButtonText);
}
function finalResultsFadeOut(){
var finalFade = game.add.tween(finalGroup._container).to({alpha:0},1000,Phaser.Easing.Linear.None).start();
finalFade.onCompleteCallback(resetGame);
};
function resetGame(){
//console.log("RESET THE GAME!")
sceneIndex = 0;
inScene = false;
inRound = -1;
roundTimerValue = 30;
isDisplaying = false;
roundStarted = false;
questionsRight=0;
questionsWrong=0;
secondsUsed=0;
totalQuestions=0;
readyForNext = false;
noGuessesLeft= false;
numberOfQuestions=0;
setQuestions();
};
function update(){
if(!inScene){
inScene = true;
switch(sceneIndex){
case 0: introduction();
break;
case 1: introductionFadeOut();
break;
case 2: roundCountdown("Round 1");
break;
case 3: roundTimerValue=30;
startRound(round[0]);
break;
case 4: roundFadeOut();
break;
case 5: roundResults();
break;
case 6: resultsFadeOut();
break;
case 7: roundCountdown("Round 2");
break;
case 8: roundTimerValue=60;
startRound(round[1]);
break;
case 9: roundFadeOut();
break;
case 10:roundResults();
break;
case 11:resultsFadeOut();
break;
case 12: roundCountdown("Final Round");
break;
case 13: roundTimerValue=90;
startRound(round[2]);
break;
case 14: roundFadeOut();
break;
case 15: roundResults();
break;
case 16: resultsFadeOut();
break;
case 17:finalResults();
break;
case 18:finalResultsFadeOut();
break;
case 19:resetGame();
break;
};
};
if(inRound>-1){
if(!isDisplaying){
isDisplaying=true;
displayWord(round[inRound]);
};
};
};
| bpickard/c9_phaser | tutorials/this_or_that/unit2game_source.js.js | JavaScript | mit | 23,780 | [
30522,
13075,
2208,
1027,
2047,
4403,
2099,
1012,
2208,
1006,
10332,
1010,
8698,
1010,
4403,
2099,
1012,
10683,
1010,
1005,
1005,
1010,
1063,
3653,
11066,
1024,
3653,
11066,
1010,
3443,
1024,
3443,
1010,
10651,
1024,
10651,
1065,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package io.github.ibuildthecloud.dstack.object.postinit;
import io.github.ibuildthecloud.dstack.object.ObjectDefaultsProvider;
import io.github.ibuildthecloud.dstack.util.type.InitializationTask;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ObjectDefaultsPostInstantiationHandler implements ObjectPostInstantiationHandler, InitializationTask {
private static final Logger log = LoggerFactory.getLogger(ObjectDefaultsPostInstantiationHandler.class);
List<ObjectDefaultsProvider> defaultProviders;
Map<Class<?>,Map<String,Object>> defaults = new HashMap<Class<?>, Map<String,Object>>();
@Override
public <T> T postProcess(T obj, Class<T> clz, Map<String,Object> properties) {
try {
applyDefaults(clz, obj);
} catch (IllegalAccessException e) {
throw new IllegalStateException("Failed to apply defaults to [" + obj + "]", e);
} catch (InvocationTargetException e) {
throw new IllegalStateException("Failed to apply defaults to [" + obj + "]", e);
}
return obj;
}
protected void applyDefaults(Class<?> clz, Object instance) throws IllegalAccessException, InvocationTargetException {
Map<String,Object> defaultValues = defaults.get(instance.getClass());
if ( defaultValues == null ) {
return;
}
log.debug("Applying defaults [{}] to [{}]", defaultValues, instance);
BeanUtils.copyProperties(instance, defaultValues);
}
@Override
public void start() {
for ( ObjectDefaultsProvider provider : defaultProviders ) {
defaults.putAll(provider.getDefaults());
}
}
@Override
public void stop() {
}
public List<ObjectDefaultsProvider> getDefaultProviders() {
return defaultProviders;
}
@Inject
public void setDefaultProviders(List<ObjectDefaultsProvider> defaultProviders) {
this.defaultProviders = defaultProviders;
}
}
| ibuildthecloud/dstack | code/framework/object/src/main/java/io/github/ibuildthecloud/dstack/object/postinit/ObjectDefaultsPostInstantiationHandler.java | Java | apache-2.0 | 2,194 | [
30522,
7427,
22834,
1012,
21025,
2705,
12083,
1012,
21307,
19231,
11927,
5369,
20464,
19224,
1012,
16233,
2696,
3600,
1012,
4874,
1012,
2695,
5498,
2102,
1025,
12324,
22834,
1012,
21025,
2705,
12083,
1012,
21307,
19231,
11927,
5369,
20464,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const errors = require('@tryghost/errors');
const should = require('should');
const sinon = require('sinon');
const fs = require('fs-extra');
const moment = require('moment');
const Promise = require('bluebird');
const path = require('path');
const LocalFileStore = require('../../../../../core/server/adapters/storage/LocalFileStorage');
let localFileStore;
const configUtils = require('../../../../utils/configUtils');
describe('Local File System Storage', function () {
let image;
let momentStub;
function fakeDate(mm, yyyy) {
const month = parseInt(mm, 10);
const year = parseInt(yyyy, 10);
momentStub.withArgs('YYYY').returns(year.toString());
momentStub.withArgs('MM').returns(month < 10 ? '0' + month.toString() : month.toString());
}
beforeEach(function () {
// Fake a date, do this once for all tests in this file
momentStub = sinon.stub(moment.fn, 'format');
});
afterEach(function () {
sinon.restore();
configUtils.restore();
});
beforeEach(function () {
sinon.stub(fs, 'mkdirs').resolves();
sinon.stub(fs, 'copy').resolves();
sinon.stub(fs, 'stat').rejects();
sinon.stub(fs, 'unlink').resolves();
image = {
path: 'tmp/123456.jpg',
name: 'IMAGE.jpg',
type: 'image/jpeg'
};
localFileStore = new LocalFileStore();
fakeDate(9, 2013);
});
it('should send correct path to image when date is in Sep 2013', function (done) {
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/IMAGE.jpg');
done();
}).catch(done);
});
it('should send correct path to image when original file has spaces', function (done) {
image.name = 'AN IMAGE.jpg';
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/AN-IMAGE.jpg');
done();
}).catch(done);
});
it('should allow "@" symbol to image for Apple hi-res (retina) modifier', function (done) {
image.name = 'photo@2x.jpg';
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/photo@2x.jpg');
done();
}).catch(done);
});
it('should send correct path to image when date is in Jan 2014', function (done) {
fakeDate(1, 2014);
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2014/01/IMAGE.jpg');
done();
}).catch(done);
});
it('should create month and year directory', function (done) {
localFileStore.save(image).then(function () {
fs.mkdirs.calledOnce.should.be.true();
fs.mkdirs.args[0][0].should.equal(path.resolve('./content/images/2013/09'));
done();
}).catch(done);
});
it('should copy temp file to new location', function (done) {
localFileStore.save(image).then(function () {
fs.copy.calledOnce.should.be.true();
fs.copy.args[0][0].should.equal('tmp/123456.jpg');
fs.copy.args[0][1].should.equal(path.resolve('./content/images/2013/09/IMAGE.jpg'));
done();
}).catch(done);
});
it('can upload two different images with the same name without overwriting the first', function (done) {
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE.jpg')).resolves();
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE-1.jpg')).rejects();
// if on windows need to setup with back slashes
// doesn't hurt for the test to cope with both
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE.jpg')).resolves();
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE-1.jpg')).rejects();
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/IMAGE-1.jpg');
done();
}).catch(done);
});
it('can upload five different images with the same name without overwriting the first', function (done) {
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE.jpg')).resolves();
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE-1.jpg')).resolves();
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE-2.jpg')).resolves();
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE-3.jpg')).resolves();
fs.stat.withArgs(path.resolve('./content/images/2013/09/IMAGE-4.jpg')).rejects();
// windows setup
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE.jpg')).resolves();
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE-1.jpg')).resolves();
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE-2.jpg')).resolves();
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE-3.jpg')).resolves();
fs.stat.withArgs(path.resolve('.\\content\\images\\2013\\Sep\\IMAGE-4.jpg')).rejects();
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/IMAGE-4.jpg');
done();
}).catch(done);
});
describe('read image', function () {
beforeEach(function () {
// we have some example images in our test utils folder
localFileStore.storagePath = path.join(__dirname, '../../../../utils/fixtures/images/');
});
it('success', function (done) {
localFileStore.read({path: 'ghost-logo.png'})
.then(function (bytes) {
bytes.length.should.eql(8638);
done();
});
});
it('success', function (done) {
localFileStore.read({path: '/ghost-logo.png/'})
.then(function (bytes) {
bytes.length.should.eql(8638);
done();
});
});
it('image does not exist', function (done) {
localFileStore.read({path: 'does-not-exist.png'})
.then(function () {
done(new Error('image should not exist'));
})
.catch(function (err) {
(err instanceof errors.NotFoundError).should.eql(true);
err.code.should.eql('ENOENT');
done();
});
});
});
describe('validate extentions', function () {
it('name contains a .\d as extension', function (done) {
localFileStore.save({
name: 'test-1.1.1'
}).then(function (url) {
should.exist(url.match(/test-1.1.1/));
done();
}).catch(done);
});
it('name contains a .zip as extension', function (done) {
localFileStore.save({
name: 'test-1.1.1.zip'
}).then(function (url) {
should.exist(url.match(/test-1.1.1.zip/));
done();
}).catch(done);
});
it('name contains a .jpeg as extension', function (done) {
localFileStore.save({
name: 'test-1.1.1.jpeg'
}).then(function (url) {
should.exist(url.match(/test-1.1.1.jpeg/));
done();
}).catch(done);
});
});
describe('when a custom content path is used', function () {
beforeEach(function () {
const configPaths = configUtils.defaultConfig.paths;
configUtils.set('paths:contentPath', configPaths.appRoot + '/var/ghostcms');
});
it('should send the correct path to image', function (done) {
localFileStore.save(image).then(function (url) {
url.should.equal('/content/images/2013/09/IMAGE.jpg');
done();
}).catch(done);
});
});
// @TODO: remove path.join mock...
describe('on Windows', function () {
const truePathSep = path.sep;
beforeEach(function () {
sinon.stub(path, 'join');
sinon.stub(configUtils.config, 'getContentPath').returns('content/images/');
});
afterEach(function () {
path.sep = truePathSep;
});
it('should return url in proper format for windows', function (done) {
path.sep = '\\';
path.join.returns('content\\images\\2013\\09\\IMAGE.jpg');
localFileStore.save(image).then(function (url) {
if (truePathSep === '\\') {
url.should.equal('/content/images/2013/09/IMAGE.jpg');
} else {
// if this unit test is run on an OS that uses forward slash separators,
// localfilesystem.save() will use a path.relative() call on
// one path with backslash separators and one path with forward
// slashes and it returns a path that needs to be normalized
path.normalize(url).should.equal('/content/images/2013/09/IMAGE.jpg');
}
done();
}).catch(done);
});
});
});
| janvt/Ghost | test/unit/server/adapters/storage/LocalFileStorage.test.js | JavaScript | mit | 9,369 | [
30522,
9530,
3367,
10697,
1027,
5478,
1006,
1005,
1030,
3046,
5603,
14122,
1013,
10697,
1005,
1007,
1025,
9530,
3367,
2323,
1027,
5478,
1006,
1005,
2323,
1005,
1007,
1025,
9530,
3367,
19432,
2078,
1027,
5478,
1006,
1005,
19432,
2078,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: "Use Go Channels to Build a Crawler"
date: 2017-10-11T13:38:24+02:00
---
Learn how to use channels to model your data flow by building a web crawler in Go.<!--more-->
The other day I built a crawler that checks links on your website to see if there are any links that you can update from HTTP to HTTPS.
You can find it at [qvl.io/httpsyet](https://qvl.io/httpsyet).
I came up with an implementation that abstracts the coordination using channels and I would like to share it in this article.
Let's start with the requirements:
The program should start with the URLs we pass to it, find all links on the site, and traverse through all sub-pages recursively.
All external links that start with `http://` should be tested if they also work with `https://`.
And all this should happen in parallel.
*Note that I skip validation and some settings in this article.*
The crawler is a settings `struct` with a single function.
```go
type Crawler struct {
Sites []string // At least one URL.
Out io.Writer // Writes one site per line.
}
func (c Crawler) Run {}
```
The above is similar to having a function that takes the settings as argument, but it allows users of the package to write `httpsyet.Crawler{}.Run()`
<br>
instead of `httpsyet.Run(httpsyet.Crawler{})`.
Now let's see how we can use channels to implement the architecture.
First, we want to output all URLs that can be updated.
We don't simply return them synchronous from the `Run` function,
but instead we write them to an `io.Writer`, which is specified in the `Crawler` as `c.Out`.
Since the crawling should happen in parallel and it is not guaranteed that the `io.Writer` is safe to use concurrent,
writing to the output is better abstracted using a channel:
```go
results := make(chan string)
defer close(results)
go func() {
for r := range results {
if _, err := fmt.Fprintln(c.Out, r); err != nil {
c.Log.Printf("failed to output '%s': %v\n", r, err)
}
}
}()
```
Before we can start the parallel workers for crawling, we need a way to send new sites to the workers.
However, a single channel is not enough, because the workers themselves collect more sites from links, which also need to be queued for crawling and
with a single channel there would be no way to know, that there are no more sites to be crawled.
Additionally, we need to make sure to crawl each URL only once to not get stuck in a loop when links reference to the current or a parent site.
What I came up with is a function `makeQueue` that returns three channels:
```go
func makeQueue() (chan<- site, <-chan site, chan<- int) {
queueCount := 0
wait := make(chan int)
sites := make(chan site)
queue := make(chan site)
visited := map[string]struct{}{}
go func() {
for delta := range wait {
queueCount += delta
if queueCount == 0 {
close(queue)
}
}
}()
go func() {
for s := range queue {
u := s.URL.String()
if _, v := visited[u]; !v {
visited[u] = struct{}{}
sites <- s
} else {
wait <- -1
}
}
close(sites)
close(wait)
}()
return queue, sites, wait
}
```
Let me explain what this does:
- `sites` is a readable channel. This is the channel the workers should *range* over and crawl sites from.
- `queue` is a writable channel in which all sites that need to be crawled should be send.
The sites should not be send to `sites` directly because `queue` internally tracks all sites in a `visited` *set* to make sure each site is only crawled once.
- I said `visited` is a *set* but Go has no *set* data type.
However using a `map` with empty `struct{}` as value type can be used instead.
- `wait` is another writable channel.
Internally `makeQueue` keeps a counter of how many more site will be queued.
By sending values to `wait`, we can change that counter.
For every site that we crawled we send `wait <- -1` and for all new sites we queue we send `wait <- len(sites)`.
As soon as the counter reaches 0, we know there will be no more sites to crawl.
- Since we have the `wait` channel, which tracks when we are done crawling, all channels can be closed internally once done.
The caller of `makeQueue` never has to close any channel.
The caller can simply *range* over `sites` until the `wait` counter reaches 0.
Next, we want to start a number of workers that crawl sites in parallel.
This is such a common scenario that there is a tool for it in the Go standard library, [`WaitGroup`](https://golang.org/pkg/sync/#WaitGroup).
```go
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
// Pass channels to each worker
worker(sites, queue, wait, results)
}()
}
wg.Wait()
```
With this setup, we start 10 workers and block until all of them exit.
Each worker looks like the following. Error handling and logging is removed here.
```go
func (c Crawler) worker(
sites <-chan site,
queue chan<- site,
results chan<- string,
wait chan<- int,
) {
for s := range sites {
urls, shouldUpdate := crawlSite(s)
if shouldUpdate {
results <- fmt.Sprintf("%v %v", s.Parent, s.URL.String())
}
wait <- len(urls) - 1
go queueURLs(queue, urls)
}
}
```
The workers internally *range* over the `sites` channel,
which means that all workers run until `sites` is closed.
As described before, `sites` is closed automatically in `makeQueue` as soon as the wait counter reaches 0.
<br>
The workers send links that can be updated to HTTPS to the `results` channel.
And each worker queues the links found on a site.
The queuing itself happens in a separate Goroutine, which simply sends the links to `queue`.
By updating the wait count before queuing, the queue knows that there are more sites to come.
Note that `wait <- len(urls) - 1` combines counting down -1 for the current site and counting up for all sites to be queued.
If we would count down before counting up, the wait counter could reach 0 before we are actually done.
We could also use a [buffered channel](https://gobyexample.com/channel-buffering) instead of queuing in the background,
but this would force us to set a fixed buffer size.
By using Goroutines to queue in the background, the workers are available to keep crawling sites and we buffer sites that need to be queued in memory.
The last piece missing to start the crawler is queuing initial the sites.
This needs to happen after all the other setup is done, but right before the `wg.Wait()` call:
```go
for _, u := range urls {
queue <- site{
URL: u,
Parent: nil,
}
}
```
Not all details of the implementation have been covered here and I encourage you to have a look at the source [on Github](https://github.com/qvl/httpsyet).
This article focuses on the usage of channels to handle communication in a concurrent scenario, that requires a little more than a single channel, four channels and one `WaitGroup` to be exact.
Please let me know if you have any questions and I would be really interested to hear about other solutions for this scenario!
| jorinvo/home | content/post/use-go-channels-to-build-a-crawler.md | Markdown | cc0-1.0 | 7,010 | [
30522,
1011,
1011,
1011,
2516,
1024,
1000,
2224,
2175,
6833,
2000,
3857,
1037,
13529,
2121,
1000,
3058,
1024,
2418,
1011,
2184,
1011,
2340,
2102,
17134,
1024,
4229,
1024,
2484,
1009,
6185,
1024,
4002,
1011,
1011,
1011,
4553,
2129,
2000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React, {PropTypes} from 'react';
import Anchor from './Anchor';
import getIdFromTitle from '../util/getIdFromTitle';
const Title = ({children}) => (
<h3>
<Anchor id={getIdFromTitle(children)}>
{children}
</Anchor>
</h3>
);
Title.propTypes = {
children: PropTypes.string.isRequired,
};
export default Title;
| Neophy7e/react-bootstrap-typeahead | example/components/Title.react.js | JavaScript | mit | 339 | [
30522,
12324,
10509,
1010,
1063,
17678,
13874,
2015,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
8133,
2013,
1005,
1012,
1013,
8133,
1005,
1025,
12324,
2131,
3593,
19699,
5358,
3775,
9286,
2013,
1005,
1012,
1012,
1013,
21183,
4014,
1013,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2010 Brockmann Consult GmbH (info@brockmann-consult.de)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see http://www.gnu.org/licenses/
*/
package org.esa.beam.framework.datamodel;
/**
* A listener which listens to internal data product changes.
*
* @author Norman Fomferra
* @version $Revision$ $Date$
*/
public interface ProductNodeListener {
/**
* Notified when a node changed.
*
* @param event the product node which the listener to be notified
*/
void nodeChanged(ProductNodeEvent event);
/**
* Notified when a node's data changed.
*
* @param event the product node which the listener to be notified
*/
void nodeDataChanged(ProductNodeEvent event);
/**
* Notified when a node was added.
*
* @param event the product node which the listener to be notified
*/
void nodeAdded(ProductNodeEvent event);
/**
* Notified when a node was removed.
*
* @param event the product node which the listener to be notified
*/
void nodeRemoved(ProductNodeEvent event);
}
| lveci/nest | beam/beam-core/src/main/java/org/esa/beam/framework/datamodel/ProductNodeListener.java | Java | gpl-3.0 | 1,665 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
13899,
5804,
23363,
18289,
1006,
18558,
1030,
13899,
5804,
1011,
23363,
1012,
2139,
1007,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var vueBody = new coreBody({
el: 'body',
data : {
user : "leasunhy",
selectedTab : 'All Questions',
currentOrder : 'vote',
orders : ['vote', 'view', 'time'],
page : 1,
tasks : [],
searchTerm : '',
ckeInit : false,
},
ready: function() {
$('#taskhall-index-sticky').sticky({ offset: 60 });
$('#taskhall-index-order-dropdown').dropdown();
this.updateTasks(this, false);
this.$watch('page', function() {
this.updateTasks(this, false);
});
this.$watch('selectedTab', function() {
this.updateTasks(this, true);
});
this.$watch('currentOrder', function() {
this.updateTasks(this, true);
});
this.$watch('searchTerm', function() {
this.updateTasks(this, true);
});
this.$watch('tasks', function() {
$('.question.author').popup({
inline: true,
position: 'right center',
width: '300px',
});
});
},
computed : {
unansweredOnly : function() {
return this.selectedTab === 'Unanswered';
}
},
methods: {
showAskModal : function() {
$('#taskhall-index-ask-modal').modal('show');
if (!this.ckeInit) {
this.ckeInit = true;
CKEDITOR.replace('askcontent');
}
},
updateTasks : function(store, resetPage) {
if (resetPage) store.page = 1;
var url = '/co-dev/list?page=' + store.page +
'&order=' + store.currentOrder +
'&keyword=' + store.searchTerm +
(store.unansweredOnly ? '&unanswered=True' : '');
$.get(url, function(data) {
store.tasks = data.tasks;
console.log(data);
});
$('.taskhall-index.question.item > .question.main > .detail').ellipsis();
$("html, body").animate({ scrollTop: 0 }, "slow");
},
},
});
| igemsoftware/SYSU-Software-2015 | server/static/js/taskhall/taskhall_index.js | JavaScript | lgpl-3.0 | 2,207 | [
30522,
13075,
24728,
15878,
7716,
2100,
1027,
2047,
4563,
23684,
1006,
1063,
3449,
1024,
1005,
2303,
1005,
1010,
2951,
1024,
1063,
5310,
1024,
1000,
12203,
19729,
10536,
1000,
1010,
3479,
2696,
2497,
1024,
1005,
2035,
3980,
1005,
1010,
2783... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import Tipp from 'src/models/TippModel';
/**
* Save a new tipp
* @param {Object} req Request object
* @param {Object} res Response object
* @param {Function} next Callback for next middleware in route
*/
export const postTipp = (req, res, next) => new Tipp(req.body).save()
.then(data => res.json(data))
.catch(err => next(err));
/**
* Delete a tipp, needs authentication
* @param {Object} req Request object
* @param {Object} res Response object
* @param {Function} next Callback for next middleware in route
*/
export const deleteTipp = (req, res, next) => Tipp.remove({
_id: req.params.id,
})
.then(data => res.json(data))
.catch(err => next(err));
/**
* Update a tipp
* @param {Objec} req
* @param {Object} res
* @param {Function} next Callback for next middleware in route
*/
export const putTipp = (req, res, next) => Tipp.findByIdAndUpdate(req.params.id, {
$set: req.body,
}, {
new: true,
})
.then(data => res.json(data))
.catch(err => next(err));
/**
* Get a list of all tipps
* @param {Object} req
* @param {Object} res
* @param {Function} next Callback for next middleware in route
*/
export const listTipps = (req, res, next) => Tipp
.find({}, '-email')
.sort('-created')
.then(data => res.json(data))
.catch(err => next(err));
/**
* Get one tipp
* @param {Object} req
* @param {Object} res
* @param {Function} next Callback for next middleware in route
*/
export const getTipp = (req, res, next) => Tipp.findOne({
_id: req.params.id,
})
.then(data => res.json(data))
.catch(err => next(err));
| tuelsch/bolg | src/server/api/tipp-api.js | JavaScript | mit | 1,567 | [
30522,
12324,
5955,
2361,
2013,
1005,
5034,
2278,
1013,
4275,
1013,
5955,
9737,
10244,
2140,
1005,
1025,
1013,
1008,
1008,
1008,
3828,
1037,
2047,
5955,
2361,
1008,
1030,
11498,
2213,
1063,
4874,
1065,
2128,
4160,
5227,
4874,
1008,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""
Contains exception classes specific to this project.
"""
| electronic-library/electronic-library-core | library/exceptions.py | Python | gpl-3.0 | 62 | [
30522,
1000,
1000,
1000,
3397,
6453,
4280,
3563,
2000,
2023,
2622,
1012,
1000,
1000,
1000,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2020 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/
defined('_HZEXEC_') or die();
$canDo = \Components\Cart\Admin\Helpers\Permissions::getActions('orders');
Toolbar::title(Lang::txt('COM_CART') . ': Items Ordered', 'cart.png');
if ($canDo->get('core.admin'))
{
Toolbar::preferences($this->option, '550');
Toolbar::spacer();
}
Toolbar::custom('downloadorders', 'download.png', '', 'Download CSV', false);
Toolbar::spacer();
Toolbar::help('downloads');
?>
<?php
$this->view('_submenu')
->display();
?>
<form action="<?php echo Route::url('index.php?option=' . $this->option . '&controller=' . $this->controller); ?>" method="post" name="adminForm" id="adminForm">
<table class="adminlist">
<thead>
<tr>
<th scope="col"><?php echo Html::grid('sort', 'COM_CART_SKU_ID', 'sId', @$this->filters['sort_Dir'], @$this->filters['sort']); ?></th>
<th scope="col">Product</th>
<th scope="col">QTY</th>
<th scope="col">Price</th>
<th scope="col"><?php echo Html::grid('sort', 'COM_CART_ORDER_ID', 'tId', @$this->filters['sort_Dir'], @$this->filters['sort']); ?></th>
<th scope="col"><?php echo Html::grid('sort', 'COM_CART_ORDER_PALCED', 'tLastUpdated', @$this->filters['sort_Dir'], @$this->filters['sort']); ?></th>
<th scope="col"><?php echo Html::grid('sort', 'COM_CART_ORDERED_BY', 'Name', @$this->filters['sort_Dir'], @$this->filters['sort']); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="7"><?php
// Initiate paging
echo $this->pagination(
$this->total,
$this->filters['start'],
$this->filters['limit']
);
?></td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
$i = 0;
foreach ($this->rows as $row)
{
$itemInfo = $row->itemInfo['info'];
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php
$sId = '<a href="' . Route::url('index.php?option=com_storefront&controller=skus&task=edit&id=' . $itemInfo->sId) . '">' . $this->escape(stripslashes($row->sId)) . '</a>';
?>
<span><?php echo $sId; ?></span>
</td>
<td>
<?php
$product = '<a href="' . Route::url('index.php?option=com_storefront&controller=products&task=edit&id=' . $itemInfo->pId) . '">' . $this->escape(stripslashes($itemInfo->pName)) . '</a>';
if (!stripslashes($itemInfo->pName))
{
$product = '<span class="missing">Product n/a</span>';
}
if (!stripslashes($itemInfo->sSku))
{
$product .= ', <span class="missing">SKU n/a</span>';
}
else {
$product .= ', ' . '<a href="' . Route::url('index.php?option=com_storefront&controller=skus&task=edit&id=' . $row->sId) . '">' . $this->escape(stripslashes($itemInfo->sSku)) . '</a>';
}
?>
<span><?php echo $product; ?></span>
</td>
<td>
<span><?php echo $this->escape(stripslashes($row->tiQty)); ?></span>
</td>
<td>
<span><?php echo $this->escape(stripslashes($row->tiPrice)); ?></span>
</td>
<td>
<?php
$tId = '<a href="' . Route::url('index.php?option=com_cart&controller=orders&task=view&id=' . $row->tId) . '">' . $this->escape(stripslashes($row->tId)) . '</a>';
?>
<span><?php echo $tId; ?></span>
</td>
<td>
<span><?php echo $this->escape(stripslashes($row->tLastUpdated)); ?></span>
</td>
<td>
<span><?php echo $this->escape(stripslashes($row->name)); ?></span>
</td>
</tr>
<?php
$i++;
$k = 1 - $k;
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="<?php echo $this->option ?>" />
<input type="hidden" name="controller" value="<?php echo $this->controller; ?>" />
<input type="hidden" name="task" value="<?php echo $this->task; ?>" />
<input type="hidden" name="filter_order" value="<?php echo $this->filters['sort']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->filters['sort_Dir']; ?>" />
<?php echo Html::input('token'); ?>
</form> | hubzero/hubzero-cms | core/components/com_cart/admin/views/orders/tmpl/downloadorders.php | PHP | gpl-2.0 | 4,044 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
7427,
9594,
6290,
2080,
1011,
4642,
2015,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2384,
1011,
12609,
1996,
22832,
1997,
1996,
2118,
1997,
2662,
1012,
1008,
1030,
6105,
8299,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Thu Jan 31 02:04:59 UTC 2013 -->
<TITLE>
org.apache.hadoop.streaming.io (Hadoop 1.1.2 API)
</TITLE>
<META NAME="date" CONTENT="2013-01-31">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="../../../../../org/apache/hadoop/streaming/io/package-summary.html" target="classFrame">org.apache.hadoop.streaming.io</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Classes</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="IdentifierResolver.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">IdentifierResolver</A>
<BR>
<A HREF="InputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">InputWriter</A>
<BR>
<A HREF="OutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">OutputReader</A>
<BR>
<A HREF="RawBytesInputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">RawBytesInputWriter</A>
<BR>
<A HREF="RawBytesOutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">RawBytesOutputReader</A>
<BR>
<A HREF="TextInputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TextInputWriter</A>
<BR>
<A HREF="TextOutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TextOutputReader</A>
<BR>
<A HREF="TypedBytesInputWriter.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TypedBytesInputWriter</A>
<BR>
<A HREF="TypedBytesOutputReader.html" title="class in org.apache.hadoop.streaming.io" target="classFrame">TypedBytesOutputReader</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
| markkerzner/nn_kove | hadoop/docs/api/org/apache/hadoop/streaming/io/package-frame.html | HTML | apache-2.0 | 1,975 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright ยฉ 2007 Apple Inc. All Rights Reserved.
Disclaimer: IMPORTANT: This Apple software is supplied to you by
Apple Inc. ("Apple") in consideration of your agreement to the
following terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of these
terms. If you do not agree with these terms, please do not use,
install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc.
may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple. Except
as expressly stated in this notice, no other rights or licenses, express
or implied, are granted by Apple herein, including but not limited to
any patent rights that may be infringed by your derivative works or by
other works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*=============================================================================
AUOutputElement.h
=============================================================================*/
#ifndef __AUOutput_h__
#define __AUOutput_h__
#include "AUScopeElement.h"
#include "AUBuffer.h"
/*! @class AUOutputElement */
class AUOutputElement : public AUIOElement {
public:
/*! @ctor AUOutputElement */
AUOutputElement(AUBase *audioUnit);
// AUElement override
/*! @method SetStreamFormat */
virtual OSStatus SetStreamFormat(const CAStreamBasicDescription &desc);
/*! @method NeedsBufferSpace */
virtual bool NeedsBufferSpace() const { return true; }
};
#endif // __AUOutput_h__
| ptrv/supercollider | platform/mac/SuperColliderAU/AUSDK/AUOutputElement.h | C | gpl-3.0 | 3,116 | [
30522,
1013,
1008,
9385,
1075,
2289,
6207,
4297,
1012,
2035,
2916,
9235,
1012,
5860,
19771,
5017,
1024,
2590,
1024,
2023,
6207,
4007,
2003,
8127,
2000,
2017,
2011,
6207,
4297,
1012,
1006,
1000,
6207,
1000,
1007,
1999,
9584,
1997,
2115,
38... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @license Highstock JS v8.0.3 (2020-03-06)
* @module highcharts/indicators/wma
* @requires highcharts
* @requires highcharts/modules/stock
*
* Indicator series type for Highstock
*
* (c) 2010-2019 Kacper Madej
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../indicators/wma.src.js';
| cdnjs/cdnjs | ajax/libs/highcharts/8.0.3/es-modules/masters/indicators/wma.src.js | JavaScript | mit | 321 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
26836,
17406,
1046,
2015,
15754,
1012,
1014,
1012,
1017,
1006,
12609,
1011,
6021,
1011,
5757,
1007,
1008,
1030,
11336,
2152,
7507,
21217,
1013,
20390,
1013,
1059,
2863,
1008,
1030,
5942,
2152,
7507... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* This file is part of ePipe
* Copyright (C) 2019, Logical Clocks AB. All rights reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef TBLSTAILER_H
#define TBLSTAILER_H
#include "TableTailer.h"
#include "tables/hive/TBLSTable.h"
#include "tables/hive/SDSTable.h"
#include "tables/hive/TABCOLSTATSTable.h"
#include "tables/hive/TABLEPARAMSTable.h"
class TBLSTailer : public TableTailer<TBLSRow> {
public:
TBLSTailer(Ndb *ndb, const int poll_maxTimeToWait, const Barrier barrier)
: TableTailer(ndb, new TBLSTable(), poll_maxTimeToWait, barrier) {}
virtual ~TBLSTailer() {}
private:
SDSTable mSDSTable;
TABLEPARAMSTable mTABLEPARAMSTable;
TABCOLSTATSTable mTABCOLSTATSTable;
virtual void handleEvent(NdbDictionary::Event::TableEvent eventType, TBLSRow
pre, TBLSRow row) {
LOG_INFO("Delete TBLS event received. Primary Key value: " << pre.mTBLID);
mTABLEPARAMSTable.remove(mNdbConnection, pre.mTBLID);
mTABCOLSTATSTable.remove(mNdbConnection, pre.mTBLID);
mSDSTable.remove(mNdbConnection, pre.mSDID);
}
};
#endif /* TBLSTAILER_H */
| hopshadoop/ePipe | include/hive/TBLSTailer.h | C | gpl-2.0 | 1,763 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
4958,
15457,
1008,
9385,
1006,
1039,
1007,
10476,
1010,
11177,
20940,
11113,
1012,
2035,
2916,
9235,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
* Copyright 2002-2004 Wilmer van der Gaast and others *
\********************************************************************/
/* Some stuff to fetch, save and handle nicknames for your buddies */
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License with
the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
if not, write to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA
*/
void nick_set( account_t *acc, const char *handle, const char *nick );
char *nick_get( account_t *acc, const char *handle );
void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] );
int nick_saved( account_t *acc, const char *handle );
void nick_del( account_t *acc, const char *handle );
void nick_strip( char *nick );
int nick_ok( const char *nick );
int nick_lc( char *nick );
int nick_uc( char *nick );
int nick_cmp( const char *a, const char *b );
char *nick_dup( const char *nick );
| jianingy/bitlbee-clone | nick.h | C | gpl-2.0 | 1,717 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'oauth/signature/base'
module OAuth::Signature
class PLAINTEXT < Base
implements 'plaintext'
def signature
signature_base_string
end
def ==(cmp_signature)
signature == escape(cmp_signature)
end
def signature_base_string
secret
end
def secret
escape(super)
end
end
end
| maximilien/people_finder | vendor/plugins/oauth/lib/oauth/signature/plaintext.rb | Ruby | mit | 345 | [
30522,
5478,
1005,
1051,
4887,
2705,
1013,
8085,
1013,
2918,
1005,
11336,
1051,
4887,
2705,
1024,
1024,
8085,
2465,
5810,
18209,
1026,
2918,
22164,
1005,
5810,
18209,
1005,
13366,
8085,
8085,
1035,
2918,
1035,
5164,
2203,
13366,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Cookbook Name:: openstack_model_t
# Recipe:: nova-compute-node
#
# Copyright (c) 2015 The Authors, All Rights
%w{nova-compute sysfsutils python-guestfs libguestfs-tools}.each do |pkg|
package pkg do
action [:install]
end
end
bash "libguestfs stuff" do
user "root"
cwd "/tmp"
creates "/etc/nova/libguestfs_setup"
code <<-EOH
STATUS=0
/usr/sbin/update-guestfs-appliance || STATUS=1
chmod 0644 /boot/vmlinuz* || STATUS=1
touch /etc/nova/libguestfs_setup
exit $STATUS
EOH
end
template "/etc/nova/nova.conf" do
source "nova-compute-node.conf.erb"
owner "nova"
group "nova"
mode "0644"
notifies :restart, 'service[nova-compute]', :delayed
end
template "/etc/nova/nova-compute.conf" do
source "nova-compute.conf.erb"
owner "nova"
group "nova"
mode "0644"
notifies :restart, 'service[nova-compute]', :delayed
end
service 'nova-compute' do
supports :restart => true, :reload => true
action :enable
end
file '/var/lib/nova/nova.sqlite' do
action :delete
end
| chef-partners/openstack-model-t | recipes/nova-compute-node.rb | Ruby | apache-2.0 | 1,024 | [
30522,
1001,
1001,
5660,
8654,
2171,
1024,
1024,
7480,
2696,
3600,
1035,
2944,
1035,
1056,
1001,
17974,
1024,
1024,
6846,
1011,
24134,
1011,
13045,
1001,
1001,
9385,
1006,
1039,
1007,
2325,
1996,
6048,
1010,
2035,
2916,
1003,
1059,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
#define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/installer/util/master_preferences.h"
class GURL;
class Profile;
namespace base {
class CommandLine;
class FilePath;
}
namespace content {
class WebContents;
}
namespace user_prefs {
class PrefRegistrySyncable;
}
// This namespace contains the chrome first-run installation actions needed to
// fully test the custom installer. It also contains the opposite actions to
// execute during uninstall. When the first run UI is ready we won't
// do the actions unconditionally. Currently the only action is to create a
// desktop shortcut.
//
// The way we detect first-run is by looking at a 'sentinel' file.
// If it does not exist we understand that we need to do the first time
// install work for this user. After that the sentinel file is created.
namespace first_run {
enum AutoImportState {
AUTO_IMPORT_NONE = 0,
AUTO_IMPORT_CALLED = 1 << 0,
AUTO_IMPORT_PROFILE_IMPORTED = 1 << 1,
AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED = 1 << 2,
};
enum ProcessMasterPreferencesResult {
FIRST_RUN_PROCEED = 0, // Proceed with first run.
EULA_EXIT_NOW, // Should immediately exit due to EULA flow.
};
// See ProcessMasterPreferences for more info about this structure.
struct MasterPrefs {
MasterPrefs();
~MasterPrefs();
// TODO(macourteau): as part of the master preferences refactoring effort,
// remove items from here which are being stored temporarily only to be later
// dumped into local_state. Also see related TODO in chrome_browser_main.cc.
bool make_chrome_default_for_user = false;
std::vector<GURL> new_tabs;
std::vector<GURL> bookmarks;
std::string import_bookmarks_path;
std::string suppress_default_browser_prompt_for_version;
};
void RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry);
// Returns true if Chrome should behave as if this is the first time Chrome is
// run for this user.
bool IsChromeFirstRun();
#if defined(OS_MACOSX)
// Returns true if |command_line|'s switches explicitly specify that first run
// should be suppressed in the current run.
bool IsFirstRunSuppressed(const base::CommandLine& command_line);
#endif
// Returns whether metrics reporting is currently opt-in. This is used to
// determine if the enable metrics reporting checkbox on first-run should be
// initially checked. Opt-in means it is not initially checked, opt-out means it
// is. This is not guaranteed to be correct outside of the first-run situation,
// as the default may change over time. For that, use
// GetMetricsReportingDefaultState in
// chrome/browser/metrics/metrics_reporting_state.h, which gives a value that
// was stored during first-run.
bool IsMetricsReportingOptIn();
// Creates the first run sentinel if needed. This should only be called after
// the process singleton has been grabbed by the current process
// (http://crbug.com/264694).
void CreateSentinelIfNeeded();
// Returns the first run sentinel creation time. This only requires I/O
// permission on the sequence it is first called on.
base::Time GetFirstRunSentinelCreationTime();
// Resets the first run status and cached first run sentinel creation time.
// This is needed for unit tests which are runned in the same process.
void ResetCachedSentinelDataForTesting();
// Sets a flag that will cause ShouldShowWelcomePage to return true
// exactly once, so that the browser loads the welcome tab once the
// message loop gets going.
void SetShouldShowWelcomePage();
// Returns true if the welcome page should be shown.
//
// This will return true only once: The first time it is called after
// SetShouldShowWelcomePage() is called.
bool ShouldShowWelcomePage();
// Returns true if |contents| hosts one of the welcome pages.
bool IsOnWelcomePage(content::WebContents* contents);
// Iterates over the given tabs, replacing "magic words" designated for
// use in Master Preferences files with corresponding URLs.
std::vector<GURL> ProcessMasterPrefsTabs(const std::vector<GURL>& tabs);
// Sets a flag that will cause ShouldDoPersonalDataManagerFirstRun()
// to return true exactly once, so that the browser loads
// PersonalDataManager once the main message loop gets going.
void SetShouldDoPersonalDataManagerFirstRun();
// Returns true if the autofill personal data manager first-run action
// should be taken.
//
// This will return true only once, the first time it is called after
// SetShouldDoPersonalDataManagerFirstRun() is called.
bool ShouldDoPersonalDataManagerFirstRun();
// Automatically imports items requested by |profile|'s configuration (sum of
// policies and master prefs). Also imports bookmarks from file if
// |import_bookmarks_path| is not empty.
void AutoImport(Profile* profile,
const std::string& import_bookmarks_path);
// Does remaining first run tasks. This can pop the first run consent dialog on
// linux. |make_chrome_default_for_user| is the value of
// kMakeChromeDefaultForUser in master_preferences which contributes to the
// decision of making chrome default browser in post import tasks.
void DoPostImportTasks(Profile* profile, bool make_chrome_default_for_user);
// Returns the current state of AutoImport as recorded in a bitfield formed from
// values in AutoImportState.
uint16_t auto_import_state();
// Set a master preferences file path that overrides platform defaults.
void SetMasterPrefsPathForTesting(const base::FilePath& master_prefs);
// Loads master preferences from the master preference file into the installer
// master preferences. Returns the pointer to installer::MasterPreferences
// object if successful; otherwise, returns nullptr.
std::unique_ptr<installer::MasterPreferences> LoadMasterPrefs();
// The master_preferences is a JSON file with the same entries as the
// 'Default\Preferences' file. This function locates this file from a standard
// location, processes it, and uses its content to initialize the preferences
// for the profile pointed to by |user_data_dir|. After processing the file,
// this function returns a value from the ProcessMasterPreferencesResult enum,
// indicating whether the first run flow should be shown, skipped, or whether
// the browser should exit.
//
// This function overwrites any existing Preferences file and is only meant to
// be invoked on first run.
//
// See chrome/installer/util/master_preferences.h for a description of
// 'master_preferences' file.
ProcessMasterPreferencesResult ProcessMasterPreferences(
const base::FilePath& user_data_dir,
std::unique_ptr<installer::MasterPreferences> install_prefs,
MasterPrefs* out_prefs);
} // namespace first_run
#endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_
| endlessm/chromium-browser | chrome/browser/first_run/first_run.h | C | bsd-3-clause | 7,006 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.samza.coordinator.metadatastore;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.samza.Partition;
import org.apache.samza.SamzaException;
import org.apache.samza.config.Config;
import org.apache.samza.coordinator.stream.CoordinatorStreamKeySerde;
import org.apache.samza.coordinator.stream.messages.CoordinatorStreamMessage;
import org.apache.samza.metadatastore.MetadataStore;
import org.apache.samza.metrics.MetricsRegistry;
import org.apache.samza.serializers.JsonSerde;
import org.apache.samza.serializers.Serde;
import org.apache.samza.system.IncomingMessageEnvelope;
import org.apache.samza.system.OutgoingMessageEnvelope;
import org.apache.samza.system.SystemAdmin;
import org.apache.samza.system.SystemConsumer;
import org.apache.samza.system.SystemFactory;
import org.apache.samza.system.SystemProducer;
import org.apache.samza.system.SystemStream;
import org.apache.samza.system.SystemStreamMetadata;
import org.apache.samza.system.SystemStreamMetadata.SystemStreamPartitionMetadata;
import org.apache.samza.system.SystemStreamPartition;
import org.apache.samza.system.SystemStreamPartitionIterator;
import org.apache.samza.util.CoordinatorStreamUtil;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An implementation of the {@link MetadataStore} interface where the metadata of the samza job is stored in coordinator stream.
*
* This class is thread safe.
*
* It is recommended to use {@link NamespaceAwareCoordinatorStreamStore}. This will enable the single CoordinatorStreamStore connection
* to be shared by the multiple {@link NamespaceAwareCoordinatorStreamStore} instances.
*/
public class CoordinatorStreamStore implements MetadataStore {
private static final Logger LOG = LoggerFactory.getLogger(CoordinatorStreamStore.class);
private static final String SOURCE = "SamzaContainer";
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private final Config config;
private final SystemStream coordinatorSystemStream;
private final SystemStreamPartition coordinatorSystemStreamPartition;
private final SystemProducer systemProducer;
private final SystemConsumer systemConsumer;
private final SystemAdmin systemAdmin;
// Namespaced key to the message byte array.
private final Map<String, byte[]> messagesReadFromCoordinatorStream = new ConcurrentHashMap<>();
private final Object bootstrapLock = new Object();
private final AtomicBoolean isInitialized = new AtomicBoolean(false);
private SystemStreamPartitionIterator iterator;
public CoordinatorStreamStore(Config config, MetricsRegistry metricsRegistry) {
this.config = config;
this.coordinatorSystemStream = CoordinatorStreamUtil.getCoordinatorSystemStream(config);
this.coordinatorSystemStreamPartition = new SystemStreamPartition(coordinatorSystemStream, new Partition(0));
SystemFactory systemFactory = CoordinatorStreamUtil.getCoordinatorSystemFactory(config);
this.systemProducer = systemFactory.getProducer(this.coordinatorSystemStream.getSystem(), config, metricsRegistry);
this.systemConsumer = systemFactory.getConsumer(this.coordinatorSystemStream.getSystem(), config, metricsRegistry);
this.systemAdmin = systemFactory.getAdmin(this.coordinatorSystemStream.getSystem(), config);
}
@VisibleForTesting
protected CoordinatorStreamStore(Config config, SystemProducer systemProducer, SystemConsumer systemConsumer, SystemAdmin systemAdmin) {
this.config = config;
this.systemConsumer = systemConsumer;
this.systemProducer = systemProducer;
this.systemAdmin = systemAdmin;
this.coordinatorSystemStream = CoordinatorStreamUtil.getCoordinatorSystemStream(config);
this.coordinatorSystemStreamPartition = new SystemStreamPartition(coordinatorSystemStream, new Partition(0));
}
@Override
public void init() {
if (isInitialized.compareAndSet(false, true)) {
LOG.info("Starting the coordinator stream system consumer with config: {}.", config);
registerConsumer();
systemConsumer.start();
systemProducer.register(SOURCE);
systemProducer.start();
iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
readMessagesFromCoordinatorStream();
} else {
LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition);
}
}
@Override
public byte[] get(String namespacedKey) {
readMessagesFromCoordinatorStream();
return messagesReadFromCoordinatorStream.get(namespacedKey);
}
@Override
public void put(String namespacedKey, byte[] value) {
// 1. Store the namespace and key into correct fields of the CoordinatorStreamKey and convert the key to bytes.
CoordinatorMessageKey coordinatorMessageKey = deserializeCoordinatorMessageKeyFromJson(namespacedKey);
CoordinatorStreamKeySerde keySerde = new CoordinatorStreamKeySerde(coordinatorMessageKey.getNamespace());
byte[] keyBytes = keySerde.toBytes(coordinatorMessageKey.getKey());
// 2. Set the key, message in correct fields of {@link OutgoingMessageEnvelope} and publish it to the coordinator stream.
OutgoingMessageEnvelope envelope = new OutgoingMessageEnvelope(coordinatorSystemStream, 0, keyBytes, value);
systemProducer.send(SOURCE, envelope);
}
@Override
public void delete(String namespacedKey) {
// Since kafka doesn't support individual message deletion, store value as null for a namespacedKey to delete.
put(namespacedKey, null);
}
@Override
public Map<String, byte[]> all() {
readMessagesFromCoordinatorStream();
return Collections.unmodifiableMap(messagesReadFromCoordinatorStream);
}
private void readMessagesFromCoordinatorStream() {
synchronized (bootstrapLock) {
while (iterator.hasNext()) {
IncomingMessageEnvelope envelope = iterator.next();
byte[] keyAsBytes = (byte[]) envelope.getKey();
Serde<List<?>> serde = new JsonSerde<>();
Object[] keyArray = serde.fromBytes(keyAsBytes).toArray();
CoordinatorStreamMessage coordinatorStreamMessage = new CoordinatorStreamMessage(keyArray, new HashMap<>());
String namespacedKey = serializeCoordinatorMessageKeyToJson(coordinatorStreamMessage.getType(), coordinatorStreamMessage.getKey());
if (envelope.getMessage() != null) {
messagesReadFromCoordinatorStream.put(namespacedKey, (byte[]) envelope.getMessage());
} else {
messagesReadFromCoordinatorStream.remove(namespacedKey);
}
}
}
}
@Override
public void close() {
try {
LOG.info("Stopping the coordinator stream system consumer.", config);
systemAdmin.stop();
systemProducer.stop();
systemConsumer.stop();
} catch (Exception e) {
LOG.error("Exception occurred when closing the metadata store:", e);
}
}
@Override
public void flush() {
try {
systemProducer.flush(SOURCE);
} catch (Exception e) {
LOG.error("Exception occurred when flushing the metadata store:", e);
throw new SamzaException("Exception occurred when flushing the metadata store:", e);
}
}
/**
* <p>
* Fetches the metadata of the topic partition of coordinator stream. Registers the oldest offset
* for the topic partition of coordinator stream with the coordinator system consumer.
* </p>
*/
private void registerConsumer() {
LOG.debug("Attempting to register system stream partition: {}", coordinatorSystemStreamPartition);
String streamName = coordinatorSystemStreamPartition.getStream();
Map<String, SystemStreamMetadata> systemStreamMetadataMap = systemAdmin.getSystemStreamMetadata(Sets.newHashSet(streamName));
SystemStreamMetadata systemStreamMetadata = systemStreamMetadataMap.get(streamName);
Preconditions.checkNotNull(systemStreamMetadata, String.format("System stream metadata does not exist for stream: %s.", streamName));
SystemStreamPartitionMetadata systemStreamPartitionMetadata = systemStreamMetadata.getSystemStreamPartitionMetadata().get(coordinatorSystemStreamPartition.getPartition());
Preconditions.checkNotNull(systemStreamPartitionMetadata, String.format("System stream partition metadata does not exist for: %s.", coordinatorSystemStreamPartition));
String startingOffset = systemStreamPartitionMetadata.getOldestOffset();
LOG.info("Registering system stream partition: {} with offset: {}.", coordinatorSystemStreamPartition, startingOffset);
systemConsumer.register(coordinatorSystemStreamPartition, startingOffset);
}
/**
*
* Serializes the {@link CoordinatorMessageKey} into a json string.
*
* @param type the type of the coordinator message.
* @param key the key associated with the type
* @return the CoordinatorMessageKey serialized to a json string.
*/
public static String serializeCoordinatorMessageKeyToJson(String type, String key) {
try {
CoordinatorMessageKey coordinatorMessageKey = new CoordinatorMessageKey(key, type);
return OBJECT_MAPPER.writeValueAsString(coordinatorMessageKey);
} catch (IOException e) {
throw new SamzaException(String.format("Exception occurred when serializing metadata for type: %s, key: %s", type, key), e);
}
}
/**
* Deserializes the @param coordinatorMsgKeyAsString in json format to {@link CoordinatorMessageKey}.
* @param coordinatorMsgKeyAsJson the serialized CoordinatorMessageKey in json format.
* @return the deserialized CoordinatorMessageKey.
*/
public static CoordinatorMessageKey deserializeCoordinatorMessageKeyFromJson(String coordinatorMsgKeyAsJson) {
try {
return OBJECT_MAPPER.readValue(coordinatorMsgKeyAsJson, CoordinatorMessageKey.class);
} catch (IOException e) {
throw new SamzaException(String.format("Exception occurred when deserializing the coordinatorMsgKey: %s", coordinatorMsgKeyAsJson), e);
}
}
/**
* <p>
* Represents the key of a message in the coordinator stream.
*
* Coordinator message key is composite. It has both the type of the message
* and the key associated with the type in it.
* </p>
*/
public static class CoordinatorMessageKey {
// Represents the key associated with the type
private final String key;
// Represents the type of the message.
private final String namespace;
CoordinatorMessageKey(@JsonProperty("key") String key,
@JsonProperty("namespace") String namespace) {
this.key = key;
this.namespace = namespace;
}
public String getKey() {
return this.key;
}
public String getNamespace() {
return this.namespace;
}
}
}
| abhishekshivanna/samza | samza-core/src/main/java/org/apache/samza/coordinator/metadatastore/CoordinatorStreamStore.java | Java | apache-2.0 | 11,941 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
6095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#! nqp
# Copyright (C) 2009-2010, Parrot Foundation.
class Ops::Compiler::Actions is HLL::Actions;
our $OP;
our $OPLIB;
INIT {
pir::load_bytecode("nqp-setting.pbc");
$OPLIB := 0;
}
method TOP($/) {
make $<body>.ast;
}
method body($/) {
my $past := PAST::Stmts.new(
:node($/)
);
$past<preamble> := PAST::Stmts.new(
:node($/)
);
$past<ops> := PAST::Stmts.new(
:node($/)
);
for $<preamble> {
$past<preamble>.push($_<preamble_guts>);
}
for $<op> {
my $ops := $_.ast;
my $op_skip_table;
if $OPLIB {
$op_skip_table := $OPLIB.op_skip_table;
}
for @($ops) -> $op {
if $OPLIB && !$op_skip_table.exists($op.full_name) || !$OPLIB {
$past<ops>.push($op);
}
}
}
make $past;
}
method preamble($/) {
make PAST::Op.new(
:node($/),
:pasttype('preamble'),
~$<preamble_guts>
);
}
method op ($/, $key?) {
if $key eq 'start' {
# Handling flags.
my %flags := hash();
for $<op_flag> {
%flags{~$_<identifier>} := 1;
}
my @args := @($<signature>.ast);
my @norm_args := normalize_args(@args);
$OP := Ops::Op.new(
:name(~$<op_name>),
);
if ~$<op_name> eq 'runinterp' {
$OP.add_jump('PARROT_JUMP_RELATIVE');
}
$OP<flags> := %flags;
$OP<args> := @args;
$OP<type> := ~$<op_type>;
$OP<normalized_args> := @norm_args;
}
else {
# Handle op body
$OP.push($<op_body>.ast);
if !$OP<flags><flow> {
$OP[0].push(self.make_write_barrier) if $OP.need_write_barrier;
my $goto_next := PAST::Op.new(
:pasttype('macro'),
:name('goto_offset'),
self.opsize,
);
$OP[0].push($goto_next);
}
my $past := PAST::Stmts.new(
:node($/)
);
# We have to clone @norm_args. Otherwise it will be destroyed...
my @variants := expand_args(pir::clone__PP($OP<normalized_args>));
if @variants {
for @variants {
my $new_op := pir::clone__PP($OP);
$new_op<arg_types> := $_;
$past.push($new_op);
}
}
else {
$past.push($OP);
}
make $past;
}
}
# Normalize args
# For each arg produce LoL of all available variants
# E.g. "in" will produce "i" and "ic" variants
#
# type one of <i p s n>
# direction one of <i o io>
# is_label one of <0 1>
sub normalize_args(@args) {
my @result;
for @args -> $arg {
my $res := PAST::Var.new(
:isdecl(1)
);
if $arg<type> eq 'LABEL' {
$res<type> := 'i';
$res<is_label> := 1;
}
else {
$res<is_label> := 0;
}
if $arg<type> eq 'INTKEY' {
$res<type> := 'ki';
}
elsif $arg<type> ne 'LABEL' {
$res<type> := lc(substr($arg<type>, 0, 1));
}
my $use := $arg<direction>;
if $use eq 'in' {
$res<variant> := $res<type> ~ "c";
$res<direction> := 'i';
}
elsif $use eq 'invar' {
$res<direction> := 'i';
}
elsif $use eq 'inconst' {
$res<type> := $res<type> ~ "c";
$res<direction> := 'i';
}
elsif $use eq 'inout' {
$res<direction> := 'io';
}
else {
$res<direction> := 'o';
}
@result.push($res);
}
@result;
}
=begin
=item C<expand_args(@args)>
Given an argument list, returns a list of all the possible argument
combinations.
=end
sub expand_args(@args) {
return list() unless @args;
my $arg := @args.shift;
my @var := list($arg<type>);
if $arg<variant> {
@var.push($arg<variant>);
}
my @list := expand_args(@args);
unless +@list {
return @var;
}
my @results;
for @list -> $l {
for @var -> $v {
# NQP can't handle it automagically. So wrap $l into list.
my @l := pir::does__IPS($l, 'array') ?? $l !! list($l);
@results.push(list($v, |@l));
}
}
@results;
}
method signature($/) {
my $past := PAST::Stmts.new(
:node($/)
);
for $<op_param> {
$past.push($_.ast);
}
make $past;
}
method op_param($/) {
my $past := PAST::Var.new(
:node($/),
:isdecl(1)
);
# We have to store 2 "types". Just set 2 properties on Var for now
$past<direction> := ~$<op_param_direction>;
$past<type> := ~$<op_param_type>;
make $past;
}
method op_body($/) {
make $<blockoid>.ast;
}
method op_macro:sym<expr offset>($/) {
make PAST::Op.new(
:pasttype<macro>,
:name<expr_offset>,
$<arg>.ast,
);
}
method op_macro:sym<goto offset>($/) {
$OP.add_jump('PARROT_JUMP_RELATIVE');
my $past := PAST::Op.new(
:pasttype<macro>,
:name<goto_offset>,
$<arg>.ast,
);
if $OP.need_write_barrier {
$past := PAST::Block.new(
self.make_write_barrier,
$past,
);
}
make $past;
}
method op_macro:sym<expr address>($/) {
make PAST::Op.new(
:pasttype<macro>,
:name<expr_address>,
$<arg>.ast,
);
}
method op_macro:sym<goto address>($/) {
my $past := PAST::Op.new(
:pasttype<macro>,
:name<goto_address>,
$<arg>.ast,
);
if $OP.need_write_barrier {
$past := PAST::Block.new(
self.make_write_barrier,
$past,
);
}
make $past;
}
method op_macro:sym<expr next>($/) {
make PAST::Op.new(
:pasttype<macro>,
:name<expr_offset>,
self.opsize,
);
}
method op_macro:sym<goto next>($/) {
$OP.add_jump('PARROT_JUMP_RELATIVE');
my $past := PAST::Op.new(
:pasttype<macro>,
:name<goto_offset>,
self.opsize,
);
if $OP.need_write_barrier {
$past := PAST::Block.new(
self.make_write_barrier,
$past,
);
}
make $past;
}
method op_macro:sym<restart next> ($/) {
#say('# op_macro');
# restart NEXT() -> restart_offset(opsize()); goto_address(0)
my $past := PAST::Stmts.new(
PAST::Op.new(
:pasttype<macro>,
:name<restart_offset>,
self.opsize,
),
PAST::Op.new(
:pasttype<macro>,
:name<goto_address>,
PAST::Val.new(
:value<0>
)
),
);
$past.unshift(self.make_write_barrier) if $OP.need_write_barrier;
make $past;
}
method blockoid ($/) {
my $past := PAST::Block.new(:node($/));
$past.push($_) for @($<mixed_content>.ast);
make $past;
}
method mixed_content ($/) {
my $past := PAST::Stmts.new(:node($/));
@($_.ast).map(-> $_ { $past.push($_) }) for $<declarator>;
$past.push($_) for @($<statement_list>.ast);
make $past;
}
method declarator ($/) {
my $past := PAST::Stmts.new(:node($/));
for $<declarator_name> {
my $decl := PAST::Var.new(
:node($_),
:isdecl(1),
:name(~$_<variable>),
:vivibase(~$<type_declarator>),
);
$decl.viviself($_<EXPR>[0].ast) if $_<EXPR>[0];
$decl<array_size> := ~$_<array_size><VALUE> if $_<array_size>;
$decl<pointer> := $_<pointer>.join('');
$past.push($decl);
}
make $past;
}
method statement_list ($/) {
my $past := PAST::Stmts.new(:node($/));
$past.push($_.ast) for $<labeled_statement>;
# Avoid wrapping single blockoid into Stmts.
make (+@($past) == 1) && ($past[0] ~~ PAST::Block)
?? $past[0]
!! $past;
}
method labeled_statement ($/) {
# FIXME!!!
my $past := $<statement>
?? $<statement>.ast
!! PAST::Op.new();
# FIXME!!! We need some semantics here.
$past<label> := ~$<label> if $<label>;
make $past;
}
method statement ($/) {
my $past;
if $<statement_control> {
$past := $<statement_control>.ast;
}
elsif $<blockoid> {
$past := $<blockoid>.ast;
}
elsif $<EXPR> {
$past := $<EXPR>.ast;
}
elsif $<c_macro> {
$past := $<c_macro>.ast;
}
else {
$/.CURSOR.panic("Unknown content in statement");
}
make $past;
}
method c_macro:sym<define> ($/) {
my $past := PAST::Op.new(
:pasttype<macro_define>,
$<name>,
);
$past<macro_args> := $<c_macro_args>[0].ast if $<c_macro_args>;
$past<body> := $<body>[0].ast if $<body>;
make $past;
}
method c_macro:sym<if> ($/) {
my $past := PAST::Op.new(
:pasttype<macro_if>,
~$<condition>, # FIXME! We have to parse condition somehow.
$<then>.ast,
);
$past.push($<else>[0].ast) if $<else>;
make $past;
}
method c_macro:sym<ifdef> ($/) {
my $past := PAST::Op.new(
:pasttype<macro_if>,
'defined(' ~ ~$<name> ~ ')', # FIXME! We have to parse condition somehow.
$<then>.ast,
);
$past.push($<else>[0].ast) if $<else>;
make $past;
}
method term:sym<concatenate_strings> ($/) {
make ~$<identifier> ~ ' ' ~ ~$<quote>;
}
method term:sym<identifier> ($/) {
# XXX Type vs Variable
make PAST::Var.new(
:name(~$/),
);
}
method term:sym<call> ($/) {
my $past := PAST::Op.new(
:pasttype('call'),
:name(~$<identifier>),
);
if ($<arglist><arg>) {
$past.push($_.ast) for $<arglist><arg>;
}
make $past;
}
method arg ($/) {
make $<type_declarator>
?? ~$<type_declarator>
!! $<EXPR>.ast;
}
method term:sym<reg> ($/) {
make PAST::Var.new(
:name(+$<num>),
:node($/),
:scope('register'), # Special scope
);
}
method term:sym<macro> ($/) {
make $<op_macro>.ast;
}
method term:sym<int> ($/) {
# TODO Handle type
make PAST::Val.new(
:value(~$/),
:returns<int>
);
}
method term:sym<str> ($/) {
make PAST::Val.new(
:value(~$<quote>),
:returns<string>
);
}
method term:sym<float_constant_long> ($/) { # longer to work-around lack of LTM
make PAST::Val.new(
:value(~$/[0]),
:returns<float>
);
}
method infix:sym<?:> ($/) {
my $past := PAST::Op.new(
:pasttype<if>,
);
# Override to emit ternary ops in .to_c
$past<ternary> := 1;
make $past;
}
method statement_control:sym<if> ($/) {
my $past := PAST::Op.new(
:pasttype<if>,
$<EXPR>.ast,
$<then>.ast,
);
$past.push($<else>[0].ast) if $<else>;
make $past;
}
method statement_control:sym<while> ($/) {
my $past := PAST::Op.new(
:pasttype<while>,
$<condition>.ast,
$<statement_list>.ast,
);
make $past;
}
method statement_control:sym<do-while> ($/) {
my $past := PAST::Op.new(
:pasttype<do-while>,
$<blockoid>.ast,
$<condition>.ast,
);
make $past;
}
method statement_control:sym<for> ($/) {
my $past := PAST::Op.new(
:pasttype<for>,
$<init> ?? $<init>[0].ast !! undef,
$<test> ?? $<test>[0].ast !! undef,
$<step> ?? $<step>[0].ast !! undef,
$<statement_list>.ast,
);
make $past;
}
# Not real "C" switch. Just close enough
method statement_control:sym<switch> ($/) {
my $past := PAST::Op.new(
:pasttype<switch>,
$<test>.ast,
$<statement_list>.ast,
);
make $past;
}
method statement_control:sym<break> ($/) {
my $past := PAST::Op.new();
$past<control> := 'break';
make $past;
}
method statement_control:sym<continue> ($/) {
my $past := PAST::Op.new();
$past<control> := 'continue';
make $past;
}
method statement_or_block ($/) {
$<labeled_statement>
?? make PAST::Block.new(
$<labeled_statement>.ast
)
!! make $<blockoid>.ast
}
method circumfix:sym<( )> ($/) {
my $past := $<EXPR>.ast;
# Indicate that we need wrapping.
$past<wrap> := 1;
make $past;
}
method postcircumfix:sym<[ ]> ($/) {
make PAST::Var.new(
$<EXPR>.ast,
:scope('keyed'),
);
}
# For casting we just set "returns" of EXPR.
method prefix:sym<( )> ($/) {
make PAST::Op.new(
:returns(~$<type_declarator>),
);
}
# Helper method for generating PAST::Val with opsize
method opsize () {
make PAST::Val.new(
:value($OP.size),
:returns('int'),
);
}
method make_write_barrier () {
make PAST::Op.new(
:pasttype<call>,
:name<PARROT_GC_WRITE_BARRIER>,
PAST::Var.new(
:name<interp>
),
PAST::Op.new(
:pasttype<call>,
:name<CURRENT_CONTEXT>,
PAST::Var.new(
:name<interp>
)
)
);
}
# Local Variables:
# mode: perl6
# fill-column: 100
# End:
# vim: expandtab ft=perl6 shiftwidth=4:
| FROGGS/parrot | compilers/opsc/src/Ops/Compiler/Actions.pm | Perl | artistic-2.0 | 13,317 | [
30522,
1001,
999,
1050,
4160,
2361,
1001,
9385,
1006,
1039,
1007,
2268,
1011,
2230,
1010,
22530,
3192,
1012,
2465,
23092,
1024,
1024,
21624,
1024,
1024,
4506,
2003,
1044,
3363,
1024,
1024,
4506,
30524,
1999,
4183,
1063,
14255,
2099,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.type;
import com.facebook.presto.operator.scalar.AbstractTestFunctions;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.block.BlockBuilder;
import com.google.common.net.InetAddresses;
import io.airlift.slice.Slices;
import org.testng.annotations.Test;
import static com.facebook.presto.spi.function.OperatorType.HASH_CODE;
import static com.facebook.presto.spi.function.OperatorType.INDETERMINATE;
import static com.facebook.presto.spi.type.BigintType.BIGINT;
import static com.facebook.presto.spi.type.BooleanType.BOOLEAN;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.type.IpAddressType.IPADDRESS;
import static com.facebook.presto.type.IpPrefixType.IPPREFIX;
import static java.lang.System.arraycopy;
public class TestIpPrefixOperators
extends AbstractTestFunctions
{
@Test
public void testVarcharToIpPrefixCast()
{
assertFunction("CAST('::ffff:1.2.3.4/24' AS IPPREFIX)", IPPREFIX, "1.2.3.0/24");
assertFunction("CAST('192.168.0.0/24' AS IPPREFIX)", IPPREFIX, "192.168.0.0/24");
assertFunction("CAST('255.2.3.4/0' AS IPPREFIX)", IPPREFIX, "0.0.0.0/0");
assertFunction("CAST('255.2.3.4/1' AS IPPREFIX)", IPPREFIX, "128.0.0.0/1");
assertFunction("CAST('255.2.3.4/2' AS IPPREFIX)", IPPREFIX, "192.0.0.0/2");
assertFunction("CAST('255.2.3.4/4' AS IPPREFIX)", IPPREFIX, "240.0.0.0/4");
assertFunction("CAST('1.2.3.4/8' AS IPPREFIX)", IPPREFIX, "1.0.0.0/8");
assertFunction("CAST('1.2.3.4/16' AS IPPREFIX)", IPPREFIX, "1.2.0.0/16");
assertFunction("CAST('1.2.3.4/24' AS IPPREFIX)", IPPREFIX, "1.2.3.0/24");
assertFunction("CAST('1.2.3.255/25' AS IPPREFIX)", IPPREFIX, "1.2.3.128/25");
assertFunction("CAST('1.2.3.255/26' AS IPPREFIX)", IPPREFIX, "1.2.3.192/26");
assertFunction("CAST('1.2.3.255/28' AS IPPREFIX)", IPPREFIX, "1.2.3.240/28");
assertFunction("CAST('1.2.3.255/30' AS IPPREFIX)", IPPREFIX, "1.2.3.252/30");
assertFunction("CAST('1.2.3.255/32' AS IPPREFIX)", IPPREFIX, "1.2.3.255/32");
assertFunction("CAST('2001:0db8:0000:0000:0000:ff00:0042:8329/128' AS IPPREFIX)", IPPREFIX, "2001:db8::ff00:42:8329/128");
assertFunction("CAST('2001:db8::ff00:42:8329/128' AS IPPREFIX)", IPPREFIX, "2001:db8::ff00:42:8329/128");
assertFunction("CAST('2001:db8:0:0:1:0:0:1/128' AS IPPREFIX)", IPPREFIX, "2001:db8::1:0:0:1/128");
assertFunction("CAST('2001:db8:0:0:1::1/128' AS IPPREFIX)", IPPREFIX, "2001:db8::1:0:0:1/128");
assertFunction("CAST('2001:db8::1:0:0:1/128' AS IPPREFIX)", IPPREFIX, "2001:db8::1:0:0:1/128");
assertFunction("CAST('2001:DB8::FF00:ABCD:12EF/128' AS IPPREFIX)", IPPREFIX, "2001:db8::ff00:abcd:12ef/128");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/0' AS IPPREFIX)", IPPREFIX, "::/0");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/1' AS IPPREFIX)", IPPREFIX, "8000::/1");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/2' AS IPPREFIX)", IPPREFIX, "c000::/2");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/4' AS IPPREFIX)", IPPREFIX, "f000::/4");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/8' AS IPPREFIX)", IPPREFIX, "ff00::/8");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/16' AS IPPREFIX)", IPPREFIX, "ffff::/16");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/32' AS IPPREFIX)", IPPREFIX, "ffff:ffff::/32");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/48' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff::/48");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/64' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff::/64");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/80' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff::/80");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/96' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff::/96");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/112' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:0/112");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/120' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00/120");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/124' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0/124");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/126' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc/126");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/127' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe/127");
assertFunction("CAST('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128' AS IPPREFIX)", IPPREFIX, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128");
assertFunction("IPPREFIX '10.0.0.0/32'", IPPREFIX, "10.0.0.0/32");
assertFunction("IPPREFIX '64:ff9b::10.0.0.0/128'", IPPREFIX, "64:ff9b::a00:0/128");
assertInvalidCast("CAST('facebook.com/32' AS IPPREFIX)", "Cannot cast value to IPPREFIX: facebook.com/32");
assertInvalidCast("CAST('localhost/32' AS IPPREFIX)", "Cannot cast value to IPPREFIX: localhost/32");
assertInvalidCast("CAST('2001:db8::1::1/128' AS IPPREFIX)", "Cannot cast value to IPPREFIX: 2001:db8::1::1/128");
assertInvalidCast("CAST('2001:zxy::1::1/128' AS IPPREFIX)", "Cannot cast value to IPPREFIX: 2001:zxy::1::1/128");
assertInvalidCast("CAST('789.1.1.1/32' AS IPPREFIX)", "Cannot cast value to IPPREFIX: 789.1.1.1/32");
assertInvalidCast("CAST('192.1.1.1' AS IPPREFIX)", "Cannot cast value to IPPREFIX: 192.1.1.1");
assertInvalidCast("CAST('192.1.1.1/128' AS IPPREFIX)", "Cannot cast value to IPPREFIX: 192.1.1.1/128");
}
@Test
public void testIpPrefixToVarcharCast()
{
assertFunction("CAST(IPPREFIX '::ffff:1.2.3.4/32' AS VARCHAR)", VARCHAR, "1.2.3.4/32");
assertFunction("CAST(IPPREFIX '::ffff:102:304/32' AS VARCHAR)", VARCHAR, "1.2.3.4/32");
assertFunction("CAST(IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329/128");
assertFunction("CAST(IPPREFIX '2001:db8::ff00:42:8329/128' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329/128");
assertFunction("CAST(IPPREFIX '2001:db8:0:0:1:0:0:1/128' AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1/128");
assertFunction("CAST(CAST('1.2.3.4/32' AS IPPREFIX) AS VARCHAR)", VARCHAR, "1.2.3.4/32");
assertFunction("CAST(CAST('2001:db8:0:0:1::1/128' AS IPPREFIX) AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1/128");
assertFunction("CAST(CAST('64:ff9b::10.0.0.0/128' AS IPPREFIX) AS VARCHAR)", VARCHAR, "64:ff9b::a00:0/128");
}
@Test
public void testIpPrefixToIpAddressCast()
{
assertFunction("CAST(IPPREFIX '1.2.3.4/32' AS IPADDRESS)", IPADDRESS, "1.2.3.4");
assertFunction("CAST(IPPREFIX '1.2.3.4/24' AS IPADDRESS)", IPADDRESS, "1.2.3.0");
assertFunction("CAST(IPPREFIX '::1/128' AS IPADDRESS)", IPADDRESS, "::1");
assertFunction("CAST(IPPREFIX '2001:db8::ff00:42:8329/128' AS IPADDRESS)", IPADDRESS, "2001:db8::ff00:42:8329");
assertFunction("CAST(IPPREFIX '2001:db8::ff00:42:8329/64' AS IPADDRESS)", IPADDRESS, "2001:db8::");
}
@Test
public void testIpAddressToIpPrefixCast()
{
assertFunction("CAST(IPADDRESS '1.2.3.4' AS IPPREFIX)", IPPREFIX, "1.2.3.4/32");
assertFunction("CAST(IPADDRESS '::ffff:102:304' AS IPPREFIX)", IPPREFIX, "1.2.3.4/32");
assertFunction("CAST(IPADDRESS '::1' AS IPPREFIX)", IPPREFIX, "::1/128");
assertFunction("CAST(IPADDRESS '2001:db8::ff00:42:8329' AS IPPREFIX)", IPPREFIX, "2001:db8::ff00:42:8329/128");
}
@Test
public void testEquals()
{
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' = IPPREFIX '2001:db8::ff00:42:8329/128'", BOOLEAN, true);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) = CAST('::ffff:1.2.3.4/32' AS IPPREFIX)", BOOLEAN, true);
assertFunction("IPPREFIX '192.168.0.0/32' = IPPREFIX '::ffff:192.168.0.0/32'", BOOLEAN, true);
assertFunction("IPPREFIX '10.0.0.0/32' = IPPREFIX '::ffff:a00:0/32'", BOOLEAN, true);
assertFunction("CAST('1.2.3.4/24' AS IPPREFIX) = IPPREFIX '1.2.3.5/24'", BOOLEAN, true);
assertFunction("IPPREFIX '2001:db8::ff00:42:8329/128' = IPPREFIX '2001:db8::ff00:42:8300/128'", BOOLEAN, false);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) = IPPREFIX '1.2.3.5/32'", BOOLEAN, false);
assertFunction("CAST('1.2.0.0/24' AS IPPREFIX) = IPPREFIX '1.2.0.0/25'", BOOLEAN, false);
}
@Test
public void testDistinctFrom()
{
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' IS DISTINCT FROM IPPREFIX '2001:db8::ff00:42:8329/128'", BOOLEAN, false);
assertFunction("CAST(NULL AS IPPREFIX) IS DISTINCT FROM CAST(NULL AS IPPREFIX)", BOOLEAN, false);
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' IS DISTINCT FROM IPPREFIX '2001:db8::ff00:42:8328/128'", BOOLEAN, true);
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' IS DISTINCT FROM CAST(NULL AS IPPREFIX)", BOOLEAN, true);
assertFunction("CAST(NULL AS IPPREFIX) IS DISTINCT FROM IPPREFIX '2001:db8::ff00:42:8328/128'", BOOLEAN, true);
}
@Test
public void testNotEquals()
{
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' != IPPREFIX '1.2.3.4/32'", BOOLEAN, true);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) <> CAST('1.2.3.5/32' AS IPPREFIX)", BOOLEAN, true);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) != IPPREFIX '1.2.3.4/32'", BOOLEAN, false);
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' <> IPPREFIX '2001:db8::ff00:42:8329/128'", BOOLEAN, false);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) <> CAST('::ffff:1.2.3.4/32' AS IPPREFIX)", BOOLEAN, false);
}
@Test
public void testOrderOperators()
{
assertFunction("IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128' > IPPREFIX '1.2.3.4/32'", BOOLEAN, true);
assertFunction("IPPREFIX '1.2.3.4/32' > IPPREFIX '2001:0db8:0000:0000:0000:ff00:0042:8329/128'", BOOLEAN, false);
assertFunction("CAST('1.2.3.4/32' AS IPPREFIX) < CAST('1.2.3.5/32' AS IPPREFIX)", BOOLEAN, true);
assertFunction("CAST('1.2.3.5/32' AS IPPREFIX) < CAST('1.2.3.4/32' AS IPPREFIX)", BOOLEAN, false);
assertFunction("CAST('1.2.0.0/24' AS IPPREFIX) < CAST('1.2.0.0/25' AS IPPREFIX)", BOOLEAN, true);
assertFunction("IPPREFIX '::1/128' <= CAST('1.2.3.5/32' AS IPPREFIX)", BOOLEAN, true);
assertFunction("IPPREFIX '1.2.3.5/32' <= CAST('1.2.3.5/32' AS IPPREFIX)", BOOLEAN, true);
assertFunction("IPPREFIX '1.2.3.6/32' <= CAST('1.2.3.5/32' AS IPPREFIX)", BOOLEAN, false);
assertFunction("IPPREFIX '::1/128' >= IPPREFIX '::/128'", BOOLEAN, true);
assertFunction("IPPREFIX '::1/128' >= IPPREFIX '::1/128'", BOOLEAN, true);
assertFunction("IPPREFIX '::/128' >= IPPREFIX '::1/128'", BOOLEAN, false);
assertFunction("IPPREFIX '::1/128' BETWEEN IPPREFIX '::/128' AND IPPREFIX '::1234/128'", BOOLEAN, true);
assertFunction("IPPREFIX '::2222/128' BETWEEN IPPREFIX '::/128' AND IPPREFIX '::1234/128'", BOOLEAN, false);
}
@Test
public void testIndeterminate()
{
assertOperator(INDETERMINATE, "CAST(null AS IPPREFIX)", BOOLEAN, true);
assertOperator(INDETERMINATE, "IPPREFIX '::2222/128'", BOOLEAN, false);
}
@Test
public void testHash()
{
assertOperator(HASH_CODE, "CAST(null AS IPPREFIX)", BIGINT, null);
assertOperator(HASH_CODE, "IPPREFIX '::2222/128'", BIGINT, hashFromType("::2222/128"));
}
private static long hashFromType(String address)
{
BlockBuilder blockBuilder = IPPREFIX.createBlockBuilder(null, 1);
String[] parts = address.split("/");
byte[] bytes = new byte[IPPREFIX.getFixedSize()];
byte[] addressBytes = InetAddresses.forString(parts[0]).getAddress();
arraycopy(addressBytes, 0, bytes, 0, 16);
bytes[IPPREFIX.getFixedSize() - 1] = (byte) Integer.parseInt(parts[1]);
IPPREFIX.writeSlice(blockBuilder, Slices.wrappedBuffer(bytes));
Block block = blockBuilder.build();
return IPPREFIX.hash(block, 0);
}
}
| ptkool/presto | presto-main/src/test/java/com/facebook/presto/type/TestIpPrefixOperators.java | Java | apache-2.0 | 13,240 | [
30522,
1013,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6855,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
//
// VPL for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// VPL for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class to show two files diff
*
* @package mod_vpl
* @copyright 2012 Juan Carlos Rodrรญguez-del-Pino
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Juan Carlos Rodrรญguez-del-Pino <jcrodriguez@dis.ulpgc.es>
*/
require_once dirname(__FILE__).'/../../../config.php';
require_once dirname(__FILE__).'/../locallib.php';
require_once dirname(__FILE__).'/../vpl.class.php';
require_once dirname(__FILE__).'/../vpl_submission.class.php';
require_once dirname(__FILE__).'/../views/sh_base.class.php';
require_once dirname(__FILE__).'/similarity_factory.class.php';
require_once dirname(__FILE__).'/similarity_base.class.php';
class vpl_diff{
/**
* Remove chars and digits
* @param $line string to process
* @return string without chars and digits
*/
static function removeAlphaNum($line){
$ret='';
$l= strlen($line);
//Parse line to remove alphanum chars
for($i=0; $i<$l; $i++){
$c=$line[$i];
if(!ctype_alnum($c) && $c != ' '){
$ret.=$c;
}
}
return $ret;
}
/**
* Calculate the similarity of two lines
* @param $line1
* @param $line2
* @return int (3 => trimmed equal, 2 =>removeAlphaNum , 1 => start of line , 0 => not equal)
*/
static function diffLine($line1,$line2){
//TODO Refactor.
//This is a bad solution that must be rebuild to consider diferent languages
//Compare trimed text
$line1=trim($line1);
$line2=trim($line2);
if($line1==$line2){
if(strlen($line1)>0){
return 3;
}else{
return 1;
}
}
//Compare filtered text (removing alphanum)
$rAN1=self::removeAlphaNum($line1);
$limit = strlen($rAN1);
if($limit>0){
if($limit>3){
$limite = 3;
}
if(strncmp($rAN1,self::removeAlphaNum($line2),$limit) == 0){
return 2;
}
}
//Compare start of line
$l=4;
if($l>strlen($line1)){
$l=strlen($line1);
}
if($l>strlen($line2)){
$l=strlen($line2);
}
for($i=0; $i<$l; ++$i){
if($line1[$i] !=$line2[$i]){
break;
}
}
return $i>0 ? 1:0;
}
static function newLineInfo($type,$ln1,$ln2=0){
$ret = new StdClass();
$ret->type = $type;
$ret->ln1 = $ln1;
$ret->ln2 = $ln2;
return $ret;
}
/**
* Initialize used matrix
* @param $matrix matrix to initialize
* @param $prev matrix to initialize
* @param $nl1 number of rows
* @param $nl2 number of columns
* @return void
*/
static function initAuxiliarMatrices(&$matrix,&$prev,$nl1,$nl2){
// matrix[0..nl1+1][0..nl2+1]=0
$row = array_pad(array(),$nl2+1,0);
$matrix = array_pad(array(),$nl1+1,$row);
// prev[0..nl1+1][0..nl2+1]=0
$prev = $matrix;
//update first column
for($i=0; $i<=$nl1;$i++){
$matriz[$i][0]=0;
$prev[$i][0]=-1;
}
//update first row
for($j=1; $j<=$nl2;$j++){
$matriz[0][$j]=0;
$prev[0][$j]=1;
}
}
/**
* Calculate diff for two array of lines
* @param $lines1 array of string
* @param $lines2 array of string
* @return array of objects with info to show the two array of lines
*/
static function calculateDiff($lines1,$lines2){
$ret = array();
$nl1=count($lines1);
$nl2=count($lines2);
if($nl1==0 && $nl2==0){
return false;
}
if($nl1==0){ //There is no first file
foreach($lines2 as $pos => $line){
$ret[] = self::newLineInfo('>',0,$pos+1);
}
return $ret;
}
if($nl2==0){ //There is no second file
foreach($lines1 as $pos => $line){
$ret[] = self::newLineInfo('<',$pos+1);
}
return $ret;
}
self::initAuxiliarMatrices($matrix,$prev,$nl1,$nl2);
//Matrix processing
for($i=1; $i <= $nl1;$i++){
$line=$lines1[$i-1];
for($j=1; $j<=$nl2;$j++){
if($matrix[$i][$j-1]>$matrix[$i-1][$j]) {
$max=$matrix[$i][$j-1];
$best = 1;
}else{
$max=$matrix[$i-1][$j];
$best = -1;
}
$prize=self::diffLine($line,$lines2[$j-1]);
if($matrix[$i-1][$j-1]+$prize>=$max){
$max=$matrix[$i-1][$j-1]+$prize;
$best = 0;
}
$matrix[$i][$j]=$max;
$prev[$i][$j]=$best;
}
}
//Calculate show info
$limit=$nl1+$nl2;
$pairs = array();
$pi=$nl1;
$pj=$nl2;
while((!($pi == 0 && $pj == 0)) && $limit>0){
$pair = new stdClass();
$pair->i = $pi;
$pair->j = $pj;
$pairs[]=$pair;
$p = $prev[$pi][$pj];
if($p == 0){
$pi--;
$pj--;
}elseif($p == -1){
$pi--;
}else{
$pj--;
}
$limit--;
}
krsort($pairs);
$prevpair = new stdClass();
$prevpair->i=0;
$prevpair->j=0;
foreach($pairs as $pair){
if($pair->i == $prevpair->i+1 && $pair->j == $prevpair->j+1){ //Regular advance
if($lines1[$pair->i-1] == $lines2[$pair->j-1]){ //Equals
$ret[]=self::newLineInfo('=',$pair->i,$pair->j);
}else{
$ret[]=self::newLineInfo('#',$pair->i,$pair->j);
}
}elseif($pair->i == $prevpair->i+1){ //Removed next line
$ret[]=self::newLineInfo('<',$pair->i);
}elseif($pair->j == $prevpair->j+1){ //Added one line
$ret[]=self::newLineInfo('>',0,$pair->j);
}else{
debugging("Internal error ".print_r($pair,true)." ".print_r($prevpair,true));
}
$prevpair=$pair;
}
return $ret;
}
static function show($filename1, $data1, $HTMLheader1, $filename2, $data2, $HTMLheader2) {
//Get file lines
$nl = vpl_detect_newline($data1);
$lines1 = explode($nl,$data1);
$nl = vpl_detect_newline($data2);
$lines2 = explode($nl,$data2);
//Get dif as an array of info
$diff = self::calculateDiff($lines1,$lines2);
if($diff === false){
return;
}
$separator= array('<'=>' <<< ', '>'=>' >>> ','='=>' === ','#'=>' ### ');
$emptyline=" \n";
$data1='';
$data2='';
$datal1='';
$datal2='';
$diffl='';
$lines1[-1]='';
$lines2[-1]='';
foreach($diff as $line){
$diffl.= $separator[$line->type]."\n";
if($line->ln1){
$datal1.=$line->ln1." \n";
$data1.=$lines1[$line->ln1-1]."\n";
}else{
$data1.=" \n";
$datal1.=$emptyline;
}
if($line->ln2){
$datal2.=$line->ln2." \n";
$data2.=$lines2[$line->ln2-1]."\n";
}else{
$data2.=" \n";
$datal2.=$emptyline;
}
}
echo '<div style="width: 100%;min-width: 950px; overflow: auto">';
//Header
echo '<div style="float:left; width: 445px">';
echo $HTMLheader1;
echo '</div>';
echo '<div style="float:left; width: 445px">';
echo $HTMLheader2;
echo '</div>';
echo '<div style="clear:both;"></div>';
//Files
echo '<div style="float:left; text-align: right">';
echo '<pre class="'.vpl_sh_base::c_general.'">';
echo $datal1;
echo '</pre>';
echo '</div>';
echo '<div style="float:left; width: 390px; overflow:auto">';
$shower= vpl_sh_factory::get_sh($filename1);
$shower->print_file($filename1,$data1,false);
echo '</div>';
echo '<div style="float:left">';
echo '<pre class="'.vpl_sh_base::c_general.'">';
echo $diffl;
echo '</pre>';
echo '</div>';
echo '<div style="float:left; text-align: right;">';
echo '<pre class="'.vpl_sh_base::c_general.'">';
echo $datal2;
echo '</pre>';
echo '</div>';
echo '<div style="float:left; width: 390px; overflow:auto">';
$shower= vpl_sh_factory::get_sh($filename2);
$shower->print_file($filename2,$data2,false);
echo '</div>';
echo '</div>';
echo '<div style="clear:both;"></div>';
}
static function vpl_get_similfile($f,$vpl,&$HTMLheader,&$filename,&$data){
global $DB;
$HTMLheader='';
$filename='';
$data='';
$type = required_param('type'.$f, PARAM_INT);
if($type==1){
$subid = required_param('subid'.$f, PARAM_INT);
$filename = required_param('filename'.$f, PARAM_TEXT);
$subinstance = $DB->get_record('vpl_submissions',array('id' => $subid));
if($subinstance !== false){
$vpl = new mod_vpl(false,$subinstance->vpl);
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
$submission = new mod_vpl_submission($vpl,$subinstance);
$user = $DB->get_record('user', array('id' => $subinstance->userid));
if($user){
$HTMLheader .='<a href="'.vpl_mod_href('/forms/submissionview.php',
'id',$vpl->get_course_module()->id,'userid',$subinstance->userid).'">';
}
$HTMLheader .=s($filename).' ';
if($user){
$HTMLheader .= '</a>';
$HTMLheader .= $vpl->user_fullname_picture($user);
}
$fg = $submission->get_submitted_fgm();
$data = $fg->getFileData($filename);
\mod_vpl\event\vpl_diff_viewed::log($submission);
}
}elseif($type == 2){
//FIXME adapt to moodle 2.x
/*
global $CFG;
$dirname = required_param('dirname'.$f,PARAM_RAW);
$filename = required_param('filename'.$f,PARAM_RAW);
$base=$CFG->dataroot.'/'.$vpl->get_course()->id.'/';
$data = file_get_contents($base.$dirname.'/'.$filename);
$HTMLheader .= $filename.' '.optional_param('username'.$f,'',PARAM_TEXT);
*/
}elseif($type == 3){
global $CFG;
$data='';
$zipname = required_param('zipfile'.$f,PARAM_RAW);
$filename = required_param('filename'.$f,PARAM_RAW);
$HTMLheader .= $filename.' '.optional_param('username'.$f,'',PARAM_TEXT);
$ext = strtoupper(pathinfo($zipfile,PATHINFO_EXTENSION));
if($ext != 'ZIP'){
print_error('nozipfile');
}
$zip = new ZipArchive();
$zipfilename=self::get_zip_filepath($zipname);
if($zip->open($zipfilename)){
$data=$zip->getFromName($filename);
$zip->close();
}
}else{
print_error('type error');
}
}
}
| InstaLearn/phonegaptest3 | mod/vpl/similarity/diff.class.php | PHP | gpl-3.0 | 12,386 | [
30522,
1026,
1029,
25718,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
21210,
2140,
2005,
6888,
2571,
1011,
8299,
1024,
1013,
1013,
21210,
2140,
1012,
4487,
2015,
1012,
17359,
26952,
2278,
1012,
9686,
1013,
1013,
1013,
1013,
1013,
21210,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2013, Inmite s.r.o. (www.inmite.eu).
*
* All rights reserved. This source code can be used only for purposes specified
* by the given license contract signed by the rightful deputy of Inmite s.r.o.
* This source code can be used only by the owner of the license.
*
* Any disputes arising in respect of this agreement (license) shall be brought
* before the Municipal Court of Prague.
*/
package eu.inmite.android.lib.validations.form.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Validate for minimal length of input string.
* @author Tomas Vondracek
*/
@Target(value= ElementType.FIELD)
@Retention(value= RetentionPolicy.RUNTIME)
public @interface MinLength {
/**
* minimal length
*/
int value();
ComparingPolicy policy() default ComparingPolicy.INCLUSIVE;
int messageId() default 0;
int order() default 1000;
}
| douglasjunior/android-validation-komensky | library/src/main/java/eu/inmite/android/lib/validations/form/annotations/MinLength.java | Java | apache-2.0 | 991 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
1010,
1999,
23419,
1055,
1012,
1054,
1012,
1051,
1012,
1006,
7479,
1012,
1999,
23419,
1012,
7327,
1007,
1012,
1008,
1008,
2035,
2916,
9235,
1012,
2023,
3120,
3642,
2064,
2022,
2109,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# linux/arch/arm/boot/compressed/Makefile
#
# create a compressed vmlinuz image from the original vmlinux
#
OBJS =
plus_sec := $(call as-instr,.arch_extension sec,+sec)
# Ensure that MMCIF loader code appears early in the image
# to minimise that number of bocks that have to be read in
# order to load it.
ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y)
OBJS += mmcif-sh7372.o
endif
# Ensure that SDHI loader code appears early in the image
# to minimise that number of bocks that have to be read in
# order to load it.
ifeq ($(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI),y)
OBJS += sdhi-shmobile.o
OBJS += sdhi-sh7372.o
endif
AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
AFLAGS_head.o += -Wa,-march=armv7-a$(plus_sec)
AFLAGS_misc.o += -Wa,-march=armv7-a$(plus_sec)
AFLAGS_decompress.o += -Wa,-march=armv7-a$(plus_sec)
AFLAGS_lib1funcs.o += -Wa,-march=armv7-a$(plus_sec)
AFLAGS_ashldi3.o += -Wa,-march=armv7-a$(plus_sec)
# Make sure we can use these during final link
CFLAGS_misc.o += -ffat-lto-objects
CFLAGS_decompress.o += -ffat-lto-objects
CFLAGS_string.o += -ffat-lto-objects
HEAD = head.o
OBJS += misc.o decompress.o
ifeq ($(CONFIG_KERNEL_LZ4),y)
CFLAGS_decompress.o := -Os
endif
FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
# string library code (-Os is enforced to keep it much smaller)
OBJS += string.o
CFLAGS_string.o += -Os
#
# Architecture dependencies
#
ifeq ($(CONFIG_ARCH_ACORN),y)
OBJS += ll_char_wr.o font.o
endif
ifeq ($(CONFIG_ARCH_SHARK),y)
OBJS += head-shark.o ofw-shark.o
endif
ifeq ($(CONFIG_ARCH_P720T),y)
# Borrow this code from SA1100
OBJS += head-sa1100.o
endif
ifeq ($(CONFIG_ARCH_SA1100),y)
OBJS += head-sa1100.o
endif
ifeq ($(CONFIG_ARCH_VT8500),y)
OBJS += head-vt8500.o
endif
ifeq ($(CONFIG_CPU_XSCALE),y)
OBJS += head-xscale.o
endif
ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y)
OBJS += head-sharpsl.o
endif
ifeq ($(CONFIG_CPU_ENDIAN_BE32),y)
ifeq ($(CONFIG_CPU_CP15),y)
OBJS += big-endian.o
else
# The endian should be set by h/w design.
endif
endif
ifeq ($(CONFIG_ARCH_SHMOBILE),y)
OBJS += head-shmobile.o
endif
#
# We now have a PIC decompressor implementation. Decompressors running
# from RAM should not define ZTEXTADDR. Decompressors running directly
# from ROM or Flash must define ZTEXTADDR (preferably via the config)
# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
ifeq ($(CONFIG_ZBOOT_ROM),y)
ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
else
ZTEXTADDR := 0
ZBSSADDR := ALIGN(8)
endif
SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
suffix_$(CONFIG_KERNEL_GZIP) = gzip
suffix_$(CONFIG_KERNEL_LZO) = lzo
suffix_$(CONFIG_KERNEL_LZMA) = lzma
suffix_$(CONFIG_KERNEL_XZ) = xzkern
suffix_$(CONFIG_KERNEL_LZ4) = lz4
AFLAGS_piggy.$(suffix_y).o += -Wa,-march=armv7-a$(plus_sec)
# Borrowed libfdt files for the ATAG compatibility mode
libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h
libfdt_objs := $(addsuffix .o, $(basename $(libfdt)))
$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
$(call cmd,shipped)
$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
$(addprefix $(obj)/,$(libfdt_hdrs))
ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
OBJS += $(libfdt_objs) atags_to_fdt.o
endif
targets := vmlinux vmlinux.lds \
piggy.$(suffix_y) piggy.$(suffix_y).o \
lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \
font.o font.c head.o misc.o $(OBJS)
# Make sure files are removed during clean
extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs)
ifeq ($(CONFIG_FUNCTION_TRACER),y)
ORIG_CFLAGS := $(KBUILD_CFLAGS)
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
endif
ccflags-y := -fpic -fno-builtin -I$(obj)
asflags-y :=
# Supply kernel BSS size to the decompressor via a linker symbol.
KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \
awk 'END{print $$3}')
LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
# Supply ZRELADDR to the decompressor via a linker symbol.
ifneq ($(CONFIG_AUTO_ZRELADDR),y)
LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
endif
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
endif
ifneq ($(PARAMS_PHYS),)
LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
endif
# ?
LDFLAGS_vmlinux += -p
# Report unresolved symbol references
LDFLAGS_vmlinux += --no-undefined
# Delete all temporary local symbols
LDFLAGS_vmlinux += -X
# Next argument is a linker script
LDFLAGS_vmlinux += -T
# For __aeabi_uidivmod
lib1funcs = $(obj)/lib1funcs.o
$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
$(call cmd,shipped)
# For __aeabi_llsl
ashldi3 = $(obj)/ashldi3.o
$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
$(call cmd,shipped)
# We need to prevent any GOTOFF relocs being used with references
# to symbols in the .bss section since we cannot relocate them
# independently from the rest at run time. This can be achieved by
# ensuring that no private .bss symbols exist, as global symbols
# always have a GOT entry which is what we need.
# The .data section is already discarded by the linker script so no need
# to bother about it here.
check_for_bad_syms = \
bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
[ -z "$$bad_syms" ] || \
( echo "following symbols must have non local/private scope:" >&2; \
echo "$$bad_syms" >&2; rm -f $@; false )
check_for_multiple_zreladdr = \
if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
echo 'multiple zreladdrs: $(ZRELADDR)'; \
echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
false; \
fi
$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
@$(check_for_multiple_zreladdr)
$(call if_changed,ld)
@$(check_for_bad_syms)
$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
$(call if_changed,$(suffix_y))
$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE
CFLAGS_font.o := -Dstatic=
$(obj)/font.c: $(FONTC)
$(call cmd,shipped)
$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
@sed "$(SEDFLAGS)" < $< > $@
| DecimalMan/dkp | arch/arm/boot/compressed/Makefile | Makefile | gpl-2.0 | 6,237 | [
30522,
1001,
1001,
11603,
1013,
7905,
1013,
2849,
1013,
9573,
1013,
16620,
1013,
2191,
8873,
2571,
1001,
1001,
3443,
1037,
16620,
1058,
19968,
2378,
17040,
3746,
2013,
1996,
2434,
1058,
19968,
2378,
5602,
1001,
27885,
22578,
1027,
4606,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php $this->widget('application.modules.category.widgets.ListCategoryWidget', array('alias' => 'content_block_'.Yii::app()->language)); ?>
<!--Blog start-->
<div class="blog_wrapper">
<!--Blog container start-->
<div class="blog container clearfix">
<?php $this->widget('application.modules.blog.widgets.ListBlogsWidget', array()); ?>
<div class="clearfix"></div>
</div>
<!--Blog container end-->
</div>
<!--Blog end-->
<!--Decorated separator-->
<div class="decor_separator decor_07"></div>
<!--Contacts-->
<div class="contacts container">
<p class="address">ะฒัะป.ะัะดะฒะฐะปัะฝะฐ 5, ะัะฒัะฒ, ะฃะบัะฐัะฝะฐ, 79000 <br> arsenal.lviv@facebook.com <br> 067 372 4455</p>
<?php
Yii::import('application.extension.EGMap.*');
$gMap = new EGMap();
$gMap->setJsName('test_map');
$gMap->width = '100%';
$gMap->height = 440;
$gMap->zoom = 16;
$gMap->setCenter(49.841022, 24.035470);
$info_box = new EGMapInfoBox('<div style="color:#fff;border: 1px solid black; margin-top: 8px; background: #000; padding: 5px;"><img src="/css/arsenal.jpg" width="100px"/></div>');
$info_box->pixelOffset = new EGMapSize('0','-140');
$info_box->maxWidth = 0;
$info_box->boxStyle = array(
'width'=>'"120px"',
'height'=>'"120px"',
'background'=>'"url(http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/examples/tipbox.gif) no-repeat"'
);
$info_box->closeBoxMargin = '"10px 2px 2px 2px"';
$info_box->infoBoxClearance = new EGMapSize(1,1);
$info_box->enableEventPropagation ='"floatPane"';
$marker = new EGMapMarker(49.841022, 24.035470, array('title' => 'ะ ะตััะพัะฐะฝ "ะััะตะฝะฐะป"'));
$marker->addHtmlInfoBox($info_box);
$gMap->addMarker($marker);
$gMap->renderMap();
?>
</div> | flesch91/uaweb-work.github.com | themes/arsenal/views/site/index.php | PHP | bsd-3-clause | 1,937 | [
30522,
1026,
1029,
25718,
1002,
2023,
1011,
1028,
15536,
24291,
1006,
1005,
4646,
1012,
14184,
1012,
4696,
1012,
15536,
28682,
1012,
2862,
16280,
20255,
2100,
9148,
24291,
1005,
1010,
9140,
1006,
1005,
14593,
1005,
1027,
1028,
1005,
4180,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
๏ปฟusing Jint.Native;
using Jint.Native.Object;
namespace Jint.Runtime.Environments
{
/// <summary>
/// Base implementation of an Environment Record
/// http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.1
/// </summary>
public abstract class EnvironmentRecord : ObjectInstance
{
protected EnvironmentRecord(Engine engine) : base(engine)
{
}
/// <summary>
/// Determines if an environment record has a binding for an identifier.
/// </summary>
/// <param name="name">The identifier of the binding</param>
/// <returns><c>true</c> if it does and <c>false</c> if it does not.</returns>
public abstract bool HasBinding(string name);
/// <summary>
/// Creates a new mutable binding in an environment record.
/// </summary>
/// <param name="name">The identifier of the binding.</param>
/// <param name="canBeDeleted"><c>true</c> if the binding may be subsequently deleted.</param>
public abstract void CreateMutableBinding(string name, bool canBeDeleted = false);
/// <summary>
/// Sets the value of an already existing mutable binding in an environment record.
/// </summary>
/// <param name="name">The identifier of the binding</param>
/// <param name="value">The value of the binding.</param>
/// <param name="strict">The identify strict mode references.</param>
public abstract void SetMutableBinding(string name, JsValue value, bool strict);
/// <summary>
/// Returns the value of an already existing binding from an environment record.
/// </summary>
/// <param name="name">The identifier of the binding</param>
/// <param name="strict">The identify strict mode references.</param>
/// <return>The value of an already existing binding from an environment record.</return>
public abstract JsValue GetBindingValue(string name, bool strict);
/// <summary>
/// Delete a binding from an environment record. The String value N is the text of the bound name If a binding for N exists, remove the binding and return true. If the binding exists but cannot be removed return false. If the binding does not exist return true.
/// </summary>
/// <param name="name">The identifier of the binding</param>
/// <returns><true>true</true> if the deletion is successfull.</returns>
public abstract bool DeleteBinding(string name);
/// <summary>
/// Returns the value to use as the <c>this</c> value on calls to function objects that are obtained as binding values from this environment record.
/// </summary>
/// <returns>The value to use as <c>this</c>.</returns>
public abstract JsValue ImplicitThisValue();
/// <summary>
/// Returns an array of all the defined binding names
/// </summary>
/// <returns>The array of all defined bindings</returns>
public abstract string[] GetAllBindingNames();
}
}
| Neproify/ivmp | Jint/Runtime/Environments/EnvironmentRecord.cs | C# | gpl-3.0 | 3,097 | [
30522,
2478,
9743,
2102,
1012,
3128,
1025,
2478,
9743,
2102,
1012,
3128,
1012,
4874,
1025,
3415,
15327,
9743,
2102,
1012,
2448,
7292,
1012,
10058,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
2918,
7375,
1997,
2019,
4044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head>
<title>OGRE: Member List - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="doxygen.css">
<link type="text/css" rel="stylesheet" href="tabs.css">
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>Ogre::EAGL2Support Member List</h1>This is the complete list of members for <a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a245c2fd4d66609583093184037ca8259">addConfig</a>(void)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a2e2d135ef1ba81fee239544f65ba2ad1">checkExtension</a>(const String &ext) const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#ac9e01328dfcf514e9f1adfdf53c0d0fd">chooseGLConfig</a>(const GLint *attribList, GLint *nElements)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a1264e10d01dd5e50e1932499c41cbabb">createWindow</a>(bool autoCreateWindow, GLES2RenderSystem *renderSystem, const String &windowTitle)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#ab6af1466075ab8ee94431738a7ea7c32">EAGL2Support</a>()</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a21558f79fc4b83c4a87c470ca652be4e">extensionList</a></td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#adcf0c781fbbfc12de5546dcc8fb07325">getConfigOptions</a>(void)</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a31e3c69a77c8d6c4ca0de1de334d28fd">getDisplayMonitorCount</a>() const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a3bb5f180de993107121c27e826b06309">getDisplayName</a>(void)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a862de7a3ef2c388969cb076e08a84843">getGLConfigAttrib</a>(CFDictionaryRef fbConfig, GLint attribute, GLint *value)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#acf1a56586e7f452554433e4a982a915c">getGLVendor</a>(void) const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a276c49b57cb60c3ae2aa4ca94524cd80">getGLVersion</a>(void) const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#aa6f3f20e84ba85824dfac00cb82b7b9c">getProcAddress</a>(const Ogre::String &name)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#ae0833c742adcccc532729ff76176c44c">getShaderCachePath</a>(void) const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a03aaf2bec1baf7d1a6687b49c4fdb591">getShaderLibraryPath</a>(void) const </td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#aeb24119b020395dc5180e5c93fd21cbf">GLES2Support</a>()</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a1b2f582872d8c79698d93e7aa02ba4c6">initialiseExtensions</a>()</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a18ab92cb7fbc22d891eb9495575dc168">mOptions</a></td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#af8d522d0ff1cd7f3c7f46ac9d48b04b0">newWindow</a>(const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams=0)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#ae3249b8d300840d4b245b9de3502b7db">selectGLConfig</a>(const int *minAttribs, const int *maxAttribs)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#af94869c73d966530b0d919ca3925b2cf">setConfigOption</a>(const String &name, const String &value)</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#aa52a532cd85238d5227f23d4b3de35e4">setShaderCachePath</a>(String path)</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#aee9a5957c98ac70592dc9ec82a862d68">setShaderLibraryPath</a>(String path)</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a8c60dfcba3f49286be8022fdaf84754f">start</a>(void)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#addec458397a8649396b51772c4a6ecf5">stop</a>(void)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#a893f3a84904fd92955610754f2e04830">validateConfig</a>(void)</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1EAGL2Support.html#addbf47690669e6445a1f2d9b23e9dc1d">~EAGL2Support</a>()</td><td><a class="el" href="classOgre_1_1EAGL2Support.html">Ogre::EAGL2Support</a></td><td><code> [virtual]</code></td></tr>
<tr class="memlist"><td><a class="el" href="classOgre_1_1GLES2Support.html#a462bd9434d945f2436cbe3f971d28050">~GLES2Support</a>()</td><td><a class="el" href="classOgre_1_1GLES2Support.html">Ogre::GLES2Support</a></td><td><code> [virtual]</code></td></tr>
</table></div>
<hr>
<p>
Copyright © 2012 Torus Knot Software Ltd<br />
<!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.<br/>
<!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> -->
Last modified Sun Sep 2 08:31:21 2012
</p>
</body>
</html>
| lennonchan/OgreSource | Docs/api/html/classOgre_1_1EAGL2Support-members.html | HTML | mit | 10,323 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
13958,
2890,
1024,
2266,
2862,
1011,
13958,
2890,
12653,
1026,
1013,
2516,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
30524,
16129,
1025,
258... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_04) on Thu Jun 29 15:56:25 CEST 2006 -->
<TITLE>
GridAttribute (ASTRON/LOFAR Plotter)
</TITLE>
<META NAME="keywords" CONTENT="gov.noaa.pmel.sgt.GridAttribute class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="GridAttribute (ASTRON/LOFAR Plotter)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/GridAttribute.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../gov/noaa/pmel/sgt/Graph.html" title="class in gov.noaa.pmel.sgt"><B>PREV CLASS</B></A>
<A HREF="../../../../gov/noaa/pmel/sgt/GridCartesianRenderer.html" title="class in gov.noaa.pmel.sgt"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?gov/noaa/pmel/sgt/GridAttribute.html" target="_top"><B>FRAMES</B></A>
<A HREF="GridAttribute.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
gov.noaa.pmel.sgt</FONT>
<BR>
Class GridAttribute</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>gov.noaa.pmel.sgt.GridAttribute</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A>, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener</DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>GridAttribute</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A>, java.lang.Cloneable, java.beans.PropertyChangeListener</DL>
</PRE>
<P>
Sets the rendering style for grid data. <code>ColorMap</code>,
<code>ContourLevels</code> are <code>GridAttribute</code> properties.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>1.0</DD>
<DT><B>Version:</B></DT>
<DD>$Revision$, $Date$</DD>
<DT><B>Author:</B></DT>
<DD>Donald Denbo</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../gov/noaa/pmel/sgt/GridCartesianRenderer.html" title="class in gov.noaa.pmel.sgt"><CODE>GridCartesianRenderer</CODE></A>,
<A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt"><CODE>ContourLevels</CODE></A>,
<A HREF="../../../../serialized-form.html#gov.noaa.pmel.sgt.GridAttribute">Serialized Form</A></DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#AREA_FILL">AREA_FILL</A></B></CODE>
<BR>
Area fill style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#AREA_FILL_CONTOUR">AREA_FILL_CONTOUR</A></B></CODE>
<BR>
Area fill and Contour style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#CONTOUR">CONTOUR</A></B></CODE>
<BR>
Contour line style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#RASTER">RASTER</A></B></CODE>
<BR>
Raster style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#RASTER_CONTOUR">RASTER_CONTOUR</A></B></CODE>
<BR>
Raster and Contour style.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#GridAttribute()">GridAttribute</A></B>()</CODE>
<BR>
Default constructor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#GridAttribute(gov.noaa.pmel.sgt.ContourLevels)">GridAttribute</A></B>(<A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A> clev)</CODE>
<BR>
<code>GridAttribute</code> constructor for <code>CONTOUR</code> style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#GridAttribute(int, gov.noaa.pmel.sgt.ColorMap)">GridAttribute</A></B>(int style,
<A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A> cmap)</CODE>
<BR>
<code>GridAttribute</code> constructor for <code>RASTER</code> and
<code>AREA_FILL</code> styles.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#addPropertyChangeListener(java.beans.PropertyChangeListener)">addPropertyChangeListener</A></B>(java.beans.PropertyChangeListener listener)</CODE>
<BR>
Add listener to changes in <code>GridAttribute</code> properties.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html" title="class in gov.noaa.pmel.sgt">GridAttribute</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#copy()">copy</A></B>()</CODE>
<BR>
Copy the <code>GridAttribute</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)">firePropertyChange</A></B>(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#getColorMap()">getColorMap</A></B>()</CODE>
<BR>
Get the <code>ColorMap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#getContourLevels()">getContourLevels</A></B>()</CODE>
<BR>
Get the <code>ContourLevels</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#getId()">getId</A></B>()</CODE>
<BR>
Get attribute id.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#getStyle()">getStyle</A></B>()</CODE>
<BR>
Get grid style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#isAreaFill()">isAreaFill</A></B>()</CODE>
<BR>
Tests if <code>GridAttribute</code> style is eigther
AREA_FILL or AREA_FILL_CONTOUR.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#isBatch()">isBatch</A></B>()</CODE>
<BR>
Is the attribute in batch mode?</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#isContour()">isContour</A></B>()</CODE>
<BR>
Tests if <code>GridAttribute</code> style is either
CONTOUR, RASTER_CONTOUR, or AREA_FILL_CONTOUR.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#isRaster()">isRaster</A></B>()</CODE>
<BR>
Tests if <code>GridAttribute</code> style is either
RASTER or RASTER_CONTOUR.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#propertyChange(java.beans.PropertyChangeEvent)">propertyChange</A></B>(java.beans.PropertyChangeEvent evt)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">removePropertyChangeListener</A></B>(java.beans.PropertyChangeListener listener)</CODE>
<BR>
Remove change listener.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setBatch(boolean)">setBatch</A></B>(boolean batch)</CODE>
<BR>
Batch the changes to the attribute.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setBatch(boolean, boolean)">setBatch</A></B>(boolean batch,
boolean local)</CODE>
<BR>
Batch the changes to the attribute and set local flag.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setColorMap(gov.noaa.pmel.sgt.ColorMap)">setColorMap</A></B>(<A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A> cmap)</CODE>
<BR>
Set the <code>ColorMap</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setContourLevels(gov.noaa.pmel.sgt.ContourLevels)">setContourLevels</A></B>(<A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A> clev)</CODE>
<BR>
Set the <code>ContourLevels</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setId(java.lang.String)">setId</A></B>(java.lang.String id)</CODE>
<BR>
Set attribute id.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#setStyle(int)">setStyle</A></B>(int st)</CODE>
<BR>
Set the grid style.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html#toString()">toString</A></B>()</CODE>
<BR>
Get a <code>String</code> representation of the
<code>GridAttribute</code>.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="RASTER"><!-- --></A><H3>
RASTER</H3>
<PRE>
public static final int <B>RASTER</B></PRE>
<DL>
<DD>Raster style.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#gov.noaa.pmel.sgt.GridAttribute.RASTER">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="AREA_FILL"><!-- --></A><H3>
AREA_FILL</H3>
<PRE>
public static final int <B>AREA_FILL</B></PRE>
<DL>
<DD>Area fill style.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#gov.noaa.pmel.sgt.GridAttribute.AREA_FILL">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="CONTOUR"><!-- --></A><H3>
CONTOUR</H3>
<PRE>
public static final int <B>CONTOUR</B></PRE>
<DL>
<DD>Contour line style.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#gov.noaa.pmel.sgt.GridAttribute.CONTOUR">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="RASTER_CONTOUR"><!-- --></A><H3>
RASTER_CONTOUR</H3>
<PRE>
public static final int <B>RASTER_CONTOUR</B></PRE>
<DL>
<DD>Raster and Contour style.
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>2.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#gov.noaa.pmel.sgt.GridAttribute.RASTER_CONTOUR">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="AREA_FILL_CONTOUR"><!-- --></A><H3>
AREA_FILL_CONTOUR</H3>
<PRE>
public static final int <B>AREA_FILL_CONTOUR</B></PRE>
<DL>
<DD>Area fill and Contour style.
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>2.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#gov.noaa.pmel.sgt.GridAttribute.AREA_FILL_CONTOUR">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="GridAttribute()"><!-- --></A><H3>
GridAttribute</H3>
<PRE>
public <B>GridAttribute</B>()</PRE>
<DL>
<DD>Default constructor. Default style is <code>RASTER</code> and
default <code>ColorMap</code> is null.
<P>
</DL>
<HR>
<A NAME="GridAttribute(int, gov.noaa.pmel.sgt.ColorMap)"><!-- --></A><H3>
GridAttribute</H3>
<PRE>
public <B>GridAttribute</B>(int style,
<A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A> cmap)</PRE>
<DL>
<DD><code>GridAttribute</code> constructor for <code>RASTER</code> and
<code>AREA_FILL</code> styles.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>style</CODE> - grid style<DD><CODE>cmap</CODE> - <code>ColorMap</code></DL>
</DL>
<HR>
<A NAME="GridAttribute(gov.noaa.pmel.sgt.ContourLevels)"><!-- --></A><H3>
GridAttribute</H3>
<PRE>
public <B>GridAttribute</B>(<A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A> clev)</PRE>
<DL>
<DD><code>GridAttribute</code> constructor for <code>CONTOUR</code> style.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>clev</CODE> - <code>ContourLevels</code></DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setContourLevels(gov.noaa.pmel.sgt.ContourLevels)"><!-- --></A><H3>
setContourLevels</H3>
<PRE>
public void <B>setContourLevels</B>(<A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A> clev)</PRE>
<DL>
<DD>Set the <code>ContourLevels</code>.
<BR><B>Property Change:</B> <code>contourLevels</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>clev</CODE> - <code>ContourLevels</code></DL>
</DD>
</DL>
<HR>
<A NAME="getContourLevels()"><!-- --></A><H3>
getContourLevels</H3>
<PRE>
public <A HREF="../../../../gov/noaa/pmel/sgt/ContourLevels.html" title="class in gov.noaa.pmel.sgt">ContourLevels</A> <B>getContourLevels</B>()</PRE>
<DL>
<DD>Get the <code>ContourLevels</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><code>ContourLevels</code></DL>
</DD>
</DL>
<HR>
<A NAME="copy()"><!-- --></A><H3>
copy</H3>
<PRE>
public <A HREF="../../../../gov/noaa/pmel/sgt/GridAttribute.html" title="class in gov.noaa.pmel.sgt">GridAttribute</A> <B>copy</B>()</PRE>
<DL>
<DD>Copy the <code>GridAttribute</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>new <code>GridAttribute</code></DL>
</DD>
</DL>
<HR>
<A NAME="setStyle(int)"><!-- --></A><H3>
setStyle</H3>
<PRE>
public void <B>setStyle</B>(int st)</PRE>
<DL>
<DD>Set the grid style.
<BR><B>Property Change:</B> <code>style</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>st</CODE> - grid style</DL>
</DD>
</DL>
<HR>
<A NAME="getStyle()"><!-- --></A><H3>
getStyle</H3>
<PRE>
public int <B>getStyle</B>()</PRE>
<DL>
<DD>Get grid style.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>grid style</DL>
</DD>
</DL>
<HR>
<A NAME="isRaster()"><!-- --></A><H3>
isRaster</H3>
<PRE>
public boolean <B>isRaster</B>()</PRE>
<DL>
<DD>Tests if <code>GridAttribute</code> style is either
RASTER or RASTER_CONTOUR.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>2.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isContour()"><!-- --></A><H3>
isContour</H3>
<PRE>
public boolean <B>isContour</B>()</PRE>
<DL>
<DD>Tests if <code>GridAttribute</code> style is either
CONTOUR, RASTER_CONTOUR, or AREA_FILL_CONTOUR.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>2.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isAreaFill()"><!-- --></A><H3>
isAreaFill</H3>
<PRE>
public boolean <B>isAreaFill</B>()</PRE>
<DL>
<DD>Tests if <code>GridAttribute</code> style is eigther
AREA_FILL or AREA_FILL_CONTOUR.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>2.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getColorMap()"><!-- --></A><H3>
getColorMap</H3>
<PRE>
public <A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A> <B>getColorMap</B>()</PRE>
<DL>
<DD>Get the <code>ColorMap</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the <code>ColorMap</code></DL>
</DD>
</DL>
<HR>
<A NAME="setColorMap(gov.noaa.pmel.sgt.ColorMap)"><!-- --></A><H3>
setColorMap</H3>
<PRE>
public void <B>setColorMap</B>(<A HREF="../../../../gov/noaa/pmel/sgt/ColorMap.html" title="class in gov.noaa.pmel.sgt">ColorMap</A> cmap)</PRE>
<DL>
<DD>Set the <code>ColorMap</code>.
<BR><B>Property Change:</B> <code>colorMap</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cmap</CODE> - the <code>ColorMap</code></DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <B>toString</B>()</PRE>
<DL>
<DD>Get a <code>String</code> representation of the
<code>GridAttribute</code>.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#toString()">toString</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE><DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><code>String</code> representation</DL>
</DD>
</DL>
<HR>
<A NAME="addPropertyChangeListener(java.beans.PropertyChangeListener)"><!-- --></A><H3>
addPropertyChangeListener</H3>
<PRE>
public void <B>addPropertyChangeListener</B>(java.beans.PropertyChangeListener listener)</PRE>
<DL>
<DD>Add listener to changes in <code>GridAttribute</code> properties.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#addPropertyChangeListener(java.beans.PropertyChangeListener)">addPropertyChangeListener</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="removePropertyChangeListener(java.beans.PropertyChangeListener)"><!-- --></A><H3>
removePropertyChangeListener</H3>
<PRE>
public void <B>removePropertyChangeListener</B>(java.beans.PropertyChangeListener listener)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">Attribute</A></CODE></B></DD>
<DD>Remove change listener.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#removePropertyChangeListener(java.beans.PropertyChangeListener)">removePropertyChangeListener</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="propertyChange(java.beans.PropertyChangeEvent)"><!-- --></A><H3>
propertyChange</H3>
<PRE>
public void <B>propertyChange</B>(java.beans.PropertyChangeEvent evt)</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>propertyChange</CODE> in interface <CODE>java.beans.PropertyChangeListener</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setId(java.lang.String)"><!-- --></A><H3>
setId</H3>
<PRE>
public void <B>setId</B>(java.lang.String id)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setId(java.lang.String)">Attribute</A></CODE></B></DD>
<DD>Set attribute id.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setId(java.lang.String)">setId</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getId()"><!-- --></A><H3>
getId</H3>
<PRE>
public java.lang.String <B>getId</B>()</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#getId()">Attribute</A></CODE></B></DD>
<DD>Get attribute id.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#getId()">getId</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)"><!-- --></A><H3>
firePropertyChange</H3>
<PRE>
protected void <B>firePropertyChange</B>(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setBatch(boolean)"><!-- --></A><H3>
setBatch</H3>
<PRE>
public void <B>setBatch</B>(boolean batch)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setBatch(boolean)">Attribute</A></CODE></B></DD>
<DD>Batch the changes to the attribute.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setBatch(boolean)">setBatch</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="setBatch(boolean, boolean)"><!-- --></A><H3>
setBatch</H3>
<PRE>
public void <B>setBatch</B>(boolean batch,
boolean local)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setBatch(boolean, boolean)">Attribute</A></CODE></B></DD>
<DD>Batch the changes to the attribute and set local flag.
Determines whether <code>AttributeChangeEvent</code> will be set local.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#setBatch(boolean, boolean)">setBatch</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isBatch()"><!-- --></A><H3>
isBatch</H3>
<PRE>
public boolean <B>isBatch</B>()</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#isBatch()">Attribute</A></CODE></B></DD>
<DD>Is the attribute in batch mode?
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html#isBatch()">isBatch</A></CODE> in interface <CODE><A HREF="../../../../gov/noaa/pmel/sgt/Attribute.html" title="interface in gov.noaa.pmel.sgt">Attribute</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/GridAttribute.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../gov/noaa/pmel/sgt/Graph.html" title="class in gov.noaa.pmel.sgt"><B>PREV CLASS</B></A>
<A HREF="../../../../gov/noaa/pmel/sgt/GridCartesianRenderer.html" title="class in gov.noaa.pmel.sgt"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?gov/noaa/pmel/sgt/GridAttribute.html" target="_top"><B>FRAMES</B></A>
<A HREF="GridAttribute.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| kernsuite-debian/lofar | JAVA/GUI/Plotter/doc/javadoc/gov/noaa/pmel/sgt/GridAttribute.html | HTML | gpl-3.0 | 34,819 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.dto.AccessKeyDTO;
import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
import com.ctrip.framework.apollo.portal.api.AdminServiceAPI.AccessKeyAPI;
import com.ctrip.framework.apollo.portal.constant.TracerEventType;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.tracer.Tracer;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AccessKeyService {
private final AdminServiceAPI.AccessKeyAPI accessKeyAPI;
public AccessKeyService(AccessKeyAPI accessKeyAPI) {
this.accessKeyAPI = accessKeyAPI;
}
public List<AccessKeyDTO> findByAppId(Env env, String appId) {
return accessKeyAPI.findByAppId(env, appId);
}
public AccessKeyDTO createAccessKey(Env env, AccessKeyDTO accessKey) {
AccessKeyDTO accessKeyDTO = accessKeyAPI.create(env, accessKey);
Tracer.logEvent(TracerEventType.CREATE_ACCESS_KEY, accessKey.getAppId());
return accessKeyDTO;
}
public void deleteAccessKey(Env env, String appId, long id, String operator) {
accessKeyAPI.delete(env, appId, id, operator);
}
public void enable(Env env, String appId, long id, String operator) {
accessKeyAPI.enable(env, appId, id, operator);
}
public void disable(Env env, String appId, long id, String operator) {
accessKeyAPI.disable(env, appId, id, operator);
}
}
| lepdou/apollo | apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AccessKeyService.java | Java | apache-2.0 | 2,056 | [
30522,
1013,
1008,
1008,
9385,
25682,
9348,
6048,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"use strict";
ace.define("ace/snippets/matlab", ["require", "exports", "module"], function (e, t, n) {
"use strict";
t.snippetText = undefined, t.scope = "matlab";
}); | IonicaBizau/arc-assembler | clients/ace-builds/src-min-noconflict/snippets/matlab.js | JavaScript | mit | 172 | [
30522,
1000,
2224,
9384,
1000,
1025,
9078,
1012,
9375,
1006,
1000,
9078,
1013,
1055,
3490,
29519,
2015,
1013,
13523,
20470,
1000,
1010,
1031,
1000,
5478,
1000,
1010,
1000,
14338,
1000,
1010,
1000,
11336,
1000,
1033,
1010,
3853,
1006,
1041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# $FreeBSD$
SUBDIR= libasn1 libgssapi_krb5 libgssapi_ntlm libgssapi_spnego libhdb \
libheimntlm libhx509 libkadm5clnt libkadm5srv libkrb5 \
libroken libsl libvers libkdc libwind libheimbase libheimipcc libheimipcs
SUBDIR+= libkafs5 # requires krb_err.h from libkrb5
SUBDIR_DEPEND_libkafs5= libkrb5
.include <bsd.subdir.mk>
| TigerBSD/TigerBSD | FreeBSD/kerberos5/lib/Makefile | Makefile | isc | 330 | [
30522,
1001,
1002,
2489,
5910,
2094,
1002,
4942,
4305,
2099,
1027,
5622,
22083,
2078,
2487,
5622,
2497,
5620,
3736,
8197,
1035,
1047,
15185,
2629,
5622,
2497,
5620,
3736,
8197,
1035,
23961,
13728,
5622,
2497,
5620,
3736,
8197,
1035,
11867,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Sun\\' => array($baseDir . '/src'),
'PhpDocReader\\' => array($vendorDir . '/php-di/phpdoc-reader/src/PhpDocReader'),
'Invoker\\' => array($vendorDir . '/php-di/invoker/src'),
'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'DI\\' => array($vendorDir . '/php-di/php-di/src/DI'),
);
| IftekherSunny/Alien | vendor/composer/autoload_psr4.php | PHP | mit | 682 | [
30522,
1026,
1029,
25718,
1013,
1013,
8285,
11066,
1035,
8827,
2099,
2549,
1012,
25718,
1030,
7013,
2011,
4543,
1002,
21431,
4305,
2099,
1027,
16101,
18442,
1006,
16101,
18442,
1006,
1035,
1035,
5371,
1035,
1035,
1007,
1007,
1025,
1002,
224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2005 Wolfgang Becker <uafr@gmx.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
#include "GameView.hpp"
#include "gui/TextureManager.hpp"
#include "gui/Painter.hpp"
#include "gui/Rect2D.hpp"
#include "gui/Color.hpp"
#include "gui/ComponentFactory.hpp"
#include "gui/XmlReader.hpp"
#include "gui/Event.hpp"
#include "PhysfsStream/PhysfsSDL.hpp"
#include "gui/Paragraph.hpp"
#include "gui/Desktop.hpp"
#include "lincity/lin-city.h"
#include "lincity/lctypes.h"
#include "lincity/engglobs.h"
#include "MapEdit.hpp"
#include "MiniMap.hpp"
#include "Dialog.hpp"
#include "Config.hpp"
#include "ScreenInterface.hpp"
#include "Util.hpp"
#include <SDL_keysym.h>
#include <math.h>
#include <sstream>
#include <physfs.h>
#include "gui_interface/shared_globals.h"
#include "tinygettext/gettext.hpp"
#include "gui/callback/Callback.hpp"
#include "gui/Button.hpp"
#include "CheckButton.hpp"
extern int is_allowed_here(int x, int y, short cst_type, short msg);
const float GameView::defaultTileWidth = 128;
const float GameView::defaultTileHeight = 64;
const float GameView::defaultZoom = 0.5;
GameView* gameViewPtr = 0;
GameView* getGameView()
{
return gameViewPtr;
}
GameView::GameView()
{
assert(gameViewPtr == 0);
gameViewPtr = this;
mTextures = SDL_CreateMutex();
mThreadRunning = SDL_CreateMutex();
loaderThread = 0;
keyScrollState = 0;
mouseScrollState = 0;
}
GameView::~GameView()
{
stopThread = true;
SDL_mutexP( mThreadRunning );
//SDL_KillThread( loaderThread );
SDL_WaitThread( loaderThread, NULL );
SDL_DestroyMutex( mThreadRunning );
SDL_DestroyMutex( mTextures );
for(int i = 0; i < NUM_OF_TYPES; ++i) {
delete cityTextures[i];
// in case the image was loaded but no texture created yet we have a
// dangling SDL_Surface here
SDL_FreeSurface(cityImages[i]);
}
if(gameViewPtr == this)
gameViewPtr = 0;
}
//Static function to use with SDL_CreateThread
int GameView::gameViewThread( void* data )
{
GameView* gv = (GameView*) data;
gv->loadTextures();
gv->requestRedraw();
return 0;
}
void GameView::parse(XmlReader& reader)
{
//Read from config
XmlReader::AttributeIterator iter(reader);
while(iter.next()) {
const char* attribute = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
//check if Attribute handled by parent
if(parseAttribute(attribute, value)) {
continue;
} else {
std::cerr << "GameView::parse# Skipping unknown attribute '" << attribute << "'.\n";
}
}
// no more elements to parse
//Load Textures
blankTexture = readTexture( "blank.png" );
memset( &cityTextures, 0, sizeof( cityTextures ) );
memset( &cityImages, 0, sizeof( cityImages ) );
stopThread = false;
SDL_mutexP( mThreadRunning );
loaderThread = SDL_CreateThread( gameViewThread, this );
SDL_mutexV( mThreadRunning );
//GameView is resizable
setFlags(FLAG_RESIZABLE);
//start at location from savegame
zoom = defaultZoom;
tileWidth = defaultTileWidth * zoom;
tileHeight = defaultTileHeight * zoom;
virtualScreenWidth = tileWidth * WORLD_SIDE_LEN;
virtualScreenHeight = tileHeight * WORLD_SIDE_LEN;
readOrigin( false );
mouseInGameView = false;
dragging = false;
leftButtonDown = false;
roadDragging = false;
startRoad = MapPoint(0, 0);
rightButtonDown = false;
tileUnderMouse = MapPoint(0, 0);
dragStart = Vector2(0, 0);
hideHigh = false;
cursorSize = 0;
mapOverlay = overlayNone;
mapMode = MiniMap::NORMAL;
buttonsConnected = false;
lastStatusMessage = "";
}
/*
* Connect to GUI-Buttons.
*/
void GameView::connectButtons(){
if( buttonsConnected ){
return;
}
buttonsConnected = true;
Component* root = this;
while( root->getParent() ){
root = root->getParent();
}
Button* button = getButton( *root, "hideHighBuildings" );
button->clicked.connect( makeCallback(*this, &GameView::buttonClicked ) );
button = getButton( *root, "mapOverlay" );
button->clicked.connect( makeCallback(*this, &GameView::buttonClicked ) );
}
/*
* Handle Clicks on Button.
*/
void GameView::buttonClicked( Button* button ){
std::string name = button->getName();
if( name == "hideHighBuildings" ){
hideHigh = !hideHigh;
requestRedraw();
return;
}
if( name == "mapOverlay" ){
mapOverlay++;
if( mapOverlay > overlayMAX ) {
mapOverlay = overlayNone;
}
requestRedraw();
return;
}
std::cerr << "GameView::buttonClicked# Unhandled Button '" << name <<"',\n";
}
/*
* size in Tiles of marking under Cursor
* atm 0 is an outlined Version of size 1.
*/
void GameView::setCursorSize( int size )
{
if( size != cursorSize )
{
cursorSize = size;
setDirty();
}
}
/*
* evaluate main_screen_originx and main_screen_originy
*/
void GameView::readOrigin( bool redraw /* = true */ ){
MapPoint newCenter( main_screen_originx, main_screen_originy );
show( newCenter, redraw );
}
/*
* set main_screen_originx and main_screen_originy
*/
void GameView::writeOrigin(){
main_screen_originx = getCenter().x;
main_screen_originy = getCenter().y;
}
/*
* inform GameView about change in Mini Map Mode
*/
void GameView::setMapMode( MiniMap::DisplayMode mMode ) {
switch( mMode ){
case MiniMap::NORMAL:
printStatusMessage( _("Minimap: outline map") );
break;
case MiniMap::UB40:
printStatusMessage( _("Minimap: unemployment") );
break;
case MiniMap::POLLUTION:
printStatusMessage( _("Minimap: pollution") );
break;
case MiniMap::STARVE:
printStatusMessage( _("Minimap: nourishments") );
break;
case MiniMap::POWER:
printStatusMessage( _("Minimap: power supply") );
break;
case MiniMap::FIRE:
printStatusMessage( _("Minimap: firedepartment cover") );
break;
case MiniMap::CRICKET:
printStatusMessage( _("Minimap: sport cover") );
break;
case MiniMap::HEALTH:
printStatusMessage( _("Minimap: medical care") );
break;
case MiniMap::COAL:
printStatusMessage( _("Minimap: coal depots") );
break;
case MiniMap::TRAFFIC:
printStatusMessage( _("Minimap: traffic density") );
break;
default:
std::cerr << "Unknown minimap mode " << mMode<<"\n";
}
if( mapMode == mMode ){
return;
}
mapMode = mMode;
if( mapOverlay != overlayNone ){
requestRedraw();
}
}
/*
* Get Tile in Center of Screen.
*/
MapPoint GameView::getCenter(){
Vector2 center( getWidth() / 2, getHeight() / 2 );
return getTile( center );
}
/*
* Adjust the Zoomlevel.
*/
void GameView::setZoom(float newzoom){
MapPoint centerTile = getCenter();
if ( newzoom < .0625 ) return;
if ( newzoom > 4 ) return;
zoom = newzoom;
// fix rounding errors...
if(fabs(zoom - 1.0) < .01)
zoom = 1;
tileWidth = defaultTileWidth * zoom;
tileHeight = defaultTileHeight * zoom;
//a virtual screen containing the whole city
virtualScreenWidth = tileWidth * WORLD_SIDE_LEN;
virtualScreenHeight = tileHeight * WORLD_SIDE_LEN;
//std::cout << "Zoom " << zoom << "\n";
//Show the Center
show( centerTile );
}
/* set Zoomlevel to 100% */
void GameView::resetZoom(){
setZoom( defaultZoom );
}
/* increase Zoomlevel */
void GameView::zoomIn(){
setZoom( zoom * sqrt( 2.f ) );
}
/** decrease Zoomlevel */
void GameView::zoomOut(){
setZoom( zoom / sqrt( 2.f ) );
}
/**
* Show City Tile(x/y) by centering the screen
* redraw = false is used on initialisation.
*/
void GameView::show( MapPoint map , bool redraw /* = true */ )
{
Vector2 center;
center.x = virtualScreenWidth / 2 + ( map.x - map.y ) * ( tileWidth / 2 );
center.y = ( map.x + map.y ) * ( tileHeight / 2 ) + ( tileHeight / 2 );
if( redraw ){
viewport.x = center.x - ( getWidth() / 2 );
viewport.y = center.y - ( getHeight() / 2 );
requestRedraw();
} else { //on startup getWidth is 0.
viewport.x = center.x - ( getConfig()->videoX / 2 );
viewport.y = center.y - ( getConfig()->videoY / 2 );
}
}
/*
* Loads Texture from filename, Returns Pointer to Texture
* or Null if no file found.
*/
Texture* GameView::readTexture(const std::string& filename)
{
std::string nfilename = std::string("images/tiles/") + filename;
Texture* currentTexture;
try {
currentTexture = texture_manager->load(nfilename);
} catch(std::exception& err) {
std::cerr << nfilename << "GameView::readTexture# missing: " << err.what() << "\n";
return 0;
}
return currentTexture;
}
/*
* Loads Image from filename, Returns Pointer to Image
* or Null if no file found.
*/
SDL_Surface* GameView::readImage(const std::string& filename)
{
std::string nfilename = std::string("images/tiles/") + filename;
SDL_Surface* currentImage;
if( !PHYSFS_exists( nfilename.c_str() ) ){
std::cerr << "GameView::readImage# No image file "<< nfilename << " found.\n";
return 0;
}
currentImage = IMG_Load_RW(getPhysfsSDLRWops( nfilename ), 1);
if( !currentImage ) {
std::cerr << "GameView::readImage# Could not load image "<< nfilename << "\n";
}
return currentImage;
}
/**
* preload a City Texture and fill in X and Y Data.
*
* images/tiles/images.xml contains the x-Coordinate of the
* middle of the Building in Case the Image is asymetric,
* eg. a high tower with a long shadow to the right
*
* Some of the Image to Texture Conversion seems not to be threadsave
* in OpenGL, so load just Images and convert them to Textures on
* demand in the main Tread.
*/
void GameView::preReadCityTexture( int textureType, const std::string& filename )
{
//skip loading if we stop anyway
if(stopThread) {
return;
}
XmlReader reader( "images/tiles/images.xml" );
int xmlX = -1;
int xmlY = -1;
bool hit = false;
SDL_mutexP( mTextures );
cityImages[ textureType ] = readImage( filename );
if( cityImages[ textureType ] )
{
//now we need to find x for our filename in images/tiles/images.xml
while( reader.read() )
{
if( reader.getNodeType() == XML_READER_TYPE_ELEMENT)
{
const std::string& element = (const char*) reader.getName();
if( element == "image" )
{
XmlReader::AttributeIterator iter(reader);
while(iter.next())
{
const char* name = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if( strcmp(name, "file" ) == 0 )
{
if( filename.compare( value ) == 0 )
{
hit = true;
}
}
else if( strcmp(name, "x" ) == 0 )
{
if(sscanf(value, "%i", &xmlX) != 1)
{
std::cerr << "GameView::preReadCityTexture# Error parsing integer value '" << value << "' in x attribute.\n";
xmlX = -1;
}
}
else if(strcmp(name, "y") == 0 )
{
if(sscanf(value, "%i", &xmlY) != 1)
{
std::cerr << "GameView::preReadCityTexture# Error parsing integer value '" << value << "' in y attribute.\n";
xmlY = -1;
}
}
}
if( hit )
{
break;
}
}
}
}
if( hit && ( xmlX >= 0 ) )
{
cityTextureX[ textureType ] = xmlX;
}
else
{
cityTextureX[ textureType ] = int( ( cityImages[ textureType ]->w / 2 ) );
}
cityTextureY[ textureType ] = int( cityImages[ textureType ]->h );
}
SDL_mutexV( mTextures );
}
/**
* Preload all required Textures. (his Function is called by loaderThread)
* Some of the Image to Texture Conversion seems not to be threadsave
* in OpenGL, so load just Images and convert them to Textures on
* demand in the main Tread.
*/
void GameView::loadTextures()
{
//We need Textures for all Types from lincity/lctypes.h
//Code Generation:
/*
grep -e LCT src/lincity/lctypes.h | sed \
-e 's/#define LC/ preReadCityTexture( CS/' \
-e 's/_G /, /' \
-e 's/_G\t/, /' \
-e 's/"/.png" );/2'
*/
preReadCityTexture( CST_GREEN, "green.png" );
preReadCityTexture( CST_DESERT_0, "desert_0.png" );
preReadCityTexture( CST_DESERT_1L, "desert_1l.png" );
preReadCityTexture( CST_DESERT_1R, "desert_1r.png" );
preReadCityTexture( CST_DESERT_1U, "desert_1u.png" );
preReadCityTexture( CST_DESERT_1D, "desert_1d.png" );
preReadCityTexture( CST_DESERT_2LR, "desert_2lr.png" );
preReadCityTexture( CST_DESERT_2LU, "desert_2lu.png" );
preReadCityTexture( CST_DESERT_2LD, "desert_2ld.png" );
preReadCityTexture( CST_DESERT_2RU, "desert_2ru.png" );
preReadCityTexture( CST_DESERT_2RD, "desert_2rd.png" );
preReadCityTexture( CST_DESERT_2UD, "desert_2ud.png" );
preReadCityTexture( CST_DESERT_3LRD, "desert_3lrd.png" );
preReadCityTexture( CST_DESERT_3LRU, "desert_3lru.png" );
preReadCityTexture( CST_DESERT_3LUD, "desert_3lud.png" );
preReadCityTexture( CST_DESERT_3RUD, "desert_3rud.png" );
preReadCityTexture( CST_DESERT, "desert.png" );
preReadCityTexture( CST_TREE, "tree.png" );
preReadCityTexture( CST_TREE2, "tree2.png" );
preReadCityTexture( CST_TREE3, "tree3.png" );
preReadCityTexture( CST_POWERL_H_L, "powerlhl.png" );
preReadCityTexture( CST_POWERL_V_L, "powerlvl.png" );
preReadCityTexture( CST_POWERL_LD_L, "powerlldl.png" );
preReadCityTexture( CST_POWERL_RD_L, "powerlrdl.png" );
preReadCityTexture( CST_POWERL_LU_L, "powerllul.png" );
preReadCityTexture( CST_POWERL_RU_L, "powerlrul.png" );
preReadCityTexture( CST_POWERL_LDU_L, "powerlldul.png" );
preReadCityTexture( CST_POWERL_LDR_L, "powerlldrl.png" );
preReadCityTexture( CST_POWERL_LUR_L, "powerllurl.png" );
preReadCityTexture( CST_POWERL_UDR_L, "powerludrl.png" );
preReadCityTexture( CST_POWERL_LUDR_L, "powerlludrl.png" );
preReadCityTexture( CST_POWERL_H_D, "powerlhd.png" );
preReadCityTexture( CST_POWERL_V_D, "powerlvd.png" );
preReadCityTexture( CST_POWERL_LD_D, "powerlldd.png" );
preReadCityTexture( CST_POWERL_RD_D, "powerlrdd.png" );
preReadCityTexture( CST_POWERL_LU_D, "powerllud.png" );
preReadCityTexture( CST_POWERL_RU_D, "powerlrud.png" );
preReadCityTexture( CST_POWERL_LDU_D, "powerlldud.png" );
preReadCityTexture( CST_POWERL_LDR_D, "powerlldrd.png" );
preReadCityTexture( CST_POWERL_LUR_D, "powerllurd.png" );
preReadCityTexture( CST_POWERL_UDR_D, "powerludrd.png" );
preReadCityTexture( CST_POWERL_LUDR_D, "powerlludrd.png" );
preReadCityTexture( CST_SHANTY, "shanty.png" );
preReadCityTexture( CST_POWERS_SOLAR, "powerssolar.png" );
preReadCityTexture( CST_POWERS_COAL_EMPTY, "powerscoal-empty.png" );
preReadCityTexture( CST_POWERS_COAL_LOW, "powerscoal-low.png" );
preReadCityTexture( CST_POWERS_COAL_MED, "powerscoal-med.png" );
preReadCityTexture( CST_POWERS_COAL_FULL, "powerscoal-full.png" );
preReadCityTexture( CST_BURNT, "burnt_land.png" );
preReadCityTexture( CST_SUBSTATION_R, "substation-R.png" );
preReadCityTexture( CST_SUBSTATION_G, "substation-G.png" );
preReadCityTexture( CST_SUBSTATION_RG, "substation-RG.png" );
preReadCityTexture( CST_UNIVERSITY, "university.png" );
preReadCityTexture( CST_RESIDENCE_LL, "reslowlow.png" );
preReadCityTexture( CST_RESIDENCE_ML, "resmedlow.png" );
preReadCityTexture( CST_RESIDENCE_HL, "reshilow.png" );
preReadCityTexture( CST_RESIDENCE_LH, "reslowhi.png" );
preReadCityTexture( CST_RESIDENCE_MH, "resmedhi.png" );
preReadCityTexture( CST_RESIDENCE_HH, "reshihi.png" );
preReadCityTexture( CST_MARKET_EMPTY, "market-empty.png" );
preReadCityTexture( CST_MARKET_LOW, "market-low.png" );
preReadCityTexture( CST_MARKET_MED, "market-med.png" );
preReadCityTexture( CST_MARKET_FULL, "market-full.png" );
preReadCityTexture( CST_RECYCLE, "recycle-centre.png" );
preReadCityTexture( CST_TRACK_LR, "tracklr.png" );
preReadCityTexture( CST_TRACK_LU, "tracklu.png" );
preReadCityTexture( CST_TRACK_LD, "trackld.png" );
preReadCityTexture( CST_TRACK_UD, "trackud.png" );
preReadCityTexture( CST_TRACK_UR, "trackur.png" );
preReadCityTexture( CST_TRACK_DR, "trackdr.png" );
preReadCityTexture( CST_TRACK_LUR, "tracklur.png" );
preReadCityTexture( CST_TRACK_LDR, "trackldr.png" );
preReadCityTexture( CST_TRACK_LUD, "tracklud.png" );
preReadCityTexture( CST_TRACK_UDR, "trackudr.png" );
preReadCityTexture( CST_TRACK_LUDR, "trackludr.png" );
preReadCityTexture( CST_PARKLAND_PLANE, "parkland-plane.png" );
preReadCityTexture( CST_PARKLAND_LAKE, "parkland-lake.png" );
preReadCityTexture( CST_MONUMENT_0, "monument0.png" );
preReadCityTexture( CST_MONUMENT_1, "monument1.png" );
preReadCityTexture( CST_MONUMENT_2, "monument2.png" );
preReadCityTexture( CST_MONUMENT_3, "monument3.png" );
preReadCityTexture( CST_MONUMENT_4, "monument4.png" );
preReadCityTexture( CST_MONUMENT_5, "monument5.png" );
preReadCityTexture( CST_COALMINE_EMPTY, "coalmine-empty.png" );
preReadCityTexture( CST_COALMINE_LOW, "coalmine-low.png" );
preReadCityTexture( CST_COALMINE_MED, "coalmine-med.png" );
preReadCityTexture( CST_COALMINE_FULL, "coalmine-full.png" );
preReadCityTexture( CST_RAIL_LR, "raillr.png" );
preReadCityTexture( CST_RAIL_LU, "raillu.png" );
preReadCityTexture( CST_RAIL_LD, "railld.png" );
preReadCityTexture( CST_RAIL_UD, "railud.png" );
preReadCityTexture( CST_RAIL_UR, "railur.png" );
preReadCityTexture( CST_RAIL_DR, "raildr.png" );
preReadCityTexture( CST_RAIL_LUR, "raillur.png" );
preReadCityTexture( CST_RAIL_LDR, "railldr.png" );
preReadCityTexture( CST_RAIL_LUD, "raillud.png" );
preReadCityTexture( CST_RAIL_UDR, "railudr.png" );
preReadCityTexture( CST_RAIL_LUDR, "railludr.png" );
preReadCityTexture( CST_FIRE_1, "fire1.png" );
preReadCityTexture( CST_FIRE_2, "fire2.png" );
preReadCityTexture( CST_FIRE_3, "fire3.png" );
preReadCityTexture( CST_FIRE_4, "fire4.png" );
preReadCityTexture( CST_FIRE_5, "fire5.png" );
preReadCityTexture( CST_FIRE_DONE1, "firedone1.png" );
preReadCityTexture( CST_FIRE_DONE2, "firedone2.png" );
preReadCityTexture( CST_FIRE_DONE3, "firedone3.png" );
preReadCityTexture( CST_FIRE_DONE4, "firedone4.png" );
preReadCityTexture( CST_ROAD_LR, "roadlr.png" );
preReadCityTexture( CST_ROAD_LU, "roadlu.png" );
preReadCityTexture( CST_ROAD_LD, "roadld.png" );
preReadCityTexture( CST_ROAD_UD, "roadud.png" );
preReadCityTexture( CST_ROAD_UR, "roadur.png" );
preReadCityTexture( CST_ROAD_DR, "roaddr.png" );
preReadCityTexture( CST_ROAD_LUR, "roadlur.png" );
preReadCityTexture( CST_ROAD_LDR, "roadldr.png" );
preReadCityTexture( CST_ROAD_LUD, "roadlud.png" );
preReadCityTexture( CST_ROAD_UDR, "roadudr.png" );
preReadCityTexture( CST_ROAD_LUDR, "roadludr.png" );
preReadCityTexture( CST_OREMINE_5, "oremine5.png" );
preReadCityTexture( CST_OREMINE_6, "oremine6.png" );
preReadCityTexture( CST_OREMINE_7, "oremine7.png" );
preReadCityTexture( CST_OREMINE_8, "oremine8.png" );
preReadCityTexture( CST_OREMINE_1, "oremine1.png" );
preReadCityTexture( CST_OREMINE_2, "oremine2.png" );
preReadCityTexture( CST_OREMINE_3, "oremine3.png" );
preReadCityTexture( CST_OREMINE_4, "oremine4.png" );
preReadCityTexture( CST_HEALTH, "health.png" );
preReadCityTexture( CST_SCHOOL, "school0.png" );
preReadCityTexture( CST_EX_PORT, "ex_port.png" );
preReadCityTexture( CST_MILL_0, "mill0.png" );
preReadCityTexture( CST_MILL_1, "mill1.png" );
preReadCityTexture( CST_MILL_2, "mill2.png" );
preReadCityTexture( CST_MILL_3, "mill3.png" );
preReadCityTexture( CST_MILL_4, "mill4.png" );
preReadCityTexture( CST_MILL_5, "mill5.png" );
preReadCityTexture( CST_MILL_6, "mill6.png" );
preReadCityTexture( CST_ROCKET_1, "rocket1.png" );
preReadCityTexture( CST_ROCKET_2, "rocket2.png" );
preReadCityTexture( CST_ROCKET_3, "rocket3.png" );
preReadCityTexture( CST_ROCKET_4, "rocket4.png" );
preReadCityTexture( CST_ROCKET_5, "rocket5.png" );
preReadCityTexture( CST_ROCKET_6, "rocket6.png" );
preReadCityTexture( CST_ROCKET_7, "rocket7.png" );
preReadCityTexture( CST_ROCKET_FLOWN, "rocketflown.png" );
preReadCityTexture( CST_WINDMILL_1_G, "windmill1g.png" );
preReadCityTexture( CST_WINDMILL_2_G, "windmill2g.png" );
preReadCityTexture( CST_WINDMILL_3_G, "windmill3g.png" );
preReadCityTexture( CST_WINDMILL_1_RG, "windmill1rg.png" );
preReadCityTexture( CST_WINDMILL_2_RG, "windmill2rg.png" );
preReadCityTexture( CST_WINDMILL_3_RG, "windmill3rg.png" );
preReadCityTexture( CST_WINDMILL_1_R, "windmill1r.png" );
preReadCityTexture( CST_WINDMILL_2_R, "windmill2r.png" );
preReadCityTexture( CST_WINDMILL_3_R, "windmill3r.png" );
preReadCityTexture( CST_WINDMILL_1_W, "windmill1w.png" );
preReadCityTexture( CST_WINDMILL_2_W, "windmill2w.png" );
preReadCityTexture( CST_WINDMILL_3_W, "windmill3w.png" );
preReadCityTexture( CST_BLACKSMITH_0, "blacksmith0.png" );
preReadCityTexture( CST_BLACKSMITH_1, "blacksmith1.png" );
preReadCityTexture( CST_BLACKSMITH_2, "blacksmith2.png" );
preReadCityTexture( CST_BLACKSMITH_3, "blacksmith3.png" );
preReadCityTexture( CST_BLACKSMITH_4, "blacksmith4.png" );
preReadCityTexture( CST_BLACKSMITH_5, "blacksmith5.png" );
preReadCityTexture( CST_BLACKSMITH_6, "blacksmith6.png" );
preReadCityTexture( CST_POTTERY_0, "pottery0.png" );
preReadCityTexture( CST_POTTERY_1, "pottery1.png" );
preReadCityTexture( CST_POTTERY_2, "pottery2.png" );
preReadCityTexture( CST_POTTERY_3, "pottery3.png" );
preReadCityTexture( CST_POTTERY_4, "pottery4.png" );
preReadCityTexture( CST_POTTERY_5, "pottery5.png" );
preReadCityTexture( CST_POTTERY_6, "pottery6.png" );
preReadCityTexture( CST_POTTERY_7, "pottery7.png" );
preReadCityTexture( CST_POTTERY_8, "pottery8.png" );
preReadCityTexture( CST_POTTERY_9, "pottery9.png" );
preReadCityTexture( CST_POTTERY_10, "pottery10.png" );
preReadCityTexture( CST_WATER, "water.png" );
preReadCityTexture( CST_WATER_D, "waterd.png" );
preReadCityTexture( CST_WATER_R, "waterr.png" );
preReadCityTexture( CST_WATER_U, "wateru.png" );
preReadCityTexture( CST_WATER_L, "waterl.png" );
preReadCityTexture( CST_WATER_LR, "waterlr.png" );
preReadCityTexture( CST_WATER_UD, "waterud.png" );
preReadCityTexture( CST_WATER_LD, "waterld.png" );
preReadCityTexture( CST_WATER_RD, "waterrd.png" );
preReadCityTexture( CST_WATER_LU, "waterlu.png" );
preReadCityTexture( CST_WATER_UR, "waterur.png" );
preReadCityTexture( CST_WATER_LUD, "waterlud.png" );
preReadCityTexture( CST_WATER_LRD, "waterlrd.png" );
preReadCityTexture( CST_WATER_LUR, "waterlur.png" );
preReadCityTexture( CST_WATER_URD, "waterurd.png" );
preReadCityTexture( CST_WATER_LURD, "waterlurd.png" );
preReadCityTexture( CST_WATERWELL, "waterwell.png" );
preReadCityTexture( CST_CRICKET_1, "cricket1.png" );
preReadCityTexture( CST_CRICKET_2, "cricket2.png" );
preReadCityTexture( CST_CRICKET_3, "cricket3.png" );
preReadCityTexture( CST_CRICKET_4, "cricket4.png" );
preReadCityTexture( CST_CRICKET_5, "cricket5.png" );
preReadCityTexture( CST_CRICKET_6, "cricket6.png" );
preReadCityTexture( CST_CRICKET_7, "cricket7.png" );
preReadCityTexture( CST_FIRESTATION_1, "firestation1.png" );
preReadCityTexture( CST_FIRESTATION_2, "firestation2.png" );
preReadCityTexture( CST_FIRESTATION_3, "firestation3.png" );
preReadCityTexture( CST_FIRESTATION_4, "firestation4.png" );
preReadCityTexture( CST_FIRESTATION_5, "firestation5.png" );
preReadCityTexture( CST_FIRESTATION_6, "firestation6.png" );
preReadCityTexture( CST_FIRESTATION_7, "firestation7.png" );
preReadCityTexture( CST_FIRESTATION_8, "firestation8.png" );
preReadCityTexture( CST_FIRESTATION_9, "firestation9.png" );
preReadCityTexture( CST_FIRESTATION_10, "firestation10.png" );
preReadCityTexture( CST_TIP_0, "tip0.png" );
preReadCityTexture( CST_TIP_1, "tip1.png" );
preReadCityTexture( CST_TIP_2, "tip2.png" );
preReadCityTexture( CST_TIP_3, "tip3.png" );
preReadCityTexture( CST_TIP_4, "tip4.png" );
preReadCityTexture( CST_TIP_5, "tip5.png" );
preReadCityTexture( CST_TIP_6, "tip6.png" );
preReadCityTexture( CST_TIP_7, "tip7.png" );
preReadCityTexture( CST_TIP_8, "tip8.png" );
preReadCityTexture( CST_COMMUNE_1, "commune1.png" );
preReadCityTexture( CST_COMMUNE_2, "commune2.png" );
preReadCityTexture( CST_COMMUNE_3, "commune3.png" );
preReadCityTexture( CST_COMMUNE_4, "commune4.png" );
preReadCityTexture( CST_COMMUNE_5, "commune5.png" );
preReadCityTexture( CST_COMMUNE_6, "commune6.png" );
preReadCityTexture( CST_COMMUNE_7, "commune7.png" );
preReadCityTexture( CST_COMMUNE_8, "commune8.png" );
preReadCityTexture( CST_COMMUNE_9, "commune9.png" );
preReadCityTexture( CST_COMMUNE_10, "commune10.png" );
preReadCityTexture( CST_COMMUNE_11, "commune11.png" );
//preReadCityTexture( CST_COMMUNE_12, "commune12.png" );
//preReadCityTexture( CST_COMMUNE_13, "commune13.png" );
//preReadCityTexture( CST_COMMUNE_14, "commune14.png" );
preReadCityTexture( CST_INDUSTRY_H_C, "industryhc.png" );
preReadCityTexture( CST_INDUSTRY_H_L1, "industryhl1.png" );
preReadCityTexture( CST_INDUSTRY_H_L2, "industryhl2.png" );
preReadCityTexture( CST_INDUSTRY_H_L3, "industryhl3.png" );
preReadCityTexture( CST_INDUSTRY_H_L4, "industryhl4.png" );
preReadCityTexture( CST_INDUSTRY_H_L5, "industryhl5.png" );
preReadCityTexture( CST_INDUSTRY_H_L6, "industryhl6.png" );
preReadCityTexture( CST_INDUSTRY_H_L7, "industryhl7.png" );
preReadCityTexture( CST_INDUSTRY_H_L8, "industryhl8.png" );
preReadCityTexture( CST_INDUSTRY_H_M1, "industryhm1.png" );
preReadCityTexture( CST_INDUSTRY_H_M2, "industryhm2.png" );
preReadCityTexture( CST_INDUSTRY_H_M3, "industryhm3.png" );
preReadCityTexture( CST_INDUSTRY_H_M4, "industryhm4.png" );
preReadCityTexture( CST_INDUSTRY_H_M5, "industryhm5.png" );
preReadCityTexture( CST_INDUSTRY_H_M6, "industryhm6.png" );
preReadCityTexture( CST_INDUSTRY_H_M7, "industryhm7.png" );
preReadCityTexture( CST_INDUSTRY_H_M8, "industryhm8.png" );
preReadCityTexture( CST_INDUSTRY_H_H1, "industryhh1.png" );
preReadCityTexture( CST_INDUSTRY_H_H2, "industryhh2.png" );
preReadCityTexture( CST_INDUSTRY_H_H3, "industryhh3.png" );
preReadCityTexture( CST_INDUSTRY_H_H4, "industryhh4.png" );
preReadCityTexture( CST_INDUSTRY_H_H5, "industryhh5.png" );
preReadCityTexture( CST_INDUSTRY_H_H6, "industryhh6.png" );
preReadCityTexture( CST_INDUSTRY_H_H7, "industryhh7.png" );
preReadCityTexture( CST_INDUSTRY_H_H8, "industryhh8.png" );
preReadCityTexture( CST_INDUSTRY_L_C, "industrylc.png" );
preReadCityTexture( CST_INDUSTRY_L_Q1, "industrylq1.png" );
preReadCityTexture( CST_INDUSTRY_L_Q2, "industrylq2.png" );
preReadCityTexture( CST_INDUSTRY_L_Q3, "industrylq3.png" );
preReadCityTexture( CST_INDUSTRY_L_Q4, "industrylq4.png" );
preReadCityTexture( CST_INDUSTRY_L_L1, "industryll1.png" );
preReadCityTexture( CST_INDUSTRY_L_L2, "industryll2.png" );
preReadCityTexture( CST_INDUSTRY_L_L3, "industryll3.png" );
preReadCityTexture( CST_INDUSTRY_L_L4, "industryll4.png" );
preReadCityTexture( CST_INDUSTRY_L_M1, "industrylm1.png" );
preReadCityTexture( CST_INDUSTRY_L_M2, "industrylm2.png" );
preReadCityTexture( CST_INDUSTRY_L_M3, "industrylm3.png" );
preReadCityTexture( CST_INDUSTRY_L_M4, "industrylm4.png" );
preReadCityTexture( CST_INDUSTRY_L_H1, "industrylh1.png" );
preReadCityTexture( CST_INDUSTRY_L_H2, "industrylh2.png" );
preReadCityTexture( CST_INDUSTRY_L_H3, "industrylh3.png" );
preReadCityTexture( CST_INDUSTRY_L_H4, "industrylh4.png" );
preReadCityTexture( CST_FARM_O0, "farm0.png" );
//preReadCityTexture( CST_FARM_O1, "farm1.png" );
//preReadCityTexture( CST_FARM_O2, "farm2.png" );
preReadCityTexture( CST_FARM_O3, "farm3.png" );
//preReadCityTexture( CST_FARM_O4, "farm4.png" );
//preReadCityTexture( CST_FARM_O5, "farm5.png" );
//preReadCityTexture( CST_FARM_O6, "farm6.png" );
preReadCityTexture( CST_FARM_O7, "farm7.png" );
//preReadCityTexture( CST_FARM_O8, "farm8.png" );
//preReadCityTexture( CST_FARM_O9, "farm9.png" );
//preReadCityTexture( CST_FARM_O10, "farm10.png" );
preReadCityTexture( CST_FARM_O11, "farm11.png" );
//preReadCityTexture( CST_FARM_O12, "farm12.png" );
//preReadCityTexture( CST_FARM_O13, "farm13.png" );
//preReadCityTexture( CST_FARM_O14, "farm14.png" );
preReadCityTexture( CST_FARM_O15, "farm15.png" );
//preReadCityTexture( CST_FARM_O16, "farm16.png" );
preReadCityTexture( CST_TRACK_BRIDGE_LR, "Trackbridge2.png" );
preReadCityTexture( CST_TRACK_BRIDGE_UD, "Trackbridge1.png" );
preReadCityTexture( CST_TRACK_BRIDGE_LRP, "Trackbridge_pg1.png" );
preReadCityTexture( CST_TRACK_BRIDGE_UDP, "Trackbridge_pg2.png" );
preReadCityTexture( CST_TRACK_BRIDGE_ILR, "Trackbridge_entrance_270.png" );
preReadCityTexture( CST_TRACK_BRIDGE_OLR, "Trackbridge_entrance_90.png" );
preReadCityTexture( CST_TRACK_BRIDGE_IUD, "Trackbridge_entrance_00.png" );
preReadCityTexture( CST_TRACK_BRIDGE_OUD, "Trackbridge_entrance_180.png" );
preReadCityTexture( CST_ROAD_BRIDGE_LR, "Roadbridge1.png" );
preReadCityTexture( CST_ROAD_BRIDGE_UD, "Roadbridge2.png" );
preReadCityTexture( CST_ROAD_BRIDGE_LRP, "Roadbridge1s.png" );
preReadCityTexture( CST_ROAD_BRIDGE_UDP, "Roadbridge2s.png" );
preReadCityTexture( CST_ROAD_BRIDGE_LRPG, "Roadbridge_pg1.png" );
preReadCityTexture( CST_ROAD_BRIDGE_UDPG, "Roadbridge_pg2.png" );
preReadCityTexture( CST_ROAD_BRIDGE_I1LR, "Roadbridge_entrance1_270.png" );
preReadCityTexture( CST_ROAD_BRIDGE_O1LR, "Roadbridge_entrance1_90.png" );
preReadCityTexture( CST_ROAD_BRIDGE_I1UD, "Roadbridge_entrance1_00.png" );
preReadCityTexture( CST_ROAD_BRIDGE_O1UD, "Roadbridge_entrance1_180.png" );
preReadCityTexture( CST_ROAD_BRIDGE_I2LR, "Roadbridge_entrance2_270.png" );
preReadCityTexture( CST_ROAD_BRIDGE_O2LR, "Roadbridge_entrance2_90.png" );
preReadCityTexture( CST_ROAD_BRIDGE_I2UD, "Roadbridge_entrance2_00.png" );
preReadCityTexture( CST_ROAD_BRIDGE_O2UD, "Roadbridge_entrance2_180.png" );
preReadCityTexture( CST_RAIL_BRIDGE_LR, "Railbridge1.png" );
preReadCityTexture( CST_RAIL_BRIDGE_UD, "Railbridge2.png" );
preReadCityTexture( CST_RAIL_BRIDGE_LRPG, "Railbridge_pg1.png" );
preReadCityTexture( CST_RAIL_BRIDGE_UDPG, "Railbridge_pg2.png" );
preReadCityTexture( CST_RAIL_BRIDGE_I1LR, "Railbridge_entrance1_270.png" );
preReadCityTexture( CST_RAIL_BRIDGE_O1LR, "Railbridge_entrance1_90.png" );
preReadCityTexture( CST_RAIL_BRIDGE_I1UD, "Railbridge_entrance1_00.png" );
preReadCityTexture( CST_RAIL_BRIDGE_O1UD, "Railbridge_entrance1_180.png" );
preReadCityTexture( CST_RAIL_BRIDGE_I2LR, "Railbridge_entrance2_270.png" );
preReadCityTexture( CST_RAIL_BRIDGE_O2LR, "Railbridge_entrance2_90.png" );
preReadCityTexture( CST_RAIL_BRIDGE_I2UD, "Railbridge_entrance2_00.png" );
preReadCityTexture( CST_RAIL_BRIDGE_O2UD, "Railbridge_entrance2_180.png" );
// End of generated Code.
}
/*
* Scroll the map.
*/
void GameView::scroll( void )
{
static Uint32 oldTime = SDL_GetTicks();
Uint32 now = SDL_GetTicks();
//TODO: scroll speed should be configurable
float stepx = (now - oldTime) * tileWidth / 100;
float stepy = (now - oldTime) * tileHeight / 100;
oldTime = now;
if( keyScrollState == 0 && mouseScrollState == 0 ) {
return;
}
if( keyScrollState & (SCROLL_LSHIFT | SCROLL_RSHIFT) ) {
stepx *= 4;
stepy *= 4;
}
if( (keyScrollState | mouseScrollState) &
(SCROLL_UP | SCROLL_UP_LEFT | SCROLL_UP_RIGHT) ) {
viewport.y -= stepy;
}
if( (keyScrollState | mouseScrollState) &
(SCROLL_DOWN | SCROLL_DOWN_LEFT | SCROLL_DOWN_RIGHT) ) {
viewport.y += stepy;
}
if( (keyScrollState | mouseScrollState) &
(SCROLL_LEFT | SCROLL_UP_LEFT | SCROLL_DOWN_LEFT) ) {
viewport.x -= stepx;
}
if( (keyScrollState | mouseScrollState) &
(SCROLL_RIGHT | SCROLL_UP_RIGHT | SCROLL_DOWN_RIGHT) ) {
viewport.x += stepx;
}
requestRedraw();
}
/*
* Process event
*/
void GameView::event(const Event& event)
{
switch(event.type) {
case Event::MOUSEMOTION: {
mouseScrollState = 0;
if( event.mousepos.x < scrollBorder ) {
mouseScrollState |= SCROLL_LEFT;
} else if( event.mousepos.x > getWidth() - scrollBorder ) {
mouseScrollState |= SCROLL_RIGHT;
}
if( event.mousepos.y < scrollBorder ) {
mouseScrollState |= SCROLL_UP;
} else if( event.mousepos.y > getHeight() - scrollBorder ) {
mouseScrollState |= SCROLL_DOWN;
}
if( dragging ) {
if(fabsf(event.mousemove.x) < 1 && fabsf(event.mousemove.y) < 1)
break;
// this was most probably a SDL_WarpMouse
if(event.mousepos == dragStart)
break;
viewport += event.mousemove;
setDirty();
break;
}
if(!event.inside) {
mouseInGameView = false;
break;
}
mouseInGameView = true;
if( !dragging && rightButtonDown ) {
dragging = true;
dragStart = event.mousepos;
SDL_ShowCursor( SDL_DISABLE );
dragStartTime = SDL_GetTicks();
}
MapPoint tile = getTile(event.mousepos);
if( !roadDragging && leftButtonDown && ( cursorSize == 1 ) ) {
roadDragging = true;
startRoad = tile;
}
if( roadDragging && ( cursorSize != 1 ) ){
roadDragging = false;
}
// bulldoze at once while still dragging
if( roadDragging && (selected_module_type == CST_GREEN) ){
if( tile != startRoad ){
editMap( startRoad, SDL_BUTTON_LEFT);
startRoad = tile;
}
}
if(tileUnderMouse != tile) {
tileUnderMouse = tile;
setDirty();
}
break;
}
case Event::MOUSEBUTTONDOWN: {
if(!event.inside) {
break;
}
if( event.mousebutton == SDL_BUTTON_RIGHT ) {
dragging = false;
rightButtonDown = true;
break;
}
if( event.mousebutton == SDL_BUTTON_LEFT ) {
roadDragging = false;
leftButtonDown = true;
break;
}
if( event.mousebutton == SDL_BUTTON_MIDDLE ) {
if( inCity( getTile( event.mousepos ) ) ) {
getMiniMap()->showMpsEnv( getTile( event.mousepos ) );
}
}
break;
}
case Event::MOUSEBUTTONUP:
if(event.mousebutton == SDL_BUTTON_MIDDLE ){
getMiniMap()->hideMpsEnv();
}
if( event.mousebutton == SDL_BUTTON_RIGHT ){
if ( dragging ) {
dragging = false;
rightButtonDown = false;
SDL_ShowCursor( SDL_ENABLE );
SDL_WarpMouse((Uint16) dragStart.x, (Uint16) dragStart.y);
break;
}
dragging = false;
rightButtonDown = false;
}
if( event.mousebutton == SDL_BUTTON_LEFT ){
resetLastMessage();
if ( roadDragging && event.inside ) {
MapPoint endRoad = getTile( event.mousepos );
roadDragging = false;
leftButtonDown = false;
if( cursorSize != 1 ){//roadDragging was aborted with Escape
break;
}
MapPoint currentTile = startRoad;
//build last tile first to play the sound
if( !blockingDialogIsOpen )
editMap(endRoad, SDL_BUTTON_LEFT);
//turn off effects for the rest of the tiles
bool fx = getConfig()->soundEnabled;
getConfig()->soundEnabled = false;
//use same method to find all Tiles as in void GameView::draw()
int stepx = ( startRoad.x > endRoad.x ) ? -1 : 1;
int stepy = ( startRoad.y > endRoad.y ) ? -1 : 1;
while( currentTile.x != endRoad.x ) {
if( !blockingDialogIsOpen )
editMap(currentTile, SDL_BUTTON_LEFT);
currentTile.x += stepx;
}
while( currentTile.y != endRoad.y ) {
if( !blockingDialogIsOpen )
editMap(currentTile, SDL_BUTTON_LEFT);
currentTile.y += stepy;
}
getConfig()->soundEnabled = fx;
break;
}
roadDragging = false;
leftButtonDown = false;
}
if(!event.inside) {
break;
}
if( event.mousebutton == SDL_BUTTON_LEFT ){ //left
if( !blockingDialogIsOpen )
editMap( getTile( event.mousepos ), SDL_BUTTON_LEFT); //edit tile
}
else if( event.mousebutton == SDL_BUTTON_RIGHT ){ //middle
recenter(event.mousepos); //adjust view
}
else if( event.mousebutton == SDL_BUTTON_WHEELUP ){ //up
zoomIn(); //zoom in
}
else if( event.mousebutton == SDL_BUTTON_WHEELDOWN ){ //down
zoomOut(); //zoom out
}
break;
case Event::KEYDOWN:
if( event.keysym.sym == SDLK_KP8 || event.keysym.sym == SDLK_UP ){
keyScrollState |= SCROLL_UP;
break;
}
if( event.keysym.sym == SDLK_KP2 || event.keysym.sym == SDLK_DOWN ){
keyScrollState |= SCROLL_DOWN;
break;
}
if( event.keysym.sym == SDLK_KP4 || event.keysym.sym == SDLK_LEFT ){
keyScrollState |= SCROLL_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP6 || event.keysym.sym == SDLK_RIGHT ){
keyScrollState |= SCROLL_RIGHT;
break;
}
if( event.keysym.sym == SDLK_KP7 ){
keyScrollState |= SCROLL_UP_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP9 ){
keyScrollState |= SCROLL_UP_RIGHT;
break;
}
if( event.keysym.sym == SDLK_KP1 ){
keyScrollState |= SCROLL_DOWN_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP3 ){
keyScrollState |= SCROLL_DOWN_RIGHT;
break;
}
if( event.keysym.sym == SDLK_LSHIFT ){
keyScrollState |= SCROLL_LSHIFT;
break;
}
if( event.keysym.sym == SDLK_RSHIFT ){
keyScrollState |= SCROLL_RSHIFT;
break;
}
break;
case Event::KEYUP:
//TEst
if( event.keysym.sym == SDLK_x ){
writeOrigin();
readOrigin();
break;
}
//Hide High Buildings
if( event.keysym.sym == SDLK_h ){
if( hideHigh ){
hideHigh = false;
} else {
hideHigh = true;
}
requestRedraw();
break;
}
//overlay MiniMap Information
if( event.keysym.sym == SDLK_v ){
mapOverlay++;
if( mapOverlay > overlayMAX ) {
mapOverlay = overlayNone;
}
requestRedraw();
break;
}
//Zoom
if( event.keysym.sym == SDLK_KP_PLUS ){
zoomIn();
break;
}
if( event.keysym.sym == SDLK_KP_MINUS ){
zoomOut();
break;
}
if( event.keysym.sym == SDLK_KP_ENTER ){
resetZoom();
break;
}
//Scroll
if( event.keysym.sym == SDLK_KP8 || event.keysym.sym == SDLK_UP ){
keyScrollState &= ~SCROLL_UP;
break;
}
if( event.keysym.sym == SDLK_KP2 || event.keysym.sym == SDLK_DOWN ){
keyScrollState &= ~SCROLL_DOWN;
break;
}
if( event.keysym.sym == SDLK_KP4 || event.keysym.sym == SDLK_LEFT ){
keyScrollState &= ~SCROLL_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP6 || event.keysym.sym == SDLK_RIGHT ){
keyScrollState &= ~SCROLL_RIGHT;
break;
}
if( event.keysym.sym == SDLK_KP7 ){
keyScrollState &= ~SCROLL_UP_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP9 ){
keyScrollState &= ~SCROLL_UP_RIGHT;
break;
}
if( event.keysym.sym == SDLK_KP1 ){
keyScrollState &= ~SCROLL_DOWN_LEFT;
break;
}
if( event.keysym.sym == SDLK_KP3 ){
keyScrollState &= ~SCROLL_DOWN_RIGHT;
break;
}
if( event.keysym.sym == SDLK_LSHIFT ){
keyScrollState &= ~SCROLL_LSHIFT;
break;
}
if( event.keysym.sym == SDLK_RSHIFT ){
keyScrollState &= ~SCROLL_RSHIFT;
break;
}
if ( event.keysym.sym == SDLK_KP5 ) {
show(MapPoint(WORLD_SIDE_LEN / 2, WORLD_SIDE_LEN / 2));
setDirty();
break;
}
break;
case Event::UPDATE:
if(dragging)
SDL_WarpMouse((Uint16) dragStart.x, (Uint16) dragStart.y);
break;
default:
break;
}
}
/*
* Parent tells us to change size.
*/
void GameView::resize(float newwidth , float newheight )
{
width = newwidth;
height = newheight;
requestRedraw();
}
/*
* We should draw the whole City again.
*/
void GameView::requestRedraw()
{
if( !getMiniMap() ){ //initialization not completed
return;
}
//TODO: do this only when View changed
//Tell Minimap about new Corners
getMiniMap()->setGameViewCorners( getTile(Vector2(0, 0)),
getTile(Vector2(getWidth(), 0)),
getTile(Vector2(getWidth(), getHeight())),
getTile(Vector2(0, getHeight()) ) );
//request redraw
setDirty();
}
/*
* Pos is new Center of the Screen
*/
void GameView::recenter(const Vector2& pos)
{
Vector2 position = pos + viewport;
viewport.x = floor( position.x - ( getWidth() / 2 ) );
viewport.y = floor( position.y - ( getHeight() / 2 ) );
//request redraw
requestRedraw();
}
/*
* Find point on Screen, where lower right corner of tile
* is placed.
*/
Vector2 GameView::getScreenPoint(MapPoint map)
{
Vector2 point;
point.x = virtualScreenWidth / 2 + (map.x - map.y) * ( tileWidth / 2 );
point.y = (map.x + map.y) * ( tileHeight / 2 );
//we want the lower right corner
point.y += tileHeight;
//on Screen
point -= viewport;
return point;
}
/*
* Find Tile at point on viewport
*/
MapPoint GameView::getTile(const Vector2& p)
{
MapPoint tile;
// Map Point to virtual Screen
Vector2 point = p + viewport;
float x = (point.x - virtualScreenWidth / 2 ) / tileWidth
+ point.y / tileHeight;
tile.x = (int) floorf(x);
tile.y = (int) floorf( 2 * point.y / tileHeight - x );
return tile;
}
/*
* Draw a filled Diamond inside given Rectangle
*/
void GameView::fillDiamond( Painter& painter, const Rect2D& rect )
{
Vector2 points[ 4 ];
points[ 0 ].x = rect.p1.x + ( rect.getWidth() / 2 );
points[ 0 ].y = rect.p1.y;
points[ 1 ].x = rect.p1.x;
points[ 1 ].y = rect.p1.y + ( rect.getHeight() / 2 );
points[ 2 ].x = rect.p1.x + ( rect.getWidth() / 2 );
points[ 2 ].y = rect.p2.y;
points[ 3 ].x = rect.p2.x;
points[ 3 ].y = rect.p1.y + ( rect.getHeight() / 2 );
painter.fillPolygon( 4, points );
}
/*
* Draw a outlined Diamond inside given Rectangle
*/
void GameView::drawDiamond( Painter& painter, const Rect2D& rect )
{
if( !buttonsConnected ) connectButtons();//has to be done here,
// because now everything else is initialized.
Vector2 points[ 4 ];
points[ 0 ].x = rect.p1.x + ( rect.getWidth() / 2 );
points[ 0 ].y = rect.p1.y;
points[ 1 ].x = rect.p1.x;
points[ 1 ].y = rect.p1.y + ( rect.getHeight() / 2 );
points[ 2 ].x = rect.p1.x + ( rect.getWidth() / 2 );
points[ 2 ].y = rect.p2.y;
points[ 3 ].x = rect.p2.x;
points[ 3 ].y = rect.p1.y + ( rect.getHeight() / 2 );
painter.drawPolygon( 4, points );
}
/*
* Check if Tile is in City
* in oldgui you can edit (1,1) to (98,98) with WORLD_SIDE_LEN 100
* i.e. there is a hidden border of green tiles arround the city
*/
bool GameView::inCity( MapPoint tile ){
if( tile.x > gameAreaMax || tile.y > gameAreaMax || tile.x < gameAreaMin || tile.y < gameAreaMin ) {
return false;
}
return true;
}
/*
* Draw MiniMapOverlay for tile.
*/
void GameView::drawOverlay(Painter& painter, MapPoint tile){
Color black;
black.parse("black");
Color miniMapColor;
Vector2 tileOnScreenPoint = getScreenPoint(tile);
Rect2D tilerect( 0, 0, tileWidth, tileHeight );
tileOnScreenPoint.x = tileOnScreenPoint.x - ( tileWidth / 2);
tileOnScreenPoint.y -= tileHeight;
tilerect.move( tileOnScreenPoint );
//Outside of the Map gets Black overlay
if( !inCity( tile ) ) {
painter.setFillColor( black );
} else {
miniMapColor = getMiniMap()->getColor( tile.x, tile.y );
if( mapOverlay == overlayOn ){
miniMapColor.a = 200; //Transparent
}
painter.setFillColor( miniMapColor );
}
fillDiamond( painter, tilerect );
}
/*
* If the current Tile is Part of a Building, return the
* Coordinates of the tile that contains the real informations.
*/
MapPoint GameView::realTile( MapPoint tile ){
MapPoint real = tile;
if( ! inCity( tile ) )
return real;
if ( MP_TYPE( tile.x, tile.y ) == CST_USED )
{
real.x = MP_INFO(tile.x, tile.y).int_1;
real.y = MP_INFO(tile.x, tile.y).int_2;
}
return real;
}
void GameView::drawTile(Painter& painter, MapPoint tile)
{
Rect2D tilerect( 0, 0, tileWidth, tileHeight );
Vector2 tileOnScreenPoint = getScreenPoint( tile );
//is Tile in City? If not draw Blank
if( ! inCity( tile ) )
{
tileOnScreenPoint.x -= (blankTexture->getWidth() / 2) * zoom;
tileOnScreenPoint.y -= blankTexture->getHeight() * zoom;
tilerect.move( tileOnScreenPoint );
tilerect.setSize(blankTexture->getWidth() * zoom,
blankTexture->getHeight() * zoom);
if(zoom == 1.0)
{
painter.drawTexture( blankTexture, tilerect.p1 );
}
else
{
painter.drawStretchTexture( blankTexture, tilerect );
}
return;
}
Texture* texture;
int size;
int upperLeftX = tile.x;
int upperLeftY = tile.y;
if ( MP_TYPE( tile.x, tile.y ) == CST_USED )
{
upperLeftX = MP_INFO(tile.x, tile.y).int_1;
upperLeftY = MP_INFO(tile.x, tile.y).int_2;
}
size = MP_SIZE( upperLeftX, upperLeftY );
//is Tile the lower left corner of the Building?
//dont't draw if not.
if ( ( tile.x != upperLeftX ) || ( tile.y - size +1 != upperLeftY ) )
{
return;
}
//adjust OnScreenPoint of big Tiles
if( size > 1 ) {
MapPoint lowerRightTile( tile.x + size - 1 , tile.y );
tileOnScreenPoint = getScreenPoint( lowerRightTile );
}
int textureType = MP_TYPE( upperLeftX, upperLeftY );
texture = cityTextures[ textureType ];
// Test if we have to convert Preloaded Image to Texture
if( !texture ) {
SDL_mutexP( mTextures );
if( cityImages[ textureType ] ){
cityTextures[ textureType ] = texture_manager->create( cityImages[ textureType ] );
cityImages[ textureType ] = 0; //Image is erased by texture_manager->create.
texture = cityTextures[ textureType ];
}
SDL_mutexV( mTextures );
}
if( texture && ( !hideHigh || size == 1 ) )
{
/* TODO: it seems possible to put green or desert tile first,
* so that buildings without ground will look nice
* especially power lines :) */
tileOnScreenPoint.x -= cityTextureX[textureType] * zoom;
tileOnScreenPoint.y -= cityTextureY[textureType] * zoom;
tilerect.move( tileOnScreenPoint );
tilerect.setSize(texture->getWidth() * zoom, texture->getHeight() * zoom);
if( zoom == 1.0 ) {
painter.drawTexture(texture, tilerect.p1);
}
else
{
painter.drawStretchTexture(texture, tilerect);
}
}
else
{
tileOnScreenPoint.x = tileOnScreenPoint.x - ( tileWidth*size / 2);
tileOnScreenPoint.y -= tileHeight*size;
tilerect.move( tileOnScreenPoint );
tilerect.setSize( size * tileWidth, size * tileHeight );
painter.setFillColor( getMiniMap()->getColorNormal( tile.x, tile.y ) );
fillDiamond( painter, tilerect );
}
}
/*
* Mark a tile with current cursor
*/
void GameView::markTile( Painter& painter, MapPoint tile )
{
Vector2 tileOnScreenPoint = getScreenPoint(tile);
if( cursorSize == 0 ) {
Color alphawhite( 255, 255, 255, 128 );
painter.setLineColor( alphawhite );
Rect2D tilerect( 0, 0, tileWidth, tileHeight );
tileOnScreenPoint.x = tileOnScreenPoint.x - ( tileWidth / 2);
tileOnScreenPoint.y -= tileHeight;
tilerect.move( tileOnScreenPoint );
drawDiamond( painter, tilerect );
} else {
Color alphablue( 0, 0, 255, 128 );
Color alphared( 255, 0, 0, 128 );
painter.setFillColor( alphablue );
//check if building is inside the map, if not use Red Cursor
int x = (int) tile.x;
int y = (int) tile.y;
MapPoint seCorner( x + cursorSize -1, y + cursorSize -1 );
if( !inCity( seCorner ) || !inCity( tile ) ) {
painter.setFillColor( alphared );
} else {
for( y = (int) tile.y; y < tile.y + cursorSize; y++ ){
for( x = (int) tile.x; x < tile.x + cursorSize; x++ ){
if( !GROUP_IS_BARE(MP_GROUP( x, y ))) {
if( !((MP_GROUP( x, y ) == GROUP_WATER) && ( // bridge on water is OK
(selected_module_type == CST_TRACK_LR ) ||
(selected_module_type == CST_ROAD_LR ) ||
(selected_module_type == CST_RAIL_LR ) ))) {
painter.setFillColor( alphared );
y += cursorSize;
break;
}
}
}
}
}
//check if building is allowed here, if not use Red Cursor
// These tests are in engine.cpp with place_item.
if ( !is_allowed_here(tile.x, tile.y, selected_module_type, 0) )
painter.setFillColor( alphared );
Rect2D tilerect( 0, 0, tileWidth * cursorSize, tileHeight * cursorSize );
tileOnScreenPoint.x = tileOnScreenPoint.x - (tileWidth * cursorSize / 2);
tileOnScreenPoint.y -= tileHeight;
tilerect.move( tileOnScreenPoint );
fillDiamond( painter, tilerect );
// Draw range for selected_module_type
int range = 0;
int reduceNW = 0; // substation and market reduce the range to nort west by one.
switch ( selected_module_type ){
//case CST_RESIDENCE_LL: break;
//case CST_RESIDENCE_ML: break;
//case CST_RESIDENCE_HL: break;
//case CST_RESIDENCE_LH: break;
//case CST_RESIDENCE_MH: break;
//case CST_RESIDENCE_HH: break;
//case CST_FARM_O0: break;
//case CST_MILL_0: break;
case CST_HEALTH: range = HEALTH_CENTRE_RANGE; break;
case CST_CRICKET_1: range = CRICKET_RANGE; break;
case CST_FIRESTATION_1: range = FIRESTATION_RANGE; break;
//case CST_SCHOOL: break;
//case CST_UNIVERSITY: break;
//case CST_TRACK_LR: break;
//case CST_ROAD_LR: break;
//case CST_RAIL_LR: break;
//case CST_EX_PORT: break;
//case CST_ROCKET_1: break;
//case CST_POWERL_H_L: break;
//case CST_POWERS_COAL_EMPTY: break;
//case CST_POWERS_SOLAR: break;
case CST_SUBSTATION_R: range = SUBSTATION_RANGE; reduceNW = 1; break;
case CST_WINDMILL_1_R: range = SUBSTATION_RANGE; reduceNW = 1; break; //Windmills are handled like substations
//case CST_COMMUNE_1: break;
case CST_COALMINE_EMPTY: range = COAL_RESERVE_SEARCH_LEN; break;
//case CST_OREMINE_1: break;
//case CST_TIP_0: break;
//case CST_RECYCLE: break;
//case CST_INDUSTRY_L_C: break;
//case CST_INDUSTRY_H_C: break;
case CST_MARKET_EMPTY: range = MARKET_RANGE; reduceNW = 1; break;
//case CST_POTTERY_0: break;
//case CST_BLACKSMITH_0: break;
//case CST_MONUMENT_0: break;
//case CST_PARKLAND_PLANE: break;
//case CST_WATER: break;
case CST_WATERWELL: range = WATERWELL_RANGE; break;
}
if (range > 0 )
{
painter.setFillColor( Color( 0, 0, 128, 64 ) );
Rect2D rangerect( 0,0,
tileWidth * ( 2 * range - reduceNW ) ,
tileHeight * ( 2 * range - reduceNW ) );
Vector2 screenPoint = getScreenPoint(tile);
screenPoint.x -= tileWidth * ( range - 0.5 * reduceNW );
screenPoint.y -= tileHeight * ( range + 1 - reduceNW );
rangerect.move( screenPoint );
fillDiamond( painter, rangerect );
}
}
}
/*
* Paint an isometric View of the City in the component.
*/
void GameView::draw(Painter& painter)
{
//If the centre of the Screen is not Part of the city
//adjust viewport so it is.
MapPoint centerTile = getCenter();
bool outside = false;
if( centerTile.x < gameAreaMin ) {
centerTile.x = gameAreaMin;
outside = true;
}
if( centerTile.x > gameAreaMax ) {
centerTile.x = gameAreaMax;
outside = true;
}
if( centerTile.y < gameAreaMin ) {
centerTile.y = gameAreaMin;
outside = true;
}
if( centerTile.y > gameAreaMax ) {
centerTile.y = gameAreaMax;
outside = true;
}
if( outside ){
mouseScrollState = 0; //Avoid clipping in pause mode
keyScrollState = 0;
show( centerTile );
return;
}
//The Corners of The Screen
//TODO: change here to only draw dirtyRect
// dirtyRectangle is the current Clippingarea (if set)
// so we should get clippingArea (as soon this is implemented)
// and adjust these Vectors:
Vector2 upperLeft( 0, 0);
Vector2 upperRight( getWidth(), 0 );
Vector2 lowerLeft( 0, getHeight() );
//Find visible Tiles
MapPoint upperLeftTile = getTile( upperLeft );
MapPoint upperRightTile = getTile( upperRight );
MapPoint lowerLeftTile = getTile( lowerLeft );
//draw Background
Color green;
Rect2D background( 0, 0, getWidth(), getHeight() );
green.parse( "green" );
painter.setFillColor( green );
painter.fillRectangle( background );
//draw Tiles
MapPoint currentTile;
//Draw some extra tiles depending on the maximal size of a building.
int extratiles = 7;
upperLeftTile.x -= extratiles;
upperRightTile.y -= extratiles;
upperRightTile.x += extratiles;
lowerLeftTile.y += extratiles;
if( mapOverlay != overlayOnly ){
for(int k = 0; k <= 2 * ( lowerLeftTile.y - upperLeftTile.y ); k++ )
{
for(int i = 0; i <= upperRightTile.x - upperLeftTile.x; i++ )
{
currentTile.x = upperLeftTile.x + i + k / 2 + k % 2;
currentTile.y = upperLeftTile.y - i + k / 2;
drawTile( painter, currentTile );
}
}
}
if( mapOverlay != overlayNone ){
for(int k = 0; k <= 2 * ( lowerLeftTile.y - upperLeftTile.y ); k++ )
{
for(int i = 0; i <= upperRightTile.x - upperLeftTile.x; i++ )
{
currentTile.x = upperLeftTile.x + i + k / 2 + k % 2;
currentTile.y = upperLeftTile.y - i + k / 2;
drawOverlay( painter, currentTile );
}
}
}
int cost = 0;
//Mark Tile under Mouse
if( mouseInGameView && !blockingDialogIsOpen ) {
MapPoint lastRazed( -1,-1 );
int tiles = 0;
if( roadDragging && ( cursorSize == 1 ) ){
//use same method to find all Tiles as in GameView::event(const Event& event)
int stepx = ( startRoad.x > tileUnderMouse.x ) ? -1 : 1;
int stepy = ( startRoad.y > tileUnderMouse.y ) ? -1 : 1;
currentTile = startRoad;
while( currentTile.x != tileUnderMouse.x ) {
markTile( painter, currentTile );
//we are speaking of tools, so CST_GREEN == bulldozer
if( (selected_module_type == CST_GREEN) && (realTile( currentTile ) != lastRazed) ){
cost += bulldozeCost( currentTile );
lastRazed = realTile( currentTile );
} else {
cost += buildCost( currentTile );
}
tiles++;
currentTile.x += stepx;
}
while( currentTile.y != tileUnderMouse.y ) {
markTile( painter, currentTile );
if( (selected_module_type == CST_GREEN ) && realTile( currentTile ) != lastRazed ){
cost += bulldozeCost( currentTile );
lastRazed = realTile( currentTile );
} else {
cost += buildCost( currentTile );
}
tiles++;
currentTile.y += stepy;
}
}
markTile( painter, tileUnderMouse );
tiles++;
if( (selected_module_type == CST_GREEN ) && realTile( currentTile ) != lastRazed ) {
cost += bulldozeCost( tileUnderMouse );
} else {
cost += buildCost( tileUnderMouse );
}
std::stringstream prize;
if( selected_module_type == CST_GREEN ){
if( roadDragging ){
prize << _("Estimated Bulldoze Cost: ");
} else {
prize << _("Bulldoze Cost: ");
}
if( cost > 0 ) {
prize << cost << _("$");
} else {
prize << _("n/a");
}
printStatusMessage( prize.str() );
} else if( selected_module_type == CST_TRACK_LR || selected_module_type == CST_ROAD_LR
|| selected_module_type == CST_RAIL_LR )
{
int group = main_types[ selected_module_type ].group;
std::string buildingName = main_groups[ group ].name;
prize << dictionaryManager->get_dictionary().translate( buildingName );
prize << _(": Cost to build ");
if( cost > 0 ) {
prize << cost << _("$");
} else {
prize << _("n/a");
}
printStatusMessage( prize.str() );
} else {
showToolInfo( tiles );
}
}
}
/*
* Show informatiosn about selected Tool
*/
void GameView::showToolInfo( int number /*= 0*/ )
{
std::stringstream infotextstream;
if( selected_module_type == CST_NONE ) //query
{
infotextstream << _("Query Tool: Show information about selected building.");
}
else if( selected_module_type == CST_GREEN ) //bulldoze
{
infotextstream << _("Bulldozer: remove building -price varies-");
}
else
{
int group = main_types[ selected_module_type ].group;
std::string buildingName = main_groups[ group ].name;
infotextstream << dictionaryManager->get_dictionary().translate( buildingName );
infotextstream << _(": Cost to build ") << selected_module_cost <<_("$");
infotextstream << _(", to bulldoze ") << main_groups[ group ].bul_cost <<_("$.");
if( number > 1 ){
infotextstream << _(" To build ") << number << _(" of them ");
infotextstream << _("will cost about ") << number*selected_module_cost << _("$.");
}
}
printStatusMessage( infotextstream.str() );
}
/*
* Print a Message to the StatusBar.
*/
void GameView::printStatusMessage( std::string message ){
if( message == lastStatusMessage ){
return;
}
Component* root = this;
while( root->getParent() )
root = root->getParent();
Desktop* desktop = dynamic_cast<Desktop*> (root);
if(!desktop) {
std::cerr << "Root not a desktop!?!\n";
return;
}
try {
Paragraph* statusParagraph = getParagraph( *root, "statusParagraph");
statusParagraph->setText( message );
} catch(std::exception& e) {
std::cerr << "Couldn't print status message '" << message << "': "
<< e.what() << "\n";
return;
}
lastStatusMessage = message;
}
int GameView::bulldozeCost( MapPoint tile ){
int group;
int prize = 0;
if (MP_TYPE( tile.x, tile.y) == CST_USED)
group = MP_GROUP( MP_INFO(tile.x,tile.y).int_1,
MP_INFO(tile.x,tile.y).int_2 );
else
group = MP_GROUP( tile.x,tile.y );
prize = main_groups[group].bul_cost;
return prize;
}
int GameView::buildCost( MapPoint tile ){
if( selected_module_type == CST_NONE ){
return 0;
}
if (MP_TYPE( tile.x, tile.y ) == CST_USED)
return 0;
if (( selected_module_type == CST_TRACK_LR || selected_module_type == CST_ROAD_LR ||
selected_module_type == CST_RAIL_LR) &&
// Transport on water need a bridge
(MP_GROUP( tile.x, tile.y) == GROUP_WATER ||
// upgrade bridge
((selected_module_type == CST_ROAD_LR && (MP_GROUP( tile.x, tile.y) == GROUP_TRACK_BRIDGE)) ||
(selected_module_type == CST_RAIL_LR && (MP_GROUP( tile.x, tile.y) == GROUP_TRACK_BRIDGE ||
MP_GROUP( tile.x, tile.y) == GROUP_ROAD_BRIDGE))) ) )
{
switch( selected_module_type ) {
case CST_TRACK_LR:
return get_group_cost( GROUP_TRACK_BRIDGE );
case CST_ROAD_LR:
return get_group_cost( GROUP_ROAD_BRIDGE );
case CST_RAIL_LR:
return get_group_cost( GROUP_RAIL_BRIDGE );
}
// Not updgrade a transport
} else if ( !GROUP_IS_BARE(MP_GROUP( tile.x, tile.y )) && (selected_module_type == CST_TRACK_LR
|| (selected_module_type == CST_ROAD_LR && (MP_GROUP( tile.x, tile.y) == GROUP_ROAD ||
MP_GROUP( tile.x, tile.y) == GROUP_RAIL || MP_GROUP( tile.x, tile.y) == GROUP_RAIL_BRIDGE))
|| (selected_module_type == CST_RAIL_LR &&
(MP_GROUP( tile.x, tile.y) == GROUP_RAIL || MP_GROUP( tile.x, tile.y) == GROUP_RAIL_BRIDGE))
|| (selected_module_type == CST_WATER && MP_GROUP( tile.x, tile.y) == GROUP_WATER )) ){
return 0;
}
return get_group_cost( main_types[ selected_module_type ].group );
}
//Register as Component
IMPLEMENT_COMPONENT_FACTORY(GameView);
| javiercantero/lincity-ng | src/lincity-ng/GameView.cpp | C++ | gpl-2.0 | 69,238 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2384,
13865,
15309,
1026,
25423,
19699,
1030,
13938,
2595,
1012,
2139,
1028,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php defined('SYSPATH') OR die('No direct access allowed.');
/*
* Class: Database_PdoSqlite_Driver
* Provides specific database items for Sqlite.
*
* Connection string should be, eg: "pdosqlite://path/to/database.db"
*
* Version 1.0 alpha
* author - Doutu, updated by gregmac
* copyright - (c) BSD
* license - <no>
*/
class Database_Pdosqlite_Driver extends Database_Driver {
// Database connection link
protected $link;
protected $db_config;
/*
* Constructor: __construct
* Sets up the config for the class.
*
* Parameters:
* config - database configuration
*
*/
public function __construct($config)
{
$this->db_config = $config;
Kohana::log('debug', 'PDO:Sqlite Database Driver Initialized');
}
public function connect()
{
// Import the connect variables
extract($this->db_config['connection']);
try
{
$this->link = new PDO('sqlite:'.$socket.$database, $user, $pass,
array(PDO::ATTR_PERSISTENT => $this->db_config['persistent']));
$this->link->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
//$this->link->query('PRAGMA count_changes=1;');
if ($charset = $this->db_config['character_set'])
{
$this->set_charset($charset);
}
}
catch (PDOException $e)
{
throw new Kohana_Database_Exception('database.error', $e->getMessage());
}
// Clear password after successful connect
$this->db_config['connection']['pass'] = NULL;
return $this->link;
}
public function query($sql)
{
try
{
$sth = $this->link->prepare($sql);
}
catch (PDOException $e)
{
throw new Kohana_Database_Exception('database.error', $e->getMessage());
}
return new Pdosqlite_Result($sth, $this->link, $this->db_config['object'], $sql);
}
public function set_charset($charset)
{
$this->link->query('PRAGMA encoding = '.$this->escape_str($charset));
}
public function escape_table($table)
{
if ( ! $this->db_config['escape'])
return $table;
return '`'.str_replace('.', '`.`', $table).'`';
}
public function escape_column($column)
{
if ( ! $this->db_config['escape'])
return $column;
if ($column == '*')
return $column;
// This matches any functions we support to SELECT.
if ( preg_match('/(avg|count|sum|max|min)\(\s*(.*)\s*\)(\s*as\s*(.+)?)?/i', $column, $matches))
{
if ( count($matches) == 3)
{
return $matches[1].'('.$this->escape_column($matches[2]).')';
}
else if ( count($matches) == 5)
{
return $matches[1].'('.$this->escape_column($matches[2]).') AS '.$this->escape_column($matches[2]);
}
}
// This matches any modifiers we support to SELECT.
if ( ! preg_match('/\b(?:rand|all|distinct(?:row)?|high_priority|sql_(?:small_result|b(?:ig_result|uffer_result)|no_cache|ca(?:che|lc_found_rows)))\s/i', $column))
{
if (stripos($column, ' AS ') !== FALSE)
{
// Force 'AS' to uppercase
$column = str_ireplace(' AS ', ' AS ', $column);
// Runs escape_column on both sides of an AS statement
$column = array_map(array($this, __FUNCTION__), explode(' AS ', $column));
// Re-create the AS statement
return implode(' AS ', $column);
}
return preg_replace('/[^.*]+/', '`$0`', $column);
}
$parts = explode(' ', $column);
$column = '';
for ($i = 0, $c = count($parts); $i < $c; $i++)
{
// The column is always last
if ($i == ($c - 1))
{
$column .= preg_replace('/[^.*]+/', '`$0`', $parts[$i]);
}
else // otherwise, it's a modifier
{
$column .= $parts[$i].' ';
}
}
return $column;
}
public function limit($limit, $offset = 0)
{
return 'LIMIT '.$offset.', '.$limit;
}
public function compile_select($database)
{
$sql = ($database['distinct'] == TRUE) ? 'SELECT DISTINCT ' : 'SELECT ';
$sql .= (count($database['select']) > 0) ? implode(', ', $database['select']) : '*';
if (count($database['from']) > 0)
{
$sql .= "\nFROM ";
$sql .= implode(', ', $database['from']);
}
if (count($database['join']) > 0)
{
foreach($database['join'] AS $join)
{
$sql .= "\n".$join['type'].'JOIN '.implode(', ', $join['tables']).' ON '.$join['conditions'];
}
}
if (count($database['where']) > 0)
{
$sql .= "\nWHERE ";
}
$sql .= implode("\n", $database['where']);
if (count($database['groupby']) > 0)
{
$sql .= "\nGROUP BY ";
$sql .= implode(', ', $database['groupby']);
}
if (count($database['having']) > 0)
{
$sql .= "\nHAVING ";
$sql .= implode("\n", $database['having']);
}
if (count($database['orderby']) > 0)
{
$sql .= "\nORDER BY ";
$sql .= implode(', ', $database['orderby']);
}
if (is_numeric($database['limit']))
{
$sql .= "\n";
$sql .= $this->limit($database['limit'], $database['offset']);
}
return $sql;
}
public function escape_str($str)
{
if ( ! $this->db_config['escape'])
return $str;
if (function_exists('sqlite_escape_string'))
{
$res = sqlite_escape_string($str);
}
else
{
$res = str_replace("'", "''", $str);
}
return $res;
}
public function list_tables()
{
$sql = "SELECT `name` FROM `sqlite_master` WHERE `type`='table' ORDER BY `name`;";
try
{
$result = $this->query($sql)->result(FALSE, PDO::FETCH_ASSOC);
$tables = array();
foreach ($result as $row)
{
$tables[] = current($row);
}
}
catch (PDOException $e)
{
throw new Kohana_Database_Exception('database.error', $e->getMessage());
}
return $tables;
}
public function show_error()
{
$err = $this->link->errorInfo();
return isset($err[2]) ? $err[2] : 'Unknown error!';
}
public function list_fields($table, $query = FALSE)
{
static $tables;
if (is_object($query))
{
if (empty($tables[$table]))
{
$tables[$table] = array();
foreach ($query->result() as $row)
{
$tables[$table][] = $row->name;
}
}
return $tables[$table];
}
else
{
$result = $this->link->query( 'PRAGMA table_info('.$this->escape_table($table).')' );
foreach ($result as $row)
{
$tables[$table][$row['name']] = $this->sql_type($row['type']);
}
return $tables[$table];
}
}
public function field_data($table)
{
Kohana::log('error', 'This method is under developing');
}
/**
* Version number query string
*
* @access public
* @return string
*/
function version()
{
return $this->link->getAttribute(constant("PDO::ATTR_SERVER_VERSION"));
}
} // End Database_PdoSqlite_Driver Class
/*
* PDO-sqlite Result
*/
class Pdosqlite_Result extends Database_Result {
// Data fetching types
protected $fetch_type = PDO::FETCH_OBJ;
protected $return_type = PDO::FETCH_ASSOC;
/**
* Sets up the result variables.
*
* @param resource query result
* @param resource database link
* @param boolean return objects or arrays
* @param string SQL query that was run
*/
public function __construct($result, $link, $object = TRUE, $sql)
{
if (is_object($result) OR $result = $link->prepare($sql))
{
// run the query. Return true if success, false otherwise
if( ! $result->execute())
{
// Throw Kohana Exception with error message. See PDOStatement errorInfo() method
$arr_infos = $result->errorInfo();
throw new Kohana_Database_Exception('database.error', $arr_infos[2]);
}
if (preg_match('/^SELECT|PRAGMA|EXPLAIN/i', $sql))
{
$this->result = $result;
$this->current_row = 0;
$this->total_rows = $this->sqlite_row_count();
$this->fetch_type = ($object === TRUE) ? PDO::FETCH_OBJ : PDO::FETCH_ASSOC;
}
elseif (preg_match('/^DELETE|INSERT|UPDATE/i', $sql))
{
$this->insert_id = $link->lastInsertId();
$this->total_rows = $result->rowCount();
}
}
else
{
// SQL error
throw new Kohana_Database_Exception('database.error', $link->errorInfo().' - '.$sql);
}
// Set result type
$this->result($object);
// Store the SQL
$this->sql = $sql;
}
private function sqlite_row_count()
{
$count = 0;
while ($this->result->fetch())
{
$count++;
}
// The query must be re-fetched now.
$this->result->execute();
return $count;
}
/*
* Destructor: __destruct
* Magic __destruct function, frees the result.
*/
public function __destruct()
{
if (is_object($this->result))
{
$this->result->closeCursor();
$this->result = NULL;
}
}
public function result($object = TRUE, $type = PDO::FETCH_BOTH)
{
$this->fetch_type = (bool) $object ? PDO::FETCH_OBJ : PDO::FETCH_BOTH;
if ($this->fetch_type == PDO::FETCH_OBJ)
{
$this->return_type = (is_string($type) AND Kohana::auto_load($type)) ? $type : 'stdClass';
}
else
{
$this->return_type = $type;
}
return $this;
}
public function as_array($object = NULL, $type = PDO::FETCH_ASSOC)
{
return $this->result_array($object, $type);
}
public function result_array($object = NULL, $type = PDO::FETCH_ASSOC)
{
$rows = array();
if (is_string($object))
{
$fetch = $object;
}
elseif (is_bool($object))
{
if ($object === TRUE)
{
$fetch = PDO::FETCH_OBJ;
// NOTE - The class set by $type must be defined before fetching the result,
// autoloading is disabled to save a lot of stupid overhead.
$type = (is_string($type) AND Kohana::auto_load($type)) ? $type : 'stdClass';
}
else
{
$fetch = PDO::FETCH_OBJ;
}
}
else
{
// Use the default config values
$fetch = $this->fetch_type;
if ($fetch == PDO::FETCH_OBJ)
{
$type = (is_string($type) AND Kohana::auto_load($type)) ? $type : 'stdClass';
}
}
try
{
while ($row = $this->result->fetch($fetch))
{
$rows[] = $row;
}
}
catch(PDOException $e)
{
throw new Kohana_Database_Exception('database.error', $e->getMessage());
return FALSE;
}
return $rows;
}
public function list_fields()
{
$field_names = array();
for ($i = 0, $max = $this->result->columnCount(); $i < $max; $i++)
{
$info = $this->result->getColumnMeta($i);
$field_names[] = $info['name'];
}
return $field_names;
}
public function seek($offset)
{
// To request a scrollable cursor for your PDOStatement object, you must
// set the PDO::ATTR_CURSOR attribute to PDO::CURSOR_SCROLL when you
// prepare the statement.
Kohana::log('error', get_class($this).' does not support scrollable cursors, '.__FUNCTION__.' call ignored');
return FALSE;
}
public function offsetGet($offset)
{
try
{
return $this->result->fetch($this->fetch_type, PDO::FETCH_ORI_ABS, $offset);
}
catch(PDOException $e)
{
throw new Kohana_Database_Exception('database.error', $e->getMessage());
}
}
public function rewind()
{
// Same problem that seek() has, see above.
return $this->seek(0);
}
} // End PdoSqlite_Result Class | fjytzh/toeer | system/libraries/drivers/Database/Pdosqlite.php | PHP | bsd-2-clause | 10,736 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
25353,
13102,
8988,
1005,
1007,
2030,
3280,
1006,
1005,
2053,
3622,
3229,
3039,
1012,
1005,
1007,
1025,
1013,
1008,
1008,
2465,
1024,
7809,
1035,
22851,
2891,
4160,
22779,
1035,
4062,
1008,
3640,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* jStorybook: ใในใฆใฎๅฐ่ชฌๅฎถใปไฝ่
ใฎใใใฎใชใผใใณใฝใผในใปใฝใใใฆใงใข
* Copyright (C) 2008 - 2012 Martin Mustun
* (ใใฎใฝใผในใฎ่ฃฝไฝ่
) KMY
*
* ใใฎใใญใฐใฉใ ใฏใใชใผใฝใใใงใใ
* ใใชใใฏใ่ช็ฑใซไฟฎๆญฃใใๅ้
ๅธใใใใจใๅบๆฅใพใใ
* ใใชใใฎๆจฉๅฉใฏใthe Free Software Foundationใซใใฃใฆ็บ่กจใใใGPL ver.2ไปฅ้ใซใใฃใฆไฟ่ญทใใใฆใใพใใ
*
* ใใฎใใญใฐใฉใ ใฏใๅฐ่ชฌใปในใใผใชใผใฎๅถไฝใใใใใใชใใใใซใจใใ้กใใ่พผใใฆๅ้
ๅธใใใฆใใพใใ
* ใใชใใใใฎใใญใฐใฉใ ใๅ้
ๅธใใใจใใฏใGPLใฉใคใปใณในใซๅๆใใชใใใฐใใใพใใใ
* <http://www.gnu.org/licenses/>.
*/
package jstorybook.view.pane;
/**
* ๆฏ่ผๅฏ่ฝใชใใคใณ
*
* @author KMY
*/
public interface IComparablePane {
public PaneType getPaneType ();
public long getPaneId ();
public default boolean isEqualPane (IComparablePane other) {
return this.getPaneType() == other.getPaneType() && this.getPaneId() == other.getPaneId();
}
}
| kmycode/jstorybook | src/jstorybook/view/pane/IComparablePane.java | Java | gpl-3.0 | 1,126 | [
30522,
1013,
1008,
1008,
1046,
23809,
2100,
8654,
1024,
1658,
30201,
30191,
30197,
1829,
100,
1825,
1738,
100,
100,
100,
1738,
100,
1008,
9385,
1006,
1039,
1007,
2263,
1011,
2262,
3235,
2442,
4609,
1008,
1006,
100,
100,
100,
100,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Fog
module Compute
class AWS
class Real
require 'fog/aws/parsers/compute/run_instances'
# Launch specified instances
#
# ==== Parameters
# * image_id<~String> - Id of machine image to load on instances
# * min_count<~Integer> - Minimum number of instances to launch. If this
# exceeds the count of available instances, no instances will be
# launched. Must be between 1 and maximum allowed for your account
# (by default the maximum for an account is 20)
# * max_count<~Integer> - Maximum number of instances to launch. If this
# exceeds the number of available instances, the largest possible
# number of instances above min_count will be launched instead. Must
# be between 1 and maximum allowed for you account
# (by default the maximum for an account is 20)
# * options<~Hash>:
# * 'Placement.AvailabilityZone'<~String> - Placement constraint for instances
# * 'Placement.GroupName'<~String> - Name of existing placement group to launch instance into
# * 'Placement.Tenancy'<~String> - Tenancy option in ['dedicated', 'default'], defaults to 'default'
# * 'BlockDeviceMapping'<~Array>: array of hashes
# * 'DeviceName'<~String> - where the volume will be exposed to instance
# * 'VirtualName'<~String> - volume virtual device name
# * 'Ebs.SnapshotId'<~String> - id of snapshot to boot volume from
# * 'Ebs.VolumeSize'<~String> - size of volume in GiBs required unless snapshot is specified
# * 'Ebs.DeleteOnTermination'<~Boolean> - specifies whether or not to delete the volume on instance termination
# * 'Ebs.Encrypted'<~Boolean> - specifies whether or not the volume is to be encrypted unless snapshot is specified
# * 'Ebs.VolumeType'<~String> - Type of EBS volue. Valid options in ['standard', 'io1'] default is 'standard'.
# * 'Ebs.Iops'<~String> - The number of I/O operations per second (IOPS) that the volume supports. Required when VolumeType is 'io1'
# * 'NetworkInterfaces'<~Array>: array of hashes
# * 'NetworkInterfaceId'<~String> - An existing interface to attach to a single instance
# * 'DeviceIndex'<~String> - The device index. Applies both to attaching an existing network interface and creating a network interface
# * 'SubnetId'<~String> - The subnet ID. Applies only when creating a network interface
# * 'Description'<~String> - A description. Applies only when creating a network interface
# * 'PrivateIpAddress'<~String> - The primary private IP address. Applies only when creating a network interface
# * 'SecurityGroupId'<~Array> or <~String> - ids of security group(s) for network interface. Applies only when creating a network interface.
# * 'DeleteOnTermination'<~String> - Indicates whether to delete the network interface on instance termination.
# * 'PrivateIpAddresses.PrivateIpAddress'<~String> - The private IP address. This parameter can be used multiple times to specify explicit private IP addresses for a network interface, but only one private IP address can be designated as primary.
# * 'PrivateIpAddresses.Primary'<~Bool> - Indicates whether the private IP address is the primary private IP address.
# * 'SecondaryPrivateIpAddressCount'<~Bool> - The number of private IP addresses to assign to the network interface.
# * 'AssociatePublicIpAddress'<~String> - Indicates whether to assign a public IP address to an instance in a VPC. The public IP address is assigned to a specific network interface
# * 'ClientToken'<~String> - unique case-sensitive token for ensuring idempotency
# * 'DisableApiTermination'<~Boolean> - specifies whether or not to allow termination of the instance from the api
# * 'SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances (not supported for VPC)
# * 'SecurityGroupId'<~Array> or <~String> - id's of security group(s) for instances, use this or SecurityGroup
# * 'InstanceInitiatedShutdownBehaviour'<~String> - specifies whether volumes are stopped or terminated when instance is shutdown, in [stop, terminate]
# * 'InstanceType'<~String> - Type of instance to boot. Valid options
# in ['t1.micro', 't2.nano', 't2.micro', 't2.small', 't2.medium', 'm1.small', 'm1.medium', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'c3.large', 'c3.xlarge', 'c3.2xlarge', 'c3.4xlarge', 'c3.8xlarge', 'g2.2xlarge', 'hs1.8xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'cr1.8xlarge', 'm3.xlarge', 'm3.2xlarge', 'hi1.4xlarge', 'cc1.4xlarge', 'cc2.8xlarge', 'cg1.4xlarge', 'i2.xlarge', 'i2.2xlarge', 'i2.4xlarge', 'i2.8xlarge']
# default is 'm1.small'
# * 'KernelId'<~String> - Id of kernel with which to launch
# * 'KeyName'<~String> - Name of a keypair to add to booting instances
# * 'Monitoring.Enabled'<~Boolean> - Enables monitoring, defaults to
# disabled
# * 'PrivateIpAddress<~String> - VPC option to specify ip address within subnet
# * 'RamdiskId'<~String> - Id of ramdisk with which to launch
# * 'SubnetId'<~String> - VPC option to specify subnet to launch instance into
# * 'UserData'<~String> - Additional data to provide to booting instances
# * 'EbsOptimized'<~Boolean> - Whether the instance is optimized for EBS I/O
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'groupSet'<~Array>: groups the instances are members in
# * 'groupName'<~String> - Name of group
# * 'instancesSet'<~Array>: returned instances
# * instance<~Hash>:
# * 'amiLaunchIndex'<~Integer> - reference to instance in launch group
# * 'architecture'<~String> - architecture of image in [i386, x86_64]
# * 'blockDeviceMapping'<~Array>
# * 'attachTime'<~Time> - time of volume attachment
# * 'deleteOnTermination'<~Boolean> - whether or not to delete volume on termination
# * 'deviceName'<~String> - specifies how volume is exposed to instance
# * 'status'<~String> - status of attached volume
# * 'volumeId'<~String> - Id of attached volume
# * 'dnsName'<~String> - public dns name, blank until instance is running
# * 'imageId'<~String> - image id of ami used to launch instance
# * 'instanceId'<~String> - id of the instance
# * 'instanceState'<~Hash>:
# * 'code'<~Integer> - current status code
# * 'name'<~String> - current status name
# * 'instanceType'<~String> - type of instance
# * 'ipAddress'<~String> - public ip address assigned to instance
# * 'kernelId'<~String> - Id of kernel used to launch instance
# * 'keyName'<~String> - name of key used launch instances or blank
# * 'launchTime'<~Time> - time instance was launched
# * 'monitoring'<~Hash>:
# * 'state'<~Boolean - state of monitoring
# * 'placement'<~Hash>:
# * 'availabilityZone'<~String> - Availability zone of the instance
# * 'privateDnsName'<~String> - private dns name, blank until instance is running
# * 'privateIpAddress'<~String> - private ip address assigned to instance
# * 'productCodes'<~Array> - Product codes for the instance
# * 'ramdiskId'<~String> - Id of ramdisk used to launch instance
# * 'reason'<~String> - reason for most recent state transition, or blank
# * 'rootDeviceName'<~String> - specifies how the root device is exposed to the instance
# * 'rootDeviceType'<~String> - root device type used by AMI in [ebs, instance-store]
# * 'ebsOptimized'<~Boolean> - Whether the instance is optimized for EBS I/O
# * 'ownerId'<~String> - Id of owner
# * 'requestId'<~String> - Id of request
# * 'reservationId'<~String> - Id of reservation
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RunInstances.html]
def run_instances(image_id, min_count, max_count, options = {})
if block_device_mapping = options.delete('BlockDeviceMapping')
block_device_mapping.each_with_index do |mapping, index|
for key, value in mapping
options.merge!({ format("BlockDeviceMapping.%d.#{key}", index) => value })
end
end
end
if security_groups = options.delete('SecurityGroup')
options.merge!(Fog::AWS.indexed_param('SecurityGroup', [*security_groups]))
end
if security_group_ids = options.delete('SecurityGroupId')
options.merge!(Fog::AWS.indexed_param('SecurityGroupId', [*security_group_ids]))
end
if options['UserData']
options['UserData'] = Base64.encode64(options['UserData'])
end
if network_interfaces = options.delete('NetworkInterfaces')
network_interfaces.each_with_index do |mapping, index|
iface = format("NetworkInterface.%d", index)
for key, value in mapping
case key
when "SecurityGroupId"
options.merge!(Fog::AWS.indexed_param("#{iface}.SecurityGroupId", [*value]))
else
options.merge!({ "#{iface}.#{key}" => value })
end
end
end
end
idempotent = !(options['ClientToken'].nil? || options['ClientToken'].empty?)
request({
'Action' => 'RunInstances',
'ImageId' => image_id,
'MinCount' => min_count,
'MaxCount' => max_count,
:idempotent => idempotent,
:parser => Fog::Parsers::Compute::AWS::RunInstances.new
}.merge!(options))
end
end
class Mock
def run_instances(image_id, min_count, max_count, options = {})
response = Excon::Response.new
response.status = 200
group_set = [ (options['SecurityGroup'] || 'default') ].flatten
instances_set = []
reservation_id = Fog::AWS::Mock.reservation_id
if options['KeyName'] && describe_key_pairs('key-name' => options['KeyName']).body['keySet'].empty?
raise Fog::Compute::AWS::NotFound.new("The key pair '#{options['KeyName']}' does not exist")
end
min_count.times do |i|
instance_id = Fog::AWS::Mock.instance_id
availability_zone = options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region)
block_device_mapping = (options['BlockDeviceMapping'] || []).reduce([]) do |mapping, device|
device_name = device.fetch("DeviceName", "/dev/sda1")
volume_size = device.fetch("Ebs.VolumeSize", 15) # @todo should pull this from the image
delete_on_termination = device.fetch("Ebs.DeleteOnTermination", true) # @todo should pull this from the image
volume_id = create_volume(availability_zone, volume_size).data[:body]["volumeId"]
self.data[:volumes][volume_id].merge!("DeleteOnTermination" => delete_on_termination)
mapping << {
"deviceName" => device_name,
"volumeId" => volume_id,
"status" => "attached",
"attachTime" => Time.now,
"deleteOnTermination" => delete_on_termination,
}
end
if options['SubnetId']
if options['PrivateIpAddress']
ni_options = {'PrivateIpAddress' => options['PrivateIpAddress']}
else
ni_options = {}
end
network_interface_id = create_network_interface(options['SubnetId'], ni_options).body['networkInterface']['networkInterfaceId']
end
network_interfaces = (options['NetworkInterfaces'] || []).reduce([]) do |mapping, device|
device_index = device.fetch("DeviceIndex", 0)
subnet_id = device.fetch("SubnetId", options[:subnet_id] || Fog::AWS::Mock.subnet_id)
private_ip_address = device.fetch("PrivateIpAddress", options[:private_ip_address] || Fog::AWS::Mock.private_ip_address)
delete_on_termination = device.fetch("DeleteOnTermination", true)
description = device.fetch("Description", "mock_network_interface")
security_group_id = device.fetch("SecurityGroupId", self.data[:security_groups]['default']['groupId'])
interface_options = {
"PrivateIpAddress" => private_ip_address,
"GroupSet" => device.fetch("GroupSet", [security_group_id]),
"Description" => description
}
interface_id = device.fetch("NetworkInterfaceId", create_network_interface(subnet_id, interface_options))
mapping << {
"networkInterfaceId" => interface_id,
"subnetId" => subnet_id,
"status" => "attached",
"attachTime" => Time.now,
"deleteOnTermination" => delete_on_termination,
}
end
instance = {
'amiLaunchIndex' => i,
'associatePublicIP' => options['associatePublicIP'] || false,
'architecture' => 'i386',
'blockDeviceMapping' => block_device_mapping,
'networkInterfaces' => network_interfaces,
'clientToken' => options['clientToken'],
'dnsName' => nil,
'ebsOptimized' => options['EbsOptimized'] || false,
'hypervisor' => 'xen',
'imageId' => image_id,
'instanceId' => instance_id,
'instanceState' => { 'code' => 0, 'name' => 'pending' },
'instanceType' => options['InstanceType'] || 'm1.small',
'kernelId' => options['KernelId'] || Fog::AWS::Mock.kernel_id,
'keyName' => options['KeyName'],
'launchTime' => Time.now,
'monitoring' => { 'state' => options['Monitoring.Enabled'] || false },
'placement' => { 'availabilityZone' => availability_zone, 'groupName' => nil, 'tenancy' => options['Placement.Tenancy'] || 'default' },
'privateDnsName' => nil,
'productCodes' => [],
'reason' => nil,
'rootDeviceName' => block_device_mapping.first && block_device_mapping.first["deviceName"],
'rootDeviceType' => 'instance-store',
'spotInstanceRequestId' => options['SpotInstanceRequestId'],
'subnetId' => options['SubnetId'],
'virtualizationType' => 'paravirtual'
}
instances_set << instance
self.data[:instances][instance_id] = instance.merge({
'groupIds' => [],
'groupSet' => group_set,
'iamInstanceProfile' => {},
'ownerId' => self.data[:owner_id],
'reservationId' => reservation_id,
'stateReason' => {}
})
if options['SubnetId']
self.data[:instances][instance_id]['vpcId'] = self.data[:subnets].find{|subnet| subnet['subnetId'] == options['SubnetId'] }['vpcId']
attachment_id = attach_network_interface(network_interface_id, instance_id, '0').data[:body]['attachmentId']
modify_network_interface_attribute(network_interface_id, 'attachment', {'attachmentId' => attachment_id, 'deleteOnTermination' => 'true'})
end
end
response.body = {
'groupSet' => group_set,
'instancesSet' => instances_set,
'ownerId' => self.data[:owner_id],
'requestId' => Fog::AWS::Mock.request_id,
'reservationId' => reservation_id
}
response
end
end
end
end
end
| jonpstone/portfolio-project-rails-mean-movie-reviews | vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.0/lib/fog/aws/requests/compute/run_instances.rb | Ruby | mit | 17,037 | [
30522,
11336,
9666,
11336,
24134,
2465,
22091,
2015,
2465,
2613,
5478,
1005,
9666,
1013,
22091,
2015,
1013,
11968,
8043,
2015,
1013,
24134,
1013,
2448,
1035,
12107,
1005,
1001,
4888,
9675,
12107,
1001,
1001,
1027,
1027,
1027,
1027,
11709,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Cleidimar Viana
*
* 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.
*/
package com.seamusdawkins.tablayout.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.seamusdawkins.tablayout.R;
public class FirstFragment extends Fragment {
TextView tv;
RelativeLayout rl;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_one, container, false);
tv = (TextView) rootView.findViewById(R.id.action);
tv.setText(R.string.str_first);
return rootView;
}
}
| cleidimarviana/Tabs-Material | app/src/main/java/com/seamusdawkins/tablayout/fragments/FirstFragment.java | Java | apache-2.0 | 1,928 | [
30522,
1013,
1008,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
18856,
7416,
22172,
2906,
3081,
2532,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
package MJDecompiler;
import java.io.IOException;
// Referenced classes of package MJDecompiler:
// bm, bf, bh, bj,
// bc
final class as extends CpField
{
as(ClazzInputStream bc, ClassFile bj1)
throws IOException
{
super(bc, bj1);
}
final void writeBytecode(ByteCodeOutput bf1)
throws IOException
{
bf1.writeByte(9);
bf1.writeUshort(super.b);
bf1.writeUshort(super.o);
}
final String type()
{
return super.a.getConstant(super.o).type();
}
final String a(ClassFile bj1)
{
return "FieldRef(" + super.b + ":" + bj1.getConstant(super.b).a(bj1) + ", " + super.o + ":" + bj1.getConstant(super.o).a(bj1) + ")";
}
}
| ghostgzt/STX | src/MJDecompiler/as.java | Java | gpl-3.0 | 839 | [
30522,
1013,
1013,
14855,
2094,
2188,
3931,
1024,
8299,
1024,
1013,
1013,
7479,
1012,
1047,
17299,
2271,
1012,
4012,
1013,
14855,
2094,
1012,
16129,
1013,
1013,
21933,
8737,
9463,
2099,
7047,
1024,
5308,
5714,
25378,
1006,
1017,
1007,
7427,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.