hexsha
stringlengths 40
40
| size
int64 5
1.05M
| ext
stringclasses 98
values | lang
stringclasses 21
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
118
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
int64 1
368k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
118
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
int64 1
134k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
135
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 5
1.05M
| avg_line_length
float64 1
1.03M
| max_line_length
int64 2
1.03M
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b094683dcd5ac0d963e6c31a8132bfcc953ec09e
| 1,751
|
py
|
Python
|
Scripts/core/sims4/random.py
|
velocist/TS4CheatsInfo
|
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
|
[
"Apache-2.0"
] | null | null | null |
Scripts/core/sims4/random.py
|
velocist/TS4CheatsInfo
|
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
|
[
"Apache-2.0"
] | null | null | null |
Scripts/core/sims4/random.py
|
velocist/TS4CheatsInfo
|
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
|
[
"Apache-2.0"
] | null | null | null |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Core\sims4\random.py
# Compiled at: 2014-10-10 00:35:00
# Size of source mod 2**32: 3002 bytes
from random import uniform
import random, sims4.math
def _weighted(pairs, random=random, flipped=False):
weight_index = 1 if flipped else 0
weights = [x[weight_index] for x in pairs]
total = sum(weights)
if total == 0:
return
select = random.uniform(0, total)
for index, weight in enumerate(weights):
select -= weight
if select <= 0 and weight > 0:
return index
def weighted_random_item(pairs, random=random, flipped=False):
value_index = 0 if flipped else 1
choice_index = _weighted(pairs, random=random, flipped=flipped)
if choice_index is not None:
return pairs[choice_index][value_index]
def weighted_random_index(tuple_of_tuples, random=random):
choice_index = _weighted(tuple_of_tuples, random=random)
if choice_index is not None:
return choice_index
def pop_weighted(pairs, random=random, flipped=False):
value_index = 0 if flipped else 1
choice_index = _weighted(pairs, random=random, flipped=flipped)
if choice_index is not None:
return pairs.pop(choice_index)[value_index]
def random_chance(chance_value, random=random):
if chance_value == 0:
return False
if chance_value == 100:
return True
return random.randint(0, 100) < chance_value
def random_orientation():
angle = random.randint(0, 360)
quaternion = sims4.math.angle_to_yaw_quaternion(angle)
return quaternion
| 32.425926
| 107
| 0.70474
|
5d6ea006c9d4b15be117a54deaf32d513ac3257c
| 225
|
dart
|
Dart
|
lib/app/core/spacing/shape.dart
|
guikebr/estacionamento
|
bde92ac4d50d578548a70b2ebcdf4a63ccea0bcc
|
[
"MIT"
] | null | null | null |
lib/app/core/spacing/shape.dart
|
guikebr/estacionamento
|
bde92ac4d50d578548a70b2ebcdf4a63ccea0bcc
|
[
"MIT"
] | null | null | null |
lib/app/core/spacing/shape.dart
|
guikebr/estacionamento
|
bde92ac4d50d578548a70b2ebcdf4a63ccea0bcc
|
[
"MIT"
] | null | null | null |
class Shape {
const Shape();
double get sharp => 0;
double get xsmall => 4;
double get small => 8;
double get medium => 16;
double get large => 24;
double get xlarge => 32;
double get rounded => 0.5;
}
| 12.5
| 28
| 0.595556
|
7eba82fe14cfb2fbba4feefe86fc2fec9955cb71
| 1,627
|
rs
|
Rust
|
src/nu.rs
|
bluk/nu_plugin_from_bencode
|
34249042b7b34fea043105aaf438bbc302cf13f2
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
src/nu.rs
|
bluk/nu_plugin_from_bencode
|
34249042b7b34fea043105aaf438bbc302cf13f2
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
src/nu.rs
|
bluk/nu_plugin_from_bencode
|
34249042b7b34fea043105aaf438bbc302cf13f2
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
// Copyright 2022 Bryant Luk
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::{from_bytes_to_value, FromBencode};
use nu_plugin::{EvaluatedCall, LabeledError, Plugin};
use nu_protocol::{Category, Signature, Value};
const FROM_BENCODE_COMMAND: &str = "from bencode";
impl Plugin for FromBencode {
fn signature(&self) -> Vec<Signature> {
vec![Signature::build(FROM_BENCODE_COMMAND)
.usage("Parse data as bencode and create table.")
.category(Category::Formats)]
}
fn run(
&mut self,
name: &str,
call: &EvaluatedCall,
input: &Value,
) -> Result<Value, LabeledError> {
match name {
FROM_BENCODE_COMMAND => {
from_bencode(call, input)
},
_ => Err(LabeledError {
label: "Plugin call with wrong name signature".into(),
msg: "the signature used to call the plugin does not match any name in the plugin signature vector".into(),
span: Some(call.head),
}),
}
}
}
fn from_bencode(call: &EvaluatedCall, input: &Value) -> Result<Value, LabeledError> {
let span = call.head;
let binary_input = input.as_binary()?;
if binary_input.is_empty() {
return Ok(Value::Nothing { span });
}
Ok(from_bytes_to_value(binary_input, span)?)
}
| 31.288462
| 123
| 0.623848
|
cc4c6169a8e731cf1c3d9c6828b7b199a3f8b89e
| 310
|
kt
|
Kotlin
|
src/main/kotlin/com/runyu/wechat/msg/cus/CusMsgVoice.kt
|
Miao4099/VertxGo
|
746886bd5e113cbc0750198a019aa28c3b625f19
|
[
"MIT"
] | 2
|
2020-08-06T09:34:00.000Z
|
2020-08-11T00:11:36.000Z
|
src/main/kotlin/com/runyu/wechat/msg/cus/CusMsgVoice.kt
|
Miao4099/VertxGo
|
746886bd5e113cbc0750198a019aa28c3b625f19
|
[
"MIT"
] | null | null | null |
src/main/kotlin/com/runyu/wechat/msg/cus/CusMsgVoice.kt
|
Miao4099/VertxGo
|
746886bd5e113cbc0750198a019aa28c3b625f19
|
[
"MIT"
] | null | null | null |
package com.runyu.wechat.msg.cus
/**
* Created by sheng on 2017/11/7.
*/
class CusMsgVoice(toUser:String): CusMsg(toUser,"voice"){
constructor(toUser:String, mediaId:String) : this(toUser) {
var j=io.vertx.core.json.JsonObject()
j.put("media_id",mediaId)
put("voice",j)
}
}
| 22.142857
| 63
| 0.63871
|
937335edf44e421d00fd96477fde09984e141943
| 1,318
|
sql
|
SQL
|
init/procedures/Detection/GetDetectionInfoAfter.sql
|
devnw/aegis
|
61a1ad3018e3df4e1fb872285236647aa496c287
|
[
"Apache-2.0"
] | null | null | null |
init/procedures/Detection/GetDetectionInfoAfter.sql
|
devnw/aegis
|
61a1ad3018e3df4e1fb872285236647aa496c287
|
[
"Apache-2.0"
] | 15
|
2021-01-21T16:31:08.000Z
|
2021-05-03T19:56:58.000Z
|
init/procedures/Detection/GetDetectionInfoAfter.sql
|
mwilliams7197/aegis
|
5f8c8e734c29bcd5fb91b0cce7fe519328ddd62a
|
[
"Apache-2.0"
] | null | null | null |
/*
RETURN DetectionInfo
ID NVARCHAR(36) NOT
OrganizationID NVARCHAR(36) NOT
SourceID NVARCHAR(36) NOT
DeviceID NVARCHAR(36) NOT
VulnerabilityID NVARCHAR(36) NOT
IgnoreID VARCHAR(36) NULL
AlertDate DATETIME NOT
LastFound DATETIME NULL
LastUpdated DATETIME NULL
Proof NVARCHAR(255) NOT
Port INT NOT
Protocol VARCHAR(20) NOT
ActiveKernel INT NULL
DetectionStatusID INT NOT
TimesSeen INT NOT
Updated DATETIME NOT
*/
DROP PROCEDURE IF EXISTS `GetDetectionInfoAfter`;
CREATE PROCEDURE `GetDetectionInfoAfter` (_After DATETIME, _OrgID VARCHAR(36))
#BEGIN#
SELECT
D.ID,
D.OrganizationID,
D.SourceID,
D.DeviceID,
D.VulnerabilityID,
D.IgnoreID,
D.AlertDate,
D.LastFound,
D.LastUpdated,
D.Proof,
D.Port,
D.Protocol,
D.ActiveKernel,
D.DetectionStatusID,
D.TimesSeen,
D.Updated
FROM Detection D
JOIN DetectionStatus DS on D.DetectionStatusId = DS.Id
WHERE D.OrganizationID = _OrgID AND D.IgnoreID IS NULL AND (D.Updated > _After OR D.Created > _After) AND DS.Status != 'fixed' ORDER BY D.Created;
| 29.954545
| 146
| 0.597117
|
45955696ebf893d2ac8c670a1f35f666e83759b9
| 3,124
|
py
|
Python
|
qark/issue.py
|
op01/qark
|
0acf116ece6d62ecb4a310b6dea402b8ac884160
|
[
"Apache-2.0",
"OpenSSL"
] | 2,943
|
2015-08-14T22:05:40.000Z
|
2022-03-29T09:17:43.000Z
|
qark/issue.py
|
op01/qark
|
0acf116ece6d62ecb4a310b6dea402b8ac884160
|
[
"Apache-2.0",
"OpenSSL"
] | 254
|
2015-08-16T06:38:35.000Z
|
2022-02-11T14:02:23.000Z
|
qark/issue.py
|
op01/qark
|
0acf116ece6d62ecb4a310b6dea402b8ac884160
|
[
"Apache-2.0",
"OpenSSL"
] | 672
|
2015-08-17T03:27:13.000Z
|
2022-03-28T05:08:04.000Z
|
import logging
from copy import deepcopy
from enum import Enum
from json import JSONEncoder, dumps
log = logging.getLogger(__name__)
class Issue(object):
def __init__(self, category, name, severity, description, line_number=None, file_object=None, apk_exploit_dict=None):
"""
Create a vulnerability, used by Plugins.
:param str category: category to put the vulnerability in the report.
:param Severity severity: severity of the vulnerability, Severity.INFO, Severity.VULNERABILITY, Severity.ERROR, or Severity.WARNING.
:param Tuple[int, int] line_number: line number of where the vulnerability was found.
:param str file_object: file where the vulnerability occurred.
:param Dict apk_exploit_dict: dictionary containing information that is needed to build the exploit apk
"""
self.category = category
# convert severity to its enum
if not isinstance(severity, Severity):
if isinstance(severity, str):
if severity.lower() == "info":
severity = Severity.INFO
elif severity.lower() == "vulnerability":
severity = Severity.VULNERABILITY
elif severity.lower() == "error":
severity = Severity.ERROR
elif severity.lower() == "warning":
severity = Severity.WARNING
else:
log.info("Severity is not set for issue. Setting severity to a warning.")
severity = Severity.WARNING
else:
log.info("Severity is not set for issue. Setting severity to a warning.")
severity = Severity.WARNING
self.severity = severity
self.description = description
self.name = name
self.line_number = line_number
self.file_object = file_object
self.apk_exploit_dict = apk_exploit_dict
def __repr__(self):
return ("Issue(category={}, name={}, severity={}, description={}, line_number={}, "
"file_object={}, apk_exploit_dict={})".format(self.category, self.name, self.severity,
self.description, self.line_number, self.file_object,
self.apk_exploit_dict))
def __hash__(self):
return hash((self.name, self.file_object, self.line_number))
class Severity(Enum):
INFO = 0
WARNING = 1
ERROR = 2
VULNERABILITY = 3
class IssueEncoder(JSONEncoder):
def default(self, issue):
if isinstance(issue, Issue):
working_dict = deepcopy(issue.__dict__)
working_dict['severity'] = working_dict['severity'].name
return working_dict
else:
log.error('Error converting issue %r to JSON %s', issue, type(issue))
return
def issue_json(value):
try:
return dumps(value, cls=IssueEncoder)
except TypeError:
log.exception('Error encoding to JSON')
return dumps('Error encoding to JSON')
| 38.567901
| 140
| 0.604994
|
6b7cb64fc7cd6524ffebd48cb5cee36307acdf5a
| 106
|
js
|
JavaScript
|
test/plugin/index.js
|
IMSupperkaka/z-qiniu-webpack-plugin
|
f81095b48be4d794015992988927f93953abc800
|
[
"MIT"
] | 2
|
2020-07-21T16:38:31.000Z
|
2020-07-22T02:02:26.000Z
|
test/plugin/index.js
|
IMSupperkaka/z-qiniu-webpack-plugin
|
f81095b48be4d794015992988927f93953abc800
|
[
"MIT"
] | null | null | null |
test/plugin/index.js
|
IMSupperkaka/z-qiniu-webpack-plugin
|
f81095b48be4d794015992988927f93953abc800
|
[
"MIT"
] | null | null | null |
const testfunc = () => {
import('lodash');
console.log('test test');
}
export default testfunc;
| 13.25
| 29
| 0.603774
|
44348e69bd00c61dbc6f5a2fa68fa0ad6767c0a1
| 1,371
|
py
|
Python
|
argminCVX.py
|
rameezw/BanditDynamicPricing
|
352d5ccadb40a25601f12000b4df2e4703980bbb
|
[
"MIT"
] | null | null | null |
argminCVX.py
|
rameezw/BanditDynamicPricing
|
352d5ccadb40a25601f12000b4df2e4703980bbb
|
[
"MIT"
] | null | null | null |
argminCVX.py
|
rameezw/BanditDynamicPricing
|
352d5ccadb40a25601f12000b4df2e4703980bbb
|
[
"MIT"
] | null | null | null |
"""implementation of argmin step"""
from scipy import optimize
import numpy as np
from BanditPricing import randUnitVector
def argmin(eta, s_radius, barrier, g_bar_aggr_t, g_tilde, d, max_iter = 1e4):
#implement argmin_ball(eta * (g_bar_1:t + g_tilde_t+1)^T x + barrier(x)
#argmin is over ball with radius r
TOL = 1e-10 # numerical error allowed
#g_bar_aggr_t = complex_to_real(g_bar_aggr_t)
#g_tilde = complex_to_real(g_tilde)
#init_pt = complex_to_real(randUnitVector(d)*s_radius/2)
cons = {'type': 'ineq', 'fun': lambda x: s_radius - np.linalg.norm(x),
'jac': lambda x: x / np.linalg.norm(x) if np.linalg.norm(x) > TOL else np.zeros(x.shape)}
res = optimize.minimize(fun=obj,
x0=randUnitVector(d)*s_radius/2,
args=(eta, barrier, g_bar_aggr_t, g_tilde),
constraints=cons,
options={'disp': False, 'maxiter': max_iter})
return res['x']
def obj(x, eta, barrier, g_bar_aggr_t, g_tilde):
return eta * np.dot(g_bar_aggr_t + g_tilde, x) + barrier(x)
def real_to_complex(z): # real vector of length 2n -> complex of length n
return z[:len(z)//2] + 1j * z[len(z)//2:]
def complex_to_real(z): # complex vector of length n -> real of length 2n
return np.concatenate((np.real(z), np.imag(z)))
| 44.225806
| 101
| 0.628738
|
2f153a3388a5dc0975d9d7a61699188ee568a6a5
| 483
|
js
|
JavaScript
|
src/components/product.js
|
SHRA-NITRR/search-demo
|
997e0949c84a5bdb9b474a265df0bb20d1cf0e82
|
[
"MIT"
] | null | null | null |
src/components/product.js
|
SHRA-NITRR/search-demo
|
997e0949c84a5bdb9b474a265df0bb20d1cf0e82
|
[
"MIT"
] | null | null | null |
src/components/product.js
|
SHRA-NITRR/search-demo
|
997e0949c84a5bdb9b474a265df0bb20d1cf0e82
|
[
"MIT"
] | null | null | null |
import React from 'react';
const Product=(props)=>{
const {name, price, stocked}=props.productDetails;
return(
<div className='panel panel-default'>
<div className="panel-body product-details">
<span className={stocked?'prd-name':'prd-name text-danger'}>{name}</span>
<span className='prd-price'>{price}</span>
</div>
</div>
)
}
export default Product;
| 28.411765
| 93
| 0.52795
|
38da4580045f194f7da2391fdf6ee037f846d285
| 480
|
php
|
PHP
|
application/controllers/Home.php
|
najmisania/Skripsi
|
03fd87610217b17160f0f14ac72097a53cd1df7d
|
[
"MIT"
] | null | null | null |
application/controllers/Home.php
|
najmisania/Skripsi
|
03fd87610217b17160f0f14ac72097a53cd1df7d
|
[
"MIT"
] | null | null | null |
application/controllers/Home.php
|
najmisania/Skripsi
|
03fd87610217b17160f0f14ac72097a53cd1df7d
|
[
"MIT"
] | null | null | null |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends CI_Controller {
public function index()
{
$query = $this->db->select('*')
->from('wisata_bogor')
->get()
->result();
// SELECT * FROM wisata_bogor WHERE jenis_wisata = 'alam'
// echo "<pre>";
// print_r($query);
// exit;
$data['wisata_bogor'] = $query;
$this->load->view('template/sidebar',$data);
}
function test_algoritma() {
}
}
| 20
| 63
| 0.585417
|
1a074861ffb87a24f55882426ddb98650d8ef33d
| 808
|
lua
|
Lua
|
0.17/JoinAndPlayCoop-Scenario-Labyrinth-0.17/session_data/jCJIGWdCvCPywhlG.lua
|
joinandplaycoop/Factorio-Scenarios
|
252c52dad35a73562880266bb7a09b9d266e8d4d
|
[
"Apache-2.0"
] | 3
|
2019-05-21T11:56:52.000Z
|
2020-08-13T03:43:02.000Z
|
0.17/JoinAndPlayCoop-Scenario-Maze-0.17/session_data/jCJIGWdCvCPywhlG.lua
|
IIPoliII/Factorio-Scenarios
|
23d5630f8f1ec0703a289262101bfb99056025b1
|
[
"Apache-2.0"
] | 8
|
2019-08-05T00:57:04.000Z
|
2020-07-09T10:29:46.000Z
|
0.17/JoinAndPlayCoop-Scenario-Maze-0.17/session_data/jCJIGWdCvCPywhlG.lua
|
IIPoliII/Factorio-Scenarios
|
23d5630f8f1ec0703a289262101bfb99056025b1
|
[
"Apache-2.0"
] | 6
|
2019-08-11T20:56:30.000Z
|
2021-10-07T16:04:37.000Z
|
local playsession = {
{"mikeike68", {146345}},
{"neuro666", {718998}},
{"kalenmonster", {530912}},
{"lluceu", {217022}},
{"Gorlos", {156632}},
{"noga89", {5937}},
{"GuidoCram", {199263}},
{"jeffertoot", {561019}},
{"Pucio", {593923}},
{"juggernautlegend", {463552}},
{"beranabus", {111625}},
{"Rezz", {55371}},
{"TheKoopa", {422535}},
{"rlidwka", {15293}},
{"Hitman451", {406728}},
{"Weizenbrot", {27309}},
{"Mark416", {391}},
{"cogito123", {24051}},
{"grootie", {309394}},
{"Vogrov", {344181}},
{"Zasc", {328085}},
{"meteorsbor", {170257}},
{"Muppet123", {293297}},
{"Tanotauro", {10262}},
{"stety", {206051}},
{"wotwotvodka", {165384}},
{"rjdunlap", {149021}},
{"AllenInsanity_YT", {6644}},
{"Gerkiz", {15336}},
{"Kirdiaga", {8859}},
{"PogomanD", {1315}}
}
return playsession
| 23.764706
| 32
| 0.568069
|
7988fc146ecb5ab0e038ef339b397e8e8ed3d86e
| 84
|
php
|
PHP
|
sidebar.php
|
ahwgs/iStar
|
e790bffb51318a5c409f1e125ae49c28c651d127
|
[
"MIT"
] | 3
|
2019-01-11T12:59:49.000Z
|
2020-06-06T11:05:22.000Z
|
sidebar.php
|
ahwgs/iStar
|
e790bffb51318a5c409f1e125ae49c28c651d127
|
[
"MIT"
] | null | null | null |
sidebar.php
|
ahwgs/iStar
|
e790bffb51318a5c409f1e125ae49c28c651d127
|
[
"MIT"
] | null | null | null |
<aside id="aside" class="fr">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</aside>
| 21
| 42
| 0.595238
|
c689230d9dc2a36464a9faa3b251d5048b751184
| 26,807
|
py
|
Python
|
scripts/clean.py
|
cuddebtj/Fantasy-Sidelines
|
54847ff6673ab2b77da2089599f7db4b19c89ce7
|
[
"MIT"
] | null | null | null |
scripts/clean.py
|
cuddebtj/Fantasy-Sidelines
|
54847ff6673ab2b77da2089599f7db4b19c89ce7
|
[
"MIT"
] | null | null | null |
scripts/clean.py
|
cuddebtj/Fantasy-Sidelines
|
54847ff6673ab2b77da2089599f7db4b19c89ce7
|
[
"MIT"
] | null | null | null |
from api import SportRadar
# from api import MySportsFeeds
import pandas as pd
import numpy as np
import time
import gspread
import re
from gspread_pandas import Spread
def schedule_clean(data):
schedule = pd.DataFrame()
season = pd.json_normalize(data).add_prefix("season.")
season_weeks = pd.json_normalize(season["season.weeks"])
for wk in range(len(season_weeks.columns)):
season_weeks_week = pd.json_normalize(season_weeks[wk]).add_prefix("week.")
season_weeks_week_games = pd.json_normalize(season_weeks_week["week.games"])
_week = pd.DataFrame()
for gm in range(len(season_weeks_week_games.columns)):
try:
season_weeks_week_games_game = pd.json_normalize(
season_weeks_week_games[gm]
).add_prefix("game.")
season_weeks_week_games_game_periods = pd.json_normalize(
season_weeks_week_games_game["game.scoring.periods"]
)
_period = pd.DataFrame()
for p in range(len(season_weeks_week_games_game_periods.columns)):
season_weeks_week_games_game_periods_period = pd.json_normalize(
season_weeks_week_games_game_periods[p]
).add_prefix(f"periods{p+1}.")
_period = _period.join(
season_weeks_week_games_game_periods_period, how="outer"
)
_game = season_weeks_week_games_game.join(
[_period, season, season_weeks_week], how="outer"
)
except:
continue
_week = pd.concat([_game, _week])
schedule = pd.concat([_week, schedule])
schedule.drop(
[
"game.scoring.periods",
"season._comment",
"season.weeks",
"week.games",
"week.bye_week",
],
axis=1,
inplace=True,
)
away = schedule.copy(deep=True)
home = schedule.copy(deep=True)
for col in home.columns:
home = home.rename(columns={col: str(col).replace("away", "opp")})
for col in home.columns:
home = home.rename(columns={col: str(col).replace("home", "team")})
home["home.away"] = "home"
for col in away.columns:
away = away.rename(columns={col: str(col).replace("home", "opp")})
for col in away.columns:
away = away.rename(columns={col: str(col).replace("away", "team")})
away["home.away"] = "away"
schedule = pd.concat([home, away])
schedule = schedule.rename(
columns={
"game.venue.id": "venue.id",
"game.venue.name": "venue.name",
"game.venue.city": "venue.city",
"game.venue.state": "venue.state",
"game.venue.country": "venue.country",
"game.venue.zip": "venue.zip",
"game.venue.address": "veunue.address",
"game.venue.capacity": "venue.capacity",
"game.venue.surface": "venue.surface",
"game.venue.roof_type": "venue.roof_type",
"game.venue.sr_id": "venue.sr_id",
"game.venue.location.lat": "venue.location.lat",
"game.venue.location.lng": "venue.location.lng",
"game.team.id": "team.id",
"game.team.name": "team.name",
"game.team.alias": "team.alias",
"game.team.game_number": "team.game_number",
"game.team.sr_id": "team.sr_id",
"game.opp.id": "opp.id",
"game.opp.name": "opp.name",
"game.opp.alias": "opp.alias",
"game.opp.game_number": "opp.game_number",
"game.opp.sr_id": "opp.sr_id",
}
)
schedule[
[
"game.reference",
"game.utc_offset",
"game.venue.location.lat",
"game.venue.location.lng",
"periods1.sequence",
"periods2.sequence",
"periods3.sequence",
"periods4.sequence",
"periods5.sequence",
"season.year",
"week.sequence",
"week.title",
]
] = schedule[
[
"game.reference",
"game.utc_offset",
"game.venue.location.lat",
"game.venue.location.lng",
"periods1.sequence",
"periods2.sequence",
"periods3.sequence",
"periods4.sequence",
"periods5.sequence",
"season.year",
"week.sequence",
"week.title",
]
].astype(
str
)
return schedule
def player_stats_clean(data):
df = pd.json_normalize(data)
team_cols = []
players_cols = []
for col in df.columns:
if "player" not in col:
team_cols.append(col)
elif "player" in col:
players_cols.append(col)
team_stats = df[team_cols]
player_stats = df[players_cols]
player_stats_df = pd.DataFrame()
for c in players_cols:
keep_columns = ["id", "name", "position", "sr_id", "jersey"]
if "home" in c:
df_1 = pd.json_normalize(player_stats[c])
df_2 = pd.DataFrame()
keep_columns = ["id", "name", "position", "sr_id", "jersey"]
for col in df_1.columns:
bridge = pd.json_normalize(df_1[col])
bridge.columns = [
"{}{}".format("" if z in keep_columns else c[16:-7], z)
for z in bridge.columns
]
bridge.rename(
columns={
"id": "player.id",
"name": "player.name",
"position": "player.position",
"sr_id": "player.sr_id",
"jersey": "player.jersey_num",
},
inplace=True,
)
bridge[
[
"team.alias",
"team.name",
"team.id",
"season",
"season.id",
"week",
"week.id",
"opp.alias",
"opp.name",
"opp.id",
"game.id",
]
] = team_stats[
[
"summary.home.alias",
"summary.home.name",
"summary.home.id",
"summary.season.year",
"summary.season.id",
"summary.week.sequence",
"summary.week.id",
"summary.away.alias",
"summary.away.name",
"summary.away.id",
"id",
]
]
bridge["home.away"] = "home"
df_2 = pd.concat([bridge, df_2])
elif "away" in c:
df_1 = pd.json_normalize(player_stats[c])
df_2 = pd.DataFrame()
for col in df_1.columns:
bridge = pd.json_normalize(df_1[col])
bridge.columns = [
"{}{}".format("" if z in keep_columns else c[16:-7], z)
for z in bridge.columns
]
bridge.rename(
columns={
"id": "player.id",
"name": "player.name",
"position": "player.position",
"sr_id": "player.sr_id",
"jersey": "player.jersey_num",
},
inplace=True,
)
bridge[
[
"team.alias",
"team.name",
"team.id",
"season",
"season.id",
"week",
"week.id",
"opp.alias",
"opp.name",
"opp.id",
"game.id",
]
] = team_stats[
[
"summary.away.alias",
"summary.away.name",
"summary.away.id",
"summary.season.year",
"summary.season.id",
"summary.week.sequence",
"summary.week.id",
"summary.home.alias",
"summary.home.name",
"summary.home.id",
"id",
]
]
bridge["home.away"] = "away"
df_2 = pd.concat([bridge, df_2])
player_stats_df = pd.concat([df_2, player_stats_df])
groupby_list = [
"player.id",
"player.name",
"player.position",
"player.sr_id",
"player.jersey_num",
"team.alias",
"team.name",
"team.id",
"season",
"season.id",
"week",
"week.id",
"opp.alias",
"opp.name",
"opp.id",
"game.id",
]
player_stats_df = player_stats_df.groupby(groupby_list).sum().reset_index()
replace = [" III", " II", " IV", " V", " Jr.", " Sr.", " Sr", " Jr"]
player_stats_df["player.name"] = player_stats_df["player.name"].str.replace(
"|".join([re.escape(s) for s in replace]), "", regex=True
)
player_stats_df = player_stats_df.drop_duplicates()
player_stats_df[
["player.jersey_num", "season.year", "week.sequence"]
] = player_stats_df[["player.jersey_num", "season.year", "week.sequence"]].astype(
str
)
return player_stats_df
def team_stats_clean(data):
df = pd.json_normalize(data)
team_cols = []
for col in df.columns:
if "player" not in col and "_comment" not in col:
team_cols.append(col)
team_stats_df = df[team_cols]
team_stats_df = team_stats_df.add_prefix("game.")
away = team_stats_df.copy(deep=True)
home = team_stats_df.copy(deep=True)
for col in home.columns:
home = home.rename(columns={col: str(col).replace("away", "opp")})
for col in home.columns:
home = home.rename(columns={col: str(col).replace("home", "team")})
home["home.away"] = "home"
for col in away.columns:
away = away.rename(columns={col: str(col).replace("home", "opp")})
for col in away.columns:
away = away.rename(columns={col: str(col).replace("away", "team")})
away["home.away"] = "away"
team_stats_df = pd.concat([home, away])
cols = []
for col in team_stats_df.columns:
if "game.summary." in col:
cols.append(col[len("game.summary.") :])
elif "game.statistics." in col:
cols.append(col[len("game.statistics.") :])
else:
cols.append(col)
team_stats_df.columns = cols
team_stats_df[
[
"game.reference",
"game.number",
"game.utc_offset",
"game.quarter",
"season.year",
"week.sequence",
"week.title",
"venue.location.lat",
"venue.location.lng",
]
] = team_stats_df[
[
"game.reference",
"game.number",
"game.utc_offset",
"game.quarter",
"season.year",
"week.sequence",
"week.title",
"venue.location.lat",
"venue.location.lng",
]
].astype(
str
)
return team_stats_df
def get_season(
api_key,
year,
access_level="trial",
version="v7",
language_code="en",
format_="json",
sleep_time=2,
timeout=5,
):
season = SportRadar(
api_key,
access_level=access_level,
version=version,
language_code=language_code,
format_=format_,
sleep_time=sleep_time,
timeout=timeout,
)
schedule_api = season.season_schedule(year)
schedule = schedule_clean(schedule_api)
game_id_list = list(schedule["game.id"].unique())
players_stats = pd.DataFrame()
teams_stats = pd.DataFrame()
for game_id in range(len(game_id_list)):
statistics_api = season.game_statistics(game_id_list[game_id])
players = player_stats_clean(statistics_api)
teams = team_stats_clean(statistics_api)
players_stats = pd.concat([players, players_stats])
teams_stats = pd.concat([teams, teams_stats])
return schedule, players_stats, teams_stats
def practice_par(season_start, season_end):
gc = gspread.service_account()
spread = gc.open("PlayerPractice")
weeks = list(range(1, 18))
seasons = list(range(season_start, season_end + 1))
teams_id = [
"Arizona Cardinals",
"Atlanta Falcons",
"Baltimore Ravens",
"Buffalo Bills",
"Carolina Panthers",
"Chicago Bears",
"Cincinnati Bengals",
"Cleveland Browns",
"Dallas Cowboys",
"Denver Broncos",
"Detroit Lions",
"Green Bay Packers",
"Houston Texans",
"Indianapolis Colts",
"Jacksonville Jaguars",
"Kansas City Chiefs",
"Los Angeles Rams",
"San Diego Chargers",
"Miami Dolphins",
"Minnesota Vikings",
"New England Patriots",
"New Orleans Saints",
"New York Giants",
"New York Jets",
"Oakland Raiders",
"Las Vegas Raiders",
"Philadelphia Eagles",
"Pittsburgh Steelers",
"Los Angeles Chargers",
"San Francisco 49ers",
"Seattle Seahawks",
"Tampa Bay Buccaneers",
"Tennessee Titans",
"Washington Redskins",
"Washington Football Team",
]
practice_par_df = pd.DataFrame()
for season in seasons:
for week in weeks:
try:
sh = str(season)
sheet = spread.worksheet(sh)
data = sheet.col_values(week)
idx = [data.index(team) for team in teams_id if team in data]
idx.append(len(data))
idx.sort()
final_df = pd.DataFrame()
for i in range(len(idx[:-1])):
start = idx[i] + 12
end = idx[i + 1]
final_data = {}
final_data["team"] = [
data[start - 12] for i in range(start, end, 6)
]
final_data["player.name"] = [
data[i - 5] for i in range(start, end, 6)
]
final_data["injury"] = [data[i - 4] for i in range(start, end, 6)]
final_data["date1"] = [
data[start - 9] for i in range(start, end, 6)
]
final_data["date1.status"] = [
data[i - 3] for i in range(start, end, 6)
]
final_data["date2"] = [
data[start - 8] for i in range(start, end, 6)
]
final_data["date2.status"] = [
data[i - 2] for i in range(start, end, 6)
]
final_data["date3"] = [
data[start - 7] for i in range(start, end, 6)
]
final_data["date3.status"] = [
data[i - 1] for i in range(start, end, 6)
]
final_data["game.status"] = [data[i] for i in range(start, end, 6)]
df = pd.DataFrame.from_dict(final_data)
final_df = pd.concat([final_df, df])
final_df["season"] = season
final_df["week"] = week
final_df[["date1", "date2", "date3"]] = final_df[
["date1", "date2", "date3"]
].replace(
{
"Tue ": "",
"Wed ": "",
"Thu ": "",
"Mon ": "",
"Sun ": "",
"Fri ": "",
"Sat ": "",
},
regex=True,
)
final_df[["last.date", "game.status", "home.away", "opp"]] = final_df[
"game.status"
].str.split(expand=True)
final_df[["player.name", "player.pos"]] = final_df[
"player.name"
].str.split(", ", 1, expand=True)
final_df = final_df.drop(["last.date"], axis=1)
final_df.sort_values(["team", "player.name"], inplace=True)
final_df["home.away"] = final_df.groupby("team")["home.away"].transform(
lambda x: x.bfill().ffill()
)
final_df["opp"] = final_df.groupby("team")["opp"].transform(
lambda x: x.bfill().ffill()
)
final_df = final_df.replace({"--": np.nan})
final_df["game.status"] = final_df["game.status"].replace(
{None: "Full"}
)
final_df["home.away"] = final_df["home.away"].replace(
{"vs": "home", "@": "away"}
)
final_df["team"] = final_df["team"].replace(
{
"Arizona Cardinals": "ARI",
"Atlanta Falcons": "ATL",
"Baltimore Ravens": "BAL",
"Buffalo Bills": "BUF",
"Carolina Panthers": "CAR",
"Chicago Bears": "CHI",
"Cincinnati Bengals": "CIN",
"Cleveland Browns": "CLE",
"Dallas Cowboys": "DAL",
"Denver Broncos": "DEN",
"Detroit Lions": "DET",
"Green Bay Packers": "GB",
"Houston Texans": "HOU",
"Indianapolis Colts": "IND",
"Jacksonville Jaguars": "JAC",
"Kansas City Chiefs": "KC",
"Las Vegas Raiders": "LV",
"Los Angeles Chargers": "LAC",
"Los Angeles Rams": "LA",
"Miami Dolphins": "MIA",
"Minnesota Vikings": "MIN",
"New England Patriots": "NE",
"New Orleans Saints": "NO",
"New York Giants": "NYG",
"New York Jets": "NYJ",
"Oakland Raiders": "OAK",
"Philadelphia Eagles": "PHI",
"Pittsburgh Steelers": "PIT",
"San Diego Chargers": "SD",
"San Francisco 49ers": "SF",
"Seattle Seahawks": "SEA",
"Tampa Bay Buccaneers": "TB",
"Tennessee Titans": "TEN",
"Washington Football Team": "WAS",
"Washington Redskins": "WAS",
}
)
final_df["opp"] = final_df["opp"].replace(
{
"Ari": "ARI",
"Atl": "ATL",
"Bal": "BAL",
"Buf": "BUF",
"Car": "CAR",
"Chi": "CHI",
"Cin": "CIN",
"Cle": "CLE",
"Dal": "DAL",
"Den": "DEN",
"Det": "DET",
"Hou": "HOU",
"Ind": "IND",
"Jax": "JAC",
"Mia": "MIA",
"Min": "MIN",
"Oak": "OAK",
"Phi": "PHI",
"Pit": "PIT",
"Sea": "SEA",
"Ten": "TEN",
"Was": "WAS",
}
)
practice_par_df = pd.concat([practice_par_df, final_df])
time.sleep(5)
except Exception as e:
print(e)
print(season, week)
break
practice_par_df[["season", "week"]] = practice_par_df[["season", "week"]].astype(
str
)
replace = [" III", " II", " IV", " V", " Jr.", " Sr.", " Sr", " Jr"]
practice_par_df["player.name"] = practice_par_df["player.name"].str.replace(
"|".join([re.escape(s) for s in replace]), "", regex=True
)
practice_par_df = practice_par_df.drop_duplicates()
return practice_par_df
def weekly_stats(player_stats, player_snaps, player_practice):
weekly_stats = player_stats.merge(
player_snaps,
how="outer",
left_on=[
"player.name",
"season.year",
"week.sequence",
"team.alias",
"opp.alias",
],
right_on=["player_name", "season", "week", "team", "opp"],
suffixes=(None, ".merged"),
)
weekly_stats["player.name"] = weekly_stats["player.name"].fillna(
weekly_stats["player_name"]
)
weekly_stats["season.year"] = weekly_stats["season.year"].fillna(
weekly_stats["season"]
)
weekly_stats["week.sequence"] = weekly_stats["week.sequence"].fillna(
weekly_stats["week"]
)
weekly_stats["team.alias"] = weekly_stats["team.alias"].fillna(weekly_stats["team"])
weekly_stats["opp.alias"] = weekly_stats["opp.alias"].fillna(weekly_stats["opp"])
weekly_stats = weekly_stats.drop(
["player_name", "season", "week", "team", "opp"], axis=1
)
weekly_stats.rename(columns={"player_url": "player_address"}, inplace=True)
weekly_stats["season.year"] = weekly_stats["season.year"].astype(str)
weekly_stats["week.sequence"] = weekly_stats["week.sequence"].astype(str)
weekly_stats = weekly_stats.merge(
player_practice,
how="outer",
right_on=["player.name", "team", "season", "week"],
left_on=["player.name", "team.alias", "season.year", "week.sequence"],
suffixes=(None, ".merged"),
)
weekly_stats["team.alias"] = weekly_stats["team.alias"].fillna(weekly_stats["team"])
weekly_stats["season.year"] = weekly_stats["season.year"].fillna(
weekly_stats["season"]
)
weekly_stats["week.sequence"] = weekly_stats["week.sequence"].fillna(
weekly_stats["week"]
)
weekly_stats["opp.alias"] = weekly_stats["opp.alias"].fillna(weekly_stats["opp"])
weekly_stats["home.away"] = weekly_stats["home.away"].fillna(
weekly_stats["home.away.merged"]
)
weekly_stats["player.position"] = weekly_stats["player.position"].fillna(
weekly_stats["player.pos"]
)
weekly_stats = weekly_stats.drop(
["team", "season", "week", "opp", "home.away.merged", "player.pos"], axis=1
)
weekly_stats[
["player.id", "player.sr_id", "player.jersey_num", "player_address"]
] = weekly_stats.groupby(["player.name", "team.alias", "season.year"])[
["player.id", "player.sr_id", "player.jersey_num", "player_address"]
].apply(
lambda x: x.ffill().bfill()
)
weekly_stats[["season.id"]] = weekly_stats.groupby(["season.year"])[
["season.id"]
].apply(lambda x: x.ffill().bfill())
weekly_stats[["week.id"]] = weekly_stats.groupby(["season.id", "week.sequence"])[
["week.id"]
].apply(lambda x: x.ffill().bfill())
weekly_stats[["team.id", "team.name"]] = weekly_stats.groupby(
["season.id", "team.alias"]
)[["team.id", "team.name"]].apply(lambda x: x.ffill().bfill())
weekly_stats[["opp.id", "opp.name"]] = weekly_stats.groupby(
["season.id", "opp.alias"]
)[["opp.id", "opp.name"]].apply(lambda x: x.ffill().bfill())
weekly_stats[["game.id"]] = weekly_stats.groupby(
["season.id", "week.id", "team.id"]
)[["game.id"]].apply(lambda x: x.ffill().bfill())
weekly_stats["date1"] = (
weekly_stats["date1"] + "/" + weekly_stats["season.year"].astype(str)
)
weekly_stats["date2"] = (
weekly_stats["date2"] + "/" + weekly_stats["season.year"].astype(str)
)
weekly_stats["date3"] = (
weekly_stats["date3"] + "/" + weekly_stats["season.year"].astype(str)
)
weekly_stats["date1"] = pd.to_datetime(weekly_stats["date1"])
weekly_stats["date2"] = pd.to_datetime(weekly_stats["date2"])
weekly_stats["date3"] = pd.to_datetime(weekly_stats["date3"])
weekly_stats.loc[weekly_stats["date1"].dt.month == 1, "date1"] = weekly_stats[
"date1"
] + pd.offsets.DateOffset(years=1)
weekly_stats.loc[weekly_stats["date2"].dt.month == 1, "date2"] = weekly_stats[
"date2"
] + pd.offsets.DateOffset(years=1)
weekly_stats.loc[weekly_stats["date3"].dt.month == 1, "date3"] = weekly_stats[
"date3"
] + pd.offsets.DateOffset(years=1)
weekly_stats[["off.snaps", "def.snaps", "st.snaps"]] = weekly_stats[
["off.snaps", "def.snaps", "st.snaps"]
].fillna(0)
weekly_stats[["off.snaps", "def.snaps", "st.snaps"]] = weekly_stats[
["off.snaps", "def.snaps", "st.snaps"]
].replace("", 0)
weekly_stats[["off.snaps", "def.snaps", "st.snaps"]] = weekly_stats[
["off.snaps", "def.snaps", "st.snaps"]
].astype(int)
weekly_stats["player.jersey_num"] = weekly_stats["player.jersey_num"].astype(str)
weekly_stats = weekly_stats[
weekly_stats["season.year"]
== "2016" & weekly_stats["season.year"]
== "2017" & weekly_stats["season.year"]
== "2018" & weekly_stats["season.year"]
== "2019" & weekly_stats["season.year"]
== "2020"
]
return weekly_stats
# def all_snaps(api_key, seasons, weeks):
#
# api = MySportsFeeds(api_key)
# start = time.time()
# final_df = pd.DataFrame()
# for s in seasons:
# for w in weeks:
# snaps = api.snaps_api(s, w)
# final_df = pd.concat([snaps, final_df])
# print(time.time()-start)
#
# return final_df
| 34.149045
| 88
| 0.47372
|
68dd88f1a35e4588cee95b65c63ae24ba550e14f
| 418
|
rb
|
Ruby
|
app/models/preneeds/state.rb
|
gg-1414/vets-api
|
263c29fa2c6e5dce50c962b068e38019eff61906
|
[
"CC0-1.0"
] | null | null | null |
app/models/preneeds/state.rb
|
gg-1414/vets-api
|
263c29fa2c6e5dce50c962b068e38019eff61906
|
[
"CC0-1.0"
] | null | null | null |
app/models/preneeds/state.rb
|
gg-1414/vets-api
|
263c29fa2c6e5dce50c962b068e38019eff61906
|
[
"CC0-1.0"
] | null | null | null |
# frozen_string_literal: true
require 'common/models/base'
module Preneeds
class State < Common::Base
attribute :code, String
attribute :name, String
attribute :first_five_zip, String
attribute :last_five_zip, String
attribute :lower_indicator, String
def id
code
end
# Default sort should be by name ascending
def <=>(other)
code <=> other.code
end
end
end
| 18.173913
| 46
| 0.677033
|
ef84e1e896bdb6b7da06752ca1927e1a746ceef3
| 32,552
|
c
|
C
|
syslinux/com32/gpllib/dmi/dmi.c
|
TooDumbForAName/modern-boot-floppy
|
c0f4352ee356aab3f31d214af73d2462bde28198
|
[
"BSD-2-Clause"
] | null | null | null |
syslinux/com32/gpllib/dmi/dmi.c
|
TooDumbForAName/modern-boot-floppy
|
c0f4352ee356aab3f31d214af73d2462bde28198
|
[
"BSD-2-Clause"
] | null | null | null |
syslinux/com32/gpllib/dmi/dmi.c
|
TooDumbForAName/modern-boot-floppy
|
c0f4352ee356aab3f31d214af73d2462bde28198
|
[
"BSD-2-Clause"
] | null | null | null |
/* ----------------------------------------------------------------------- *
*
* Copyright 2006 Erwan Velu - All Rights Reserved
*
* 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 <stdio.h>
#include <string.h>
#include "dmi/dmi.h"
const char *out_of_spec = "<OUT OF SPEC>";
const char *bad_index = "<BAD INDEX>";
/*
* Misc. util stuff
*/
/*
* 3.3.11 On Board Devices Information (Type 10)
*/
static const char *dmi_on_board_devices_type(uint8_t code)
{
/* 3.3.11.1 */
static const char *type[] = {
"Other", /* 0x01 */
"Unknown",
"Video",
"SCSI Controller",
"Ethernet",
"Token Ring",
"Sound",
"PATA Controller",
"SATA Controller",
"SAS Controller" /* 0x0A */
};
if (code >= 0x01 && code <= 0x0A)
return type[code - 0x01];
return out_of_spec;
}
static void dmi_on_board_devices(struct dmi_header *h, s_dmi * dmi)
{
uint8_t *p = h->data + 4;
uint8_t count = (h->length - 0x04) / 2;
unsigned int i;
for (i = 0;
i < count
&& i <
sizeof dmi->base_board.devices_information /
sizeof *dmi->base_board.devices_information; i++) {
strlcpy(dmi->base_board.devices_information[i].type,
dmi_on_board_devices_type(p[2 * i] & 0x7F),
sizeof dmi->base_board.devices_information[i].type);
dmi->base_board.devices_information[i].status = p[2 * i] & 0x80;
strlcpy(dmi->base_board.devices_information[i].description,
dmi_string(h, p[2 * i + 1]),
sizeof dmi->base_board.devices_information[i].description);
}
}
/*
* 3.3.24 System Reset (Type 23)
*/
static const char *dmi_system_reset_boot_option(uint8_t code)
{
static const char *option[] = {
"Operating System", /* 0x1 */
"System Utilities",
"Do Not Reboot" /* 0x3 */
};
if (code >= 0x1)
return option[code - 0x1];
return out_of_spec;
}
static void dmi_system_reset_count(uint16_t code, char *array)
{
if (code == 0xFFFF)
strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u", code);
}
static void dmi_system_reset_timer(uint16_t code, char *array)
{
if (code == 0xFFFF)
strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u min", code);
}
/*
* 3.3.25 Hardware Security (Type 24)
*/
static const char *dmi_hardware_security_status(uint8_t code)
{
static const char *status[] = {
"Disabled", /* 0x00 */
"Enabled",
"Not Implemented",
"Unknown" /* 0x03 */
};
return status[code];
}
/*
* 3.3.12 OEM Strings (Type 11)
*/
static void dmi_oem_strings(struct dmi_header *h, const char *prefix,
s_dmi * dmi)
{
uint8_t *p = h->data + 4;
uint8_t count = p[0x00];
int i;
for (i = 1; i <= count; i++)
snprintf(dmi->oem_strings, OEM_STRINGS_SIZE, "%s %s %s\n",
dmi->oem_strings, prefix, dmi_string(h, i));
}
/*
* 3.3.13 System Configuration Options (Type 12)
*/
static void dmi_system_configuration_options(struct dmi_header *h,
const char *prefix, s_dmi * dmi)
{
uint8_t *p = h->data + 4;
uint8_t count = p[0x00];
int i;
for (i = 1; i <= count; i++)
snprintf(dmi->system.configuration_options,
SYSTEM_CONFIGURATION_OPTIONS_SIZE, "%s %s %s\n",
dmi->system.configuration_options, prefix, dmi_string(h, i));
}
static void dmi_system_boot_status(uint8_t code, char *array)
{
static const char *status[] = {
"No errors detected", /* 0 */
"No bootable media",
"Operating system failed to load",
"Firmware-detected hardware failure",
"Operating system-detected hardware failure",
"User-requested boot",
"System security violation",
"Previously-requested image",
"System watchdog timer expired" /* 8 */
};
if (code <= 8)
strlcpy(array, status[code], SYSTEM_BOOT_STATUS_SIZE);
if (code >= 128 && code <= 191)
strlcpy(array, "OEM-specific", SYSTEM_BOOT_STATUS_SIZE);
if (code >= 192)
strlcpy(array, "Product-specific", SYSTEM_BOOT_STATUS_SIZE);
}
void dmi_bios_runtime_size(uint32_t code, s_dmi * dmi)
{
if (code & 0x000003FF) {
dmi->bios.runtime_size = code;
strlcpy(dmi->bios.runtime_size_unit, "bytes",
sizeof(dmi->bios.runtime_size_unit));
} else {
dmi->bios.runtime_size = code >> 10;
strlcpy(dmi->bios.runtime_size_unit, "KB",
sizeof(dmi->bios.runtime_size_unit));
}
}
void dmi_bios_characteristics(uint64_t code, s_dmi * dmi)
{
int i;
/*
* This isn't very clear what this bit is supposed to mean
*/
//if(code.l&(1<<3))
if (code && (1 << 3)) {
((bool *) (&dmi->bios.characteristics))[0] = true;
return;
}
for (i = 4; i <= 31; i++)
//if(code.l&(1<<i))
if (code & (1 << i))
((bool *) (&dmi->bios.characteristics))[i - 3] = true;
}
void dmi_bios_characteristics_x1(uint8_t code, s_dmi * dmi)
{
int i;
for (i = 0; i <= 7; i++)
if (code & (1 << i))
((bool *) (&dmi->bios.characteristics_x1))[i] = true;
}
void dmi_bios_characteristics_x2(uint8_t code, s_dmi * dmi)
{
int i;
for (i = 0; i <= 2; i++)
if (code & (1 << i))
((bool *) (&dmi->bios.characteristics_x2))[i] = true;
}
void dmi_system_uuid(uint8_t * p, s_dmi * dmi)
{
int only0xFF = 1, only0x00 = 1;
int i;
for (i = 0; i < 16 && (only0x00 || only0xFF); i++) {
if (p[i] != 0x00)
only0x00 = 0;
if (p[i] != 0xFF)
only0xFF = 0;
}
if (only0xFF) {
sprintf(dmi->system.uuid, "Not Present");
return;
}
if (only0x00) {
sprintf(dmi->system.uuid, "Not Settable");
return;
}
sprintf(dmi->system.uuid,
"%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10],
p[11], p[12], p[13], p[14], p[15]);
}
void dmi_system_wake_up_type(uint8_t code, s_dmi * dmi)
{
/* 3.3.2.1 */
static const char *type[] = {
"Reserved", /* 0x00 */
"Other",
"Unknown",
"APM Timer",
"Modem Ring",
"LAN Remote",
"Power Switch",
"PCI PME#",
"AC Power Restored" /* 0x08 */
};
if (code <= 0x08) {
strlcpy(dmi->system.wakeup_type, type[code],
sizeof(dmi->system.wakeup_type));
} else {
strlcpy(dmi->system.wakeup_type, out_of_spec,
sizeof(dmi->system.wakeup_type));
}
return;
}
static void dmi_base_board_features(uint8_t code, s_dmi * dmi)
{
if ((code & 0x1F) != 0) {
int i;
for (i = 0; i <= 4; i++)
if (code & (1 << i))
((bool *) (&dmi->base_board.features))[i] = true;
}
}
static void dmi_base_board_type(uint8_t code, s_dmi * dmi)
{
/* 3.3.3.2 */
static const char *type[] = {
"Unknown", /* 0x01 */
"Other",
"Server Blade",
"Connectivity Switch",
"System Management Module",
"Processor Module",
"I/O Module",
"Memory Module",
"Daughter Board",
"Motherboard",
"Processor+Memory Module",
"Processor+I/O Module",
"Interconnect Board" /* 0x0D */
};
if (code >= 0x01 && code <= 0x0D) {
strlcpy(dmi->base_board.type, type[code],
sizeof(dmi->base_board.type));
} else {
strlcpy(dmi->base_board.type, out_of_spec,
sizeof(dmi->base_board.type));
}
return;
}
static void dmi_processor_voltage(uint8_t code, s_dmi * dmi)
{
/* 3.3.5.4 */
static const uint16_t voltage[] = {
5000,
3300,
2900
};
int i;
if (code & 0x80)
dmi->processor.voltage_mv = (code & 0x7f) * 100;
else {
for (i = 0; i <= 2; i++)
if (code & (1 << i))
dmi->processor.voltage_mv = voltage[i];
}
}
static void dmi_processor_id(uint8_t type, uint8_t * p, const char *version,
s_dmi * dmi)
{
/*
* Extra flags are now returned in the ECX register when one calls
* the CPUID instruction. Their meaning is explained in table 6, but
* DMI doesn't support this yet.
*/
uint32_t eax, edx;
int sig = 0;
/*
* This might help learn about new processors supporting the
* CPUID instruction or another form of identification.
*/
sprintf(dmi->processor.id, "ID: %02X %02X %02X %02X %02X %02X %02X %02X\n",
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
if (type == 0x05) { /* 80386 */
uint16_t dx = WORD(p);
/*
* 80386 have a different signature.
*/
dmi->processor.signature.type = (dx >> 12);
dmi->processor.signature.family = ((dx >> 8) & 0xF);
dmi->processor.signature.stepping = (dx >> 4) & 0xF;
dmi->processor.signature.minor_stepping = (dx & 0xF);
return;
}
if (type == 0x06) { /* 80486 */
uint16_t dx = WORD(p);
/*
* Not all 80486 CPU support the CPUID instruction, we have to find
* wether the one we have here does or not. Note that this trick
* works only because we know that 80486 must be little-endian.
*/
if ((dx & 0x0F00) == 0x0400
&& ((dx & 0x00F0) == 0x0040 || (dx & 0x00F0) >= 0x0070)
&& ((dx & 0x000F) >= 0x0003))
sig = 1;
else {
dmi->processor.signature.type = ((dx >> 12) & 0x3);
dmi->processor.signature.family = ((dx >> 8) & 0xF);
dmi->processor.signature.model = ((dx >> 4) & 0xF);
dmi->processor.signature.stepping = (dx & 0xF);
return;
}
} else if ((type >= 0x0B && type <= 0x13) /* Intel, Cyrix */
||(type >= 0xB0 && type <= 0xB3) /* Intel */
||type == 0xB5 /* Intel */
|| type == 0xB9) /* Intel */
sig = 1;
else if ((type >= 0x18 && type <= 0x1D) /* AMD */
||type == 0x1F /* AMD */
|| (type >= 0xB6 && type <= 0xB7) /* AMD */
||(type >= 0x83 && type <= 0x85)) /* AMD */
sig = 2;
else if (type == 0x01 || type == 0x02) {
/*
* Some X86-class CPU have family "Other" or "Unknown". In this case,
* we use the version string to determine if they are known to
* support the CPUID instruction.
*/
if (strncmp(version, "Pentium III MMX", 15) == 0)
sig = 1;
else if (strncmp(version, "AMD Athlon(TM)", 14) == 0
|| strncmp(version, "AMD Opteron(tm)", 15) == 0)
sig = 2;
else
return;
} else /* not X86-class */
return;
eax = DWORD(p);
edx = DWORD(p + 4);
switch (sig) {
case 1: /* Intel */
dmi->processor.signature.type = ((eax >> 12) & 0x3);
dmi->processor.signature.family =
(((eax >> 16) & 0xFF0) + ((eax >> 8) & 0x00F));
dmi->processor.signature.model =
(((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F));
dmi->processor.signature.stepping = (eax & 0xF);
break;
case 2: /* AMD */
dmi->processor.signature.family =
(((eax >> 8) & 0xF) == 0xF ? (eax >> 20) & 0xFF : (eax >> 8) & 0xF);
dmi->processor.signature.model =
(((eax >> 4) & 0xF) == 0xF ? (eax >> 16) & 0xF : (eax >> 4) & 0xF);
dmi->processor.signature.stepping = (eax & 0xF);
break;
}
edx = DWORD(p + 4);
if ((edx & 0x3FF7FDFF) != 0) {
int i;
for (i = 0; i <= 31; i++)
if (cpu_flags_strings[i] != NULL && edx & (1 << i))
((bool *) (&dmi->processor.cpu_flags))[i] = true;
}
}
void to_dmi_header(struct dmi_header *h, uint8_t * data)
{
h->type = data[0];
h->length = data[1];
h->handle = WORD(data + 2);
h->data = data;
}
const char *dmi_string(struct dmi_header *dm, uint8_t s)
{
char *bp = (char *)dm->data;
size_t i, len;
if (s == 0)
return "Not Specified";
bp += dm->length;
while (s > 1 && *bp) {
bp += strlen(bp);
bp++;
s--;
}
if (!*bp)
return bad_index;
/* ASCII filtering */
len = strlen(bp);
for (i = 0; i < len; i++)
if (bp[i] < 32 || bp[i] == 127)
bp[i] = '.';
return bp;
}
int checksum(uint8_t * buf, int len)
{
uint8_t sum = 0;
int a;
for (a = 0; a < len; a++)
sum += buf[a];
return (sum == 0);
}
static int smbios_decode(s_dmi * dmi, uint8_t * buf)
{
dmi->dmitable.ver = (buf[0x06] << 8) + buf[0x07];
/* Some BIOS report weird SMBIOS version, fix that up */
switch (dmi->dmitable.ver) {
case 0x021F:
dmi->dmitable.ver = 0x0203;
break;
case 0x0233:
dmi->dmitable.ver = 0x0206;
break;
}
dmi->dmitable.major_version = dmi->dmitable.ver >> 8;
dmi->dmitable.minor_version = dmi->dmitable.ver & 0xFF;
return DMI_TABLE_PRESENT;
}
static int legacy_decode(s_dmi * dmi, uint8_t * buf)
{
dmi->dmitable.num = buf[13] << 8 | buf[12];
dmi->dmitable.len = buf[7] << 8 | buf[6];
dmi->dmitable.base = buf[11] << 24 | buf[10] << 16 | buf[9] << 8 | buf[8];
/* Version already found? */
if (dmi->dmitable.ver > 0)
return DMI_TABLE_PRESENT;
dmi->dmitable.ver = (buf[0x06] << 8) + buf[0x07];
/*
* DMI version 0.0 means that the real version is taken from
* the SMBIOS version, which we don't know at this point.
*/
if (buf[14] != 0) {
dmi->dmitable.major_version = buf[14] >> 4;
dmi->dmitable.minor_version = buf[14] & 0x0F;
} else {
dmi->dmitable.major_version = 0;
dmi->dmitable.minor_version = 0;
}
return DMI_TABLE_PRESENT;
}
int dmi_iterate(s_dmi * dmi)
{
uint8_t *p, *q;
int found = 0;
/* Cleaning structures */
memset(dmi, 0, sizeof(s_dmi));
memset(&dmi->base_board, 0, sizeof(s_base_board));
memset(&dmi->battery, 0, sizeof(s_battery));
memset(&dmi->bios, 0, sizeof(s_bios));
memset(&dmi->chassis, 0, sizeof(s_chassis));
for (int i = 0; i < MAX_DMI_MEMORY_ITEMS; i++)
memset(&dmi->memory[i], 0, sizeof(s_memory));
memset(&dmi->processor, 0, sizeof(s_processor));
memset(&dmi->system, 0, sizeof(s_system));
/* Until we found this elements in the dmitable, we consider them as not filled */
dmi->base_board.filled = false;
dmi->battery.filled = false;
dmi->bios.filled = false;
dmi->chassis.filled = false;
for (int i = 0; i < MAX_DMI_MEMORY_ITEMS; i++)
dmi->memory[i].filled = false;
dmi->processor.filled = false;
dmi->system.filled = false;
p = (uint8_t *) 0xF0000; /* The start address to look at the dmi table */
/* The anchor-string is 16-bytes aligned */
for (q = p; q < p + 0x10000; q += 16) {
/* To validate the presence of SMBIOS:
* + the overall checksum must be correct
* + the intermediate anchor-string must be _DMI_
* + the intermediate checksum must be correct
*/
if (memcmp(q, "_SM_", 4) == 0 &&
checksum(q, q[0x05]) &&
memcmp(q + 0x10, "_DMI_", 5) == 0 && checksum(q + 0x10, 0x0F)) {
/* Do not return, legacy_decode will need to be called
* on the intermediate structure to get the table length
* and address
*/
smbios_decode(dmi, q);
} else if (memcmp(q, "_DMI_", 5) == 0 && checksum(q, 0x0F)) {
found = 1;
legacy_decode(dmi, q);
}
}
if (found)
return DMI_TABLE_PRESENT;
dmi->dmitable.base = 0;
dmi->dmitable.num = 0;
dmi->dmitable.ver = 0;
dmi->dmitable.len = 0;
return -ENODMITABLE;
}
void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
{
uint8_t *data = h->data;
/*
* Note: DMI types 37, 38 and 39 are untested
*/
switch (h->type) {
case 0: /* 3.3.1 BIOS Information */
if (h->length < 0x12)
break;
dmi->bios.filled = true;
strlcpy(dmi->bios.vendor, dmi_string(h, data[0x04]),
sizeof(dmi->bios.vendor));
strlcpy(dmi->bios.version, dmi_string(h, data[0x05]),
sizeof(dmi->bios.version));
strlcpy(dmi->bios.release_date, dmi_string(h, data[0x08]),
sizeof(dmi->bios.release_date));
dmi->bios.address = WORD(data + 0x06);
dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4, dmi);
dmi->bios.rom_size = (data[0x09] + 1) << 6;
strlcpy(dmi->bios.rom_size_unit, "kB", sizeof(dmi->bios.rom_size_unit));
dmi_bios_characteristics(QWORD(data + 0x0A), dmi);
if (h->length < 0x13)
break;
dmi_bios_characteristics_x1(data[0x12], dmi);
if (h->length < 0x14)
break;
dmi_bios_characteristics_x2(data[0x13], dmi);
if (h->length < 0x18)
break;
if (data[0x14] != 0xFF && data[0x15] != 0xFF)
snprintf(dmi->bios.bios_revision, sizeof(dmi->bios.bios_revision),
"%u.%u", data[0x14], data[0x15]);
if (data[0x16] != 0xFF && data[0x17] != 0xFF)
snprintf(dmi->bios.firmware_revision,
sizeof(dmi->bios.firmware_revision), "%u.%u", data[0x16],
data[0x17]);
break;
case 1: /* 3.3.2 System Information */
if (h->length < 0x08)
break;
dmi->system.filled = true;
strlcpy(dmi->system.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->system.manufacturer));
strlcpy(dmi->system.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->system.product_name));
strlcpy(dmi->system.version, dmi_string(h, data[0x06]),
sizeof(dmi->system.version));
strlcpy(dmi->system.serial, dmi_string(h, data[0x07]),
sizeof(dmi->system.serial));
if (h->length < 0x19)
break;
dmi_system_uuid(data + 0x08, dmi);
dmi_system_wake_up_type(data[0x18], dmi);
if (h->length < 0x1B)
break;
strlcpy(dmi->system.sku_number, dmi_string(h, data[0x19]),
sizeof(dmi->system.sku_number));
strlcpy(dmi->system.family, dmi_string(h, data[0x1A]),
sizeof(dmi->system.family));
break;
case 2: /* 3.3.3 Base Board Information */
if (h->length < 0x08)
break;
dmi->base_board.filled = true;
strlcpy(dmi->base_board.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->base_board.manufacturer));
strlcpy(dmi->base_board.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->base_board.product_name));
strlcpy(dmi->base_board.version, dmi_string(h, data[0x06]),
sizeof(dmi->base_board.version));
strlcpy(dmi->base_board.serial, dmi_string(h, data[0x07]),
sizeof(dmi->base_board.serial));
if (h->length < 0x0F)
break;
strlcpy(dmi->base_board.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->base_board.asset_tag));
dmi_base_board_features(data[0x09], dmi);
strlcpy(dmi->base_board.location, dmi_string(h, data[0x0A]),
sizeof(dmi->base_board.location));
dmi_base_board_type(data[0x0D], dmi);
if (h->length < 0x0F + data[0x0E] * sizeof(uint16_t))
break;
break;
case 3: /* 3.3.4 Chassis Information */
if (h->length < 0x09)
break;
dmi->chassis.filled = true;
strlcpy(dmi->chassis.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->chassis.manufacturer));
strlcpy(dmi->chassis.type, dmi_chassis_type(data[0x05] & 0x7F),
sizeof(dmi->chassis.type));
strlcpy(dmi->chassis.lock, dmi_chassis_lock(data[0x05] >> 7),
sizeof(dmi->chassis.lock));
strlcpy(dmi->chassis.version, dmi_string(h, data[0x06]),
sizeof(dmi->chassis.version));
strlcpy(dmi->chassis.serial, dmi_string(h, data[0x07]),
sizeof(dmi->chassis.serial));
strlcpy(dmi->chassis.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->chassis.asset_tag));
if (h->length < 0x0D)
break;
strlcpy(dmi->chassis.boot_up_state, dmi_chassis_state(data[0x09]),
sizeof(dmi->chassis.boot_up_state));
strlcpy(dmi->chassis.power_supply_state,
dmi_chassis_state(data[0x0A]),
sizeof(dmi->chassis.power_supply_state));
strlcpy(dmi->chassis.thermal_state,
dmi_chassis_state(data[0x0B]),
sizeof(dmi->chassis.thermal_state));
strlcpy(dmi->chassis.security_status,
dmi_chassis_security_status(data[0x0C]),
sizeof(dmi->chassis.security_status));
if (h->length < 0x11)
break;
snprintf(dmi->chassis.oem_information,
sizeof(dmi->chassis.oem_information), "0x%08X",
DWORD(data + 0x0D));
if (h->length < 0x15)
break;
dmi->chassis.height = data[0x11];
dmi->chassis.nb_power_cords = data[0x12];
break;
case 4: /* 3.3.5 Processor Information */
if (h->length < 0x1A)
break;
dmi->processor.filled = true;
strlcpy(dmi->processor.socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->processor.socket_designation));
strlcpy(dmi->processor.type,
dmi_processor_type(data[0x05]), sizeof(dmi->processor.type));
strlcpy(dmi->processor.manufacturer,
dmi_string(h, data[0x07]), sizeof(dmi->processor.manufacturer));
strlcpy(dmi->processor.family,
dmi_processor_family(data[0x06],
dmi->processor.manufacturer),
sizeof(dmi->processor.family));
dmi_processor_id(data[0x06], data + 8, dmi_string(h, data[0x10]), dmi);
strlcpy(dmi->processor.version,
dmi_string(h, data[0x10]), sizeof(dmi->processor.version));
dmi_processor_voltage(data[0x11], dmi);
dmi->processor.external_clock = WORD(data + 0x12);
dmi->processor.max_speed = WORD(data + 0x14);
dmi->processor.current_speed = WORD(data + 0x16);
if (data[0x18] & (1 << 6))
strlcpy(dmi->processor.status,
dmi_processor_status(data[0x18] & 0x07),
sizeof(dmi->processor.status));
else
sprintf(dmi->processor.status, "Unpopulated");
strlcpy(dmi->processor.upgrade,
dmi_processor_upgrade(data[0x19]),
sizeof(dmi->processor.upgrade));
if (h->length < 0x20)
break;
dmi_processor_cache(WORD(data + 0x1A), "L1", ver,
dmi->processor.cache1);
dmi_processor_cache(WORD(data + 0x1C), "L2", ver,
dmi->processor.cache2);
dmi_processor_cache(WORD(data + 0x1E), "L3", ver,
dmi->processor.cache3);
if (h->length < 0x23)
break;
strlcpy(dmi->processor.serial, dmi_string(h, data[0x20]),
sizeof(dmi->processor.serial));
strlcpy(dmi->processor.asset_tag, dmi_string(h, data[0x21]),
sizeof(dmi->processor.asset_tag));
strlcpy(dmi->processor.part_number, dmi_string(h, data[0x22]),
sizeof(dmi->processor.part_number));
dmi->processor.core_count = 0;
dmi->processor.core_enabled = 0;
dmi->processor.thread_count = 0;
if (h->length < 0x28)
break;
dmi->processor.core_count = data[0x23];
dmi->processor.core_enabled = data[0x24];
dmi->processor.thread_count = data[0x25];
break;
case 6: /* 3.3.7 Memory Module Information */
if (h->length < 0x0C)
break;
dmi->memory_module_count++;
s_memory_module *module =
&dmi->memory_module[dmi->memory_module_count - 1];
dmi->memory_module[dmi->memory_module_count - 1].filled = true;
strlcpy(module->socket_designation, dmi_string(h, data[0x04]),
sizeof(module->socket_designation));
dmi_memory_module_connections(data[0x05], module->bank_connections, sizeof(module->bank_connections));
dmi_memory_module_speed(data[0x06], module->speed);
dmi_memory_module_types(WORD(data + 0x07), " ", module->type, sizeof(module->type));
dmi_memory_module_size(data[0x09], module->installed_size, sizeof(module->installed_size));
dmi_memory_module_size(data[0x0A], module->enabled_size, sizeof(module->enabled_size));
dmi_memory_module_error(data[0x0B], "\t\t", module->error_status);
break;
case 7: /* 3.3.8 Cache Information */
if (h->length < 0x0F)
break;
dmi->cache_count++;
if (dmi->cache_count > MAX_DMI_CACHE_ITEMS)
break;
strlcpy(dmi->cache[dmi->cache_count - 1].socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->cache[dmi->cache_count - 1].socket_designation));
snprintf(dmi->cache[dmi->cache_count - 1].configuration,
sizeof(dmi->cache[dmi->cache_count - 1].configuration),
"%s, %s, %u",
WORD(data + 0x05) & 0x0080 ? "Enabled" : "Disabled",
WORD(data +
0x05) & 0x0008 ? "Socketed" : "Not Socketed",
(WORD(data + 0x05) & 0x0007) + 1);
strlcpy(dmi->cache[dmi->cache_count - 1].mode,
dmi_cache_mode((WORD(data + 0x05) >> 8) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].mode));
strlcpy(dmi->cache[dmi->cache_count - 1].location,
dmi_cache_location((WORD(data + 0x05) >> 5) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].location));
dmi->cache[dmi->cache_count - 1].installed_size =
dmi_cache_size(WORD(data + 0x09));
dmi->cache[dmi->cache_count - 1].max_size =
dmi_cache_size(WORD(data + 0x07));
dmi_cache_types(WORD(data + 0x0B), " ",
dmi->cache[dmi->cache_count - 1].supported_sram_types);
dmi_cache_types(WORD(data + 0x0D), " ",
dmi->cache[dmi->cache_count - 1].installed_sram_types);
if (h->length < 0x13)
break;
dmi->cache[dmi->cache_count - 1].speed = data[0x0F]; /* ns */
strlcpy(dmi->cache[dmi->cache_count - 1].error_correction_type,
dmi_cache_ec_type(data[0x10]),
sizeof(dmi->cache[dmi->cache_count - 1].error_correction_type));
strlcpy(dmi->cache[dmi->cache_count - 1].system_type,
dmi_cache_type(data[0x11]),
sizeof(dmi->cache[dmi->cache_count - 1].system_type));
strlcpy(dmi->cache[dmi->cache_count - 1].associativity,
dmi_cache_associativity(data[0x12]),
sizeof(dmi->cache[dmi->cache_count - 1].associativity));
break;
case 10: /* 3.3.11 On Board Devices Information */
dmi_on_board_devices(h, dmi);
break;
case 11: /* 3.3.12 OEM Strings */
if (h->length < 0x05)
break;
dmi_oem_strings(h, "\t", dmi);
break;
case 12: /* 3.3.13 System Configuration Options */
if (h->length < 0x05)
break;
dmi_system_configuration_options(h, "\t", dmi);
break;
case 17: /* 3.3.18 Memory Device */
if (h->length < 0x15)
break;
dmi->memory_count++;
if (dmi->memory_count > MAX_DMI_MEMORY_ITEMS)
break;
s_memory *mem = &dmi->memory[dmi->memory_count - 1];
dmi->memory[dmi->memory_count - 1].filled = true;
dmi_memory_array_error_handle(WORD(data + 0x06), mem->error);
dmi_memory_device_width(WORD(data + 0x08), mem->total_width);
dmi_memory_device_width(WORD(data + 0x0A), mem->data_width);
dmi_memory_device_size(WORD(data + 0x0C), mem->size);
strlcpy(mem->form_factor,
dmi_memory_device_form_factor(data[0x0E]),
sizeof(mem->form_factor));
dmi_memory_device_set(data[0x0F], mem->device_set);
strlcpy(mem->device_locator, dmi_string(h, data[0x10]),
sizeof(mem->device_locator));
strlcpy(mem->bank_locator, dmi_string(h, data[0x11]),
sizeof(mem->bank_locator));
strlcpy(mem->type, dmi_memory_device_type(data[0x12]),
sizeof(mem->type));
dmi_memory_device_type_detail(WORD(data + 0x13), mem->type_detail, sizeof(mem->type_detail));
if (h->length < 0x17)
break;
dmi_memory_device_speed(WORD(data + 0x15), mem->speed);
if (h->length < 0x1B)
break;
strlcpy(mem->manufacturer, dmi_string(h, data[0x17]),
sizeof(mem->manufacturer));
strlcpy(mem->serial, dmi_string(h, data[0x18]), sizeof(mem->serial));
strlcpy(mem->asset_tag, dmi_string(h, data[0x19]),
sizeof(mem->asset_tag));
strlcpy(mem->part_number, dmi_string(h, data[0x1A]),
sizeof(mem->part_number));
break;
case 22: /* 3.3.23 Portable Battery */
if (h->length < 0x10)
break;
dmi->battery.filled = true;
strlcpy(dmi->battery.location, dmi_string(h, data[0x04]),
sizeof(dmi->battery.location));
strlcpy(dmi->battery.manufacturer, dmi_string(h, data[0x05]),
sizeof(dmi->battery.manufacturer));
if (data[0x06] || h->length < 0x1A)
strlcpy(dmi->battery.manufacture_date,
dmi_string(h, data[0x06]),
sizeof(dmi->battery.manufacture_date));
if (data[0x07] || h->length < 0x1A)
strlcpy(dmi->battery.serial, dmi_string(h, data[0x07]),
sizeof(dmi->battery.serial));
strlcpy(dmi->battery.name, dmi_string(h, data[0x08]),
sizeof(dmi->battery.name));
if (data[0x09] != 0x02 || h->length < 0x1A)
strlcpy(dmi->battery.chemistry,
dmi_battery_chemistry(data[0x09]),
sizeof(dmi->battery.chemistry));
if (h->length < 0x1A)
dmi_battery_capacity(WORD(data + 0x0A), 1,
dmi->battery.design_capacity);
else
dmi_battery_capacity(WORD(data + 0x0A), data[0x15],
dmi->battery.design_capacity);
dmi_battery_voltage(WORD(data + 0x0C), dmi->battery.design_voltage);
strlcpy(dmi->battery.sbds, dmi_string(h, data[0x0E]),
sizeof(dmi->battery.sbds));
dmi_battery_maximum_error(data[0x0F], dmi->battery.maximum_error);
if (h->length < 0x1A)
break;
if (data[0x07] == 0)
sprintf(dmi->battery.sbds_serial, "%04X", WORD(data + 0x10));
if (data[0x06] == 0)
sprintf(dmi->battery.sbds_manufacture_date, "%u-%02u-%02u",
1980 + (WORD(data + 0x12) >> 9),
(WORD(data + 0x12) >> 5) & 0x0F, WORD(data + 0x12) & 0x1F);
if (data[0x09] == 0x02)
strlcpy(dmi->battery.sbds_chemistry, dmi_string(h, data[0x14]),
sizeof(dmi->battery.sbds_chemistry));
// sprintf(dmi->battery.oem_info,"0x%08X",DWORD(h, data+0x16));
break;
case 23: /* 3.3.24 System Reset */
if (h->length < 0x0D)
break;
dmi->system.system_reset.filled = true;
dmi->system.system_reset.status = data[0x04] & (1 << 0);
dmi->system.system_reset.watchdog = data[0x04] & (1 << 5);
if (!(data[0x04] & (1 << 5)))
break;
strlcpy(dmi->system.system_reset.boot_option,
dmi_system_reset_boot_option((data[0x04] >> 1) & 0x3),
sizeof dmi->system.system_reset.boot_option);
strlcpy(dmi->system.system_reset.boot_option_on_limit,
dmi_system_reset_boot_option((data[0x04] >> 3) & 0x3),
sizeof dmi->system.system_reset.boot_option_on_limit);
dmi_system_reset_count(WORD(data + 0x05),
dmi->system.system_reset.reset_count);
dmi_system_reset_count(WORD(data + 0x07),
dmi->system.system_reset.reset_limit);
dmi_system_reset_timer(WORD(data + 0x09),
dmi->system.system_reset.timer_interval);
dmi_system_reset_timer(WORD(data + 0x0B),
dmi->system.system_reset.timeout);
break;
case 24: /* 3.3.25 Hardware Security */
if (h->length < 0x05)
break;
dmi->hardware_security.filled = true;
strlcpy(dmi->hardware_security.power_on_passwd_status,
dmi_hardware_security_status(data[0x04] >> 6),
sizeof dmi->hardware_security.power_on_passwd_status);
strlcpy(dmi->hardware_security.keyboard_passwd_status,
dmi_hardware_security_status((data[0x04] >> 4) & 0x3),
sizeof dmi->hardware_security.keyboard_passwd_status);
strlcpy(dmi->hardware_security.administrator_passwd_status,
dmi_hardware_security_status((data[0x04] >> 2) & 0x3),
sizeof dmi->hardware_security.administrator_passwd_status);
strlcpy(dmi->hardware_security.front_panel_reset_status,
dmi_hardware_security_status(data[0x04] & 0x3),
sizeof dmi->hardware_security.front_panel_reset_status);
break;
case 32: /* 3.3.33 System Boot Information */
if (h->length < 0x0B)
break;
dmi_system_boot_status(data[0x0A], dmi->system.system_boot_status);
case 38: /* 3.3.39 IPMI Device Information */
if (h->length < 0x10)
break;
dmi->ipmi.filled = true;
snprintf(dmi->ipmi.interface_type,
sizeof(dmi->ipmi.interface_type), "%s",
dmi_ipmi_interface_type(data[0x04]));
dmi->ipmi.major_specification_version = data[0x05] >> 4;
dmi->ipmi.minor_specification_version = data[0x05] & 0x0F;
dmi->ipmi.I2C_slave_address = data[0x06] >> 1;
if (data[0x07] != 0xFF)
dmi->ipmi.nv_address = data[0x07];
else
dmi->ipmi.nv_address = 0; /* Not Present */
dmi_ipmi_base_address(data[0x04], data + 0x08, &dmi->ipmi);
if (h->length < 0x12)
break;
if (data[0x11] != 0x00) {
dmi->ipmi.irq = data[0x11];
}
break;
}
}
void parse_dmitable(s_dmi * dmi)
{
int i = 0;
uint8_t *data = NULL;
uint8_t buf[dmi->dmitable.len];
memcpy(buf, (int *)dmi->dmitable.base, sizeof(uint8_t) * dmi->dmitable.len);
data = buf;
dmi->memory_count = 0;
while (i < dmi->dmitable.num && data + 4 <= buf + dmi->dmitable.len) { /* 4 is the length of an SMBIOS structure header */
uint8_t *next;
struct dmi_header h;
to_dmi_header(&h, data);
/*
* If a short entry is found (less than 4 bytes), not only it
* is invalid, but we cannot reliably locate the next entry.
* Better stop at this point, and let the user know his/her
* table is broken.
*/
if (h.length < 4) {
printf
("Invalid entry length (%u). DMI table is broken! Stop.\n\n",
(unsigned int)h.length);
break;
}
/* loo for the next handle */
next = data + h.length;
while (next - buf + 1 < dmi->dmitable.len
&& (next[0] != 0 || next[1] != 0))
next++;
next += 2;
if (next - buf <= dmi->dmitable.len) {
dmi_decode(&h, dmi->dmitable.ver, dmi);
}
data = next;
i++;
}
}
| 31.269933
| 126
| 0.641957
|
ed68705ba33b3d027873df7cad14702b07b9578a
| 9,585
|
h
|
C
|
src/vscp_type_multimedia.h
|
BlueAndi/vscp-framework
|
a9650a2163519212be2c07c541518d646c8acd0f
|
[
"MIT"
] | 13
|
2015-10-29T17:12:21.000Z
|
2021-02-07T19:56:46.000Z
|
src/vscp_type_multimedia.h
|
BlueAndi/vscp-framework
|
a9650a2163519212be2c07c541518d646c8acd0f
|
[
"MIT"
] | 36
|
2015-04-21T16:35:03.000Z
|
2021-09-16T15:15:26.000Z
|
src/vscp_type_multimedia.h
|
BlueAndi/vscp-framework
|
a9650a2163519212be2c07c541518d646c8acd0f
|
[
"MIT"
] | 16
|
2015-09-15T12:53:52.000Z
|
2021-11-19T20:29:24.000Z
|
/* The MIT License (MIT)
*
* Copyright (c) 2014 - 2021, Andreas Merkle
* http://www.blue-andi.de
* vscp@blue-andi.de
*
* 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.
*
*/
/*******************************************************************************
DESCRIPTION
*******************************************************************************/
/**
@brief Multimedia
@file vscp_type_multimedia.h
@author Andreas Merkle, http://www.blue-andi.de
@section desc Description
Dedicated class for multimedia functionality. This class was introduced to supplement the control
class and to offer multimedia specific control events.
This file is automatically generated. Don't change it manually.
*******************************************************************************/
#ifndef __VSCP_TYPE_MULTIMEDIA_H__
#define __VSCP_TYPE_MULTIMEDIA_H__
/** @defgroup vscp_type_multimedia Multimedia
* Level 1 protocol class types
* @{
* @ingroup vscp_l1
*/
/*******************************************************************************
INCLUDES
*******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
COMPILER SWITCHES
*******************************************************************************/
/*******************************************************************************
CONSTANTS
*******************************************************************************/
/**
* General Event.
*/
#define VSCP_TYPE_MULTIMEDIA_GENERAL 0
/**
* This is for controlling playback functionality
*/
#define VSCP_TYPE_MULTIMEDIA_PLAYBACK 1
/**
* This is typically for navigation functions or DVD controls
*/
#define VSCP_TYPE_MULTIMEDIA_NAVIGATOR_KEY_ENG 2
/**
* This is typically for adjusting the contrast level of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_CONTRAST 3
/**
* This is typically for adjusting the focus settings of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_FOCUS 4
/**
* This is typically for adjusting the tint settings of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_TINT 5
/**
* This is typically for adjusting the color balance settings of a display device.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_COLOUR_BALANCE 6
/**
* This is typically for adjusting the tint settings of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_BRIGHTNESS 7
/**
* This is typically for adjusting the hue settings of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_HUE 8
/**
* This is typically for adjusting the bass level settings of a sound device. Depending on the
* implementation, this could automatically adjust the treble level. To adjust left and right bass
* levels, a node would have to use separate zones or sub-zones for left and right.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_BASS 9
/**
* This is typically for adjusting the treble level settings of a sound device. Depending on the
* implementation, this could automatically adjust the bass level. To adjust left and right treble
* levels, a node would have to use separate zones or sub-zones for left and right.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_TREBLE 10
/**
* This is typically for adjusting the master volume level. This could be used for adjusting the level
* for all speakers.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_MASTER_VOLUME 11
/**
* This is typically for adjusting the front speaker volume level. This usually means the two front
* speakers as opposed to the single center speaker.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_FRONT_VOLUME 12
/**
* This is typically for adjusting the front speaker volume level. This usually means the single
* center speaker as opposed to the two front speakers.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_CENTRE_VOLUME 13
/**
* This is typically for adjusting the rear speaker volume level.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_REAR_VOLUME 14
/**
* This is typically for adjusting the side speaker volume level.
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SIDE_VOLUME 15
/**
* These are reserved for other future speaker combinations
*/
#define VSCP_TYPE_MULTIMEDIA_RESERVED16 16
/**
* These are reserved for other future speaker combinations
*/
#define VSCP_TYPE_MULTIMEDIA_RESERVED17 17
/**
* These are reserved for other future speaker combinations
*/
#define VSCP_TYPE_MULTIMEDIA_RESERVED18 18
/**
* These are reserved for other future speaker combinations
*/
#define VSCP_TYPE_MULTIMEDIA_RESERVED19 19
/**
* This is typically for selecting a disk for playback
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_DISK 20
/**
* This is typically for selecting a track for playback
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_TRACK 21
/**
* This is typically for selecting an album or play-list for playback
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_ALBUM 22
/**
* This is typically for selecting a TV Channel
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_CHANNEL 23
/**
* This is typically for selecting a page of a film
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_PAGE 24
/**
* This is typically for selecting a chapter of a film
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_CHAPTER 25
/**
* This is for controlling screen format of a display device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_SCREEN_FORMAT 26
/**
* This is for controlling the input source of a playback device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_INPUT_SOURCE 27
/**
* This is for controlling the output of a playback device
*/
#define VSCP_TYPE_MULTIMEDIA_ADJUST_SELECT_OUTPUT 28
/**
* Control a recording device.
*/
#define VSCP_TYPE_MULTIMEDIA_RECORD 29
/**
* Control a recording device.
*/
#define VSCP_TYPE_MULTIMEDIA_SET_RECORDING_VOLUME 30
/**
* This is typically for accessing TIVO functions
*/
#define VSCP_TYPE_MULTIMEDIA_TIVO_FUNCTION 40
/**
* Get the title for the current active media.
*/
#define VSCP_TYPE_MULTIMEDIA_GET_CURRENT_TITLE 50
/**
* This is for controlling the position in the stream/file of a playback device
*/
#define VSCP_TYPE_MULTIMEDIA_SET_POSITION 51
/**
* Get various media information from a device.
*/
#define VSCP_TYPE_MULTIMEDIA_GET_MEDIA_INFO 52
/**
* Remove an item from an album.
*/
#define VSCP_TYPE_MULTIMEDIA_REMOVE_ITEM 53
/**
* Remove all items from an album.
*/
#define VSCP_TYPE_MULTIMEDIA_REMOVE_ALL_ITEMS 54
/**
* Save album/play-list to permanent storage.
*/
#define VSCP_TYPE_MULTIMEDIA_SAVE_ALBUM 55
/**
* Send multimedia information. This can be the title for the current active media. It can be sent as
* a response to a “Get Title” or similar event or by its own when a new title is playing or other
* multimedia information has changed.
* Response should be Type=61
*/
#define VSCP_TYPE_MULTIMEDIA_CONTROL 60
/**
* Response for multimedia control.
*/
#define VSCP_TYPE_MULTIMEDIA_CONTROL_RESPONSE 61
/*******************************************************************************
MACROS
*******************************************************************************/
/*******************************************************************************
TYPES AND STRUCTURES
*******************************************************************************/
/*******************************************************************************
VARIABLES
*******************************************************************************/
/*******************************************************************************
FUNCTIONS
*******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* __VSCP_TYPE_MULTIMEDIA_H__ */
/** @} */
| 31.738411
| 103
| 0.597392
|
469f87671c8f22fd813e378273bd1384e17addad
| 17,894
|
lua
|
Lua
|
CoreScripts/Modules/Server/ClientChat/ChatBar.lua
|
jackrestaki/Core-Scripts
|
31e68fd04caa585a0a52889aa2efda37ced4203e
|
[
"Apache-2.0"
] | null | null | null |
CoreScripts/Modules/Server/ClientChat/ChatBar.lua
|
jackrestaki/Core-Scripts
|
31e68fd04caa585a0a52889aa2efda37ced4203e
|
[
"Apache-2.0"
] | null | null | null |
CoreScripts/Modules/Server/ClientChat/ChatBar.lua
|
jackrestaki/Core-Scripts
|
31e68fd04caa585a0a52889aa2efda37ced4203e
|
[
"Apache-2.0"
] | null | null | null |
-- // FileName: ChatBar.lua
-- // Written by: Xsitsu
-- // Description: Manages text typing and typing state.
local module = {}
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local TextService = game:GetService("TextService")
local LocalPlayer = Players.LocalPlayer
while not LocalPlayer do
Players.PlayerAdded:wait()
LocalPlayer = Players.LocalPlayer
end
--////////////////////////////// Include
--//////////////////////////////////////
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
local commandModules = clientChatModules:WaitForChild("CommandModules")
local WhisperModule = require(commandModules:WaitForChild("Whisper"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end
--////////////////////////////// Methods
--//////////////////////////////////////
local methods = {}
methods.__index = methods
function methods:CreateGuiObjects(targetParent)
self.ChatBarParentFrame = targetParent
local backgroundImagePixelOffset = 7
local textBoxPixelOffset = 5
local BaseFrame = Instance.new("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 1, 0)
BaseFrame.BackgroundTransparency = 0.6
BaseFrame.BorderSizePixel = 0
BaseFrame.BackgroundColor3 = ChatSettings.ChatBarBackGroundColor
BaseFrame.Parent = targetParent
local BoxFrame = Instance.new("Frame")
BoxFrame.Selectable = false
BoxFrame.Name = "BoxFrame"
BoxFrame.BackgroundTransparency = 0.6
BoxFrame.BorderSizePixel = 0
BoxFrame.BackgroundColor3 = ChatSettings.ChatBarBoxColor
BoxFrame.Size = UDim2.new(1, -backgroundImagePixelOffset * 2, 1, -backgroundImagePixelOffset * 2)
BoxFrame.Position = UDim2.new(0, backgroundImagePixelOffset, 0, backgroundImagePixelOffset)
BoxFrame.Parent = BaseFrame
local TextBoxHolderFrame = Instance.new("Frame")
TextBoxHolderFrame.BackgroundTransparency = 1
TextBoxHolderFrame.Size = UDim2.new(1, -textBoxPixelOffset * 2, 1, -textBoxPixelOffset * 2)
TextBoxHolderFrame.Position = UDim2.new(0, textBoxPixelOffset, 0, textBoxPixelOffset)
TextBoxHolderFrame.Parent = BoxFrame
local TextBox = Instance.new("TextBox")
TextBox.Selectable = ChatSettings.GamepadNavigationEnabled
TextBox.Name = "ChatBar"
TextBox.BackgroundTransparency = 1
TextBox.Size = UDim2.new(1, 0, 1, 0)
TextBox.Position = UDim2.new(0, 0, 0, 0)
TextBox.TextSize = ChatSettings.ChatBarTextSize
TextBox.Font = ChatSettings.ChatBarFont
TextBox.TextColor3 = ChatSettings.ChatBarTextColor
TextBox.TextTransparency = 0.4
TextBox.TextStrokeTransparency = 1
TextBox.ClearTextOnFocus = false
TextBox.TextXAlignment = Enum.TextXAlignment.Left
TextBox.TextYAlignment = Enum.TextYAlignment.Top
TextBox.TextWrapped = true
TextBox.Text = ""
TextBox.Parent = TextBoxHolderFrame
local MessageModeTextButton = Instance.new("TextButton")
MessageModeTextButton.Selectable = false
MessageModeTextButton.Name = "MessageMode"
MessageModeTextButton.BackgroundTransparency = 1
MessageModeTextButton.Position = UDim2.new(0, 0, 0, 0)
MessageModeTextButton.TextSize = ChatSettings.ChatBarTextSize
MessageModeTextButton.Font = ChatSettings.ChatBarFont
MessageModeTextButton.TextXAlignment = Enum.TextXAlignment.Left
MessageModeTextButton.TextWrapped = true
MessageModeTextButton.Text = ""
MessageModeTextButton.Size = UDim2.new(0, 0, 0, 0)
MessageModeTextButton.TextYAlignment = Enum.TextYAlignment.Center
MessageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor()
MessageModeTextButton.Visible = true
MessageModeTextButton.Parent = TextBoxHolderFrame
local TextLabel = Instance.new("TextLabel")
TextLabel.Selectable = false
TextLabel.TextWrapped = true
TextLabel.BackgroundTransparency = 1
TextLabel.Size = TextBox.Size
TextLabel.Position = TextBox.Position
TextLabel.TextSize = TextBox.TextSize
TextLabel.Font = TextBox.Font
TextLabel.TextColor3 = TextBox.TextColor3
TextLabel.TextTransparency = TextBox.TextTransparency
TextLabel.TextStrokeTransparency = TextBox.TextStrokeTransparency
TextLabel.TextXAlignment = TextBox.TextXAlignment
TextLabel.TextYAlignment = TextBox.TextYAlignment
TextLabel.Text = "..."
TextLabel.Parent = TextBoxHolderFrame
self.GuiObject = BaseFrame
self.TextBox = TextBox
self.TextLabel = TextLabel
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.TextBoxFrame = BoxFrame
self.GuiObjects.TextBox = TextBox
self.GuiObjects.TextLabel = TextLabel
self.GuiObjects.MessageModeTextButton = MessageModeTextButton
self:AnimGuiObjects()
self:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
if self.UserHasChatOff then
self:DoLockChatBar()
end
self.eGuiObjectsChanged:Fire()
end
-- Used to lock the chat bar when the user has chat turned off.
function methods:DoLockChatBar()
if self.TextLabel then
if LocalPlayer.UserId > 0 then
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_ChatMessageValidator_SettingsError",
"To chat in game, turn on chat in your Privacy Settings."
)
else
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_SwallowGuestChat_Message",
"Sign up to chat in game."
)
end
self:CalculateSize()
end
if self.TextBox then
self.TextBox.Active = false
self.TextBox.Focused:connect(function()
self.TextBox:ReleaseFocus()
end)
end
end
function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
-- Clean up events from a previous setup.
for name, conn in pairs(self.TextBoxConnections) do
conn:disconnect()
self.TextBoxConnections[name] = nil
end
--// Code for getting back into general channel from other target channel when pressing backspace.
self.TextBoxConnections.UserInputBegan = UserInputService.InputBegan:connect(function(inputObj, gpe)
if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
if (self:IsFocused() and TextBox.Text == "") then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end)
self.TextBoxConnections.TextBoxChanged = TextBox.Changed:connect(function(prop)
if prop == "AbsoluteSize" then
self:CalculateSize()
return
end
if prop ~= "Text" then
return
end
self:CalculateSize()
if utf8.len(utf8.nfcnormalize(TextBox.Text)) > ChatSettings.MaximumMessageLength then
TextBox.Text = self.PreviousText
else
self.PreviousText = TextBox.Text
end
if not self.InCustomState then
local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
if customState then
self.InCustomState = true
self.CustomState = customState
end
else
self.CustomState:TextUpdated()
end
end)
local function UpdateOnFocusStatusChanged(isFocused)
if isFocused or TextBox.Text ~= "" then
TextLabel.Visible = false
else
TextLabel.Visible = true
end
end
self.TextBoxConnections.MessageModeClick = MessageModeTextButton.MouseButton1Click:connect(function()
if MessageModeTextButton.Text ~= "" then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end)
self.TextBoxConnections.TextBoxFocused = TextBox.Focused:connect(function()
if not self.UserHasChatOff then
self:CalculateSize()
UpdateOnFocusStatusChanged(true)
end
end)
self.TextBoxConnections.TextBoxFocusLost = TextBox.FocusLost:connect(function(enterPressed, inputObject)
self:CalculateSize()
if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
TextBox.Text = ""
end
UpdateOnFocusStatusChanged(false)
end)
end
function methods:GetTextBox()
return self.TextBox
end
function methods:GetMessageModeTextButton()
return self.GuiObjects.MessageModeTextButton
end
-- Deprecated in favour of GetMessageModeTextButton
-- Retained for compatibility reasons.
function methods:GetMessageModeTextLabel()
return self:GetMessageModeTextButton()
end
function methods:IsFocused()
if self.UserHasChatOff then
return false
end
return self:GetTextBox():IsFocused()
end
function methods:GetVisible()
return self.GuiObject.Visible
end
function methods:CaptureFocus()
if not self.UserHasChatOff then
self:GetTextBox():CaptureFocus()
end
end
function methods:ReleaseFocus(didRelease)
self:GetTextBox():ReleaseFocus(didRelease)
end
function methods:ResetText()
self:GetTextBox().Text = ""
end
function methods:SetText(text)
self:GetTextBox().Text = text
end
function methods:GetEnabled()
return self.GuiObject.Visible
end
function methods:SetEnabled(enabled)
if self.UserHasChatOff then
-- The chat bar can not be removed if a user has chat turned off so that
-- the chat bar can display a message explaining that chat is turned off.
self.GuiObject.Visible = true
else
self.GuiObject.Visible = enabled
end
end
function methods:SetTextLabelText(text)
if not self.UserHasChatOff then
self.TextLabel.Text = text
end
end
function methods:SetTextBoxText(text)
self.TextBox.Text = text
end
function methods:GetTextBoxText()
return self.TextBox.Text
end
function methods:ResetSize()
self.TargetYSize = 0
self:TweenToTargetYSize()
end
local function measureSize(textObj)
return TextService:GetTextSize(
textObj.Text,
textObj.TextSize,
textObj.Font,
Vector2.new(textObj.AbsoluteSize.X, 10000)
)
end
function methods:CalculateSize()
if self.CalculatingSizeLock then
return
end
self.CalculatingSizeLock = true
local textSize = nil
local bounds = nil
if self:IsFocused() or self.TextBox.Text ~= "" then
textSize = self.TextBox.TextSize
bounds = measureSize(self.TextBox).Y
else
textSize = self.TextLabel.TextSize
bounds = measureSize(self.TextLabel).Y
end
local newTargetYSize = bounds - textSize
if (self.TargetYSize ~= newTargetYSize) then
self.TargetYSize = newTargetYSize
self:TweenToTargetYSize()
end
self.CalculatingSizeLock = false
end
function methods:TweenToTargetYSize()
local endSize = UDim2.new(1, 0, 1, self.TargetYSize)
local curSize = self.GuiObject.Size
local curAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = endSize
local endAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = curSize
local pixelDistance = math.abs(endAbsoluteSizeY - curAbsoluteSizeY)
local tweeningTime = math.min(1, (pixelDistance * (1 / self.TweenPixelsPerSecond))) -- pixelDistance * (seconds per pixels)
local success = pcall(function() self.GuiObject:TweenSize(endSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweeningTime, true) end)
if (not success) then
self.GuiObject.Size = endSize
end
end
function methods:SetTextSize(textSize)
if not self:IsInCustomState() then
if self.TextBox then
self.TextBox.TextSize = textSize
end
if self.TextLabel then
self.TextLabel.TextSize = textSize
end
end
end
function methods:GetDefaultChannelNameColor()
if ChatSettings.DefaultChannelNameColor then
return ChatSettings.DefaultChannelNameColor
end
return Color3.fromRGB(35, 76, 142)
end
function methods:SetChannelTarget(targetChannel)
local messageModeTextButton = self.GuiObjects.MessageModeTextButton
local textBox = self.TextBox
local textLabel = self.TextLabel
self.TargetChannel = targetChannel
if not self:IsInCustomState() then
if targetChannel ~= ChatSettings.GeneralChannelName then
messageModeTextButton.Size = UDim2.new(0, 1000, 1, 0)
local localizedTargetChannel = targetChannel
if ChatLocalization.tryLocalize then
localizedTargetChannel = ChatLocalization:tryLocalize(targetChannel)
end
messageModeTextButton.Text = string.format("[%s] ", localizedTargetChannel)
local channelNameColor = self:GetChannelNameColor(targetChannel)
if channelNameColor then
messageModeTextButton.TextColor3 = channelNameColor
else
messageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor()
end
local xSize = messageModeTextButton.TextBounds.X
messageModeTextButton.Size = UDim2.new(0, xSize, 1, 0)
textBox.Size = UDim2.new(1, -xSize, 1, 0)
textBox.Position = UDim2.new(0, xSize, 0, 0)
textLabel.Size = UDim2.new(1, -xSize, 1, 0)
textLabel.Position = UDim2.new(0, xSize, 0, 0)
else
messageModeTextButton.Text = ""
messageModeTextButton.Size = UDim2.new(0, 0, 0, 0)
textBox.Size = UDim2.new(1, 0, 1, 0)
textBox.Position = UDim2.new(0, 0, 0, 0)
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Position = UDim2.new(0, 0, 0, 0)
end
end
end
function methods:IsInCustomState()
return self.InCustomState
end
function methods:ResetCustomState()
if self.InCustomState then
self.CustomState:Destroy()
self.CustomState = nil
self.InCustomState = false
self.ChatBarParentFrame:ClearAllChildren()
self:CreateGuiObjects(self.ChatBarParentFrame)
self:SetTextLabelText(
ChatLocalization:Get(
"GameChat_ChatMain_ChatBarText",
'To chat click here or press "/" key'
)
)
end
end
function methods:EnterWhisperState(player)
self:ResetCustomState()
if WhisperModule.CustomStateCreator then
self.CustomState = WhisperModule.CustomStateCreator(
player,
self.ChatWindow,
self,
ChatSettings
)
self.InCustomState = true
else
local playerName
if ChatSettings.PlayerDisplayNamesEnabled then
playerName = player.DisplayName
else
playerName = player.Name
end
self:SetText("/w " .. playerName)
end
self:CaptureFocus()
end
function methods:GetCustomMessage()
if self.InCustomState then
return self.CustomState:GetMessage()
end
return nil
end
function methods:CustomStateProcessCompletedMessage(message)
if self.InCustomState then
return self.CustomState:ProcessCompletedMessage()
end
return false
end
function methods:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeOutText(duration)
end
function methods:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeInText(duration)
end
function methods:FadeOutText(duration)
self.AnimParams.Text_TargetTransparency = 1
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInText(duration)
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:AnimGuiObjects()
self.GuiObject.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextBoxFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextLabel.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.TextBox.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.MessageModeTextButton.TextTransparency = self.AnimParams.Text_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_CurrentTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = 1
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = 1
end
function methods:Update(dtScale)
self.AnimParams.Text_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Text_CurrentTransparency,
self.AnimParams.Text_TargetTransparency,
self.AnimParams.Text_NormalizedExptValue,
dtScale
)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
function methods:SetChannelNameColor(channelName, channelNameColor)
self.ChannelNameColors[channelName] = channelNameColor
if self.GuiObjects.MessageModeTextButton.Text == channelName then
self.GuiObjects.MessageModeTextButton.TextColor3 = channelNameColor
end
end
function methods:GetChannelNameColor(channelName)
return self.ChannelNameColors[channelName]
end
--///////////////////////// Constructors
--//////////////////////////////////////
function module.new(CommandProcessor, ChatWindow)
local obj = setmetatable({}, methods)
obj.GuiObject = nil
obj.ChatBarParentFrame = nil
obj.TextBox = nil
obj.TextLabel = nil
obj.GuiObjects = {}
obj.eGuiObjectsChanged = Instance.new("BindableEvent")
obj.GuiObjectsChanged = obj.eGuiObjectsChanged.Event
obj.TextBoxConnections = {}
obj.PreviousText = ""
obj.InCustomState = false
obj.CustomState = nil
obj.TargetChannel = nil
obj.CommandProcessor = CommandProcessor
obj.ChatWindow = ChatWindow
obj.TweenPixelsPerSecond = 500
obj.TargetYSize = 0
obj.AnimParams = {}
obj.CalculatingSizeLock = false
obj.ChannelNameColors = {}
obj.UserHasChatOff = false
obj:InitializeAnimParams()
ChatSettings.SettingsChanged:connect(function(setting, value)
if (setting == "ChatBarTextSize") then
obj:SetTextSize(value)
end
end)
coroutine.wrap(function()
local success, canLocalUserChat = pcall(function()
return Chat:CanUserChatAsync(LocalPlayer.UserId)
end)
local canChat = success and (RunService:IsStudio() or canLocalUserChat)
if canChat == false then
obj.UserHasChatOff = true
obj:DoLockChatBar()
end
end)()
return obj
end
return module
| 29.334426
| 141
| 0.783838
|
a3481e5e470efa84af8e35752c39c3422400991e
| 4,341
|
java
|
Java
|
java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
|
kyowill/derby-10.0.2.1
|
b30dddf5248b603291bdf509ba6b10efe6999609
|
[
"Apache-2.0"
] | null | null | null |
java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
|
kyowill/derby-10.0.2.1
|
b30dddf5248b603291bdf509ba6b10efe6999609
|
[
"Apache-2.0"
] | null | null | null |
java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
|
kyowill/derby-10.0.2.1
|
b30dddf5248b603291bdf509ba6b10efe6999609
|
[
"Apache-2.0"
] | null | null | null |
/*
Derby - Class org.apache.derby.impl.sql.compile.BaseColumnNode
Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable.
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.apache.derby.impl.sql.compile;
import org.apache.derby.iapi.sql.dictionary.DataDictionary;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.types.DataTypeDescriptor;
import org.apache.derby.iapi.sql.Row;
import org.apache.derby.iapi.store.access.Qualifier;
import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
import org.apache.derby.iapi.services.compiler.MethodBuilder;
import org.apache.derby.iapi.services.sanity.SanityManager;
/**
* A BaseColumnNode represents a column in a base table. The parser generates a
* BaseColumnNode for each column reference. A column refercence could be a column in
* a base table, a column in a view (which could expand into a complex
* expression), or a column in a subquery in the FROM clause. By the time
* we get to code generation, all BaseColumnNodes should stand only for columns
* in base tables.
*
* @author Jeff Lichtman
*/
public class BaseColumnNode extends ValueNode
{
public String columnName;
/*
** This is the user-specified table name. It will be null if the
** user specifies a column without a table name.
*/
public TableName tableName;
/**
* Initializer for when you only have the column name.
*
* @param columnName The name of the column being referenced
* @param tableName The qualification for the column
* @param dts DataTypeServices for the column
*/
public void init(
Object columnName,
Object tableName,
Object dts)
{
this.columnName = (String) columnName;
this.tableName = (TableName) tableName;
setType((DataTypeDescriptor) dts);
}
/**
* Convert this object to a String. See comments in QueryTreeNode.java
* for how this should be done for tree printing.
*
* @return This object as a String
*/
public String toString()
{
if (SanityManager.DEBUG)
{
return "columnName: " + columnName + "\n" +
( ( tableName != null) ?
tableName.toString() :
"tableName: null\n") +
super.toString();
}
else
{
return "";
}
}
/**
* Get the name of this column
*
* @return The name of this column
*/
public String getColumnName()
{
return columnName;
}
/**
* Get the user-supplied table name of this column. This will be null
* if the user did not supply a name (for example, select a from t).
*
* @return The user-supplied name of this column. Null if no user-
* supplied name.
*/
public String getTableName()
{
return ( ( tableName != null) ? tableName.getTableName() : null );
}
/**
* Do the code generation for this node. Should never be called.
*
* @param acb The ExpressionClassBuilder for the class being built
* @param mb The method the code to place the code
*
*
* @exception StandardException Thrown on error
*/
public void generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
throws StandardException
{
throw StandardException.newException(SQLState.LANG_UNABLE_TO_GENERATE,
this.nodeHeader());
}
/**
* Return the variant type for the underlying expression.
* The variant type can be:
* VARIANT - variant within a scan
* (method calls and non-static field access)
* SCAN_INVARIANT - invariant within a scan
* (column references from outer tables)
* QUERY_INVARIANT - invariant within the life of a query
* (constant expressions)
*
* @return The variant type for the underlying expression.
*/
protected int getOrderableVariantType()
{
return Qualifier.SCAN_INVARIANT;
}
}
| 27.301887
| 87
| 0.711587
|
b2f0d88b4147086cb28bbc1ffe616c1cf2f1ddec
| 118
|
css
|
CSS
|
dist/web/css/src/card.min.css
|
appwebd/yii2-01-base-bootstrap
|
d85d36c2c0d298d3ccf09e8302602115c07ecf70
|
[
"BSD-3-Clause"
] | null | null | null |
dist/web/css/src/card.min.css
|
appwebd/yii2-01-base-bootstrap
|
d85d36c2c0d298d3ccf09e8302602115c07ecf70
|
[
"BSD-3-Clause"
] | null | null | null |
dist/web/css/src/card.min.css
|
appwebd/yii2-01-base-bootstrap
|
d85d36c2c0d298d3ccf09e8302602115c07ecf70
|
[
"BSD-3-Clause"
] | null | null | null |
.card-header-title{font-weight:bold}.card-header-background-login{background:var(--status-bar-background);color:white}
| 118
| 118
| 0.813559
|
cc72a349e1978388a55f79deabef4349fd20deaa
| 618
|
rb
|
Ruby
|
recipes/yum_group_development_tools.rb
|
JamesJJ/chef_box_basic
|
9bb1104f414dbd2c26105426a21d55d4a38a67bf
|
[
"MIT"
] | null | null | null |
recipes/yum_group_development_tools.rb
|
JamesJJ/chef_box_basic
|
9bb1104f414dbd2c26105426a21d55d4a38a67bf
|
[
"MIT"
] | null | null | null |
recipes/yum_group_development_tools.rb
|
JamesJJ/chef_box_basic
|
9bb1104f414dbd2c26105426a21d55d4a38a67bf
|
[
"MIT"
] | null | null | null |
#
# Recipe:: yum_group_development_tools
#
_once_only_file = '/tmp/chef_box_basic_yum_group_install_development_tools'
bash "yum install 'Development tools' group" do
user "root"
cwd "/"
umask "033"
environment "PATH" => "/bin:/usr/bin:/sbin:/usr/sbin"
creates _once_only_file
code <<-EOH
touch '#{_once_only_file}'
yum -y groupinstall 'Development tools' > #{_once_only_file}_groupinstall
if [ $? -ne 0 ]
then
yum -y groups mark convert > #{_once_only_file}_groups_mark_convert
yum -y groups install 'Development tools' > #{_once_only_file}_groups_install
fi
EOH
end
| 25.75
| 83
| 0.70712
|
382b1668b5c985d7aa8f539bc1ff150ed8100c1c
| 216
|
ps1
|
PowerShell
|
src/AlbyOnContainers.Services.Catalog/Scripts/secrets.ps1
|
alby-corp/alby-on-containers
|
8c36480228e01b980a59e19a138a96fb7733ee28
|
[
"Apache-2.0"
] | 1
|
2021-06-21T18:23:58.000Z
|
2021-06-21T18:23:58.000Z
|
src/AlbyOnContainers.Services.Catalog/Scripts/secrets.ps1
|
alby-corp/alby-on-containers
|
8c36480228e01b980a59e19a138a96fb7733ee28
|
[
"Apache-2.0"
] | 1
|
2021-01-31T09:22:37.000Z
|
2021-01-31T09:22:37.000Z
|
src/AlbyOnContainers.Services.Catalog/Scripts/secrets.ps1
|
alby-corp/alby-on-containers
|
8c36480228e01b980a59e19a138a96fb7733ee28
|
[
"Apache-2.0"
] | 1
|
2021-06-21T18:24:01.000Z
|
2021-06-21T18:24:01.000Z
|
dotnet user-secrets set "ConnectionStrings:DefaultDatabase" "Host=postgres;Database=sherlock-development;Username=postgres;Password=postgres;Port=5432"
dotnet user-secrets remove "ConnectionStrings:DefaultDatabase"
| 72
| 152
| 0.861111
|
094b234ec3bd9c7b5ba0a3196571b764987f701a
| 163
|
sql
|
SQL
|
sql/_17_sql_extension2/_01_acceptance_test/cases/stddev_samp.sql
|
Zhaojia2019/cubrid-testcases
|
475a828e4d7cf74aaf2611fcf791a6028ddd107d
|
[
"BSD-3-Clause"
] | 9
|
2016-03-24T09:51:52.000Z
|
2022-03-23T10:49:47.000Z
|
sql/_17_sql_extension2/_01_acceptance_test/cases/stddev_samp.sql
|
Zhaojia2019/cubrid-testcases
|
475a828e4d7cf74aaf2611fcf791a6028ddd107d
|
[
"BSD-3-Clause"
] | 173
|
2016-04-13T01:16:54.000Z
|
2022-03-16T07:50:58.000Z
|
sql/_17_sql_extension2/_01_acceptance_test/cases/stddev_samp.sql
|
Zhaojia2019/cubrid-testcases
|
475a828e4d7cf74aaf2611fcf791a6028ddd107d
|
[
"BSD-3-Clause"
] | 38
|
2016-03-24T17:10:31.000Z
|
2021-10-30T22:55:45.000Z
|
--STDDEV_SAMP FUNCTION
CREATE TABLE voo(a int);
INSERT INTO voo VALUES (1), (2), (3);
SELECT STDDEV_SAMP(a) FROM voo;
DROP TABLE voo;
SELECT STDDEV_SAMP(NULL);
| 16.3
| 37
| 0.717791
|
cf1dcc38f1d4c0bcf794ad9f0b7fb2cbf3f83c10
| 453
|
php
|
PHP
|
resources/views/brand/brand.blade.php
|
xiaohai456/xiaohai
|
05778068962b55c2678cf048c160a7b0b22e3919
|
[
"MIT"
] | null | null | null |
resources/views/brand/brand.blade.php
|
xiaohai456/xiaohai
|
05778068962b55c2678cf048c160a7b0b22e3919
|
[
"MIT"
] | null | null | null |
resources/views/brand/brand.blade.php
|
xiaohai456/xiaohai
|
05778068962b55c2678cf048c160a7b0b22e3919
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="{{url('/brand/store')}}" method="post" enctype="multipart/form-data">
@csrf
品牌名称<input type="text" name="name"><br>
品牌网址<input type="text" name="zhi"><br>
描述<textarea name="shu" id="" cols="30" rows="10"></textarea><br>
品牌logo <input type="file" name="logo"><br>
<input type="submit" value="添加">
</form>
</body>
</html>
| 26.647059
| 84
| 0.626932
|
331f525a868558baff83d19f8cd87d1ed97898d9
| 219
|
go
|
Go
|
genuuid.go
|
krishnasrinivas/random-progs
|
29b8334c42653dd27722375a7686302266a0b088
|
[
"Apache-2.0"
] | null | null | null |
genuuid.go
|
krishnasrinivas/random-progs
|
29b8334c42653dd27722375a7686302266a0b088
|
[
"Apache-2.0"
] | null | null | null |
genuuid.go
|
krishnasrinivas/random-progs
|
29b8334c42653dd27722375a7686302266a0b088
|
[
"Apache-2.0"
] | null | null | null |
package main
import (
"fmt"
"github.com/satori/go.uuid"
)
func main() {
fmt.Printf("filenames := {")
for i := 0; i < 100000; i++ {
uuid := uuid.NewV4().String()
fmt.Printf("%s, ", uuid)
}
fmt.Printf("}")
}
| 12.882353
| 31
| 0.557078
|
653b6fdc33ce0f5baf0ec2609e79eb28217f1bb3
| 13,421
|
css
|
CSS
|
public/css/winning/infowindow.css
|
AndySR/wirent
|
7a499f0e0388c18d88b60d12ee719a8d4c5d9fcd
|
[
"MIT"
] | null | null | null |
public/css/winning/infowindow.css
|
AndySR/wirent
|
7a499f0e0388c18d88b60d12ee719a8d4c5d9fcd
|
[
"MIT"
] | null | null | null |
public/css/winning/infowindow.css
|
AndySR/wirent
|
7a499f0e0388c18d88b60d12ee719a8d4c5d9fcd
|
[
"MIT"
] | null | null | null |
.map-page {
/*position: relative;*/
}
.map-page .infowindow-container {
/*border: 2px solid #ccc;*/
background-color: white;
/*border-radius: 5px;*/
padding: 5px;
margin: 5px 0
}
.map-page .infowindow-container::after {
content: "";
clear: both;
display: table;
}
.map-page .infowindow-container img {
cursor: pointer;
margin-right: 20px;
border-radius: 0;
margin-top: 0;
}
.map-page img {
cursor: pointer!important;
}
/*.infowindow-container span {
font-size: 10px;
margin-right: 5px;
}*/
@media (max-width: 500px) {
.infowindow-container {
text-align: center;
}
.infowindow-container img {
margin: auto;
float: none;
display: block;
}
}
.map-page .info-left {
float: left;
}
.map-page .info-right {
float: right;
}
.map-page .info-right .price {
font: 400 20px/28px "microsoft sans serif" "microsoft yahei";
color: red;
font-size: 20px;
height: 28px;
}
.map-page .info-right span {
font-size: 14px;
margin-left: 5px;
}
.map-page .info-right .address {
font: 200 12px/20px "microsoft sans serif" "microsoft yahei";
color: grey;
margin-top: 15px;
}
.map-page .info-right .address a:hover {
color: #C81623;
}
.map-page .info-right em {
font-weight: 800;
font: 400 12px/20px "microsoft sans serif" "microsoft yahei";
color: dimgrey;
}
.map-page .info-right .listing-features .details:hover {
color: #C81623;
cursor: pointer;
}
/*ads window*/
.map-page .adv {
position: absolute;
top: 0;
right: 0;
width: 530px;
height: 100%;
margin: 0;
overflow-y: scroll;
border-left: solid #d8dade 1px;
}
.map-page .adv ul li {
position: relative;
margin-bottom: 10px;
float:right;
list-style: none;
/*clear: both;*/
margin:0 auto;
margin-right: 5px;
}
.map-page .adv li:before {
content: "";
clear: both;
zoom: 1;
}
.map-page .adv #box {
width: 490px;
height: 305px;
/*padding: 5px;*/
position: relative;
border: 1px solid #ccc;
border-bottom: 1px solid white;
margin: 0 auto ;
overflow: hidden;
}
.map-page .adv .description {
background-color: white;
}
.map-page .adv .ad {
width: 490px;
height: 305px;
overflow: hidden;
position: relative;
}
.map-page .adv .ad .carousel {
position: relative;
}
.map-page .adv .ad ul li {
list-style: none;
padding: 0;
margin:0;
}
.map-page .adv .ad ol.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -50%;
text-align: center;
list-style: none;
}
.map-page .adv .ad ol li {
width: 16px;
height: 16px;
line-height: 16px;
border: 1px solid #fff;
text-align: center;
background: rgba(0,0,0,.3);
/*float: left;
margin-right: 10px;*/
cursor: pointer;
_display: inline;
}
.map-page .adv .ad ol.carousel-indicators .active {
width: 18px;
height: 18px;
line-height: 18px;
border: 1px solid #ccc;
text-align: center;
background: #fff;
}
.map-page .adv .ad ol li.current {
background: yellow;
}
.map-page .adv .ad ul li {
list-style: none;
margin-left: -60px;
float: left;
}
.map-page .adv .ad ul {
position: absolute;
top: -100px;
}
.map-page .adv .ad ul li.current {
display: block;
}
.map-page .adv #arr {
display: none;
}
.map-page .adv #arr span {
width: 40px;
height: 40px;
position: absolute;
left: 5px;
top: 50%;
margin-top: -20px;
background: #000;
cursor: pointer;
line-height: 40px;
text-align: center;
font-weight: bold;
font-family: '黑体';
font-size: 30px;
color: #fff;
opacity: 0.3;
border: 1px solid #fff;
z-index: 1000;
}
.map-page .adv #arr #right {
right: 5px;
left: auto;
}
/****************lunbo starts********************************/
.map-page .lunbo {
display: block;
}
.map-page .lunbo {
position: relative;
/*margin: 0 auto;*/
width: 490px;
height: 305px;
left: 15px;
top: 10px;
overflow: hidden;
}
.map-page .lunbo ul {
position: absolute;
width: 490px;
height: 305px;
}
.map-page .lunbo ul li {
list-style-type: none;
position: absolute;
width: 490px;
height: 305px;
}
.map-page .lunbo ul li a img {
display: inline-block;
width: 490px;
height: 305px;
}
.map-page .lunbo ul.listContent {
position: absolute;
left: 500px;
top: 300px;
width: 220px;
height: 25px;
}
.map-page .lunbo ul.listContent li.list {
position: relative;
display: block;
width: 25px;
height: 25px;
float: left;
margin: 0 5px;
border: 1px solid blue;
text-align: center;
line-height: 25px;
cursor: pointer;
}
.map-page .active {
background: #161616;
color: #ffffff;
}
.map-page .hander-left,
.map-page .hander-right {
text-align: center;
position:absolute;
top: 50%;
margin-top: -26px;
width: 40px;
height: 80px;
background-color: gray;
opacity: 0.8;
font: 800;
}
.map-page .hander-left{
left: 40px;
}
.map-page .hander-right {
right: 0;
}
.map-page .hander-left a,
.map-page .hander-right a {
padding-top: 30px;
display: block;
width: 100%;
height: 100%;
}
/***************************************************/
/*.map-page .adv .ad:hover {
box-sizing: content-box;
border: 1px solid white;
}*/
/*.map-page .adv #box img {
width: 490px;
margin-left: -40px;
}*/
.map-page .map_feature_filter {
position: absolute;
top: 15px;
left: 990px;
z-index: 100;
}
.map-page .map_feature_filter > li {
list-style: none;
text-decoration: none;
}
.map-page .map_feature_filter li > ul {
margin-top: 15px;
}
.map-page .map_feature_filter > li > a {
color: #07111b;
}
.map-page .map_feature_filter > li > a:hover {
color: purple;
/*border-bottom: 3px solid rgb(150, 65, 137);*/
}
.map-page .adv .description {
width: 490px;
height: 230px;
position: relative;
border: 1px solid #ccc;
border-top: 1px solid white;
margin: 0 auto;
}
.map-page .adv .content .list-wrap li .info-panel {
float: right;
height: 230px;
margin: 15px;
/*width: 490px;*/
/*background-color: purple;*/
padding-top: 2px;
position: relative;
}
.map-page .adv .info-panel .rooms {
/*width: 109px;*/
padding-left: 10px;
height: 34px;
float: left;
margin: 6px 65px 0 10px;
border: 1px solid #DFDFDF;
line-height: 34px;
position: relative;
top: 30px;
left: 10px;
}
.map-page .adv .info-panel .rooms .room-num {
position: absolute;
font: 400 15px/15px "微软雅黑";
top: 10px;
left: 40px;
color: darkgrey;
}
.map-page .adv .info-panel .rooms .bath-num {
position: absolute;
font: 400 15px/15px "微软雅黑";
top: 10px;
left: 85px;
color: darkgrey;
}
.map-page .adv .info-panel .rooms .park-num {
position: absolute;
font: 400 15px/15px "microsoft yahei";
top: 10px;
left: 125px;
color: darkgrey;
}
.map-page .adv .info-panel .address {
position: absolute;
/*width: 209px;*/
top: 80px;
float: left;
left: 20px;
margin: 25px 65px 0 0;
}
.map-page .adv .info-panel .address a:hover {
line-height: 34px;
font: 100 15px/15px "microsoft yahei";
color: #C81623;
/*text-decoration: underline;*/
}
.map-page .adv .info-panel .address a {
line-height: 34px;
font: 100 15px/15px "microsoft yahei";
color: darkgrey;
}
.map-page .adv .info-panel .benefits {
/*width: 509px;
padding-left: 43px;
height: 34px;*/
/*float: left;*/
/*margin: 25px 65px 0 10px;*/
/*border: 1px solid #DFDFDF;*/
/*line-height: 34px;
position: relative;
top: 150px;*/
width: 190px;
padding-left: 0px;
height: 99px;
float: left;
margin: 25px 65px 0 11px;
/* border: 1px solid #DFDFDF; */
line-height: 34px;
position: relative;
top: 60px;
left: 0px;
}
.map-page .adv .info-panel .benefits a:hover {
cursor: default;
}
.map-page .adv .info-panel .benefits .train {
position: absolute;
font: 200 13px/15px "微软雅黑";
top: -45px;
left: -20px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .university {
position: absolute;
font: 200 13px/15px "微软雅黑";
top: -45px;
left: 40px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .backpack {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -45px;
left: 100px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .park {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -45px;
left: 160px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .school {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -5px;
left: -20px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .bigfamily {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -5px;
left: 40px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .shoppingmall {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -5px;
left: 100px;
color: lightslategray;
}
.map-page .adv .info-panel .benefits .offical_rental {
position: absolute;
font: 200 13px/15px "microsoft yahei";
top: -5px;
left: 160px;
color: lightslategray;
}
.map-page .adv .info-panel .price {
width: 100px;
padding-left: 43px;
height: 134px;
/*float: left;*/
margin: -15px 65px 0 20px;
/*border: 1px solid #DFDFDF;*/
position: absolute;
top: 20px;
left: 210px;
/*background: purple;*/
}
.map-page .adv .info-panel .price .num{
display: block;
position: absolute;
font: 400 40px/40px "microsoft yahei";
width: 150px;
/*line-height: 50px;*/
height: 80;
left: 40px;
top: 20px;
color: #C81623;
}
.map-page .adv .info-panel .price .period {
display: block;
position: absolute;
font: 200 13px/15px "microsoft yahei";
/*margin-top: 4px;*/
width: 150px;
/*line-height: 50px;*/
height: 20;
left: 160px;
top: 45px;
color: lightslategray;
}
.map-page .adv .info-panel .price .available {
display: block;
position: absolute;
font: 100 12px/15px "microsoft yahei";
/*margin-top: 4px;*/
width: 180px;
/*line-height: 50px;*/
height: 20;
left: 70px;
top: 100px;
color: #191D3A;
}
.map-page .adv .info-panel .room-type {
width: 100px;
height: 50px;
margin: 25px 65px 0 0;
position: absolute;
top: 100px;
left: 300px;
}
.map-page .adv .info-panel .room-type .room-size {
display: block;
font: 400 16px/20px "microsoft yahei";
width: 100px;
height: 50;
/*left: 460px;*/
margin-top: 10px;
color: #C81623;;
}
.map-page .adv .info-panel .view {
width: 100px;
height: 50px;
margin: 25px 65px 0 0;
position: absolute;
top: 160px;
left: 380px;
}
.map-page .adv .info-panel .view .view-num {
display: block;
font: 400 16px/20px "microsoft yahei";
width: 100px;
height: 50;
/*left: 460px;*/
margin-top: 10px;
color: darkgrey;
}
.map-page .adv .info-panel .view .view-num:hover {
color: #C81623;
cursor: pointer;
}
.map-page .adv .icon {
margin-left: 12px;
height: 60px;
line-height: 60px;
}
.map-page .adv .f-icon.with-text .icon {
float: left;
}
.map-page .adv .f-icon.with-text {
width: auto;
}
.map-page .adv .f-icon .icon {
display: inline-block;
font-size: 20px;
line-height: 40px;
width: 25px;
height: 40px;
}
.map-page .adv .f-icon {
display: inline-block;
width: 40px;
height: 40px;
}
.map-page .adv a.f-icon.with-text .copy {
line-height: 60px;
margin-left: 8px;
}
.map-page .adv .f-icon.with-text .copy {
float: left;
display: inline-block;
padding-right: 0;
line-height: 40px;
}
.map-page .adv .benefits .f-icon .icon {
margin-top: 10px;
}
/*more options*/
.map-page .more-options label {
color: rgb(151, 157, 167);
/*margin-right: 6px;*/
margin-top: 3px;
}
.map-page .navbar-nav.more-options > li > .dropdown-menu {
margin-top: -2px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.map-page .more-options .form-control {
display: block;
width: 65%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.map-page .more-options .row .right-li ul li {
/*float: left;*/
margin-bottom: 2px;
}
.map-page .more-options .row .left-li ul li input, .more-options .row .left-li ul li select{
float: right;
}
.map-page .relative-position {
position: relative;
top: 100px;
bottom: 0;
}
.map-page .more-options .dropdown > a:focus {
background-color: #752077;
border-color: #428bca;
}
.map-page .more-options .dropdown > a:hover {
background-color: #752077;
border-color: #428bca;
}
.map-page .shortlist-star a{
position: absolute;
display: block;
right: 70px;
top: 10px;
width: 20px;
height: 70px;
/*background: black;*/
z-index: 10;
}
.map-page .shortlist-star a:hover {
color: #C81623;
}
.map-page .list-map a {
margin-right: 20px;
color: lightgray;
}
.map-page .list-map a:hover{
/* margin-right: 20px; */
color: purple;
border-bottom: 3px solid rgb(150, 65, 137);
}
.map-page .calender p{
/*position: relative;*/
display: inline-block!important;
}
.map-page .calender p input.form-control {
width:47%;
border-radius: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.map-page .descriptions li{
display: inline-block;
text-align: center;
width: 24%;
}
.map-page .descriptions li a {
display:block;
}
| 19.310791
| 93
| 0.649355
|
065b99222a64d845fa377a415976049c1c412892
| 1,051
|
swift
|
Swift
|
IOS10CollisionDetectionTutorial/LineView.swift
|
sachanand/ioscreator
|
bbe83ccdcd0bc97916e99d80e7cd510689262d25
|
[
"MIT"
] | null | null | null |
IOS10CollisionDetectionTutorial/LineView.swift
|
sachanand/ioscreator
|
bbe83ccdcd0bc97916e99d80e7cd510689262d25
|
[
"MIT"
] | null | null | null |
IOS10CollisionDetectionTutorial/LineView.swift
|
sachanand/ioscreator
|
bbe83ccdcd0bc97916e99d80e7cd510689262d25
|
[
"MIT"
] | null | null | null |
//
// LineView.swift
// IOS10CollisionDetectionTutorial
//
// Created by Arthur Knopper on 18/04/2017.
// Copyright © 2017 Arthur Knopper. All rights reserved.
//
import UIKit
class LineView: UIView {
override func draw(_ rect: CGRect) {
drawLineFromPoint(fromX: 0, toPoint: bounds.size.width/3, pointY: bounds.size.height - 100.0)
drawLineFromPoint(fromX: bounds.size.width/3, toPoint:bounds.size.width*0.67, pointY:bounds.size.height - 150.0)
drawLineFromPoint(fromX: bounds.size.width*0.67, toPoint:bounds.size.width, pointY:bounds.size.height - 100.0)
}
func drawLineFromPoint(fromX: CGFloat, toPoint toX: CGFloat, pointY y: CGFloat) {
let currentContext = UIGraphicsGetCurrentContext()
if let currentContext = currentContext {
currentContext.setLineWidth(5.0)
currentContext.move(to: CGPoint(x: fromX, y: y))
currentContext.addLine(to: CGPoint(x: toX, y: y))
currentContext.strokePath()
}
}
}
| 30.911765
| 120
| 0.655566
|
43f7f91b56deffb8a6c8aab7804fc84c8b6af860
| 2,198
|
ps1
|
PowerShell
|
PowerShell/Working/o365/ConnectToMultipleMSOnlineServices.ps1
|
borkit/scriptdump
|
86c622e7a5ce48c75efa9eceeac58b8c69e24973
|
[
"MIT"
] | 4
|
2019-02-01T22:50:24.000Z
|
2020-10-22T15:50:04.000Z
|
PowerShell/Working/o365/ConnectToMultipleMSOnlineServices.ps1
|
borkit/scriptdump
|
86c622e7a5ce48c75efa9eceeac58b8c69e24973
|
[
"MIT"
] | null | null | null |
PowerShell/Working/o365/ConnectToMultipleMSOnlineServices.ps1
|
borkit/scriptdump
|
86c622e7a5ce48c75efa9eceeac58b8c69e24973
|
[
"MIT"
] | 2
|
2019-01-27T09:30:56.000Z
|
2020-10-22T15:50:28.000Z
|
## MSOnline: PowerShell Script that Connects to the PowerShell Modules for Core Office 365 (o365) Services ##
<#
Overview: PowerShell Script that connects to the following o365 MSOnline Services
- Azure Active Directory Module for Windows PowerShell (MSOnline)
- Skype for Business Online Windows PowerShell Module (LyncOnlineConnector)
- SharePoint Online Management Shell (Microsoft.Online.Sharepoint.PowerShell)
- Exchange Online (https://outlook.office365.com/powershell-liveid)
Usage: For SharePoint Online replace the 'contoso' placeholder value under 'Connect-SPOService' with your own tenant prefix, and provide your o365 administrative credentials when run
Resources: http://powershell.office.com/script-samples/getting-connected-to-office-365; https://technet.microsoft.com/en-us/library/dn568015.aspx
#>
#Capture administrative credential for future connections.
$credential = get-credential
#Imports the installed Azure Active Directory module.
Import-Module MSOnline
#Establishes Online Services connection to Office 365 Management Layer.
Connect-MsolService -Credential $credential
#Imports the installed Skype for Business Online services module.
Import-Module LyncOnlineConnector
#Create a Skype for Business Powershell session using defined credential.
$lyncSession = New-CsOnlineSession -Credential $credential
#Imports Skype for Business session commands into your local Windows PowerShell session.
Import-PSSession $lyncSession
#Imports SharePoint Online session commands into your local Windows PowerShell session.
Import-Module Microsoft.Online.Sharepoint.PowerShell
#This connects you to your SharePoint Online services. Substitute the ‘contoso’ portion of the URL with the name of your SharePoint Online tenant.
Connect-SPOService -url https://contoso-admin.sharepoint.com -Credential $credential
#Creates an Exchange Online session using defined credential.
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
#This imports the Office 365 session into your active Shell.
Import-PSSession $ExchangeSession
| 46.765957
| 202
| 0.824386
|
4bbb5ca8cd5733b47006b73aed9e2568dc58effe
| 3,285
|
h
|
C
|
uwsim_resources/uwsim_osgocean/include/OceanExample/Scene.h
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | 1
|
2020-11-30T09:55:33.000Z
|
2020-11-30T09:55:33.000Z
|
uwsim_resources/uwsim_osgocean/include/OceanExample/Scene.h
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | null | null | null |
uwsim_resources/uwsim_osgocean/include/OceanExample/Scene.h
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | 2
|
2020-11-21T19:50:54.000Z
|
2020-12-27T09:35:29.000Z
|
#pragma once
#include <osg/Switch>
#include <osg/TextureCubeMap>
#include <osgText/Text>
#include <osgOcean/OceanScene>
#include <osgOcean/FFTOceanSurface>
#include <osgOcean/FFTOceanSurfaceVBO>
#include "SkyDome.h"
enum DrawMask
{
CAST_SHADOW = (0x1<<30),
RECEIVE_SHADOW = (0x1<<29),
};
class Scene : public osg::Referenced
{
public:
enum SCENE_TYPE{ CLEAR, DUSK, CLOUDY };
private:
SCENE_TYPE _sceneType;
bool _useVBO;
osg::ref_ptr<osgText::Text> _modeText;
osg::ref_ptr<osg::Group> _scene;
osg::ref_ptr<osgOcean::OceanScene> _oceanScene;
osg::ref_ptr<osgOcean::FFTOceanTechnique> _FFToceanSurface;
osg::ref_ptr<osg::TextureCubeMap> _cubemap;
osg::ref_ptr<SkyDome> _skyDome;
std::vector<std::string> _cubemapDirs;
std::vector<osg::Vec4f> _lightColors;
std::vector<osg::Vec4f> _fogColors;
std::vector<osg::Vec3f> _underwaterAttenuations;
std::vector<osg::Vec4f> _underwaterDiffuse;
osg::ref_ptr<osg::Light> _light;
std::vector<osg::Vec3f> _sunPositions;
std::vector<osg::Vec4f> _sunDiffuse;
std::vector<osg::Vec4f> _waterFogColors;
osg::ref_ptr<osg::Switch> _islandSwitch;
public:
Scene(
const osg::Vec2f& windDirection = osg::Vec2f(1.0f,1.0f),
float windSpeed = 12.f,
float depth = 10000.f,
float reflectionDamping = 0.35f,
float scale = 1e-8,
bool isChoppy = true,
float choppyFactor = -2.5f,
float crestFoamHeight = 2.2f,
bool useVBO=false,
const std::string& terrain_shader_basename = "terrain" );
void build(
const osg::Vec2f& windDirection,
float windSpeed,
float depth,
float reflectionDamping,
float waveScale,
bool isChoppy,
float choppyFactor,
float crestFoamHeight,
bool useVBO,
const std::string& terrain_shader_basename );
void changeScene( SCENE_TYPE type );
// Load the islands model
// Here we attach a custom shader to the model.
// This shader overrides the default shader applied by OceanScene but uses uniforms applied by OceanScene.
// The custom shader is needed to add multi-texturing and bump mapping to the terrain.
osg::Node* loadIslands(const std::string& terrain_shader_basename);
osg::ref_ptr<osg::TextureCubeMap> loadCubeMapTextures( const std::string& dir );
osg::Geode* sunDebug( const osg::Vec3f& position );
inline osg::Vec4f intColor(unsigned r, unsigned g, unsigned b, unsigned a = 255 )
{
float div = 1.f/255.f;
return osg::Vec4f( div*(float)r, div*(float)g, div*float(b), div*(float)a );
}
inline osgOcean::OceanScene::EventHandler* getOceanSceneEventHandler()
{
return _oceanScene->getEventHandler();
}
inline osgOcean::OceanTechnique* getOceanSurface( void )
{
return _FFToceanSurface.get();
}
inline osg::Group* getScene(void){
return _scene.get();
}
inline osgOcean::OceanScene* getOceanScene()
{
return _oceanScene.get();
}
osg::Light* getLight() { return _light.get(); }
};
| 28.565217
| 111
| 0.631963
|
7e619539929b254a7ca5ce138a8b7883023e2877
| 1,065
|
kt
|
Kotlin
|
covpass-sdk/src/main/java/de/rki/covpass/sdk/cert/models/Recovery.kt
|
G00fY2/covpass-android
|
41f79b787d87c14f628da8a6eb863afc00a0e1e5
|
[
"Apache-2.0"
] | 175
|
2021-06-16T07:57:22.000Z
|
2022-03-17T19:35:33.000Z
|
covpass-sdk/src/main/java/de/rki/covpass/sdk/cert/models/Recovery.kt
|
G00fY2/covpass-android
|
41f79b787d87c14f628da8a6eb863afc00a0e1e5
|
[
"Apache-2.0"
] | 164
|
2021-06-16T12:15:53.000Z
|
2022-03-31T13:24:15.000Z
|
covpass-sdk/src/main/java/de/rki/covpass/sdk/cert/models/Recovery.kt
|
G00fY2/covpass-android
|
41f79b787d87c14f628da8a6eb863afc00a0e1e5
|
[
"Apache-2.0"
] | 105
|
2021-06-17T19:10:54.000Z
|
2022-03-26T10:48:27.000Z
|
/*
* (C) Copyright IBM Deutschland GmbH 2021
* (C) Copyright IBM Corp. 2021
*/
package de.rki.covpass.sdk.cert.models
import kotlinx.serialization.Contextual
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import java.time.LocalDate
/**
* Enum to mark the type of a [Recovery].
*/
public enum class RecoveryCertType : DGCEntryType {
RECOVERY,
}
/**
* Data model for the recoveries inside a Digital Green Certificate.
*/
@Serializable
public data class Recovery(
@SerialName("tg")
val targetDisease: String = "",
@Contextual
@SerialName("fr")
val firstResult: LocalDate? = null,
@Contextual
@SerialName("df")
val validFrom: LocalDate? = null,
@Contextual
@SerialName("du")
val validUntil: LocalDate? = null,
@SerialName("co")
val country: String = "",
@SerialName("is")
val certificateIssuer: String = "",
@SerialName("ci")
override val id: String = ""
) : DGCEntry {
override val type: DGCEntryType
get() = RecoveryCertType.RECOVERY
}
| 22.659574
| 68
| 0.679812
|
17eea714d5de489d7e6558cb0c25ade9f13a361c
| 808
|
rb
|
Ruby
|
lib/whatweb/plugins/adsubtract.rb
|
ninoseki/SimpleWhatWeb
|
8ba51cfec0179333ca0742fdbd10ade9b9c67425
|
[
"MIT"
] | 6
|
2018-08-18T23:15:53.000Z
|
2021-04-01T06:58:08.000Z
|
lib/whatweb/plugins/adsubtract.rb
|
ninoseki/SimpleWhatWeb
|
8ba51cfec0179333ca0742fdbd10ade9b9c67425
|
[
"MIT"
] | 16
|
2018-08-19T00:34:03.000Z
|
2020-08-07T01:19:09.000Z
|
lib/whatweb/plugins/adsubtract.rb
|
ninoseki/SimpleWhatWeb
|
8ba51cfec0179333ca0742fdbd10ade9b9c67425
|
[
"MIT"
] | 2
|
2020-11-04T06:31:49.000Z
|
2020-11-06T11:01:53.000Z
|
# frozen_string_literal: true
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 # 2016-04-18 # Andrew Horton
# Replaced passive function with match for server header
##
WhatWeb::Plugin.define "AdSubtract" do
@author = "Brendan Coles <bcoles@gmail.com>" # 2011-06-06
@version = "0.2"
@description = "AdSubtract - a Windows proxy which removes popup ads."
@website = "http://AdSubtract.com"
# ShodanHQ results as at 2011-06-06 #
# 65 for AdSubtract
@matches = [
# Version Detection # HTTP Server Header
{ version: /^AdSubtract ([\d\.]+)$/, search: "headers[server]" }
]
end
| 31.076923
| 72
| 0.706683
|
45bfd0eacac3feb1e8207731f6920217d4c1c43f
| 1,233
|
py
|
Python
|
sentiment_analysis_nltk.py
|
ss-sathishsampath/Sentiment_Analysis_Movie_Reviews
|
d9166b73e8f675ac84620542e6b3bb349e89c234
|
[
"Apache-2.0"
] | null | null | null |
sentiment_analysis_nltk.py
|
ss-sathishsampath/Sentiment_Analysis_Movie_Reviews
|
d9166b73e8f675ac84620542e6b3bb349e89c234
|
[
"Apache-2.0"
] | null | null | null |
sentiment_analysis_nltk.py
|
ss-sathishsampath/Sentiment_Analysis_Movie_Reviews
|
d9166b73e8f675ac84620542e6b3bb349e89c234
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Sentiment Analysis-Movie Reviews using NLTK
@author: Sathish Sampath(ss.sathishsampath@gmail.com)
Developed as part of Microsoft's NLP MOOC(https://www.edx.org/course/natural-language-processing-nlp)
"""
# movie reviews / sentiment analysis
import nltk
from nltk.corpus import movie_reviews as reviews
import random
# Input Documents
docs = [(list(reviews.words(id)), cat) for cat in reviews.categories() for id in reviews.fileids(cat)]
# Shuffle the input
random.shuffle(docs)
fd = nltk.FreqDist(word.lower() for word in reviews.words())
topKeys = [ key for (key,value) in fd.most_common(2000)]
def review_features(doc):
docSet = set(doc)
features = {}
for word in topKeys:
features[word] = (word in docSet)
return features
data = [(review_features(doc), label) for (doc,label) in docs]
dataCount = len(data)
trainCount = int(.8*dataCount)
trainData = data[:trainCount]
testData = data[trainCount:]
bayes2 = nltk.NaiveBayesClassifier.train(trainData)
print("train accuracy=", nltk.classify.accuracy(bayes2, trainData))
print("test accuracy=", nltk.classify.accuracy(bayes2, testData))
# Show Best Features
bayes2.show_most_informative_features(20)
| 24.66
| 103
| 0.726683
|
b6de606d7fe885f7d056afe297aeb9eb0e9c7df6
| 876
|
swift
|
Swift
|
DPSlideMenuKitDemo/DPSlideMenuKitDemo/DPSlideMenuKit/DPBaseEmbedViewController.swift
|
EchoLiao/DPSlideMenuKit-Swift
|
66243b9c4e289d3525696791f86aa5f8292fad60
|
[
"MIT"
] | null | null | null |
DPSlideMenuKitDemo/DPSlideMenuKitDemo/DPSlideMenuKit/DPBaseEmbedViewController.swift
|
EchoLiao/DPSlideMenuKit-Swift
|
66243b9c4e289d3525696791f86aa5f8292fad60
|
[
"MIT"
] | null | null | null |
DPSlideMenuKitDemo/DPSlideMenuKitDemo/DPSlideMenuKit/DPBaseEmbedViewController.swift
|
EchoLiao/DPSlideMenuKit-Swift
|
66243b9c4e289d3525696791f86aa5f8292fad60
|
[
"MIT"
] | null | null | null |
//
// DPBaseEmbedViewController.swift
// DPSlideMenuKitDemo
//
// Created by Hongli Yu on 11/07/2017.
// Copyright © 2017 Hongli Yu. All rights reserved.
//
import UIKit
open class DPBaseEmbedViewController: UIViewController {
fileprivate (set) var positionState: DPEmbedViewControllerPositionState = .left
func setPositionState(positionState: DPEmbedViewControllerPositionState) {
self.positionState = positionState
}
// MARK: Life Cycle
override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
override open func viewDidLoad() {
super.viewDidLoad()
}
override open func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
| 23.675676
| 87
| 0.729452
|
321d9ec9fe2961e0d05176a84f3f529833f1f709
| 1,436
|
dart
|
Dart
|
lib/widgets/fileBrowser.dart
|
nchartiot/giffer
|
b2b75cdd3f3e3fc75cbe68e76380e276796efbb8
|
[
"MIT"
] | null | null | null |
lib/widgets/fileBrowser.dart
|
nchartiot/giffer
|
b2b75cdd3f3e3fc75cbe68e76380e276796efbb8
|
[
"MIT"
] | null | null | null |
lib/widgets/fileBrowser.dart
|
nchartiot/giffer
|
b2b75cdd3f3e3fc75cbe68e76380e276796efbb8
|
[
"MIT"
] | null | null | null |
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:file_picker/file_picker.dart';
void main() => runApp(new FileBrowser());
class FileBrowser extends StatefulWidget {
@override
_FileBrowserState createState() => new _FileBrowserState();
}
class _FileBrowserState extends State<FileBrowser> {
String _path = "none";
String _fileName;
String _extension;
bool _hasValidMime = false;
FileType _pickingType = FileType.VIDEO;
TextEditingController _controller = new TextEditingController();
@override
void initState() {
super.initState();
_controller.addListener(() => _extension = _controller.text);
}
void _openFileExplorer() async {
if (_pickingType != FileType.CUSTOM || _hasValidMime) {
try {
_path = await FilePicker.getFilePath(
type: _pickingType,
fileExtension: _extension,
);
} on PlatformException catch (e) {
print("Unsupported operation" + e.toString());
}
if (!mounted) return;
setState(() {
_fileName = _path != null ? _path.split('/').last : '...';
});
Navigator.pushNamed(context, '/encode');
}
}
@override
Widget build(BuildContext context) {
return FlatButton(
onPressed: () => _openFileExplorer(),
child: Text(
_fileName,
style: TextStyle(color: Colors.white, fontSize: 30),
),
);
}
}
| 25.192982
| 66
| 0.648329
|
38b910c82c47ffeb29c956d5439e546a7a845488
| 331
|
php
|
PHP
|
app/Models/ModelHasPermissionsModel.php
|
sheshkumarp/chai
|
7edd413644da540c6e05105ff6426a2dcaea54f9
|
[
"MIT"
] | null | null | null |
app/Models/ModelHasPermissionsModel.php
|
sheshkumarp/chai
|
7edd413644da540c6e05105ff6426a2dcaea54f9
|
[
"MIT"
] | null | null | null |
app/Models/ModelHasPermissionsModel.php
|
sheshkumarp/chai
|
7edd413644da540c6e05105ff6426a2dcaea54f9
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\Permission\Models\Permission;
class ModelHasPermissionsModel extends Model
{
protected $table = 'model_has_permissions';
public function permissions()
{
return $this->belongsTo(Permission::class, 'permission_id', 'id');
}
}
| 18.388889
| 71
| 0.725076
|
0d413bb6fb4f6ba7912012917443bf09e6ec8d11
| 20,265
|
c
|
C
|
third-party/libfabric/libfabric-src/prov/efa/src/rxr/rxr_read.c
|
kamleshbhalui/chapel
|
275f4fe65997bca8cbdba6079a37ccc7157f5676
|
[
"ECL-2.0",
"Apache-2.0"
] | 2
|
2018-01-16T20:08:24.000Z
|
2018-01-31T17:05:32.000Z
|
third-party/libfabric/libfabric-src/prov/efa/src/rxr/rxr_read.c
|
kamleshbhalui/chapel
|
275f4fe65997bca8cbdba6079a37ccc7157f5676
|
[
"ECL-2.0",
"Apache-2.0"
] | 18
|
2022-03-08T13:46:16.000Z
|
2022-03-23T15:30:29.000Z
|
third-party/libfabric/libfabric-src/prov/efa/src/rxr/rxr_read.c
|
benharsh/chapel
|
e4efca905abda765881e834c79abe2854aa9aa5d
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
/*
* Copyright (c) 2019-2020 Amazon.com, Inc. or its affiliates.
* All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 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 "efa.h"
#include "rxr.h"
#include "rxr_rma.h"
#include "rxr_cntr.h"
#include "rxr_read.h"
int rxr_locate_iov_pos(struct iovec *iov, int iov_count, size_t offset,
int *iov_idx, size_t *iov_offset)
{
int i;
size_t curoffset;
curoffset = 0;
for (i = 0; i < iov_count; ++i) {
if (offset >= curoffset &&
offset < curoffset + iov[i].iov_len) {
*iov_idx = i;
*iov_offset = offset - curoffset;
return 0;
}
curoffset += iov[i].iov_len;
}
return -1;
}
int rxr_locate_rma_iov_pos(struct fi_rma_iov *rma_iov, int rma_iov_count, size_t offset,
int *rma_iov_idx, size_t *rma_iov_offset)
{
int i;
size_t curoffset;
curoffset = 0;
for (i = 0; i < rma_iov_count; ++i) {
if (offset >= curoffset &&
offset < curoffset + rma_iov[i].len) {
*rma_iov_idx = i;
*rma_iov_offset = offset - curoffset;
return 0;
}
curoffset += rma_iov[i].len;
}
return -1;
}
/*
* rxr_read_prepare_pkt_entry_mr() ensure pkt_entry's memory is registered.
*
* For a packet entry whose memory is not registered, it will reserve a pkt entry
* from rx_readcopy_pkt_pool and copy data their.
*
* Return value:
*
* On success, return 0
* On pack entry reservation failure, return -FI_EAGAIN
*/
static
ssize_t rxr_read_prepare_pkt_entry_mr(struct rxr_ep *ep, struct rxr_read_entry *read_entry)
{
size_t pkt_offset;
struct rxr_pkt_entry *pkt_entry;
struct rxr_pkt_entry *pkt_entry_copy;
assert(read_entry->context_type == RXR_READ_CONTEXT_PKT_ENTRY);
/*
* In this case, target buffer is data in a pkt_entry, so rma_iov_count must be 1.
*/
assert(read_entry->rma_iov_count == 1);
pkt_entry = read_entry->context;
if (pkt_entry->mr) {
assert(read_entry->rma_iov[0].key == fi_mr_key(pkt_entry->mr));
return 0;
}
/* only ooo and unexp packet entry's memory is not registered with device */
assert(pkt_entry->alloc_type == RXR_PKT_FROM_OOO_POOL ||
pkt_entry->alloc_type == RXR_PKT_FROM_UNEXP_POOL);
pkt_offset = (char *)read_entry->rma_iov[0].addr - (char *)pkt_entry->pkt;
assert(pkt_offset > sizeof(struct rxr_base_hdr));
pkt_entry_copy = rxr_pkt_entry_clone(ep, ep->rx_readcopy_pkt_pool,
RXR_PKT_FROM_READ_COPY_POOL,
pkt_entry);
if (!pkt_entry_copy) {
FI_WARN(&rxr_prov, FI_LOG_CQ,
"readcopy pkt pool exhausted! Set FI_EFA_READCOPY_POOL_SIZE to a higher value!");
return -FI_EAGAIN;
}
rxr_pkt_entry_release_rx(ep, pkt_entry);
assert(pkt_entry_copy->mr);
read_entry->context = pkt_entry_copy;
read_entry->rma_iov[0].addr = (uint64_t)pkt_entry_copy->pkt + pkt_offset;
read_entry->rma_iov[0].key = fi_mr_key(pkt_entry_copy->mr);
return 0;
}
/*
* rxr_read_mr_reg register the memory of local buffer if application did not
* provide descriptor.
* It is called by rxr_read_post().
* On success, it return 0.
* If memory registration failed with -FI_ENOMEM, it will return -FI_EAGAIN.
* If memory registration failed with other error, it will return the error code.
*/
ssize_t rxr_read_mr_reg(struct rxr_ep *ep, struct rxr_read_entry *read_entry)
{
size_t i;
int err;
for (i = 0; i < read_entry->iov_count; ++i) {
if (read_entry->mr_desc[i] || read_entry->mr[i]) {
continue;
}
err = fi_mr_reg(rxr_ep_domain(ep)->rdm_domain,
read_entry->iov[i].iov_base, read_entry->iov[i].iov_len,
FI_RECV, 0, 0, 0, &read_entry->mr[i], NULL);
if (err) {
/* If registration failed with -FI_ENOMEM, we return -FI_EAGAIN.
* This read entry will be put into a queue.
*
* The progress engine will progress other message transfers, which
* will release registrations. Thus, when the progress engine call this
* function again later, there will be registrations available.
*
* All registration opened here will be closed during release of
* the read_entry.
*/
FI_WARN(&rxr_prov, FI_LOG_MR, "Unable to register MR buf for read!\n");
if (err == -FI_ENOMEM)
err = -FI_EAGAIN;
return err;
}
read_entry->mr_desc[i] = fi_mr_desc(read_entry->mr[i]);
}
return 0;
}
/**
* @brief convert descriptor from application for lower provider to use
*
* Each provider define its descriptors format. The descriptor provided
* by application is in EFA provider format.
* This function convert it to descriptors for lower provider according
* to lower provider type. It also handle the case application does not
* provider descriptors.
*
* @param lower_ep_type[in] lower efa type, can be EFA_EP or SHM_EP.
* @param numdesc[in] number of descriptors in the array
* @param desc_in[in] descriptors provided by application
* @param desc_out[out] descriptors for lower provider.
*/
static inline
void rxr_read_copy_desc(enum rxr_lower_ep_type lower_ep_type,
int numdesc, void **desc_in, void **desc_out)
{
if (!desc_in) {
memset(desc_out, 0, numdesc * sizeof(void *));
return;
}
memcpy(desc_out, desc_in, numdesc * sizeof(void *));
if (lower_ep_type == SHM_EP) {
rxr_convert_desc_for_shm(numdesc, desc_out);
}
}
/* rxr_read_alloc_entry allocates a read entry.
* It is called by rxr_read_post_or_queue().
* Input:
* x_entry: can be a tx_entry or an rx_entry.
* If x_entry is tx_entry, application called fi_read().
* If x_entry is rx_entry, read message protocol is being used.
* lower_ep_type: EFA_EP or SHM_EP
* Return:
* On success, return the pointer of allocated read_entry
* Otherwise, return NULL
*/
struct rxr_read_entry *rxr_read_alloc_entry(struct rxr_ep *ep, int entry_type, void *x_entry,
enum rxr_lower_ep_type lower_ep_type)
{
struct rxr_tx_entry *tx_entry = NULL;
struct rxr_rx_entry *rx_entry = NULL;
struct rxr_read_entry *read_entry;
int i;
size_t total_iov_len, total_rma_iov_len;
read_entry = ofi_buf_alloc(ep->read_entry_pool);
if (OFI_UNLIKELY(!read_entry)) {
FI_WARN(&rxr_prov, FI_LOG_EP_CTRL, "RDMA entries exhausted\n");
return NULL;
}
read_entry->type = RXR_READ_ENTRY;
read_entry->read_id = ofi_buf_index(read_entry);
read_entry->state = RXR_RDMA_ENTRY_CREATED;
if (entry_type == RXR_TX_ENTRY) {
tx_entry = (struct rxr_tx_entry *)x_entry;
assert(tx_entry->op == ofi_op_read_req);
read_entry->context_type = RXR_READ_CONTEXT_TX_ENTRY;
read_entry->context = tx_entry;
read_entry->addr = tx_entry->addr;
read_entry->iov_count = tx_entry->iov_count;
memcpy(read_entry->iov, tx_entry->iov,
tx_entry->iov_count * sizeof(struct iovec));
read_entry->rma_iov_count = tx_entry->rma_iov_count;
memcpy(read_entry->rma_iov, tx_entry->rma_iov,
tx_entry->rma_iov_count * sizeof(struct fi_rma_iov));
total_iov_len = ofi_total_iov_len(tx_entry->iov, tx_entry->iov_count);
total_rma_iov_len = ofi_total_rma_iov_len(tx_entry->rma_iov, tx_entry->rma_iov_count);
read_entry->total_len = MIN(total_iov_len, total_rma_iov_len);
rxr_read_copy_desc(lower_ep_type, read_entry->iov_count, tx_entry->desc, read_entry->mr_desc);
} else {
rx_entry = (struct rxr_rx_entry *)x_entry;
assert(rx_entry->op == ofi_op_write || rx_entry->op == ofi_op_msg ||
rx_entry->op == ofi_op_tagged);
read_entry->context_type = RXR_READ_CONTEXT_RX_ENTRY;
read_entry->context = rx_entry;
read_entry->addr = rx_entry->addr;
read_entry->iov_count = rx_entry->iov_count;
memcpy(read_entry->iov, rx_entry->iov,
rx_entry->iov_count * sizeof(struct iovec));
read_entry->rma_iov_count = rx_entry->rma_iov_count;
memcpy(read_entry->rma_iov, rx_entry->rma_iov,
rx_entry->rma_iov_count * sizeof(struct fi_rma_iov));
total_iov_len = ofi_total_iov_len(rx_entry->iov, rx_entry->iov_count);
total_rma_iov_len = ofi_total_rma_iov_len(rx_entry->rma_iov, rx_entry->rma_iov_count);
read_entry->total_len = MIN(total_iov_len, total_rma_iov_len);
rxr_read_copy_desc(lower_ep_type, read_entry->iov_count, rx_entry->desc, read_entry->mr_desc);
}
memset(read_entry->mr, 0, read_entry->iov_count * sizeof(struct fid_mr *));
if (lower_ep_type == SHM_EP) {
assert(lower_ep_type == SHM_EP);
/* FI_MR_VIRT_ADDR is not being set, use 0-based offset instead. */
if (!(shm_info->domain_attr->mr_mode & FI_MR_VIRT_ADDR)) {
for (i = 0; i < read_entry->rma_iov_count; ++i)
read_entry->rma_iov[i].addr = 0;
}
}
read_entry->lower_ep_type = lower_ep_type;
read_entry->bytes_submitted = 0;
read_entry->bytes_finished = 0;
return read_entry;
}
void rxr_read_release_entry(struct rxr_ep *ep, struct rxr_read_entry *read_entry)
{
int i, err;
for (i = 0; i < read_entry->iov_count; ++i) {
if (read_entry->mr[i]) {
err = fi_close((struct fid *)read_entry->mr[i]);
if (err) {
FI_WARN(&rxr_prov, FI_LOG_MR, "Unable to close mr\n");
rxr_read_write_error(ep, read_entry, -err, -err);
}
}
}
#ifdef ENABLE_EFA_POISONING
rxr_poison_mem_region((uint32_t *)read_entry, sizeof(struct rxr_read_entry));
#endif
read_entry->state = RXR_RDMA_ENTRY_FREE;
ofi_buf_free(read_entry);
}
static inline
int rxr_read_post_or_queue(struct rxr_ep *ep, struct rxr_read_entry *read_entry)
{
int err;
err = rxr_read_post(ep, read_entry);
if (err == -FI_EAGAIN) {
dlist_insert_tail(&read_entry->pending_entry, &ep->read_pending_list);
read_entry->state = RXR_RDMA_ENTRY_PENDING;
err = 0;
} else if(err) {
rxr_read_release_entry(ep, read_entry);
FI_WARN(&rxr_prov, FI_LOG_CQ,
"RDMA post read failed. errno=%d.\n", err);
}
return err;
}
int rxr_read_post_remote_read_or_queue(struct rxr_ep *ep, int entry_type, void *x_entry)
{
struct rdm_peer *peer;
struct rxr_read_entry *read_entry;
int lower_ep_type;
if (entry_type == RXR_TX_ENTRY) {
peer = rxr_ep_get_peer(ep, ((struct rxr_tx_entry *)x_entry)->addr);
} else {
assert(entry_type == RXR_RX_ENTRY);
peer = rxr_ep_get_peer(ep, ((struct rxr_rx_entry *)x_entry)->addr);
}
assert(peer);
lower_ep_type = (peer->is_local) ? SHM_EP : EFA_EP;
read_entry = rxr_read_alloc_entry(ep, entry_type, x_entry, lower_ep_type);
if (!read_entry) {
FI_WARN(&rxr_prov, FI_LOG_CQ,
"RDMA entries exhausted.\n");
return -FI_ENOBUFS;
}
return rxr_read_post_or_queue(ep, read_entry);
}
int rxr_read_post_local_read_or_queue(struct rxr_ep *ep,
struct rxr_rx_entry *rx_entry,
size_t data_offset,
struct rxr_pkt_entry *pkt_entry,
char *data, size_t data_size)
{
int err;
struct rxr_read_entry *read_entry;
read_entry = ofi_buf_alloc(ep->read_entry_pool);
if (!read_entry) {
FI_WARN(&rxr_prov, FI_LOG_EP_CTRL, "RDMA entries exhausted\n");
return -FI_ENOBUFS;
}
read_entry->read_id = ofi_buf_index(read_entry);
read_entry->lower_ep_type = EFA_EP;
read_entry->context_type = RXR_READ_CONTEXT_PKT_ENTRY;
read_entry->context = pkt_entry;
read_entry->state = RXR_RDMA_ENTRY_CREATED;
read_entry->addr = FI_ADDR_NOTAVAIL;
read_entry->total_len = data_size;
read_entry->bytes_submitted = 0;
read_entry->bytes_finished = 0;
/* setup rma_iov */
read_entry->rma_iov_count = 1;
read_entry->rma_iov[0].addr = (uint64_t)data;
read_entry->rma_iov[0].len = data_size;
read_entry->rma_iov[0].key = (pkt_entry->mr) ? fi_mr_key(pkt_entry->mr) : 0;
/* setup iov */
assert(pkt_entry->x_entry == rx_entry);
assert(rx_entry->desc && efa_ep_is_cuda_mr(rx_entry->desc[0]));
read_entry->iov_count = rx_entry->iov_count;
memset(read_entry->mr, 0, sizeof(*read_entry->mr) * read_entry->iov_count);
memcpy(read_entry->iov, rx_entry->iov, rx_entry->iov_count * sizeof(struct iovec));
rxr_read_copy_desc(EFA_EP, rx_entry->iov_count, rx_entry->desc, read_entry->mr_desc);
ofi_consume_iov_desc(read_entry->iov, read_entry->mr_desc, &read_entry->iov_count, data_offset);
if (read_entry->iov_count == 0) {
FI_WARN(&rxr_prov, FI_LOG_CQ,
"data_offset %ld out of range\n",
data_offset);
ofi_buf_free(read_entry);
return -FI_ETRUNC;
}
assert(efa_ep_is_cuda_mr(read_entry->mr_desc[0]));
err = ofi_truncate_iov(read_entry->iov, &read_entry->iov_count, data_size + ep->msg_prefix_size);
if (err) {
FI_WARN(&rxr_prov, FI_LOG_CQ,
"data_offset %ld data_size %ld out of range\n",
data_offset, data_size);
ofi_buf_free(read_entry);
return -FI_ETRUNC;
}
return rxr_read_post_or_queue(ep, read_entry);
}
int rxr_read_init_iov(struct rxr_ep *ep,
struct rxr_tx_entry *tx_entry,
struct fi_rma_iov *read_iov)
{
int i, err;
struct fid_mr *mr;
struct rdm_peer *peer;
peer = rxr_ep_get_peer(ep, tx_entry->addr);
for (i = 0; i < tx_entry->iov_count; ++i) {
read_iov[i].addr = (uint64_t)tx_entry->iov[i].iov_base;
read_iov[i].len = tx_entry->iov[i].iov_len;
}
if (tx_entry->desc[0]) {
for (i = 0; i < tx_entry->iov_count; ++i) {
mr = (struct fid_mr *)tx_entry->desc[i];
read_iov[i].key = fi_mr_key(mr);
}
} else {
/* note mr could be been set by an unsucessful rxr_ep_post_ctrl */
if (!tx_entry->mr[0]) {
for (i = 0; i < tx_entry->iov_count; ++i) {
assert(!tx_entry->mr[i]);
assert(peer);
if (peer->is_local)
err = efa_mr_reg_shm(rxr_ep_domain(ep)->rdm_domain,
tx_entry->iov + i,
FI_REMOTE_READ, &tx_entry->mr[i]);
else
err = fi_mr_regv(rxr_ep_domain(ep)->rdm_domain,
tx_entry->iov + i, 1,
FI_REMOTE_READ,
0, 0, 0, &tx_entry->mr[i], NULL);
if (err) {
FI_WARN(&rxr_prov, FI_LOG_MR,
"Unable to register MR buf %p as FI_REMOTE_READ",
tx_entry->iov[i].iov_base);
return err;
}
}
}
for (i = 0; i < tx_entry->iov_count; ++i) {
assert(tx_entry->mr[i]);
read_iov[i].key = fi_mr_key(tx_entry->mr[i]);
}
}
return 0;
}
int rxr_read_post(struct rxr_ep *ep, struct rxr_read_entry *read_entry)
{
int ret;
int iov_idx = 0, rma_iov_idx = 0;
bool self_comm;
size_t iov_offset = 0, rma_iov_offset = 0;
size_t total_iov_len, total_rma_iov_len, max_read_size;
struct rxr_pkt_entry *pkt_entry;
struct iovec iov;
struct fi_rma_iov rma_iov;
struct fi_msg_rma msg;
struct efa_ep *efa_ep;
struct rdm_peer *peer;
fi_addr_t shm_fiaddr = FI_ADDR_NOTAVAIL;
assert(read_entry->iov_count > 0);
assert(read_entry->rma_iov_count > 0);
assert(read_entry->bytes_submitted < read_entry->total_len);
if (read_entry->context_type == RXR_READ_CONTEXT_PKT_ENTRY) {
assert(read_entry->lower_ep_type == EFA_EP);
ret = rxr_read_prepare_pkt_entry_mr(ep, read_entry);
if (ret)
return ret;
}
if (read_entry->lower_ep_type == EFA_EP) {
ret = rxr_read_mr_reg(ep, read_entry);
if (ret)
return ret;
}
if (read_entry->lower_ep_type == SHM_EP) {
peer = rxr_ep_get_peer(ep, read_entry->addr);
assert(peer);
shm_fiaddr = peer->shm_fiaddr;
}
max_read_size = (read_entry->lower_ep_type == EFA_EP) ?
efa_max_rdma_size(ep->rdm_ep) : SIZE_MAX;
assert(max_read_size > 0);
ret = rxr_locate_iov_pos(read_entry->iov, read_entry->iov_count,
read_entry->bytes_submitted + ep->msg_prefix_size,
&iov_idx, &iov_offset);
assert(ret == 0);
ret = rxr_locate_rma_iov_pos(read_entry->rma_iov, read_entry->rma_iov_count,
read_entry->bytes_submitted,
&rma_iov_idx, &rma_iov_offset);
assert(ret == 0);
total_iov_len = ofi_total_iov_len(read_entry->iov, read_entry->iov_count);
total_rma_iov_len = ofi_total_rma_iov_len(read_entry->rma_iov, read_entry->rma_iov_count);
assert(read_entry->total_len == MIN(total_iov_len, total_rma_iov_len));
while (read_entry->bytes_submitted < read_entry->total_len) {
if (read_entry->lower_ep_type == EFA_EP && ep->efa_outstanding_tx_ops == ep->efa_max_outstanding_tx_ops)
return -FI_EAGAIN;
assert(iov_idx < read_entry->iov_count);
assert(iov_offset < read_entry->iov[iov_idx].iov_len);
assert(rma_iov_idx < read_entry->rma_iov_count);
assert(rma_iov_offset < read_entry->rma_iov[rma_iov_idx].len);
iov.iov_base = (char *)read_entry->iov[iov_idx].iov_base + iov_offset;
iov.iov_len = read_entry->iov[iov_idx].iov_len - iov_offset;
rma_iov.addr = (uintptr_t)read_entry->rma_iov[rma_iov_idx].addr + rma_iov_offset;
rma_iov.len = read_entry->rma_iov[rma_iov_idx].len - rma_iov_offset;
rma_iov.key = read_entry->rma_iov[rma_iov_idx].key;
iov.iov_len = MIN(iov.iov_len, rma_iov.len);
if (read_entry->lower_ep_type == EFA_EP)
iov.iov_len = MIN(iov.iov_len, rxr_env.efa_read_segment_size);
iov.iov_len = MIN(iov.iov_len, max_read_size);
rma_iov.len = iov.iov_len;
/* because fi_send uses a pkt_entry as context
* we had to use a pkt_entry as context too
*/
if (read_entry->lower_ep_type == SHM_EP)
pkt_entry = rxr_pkt_entry_alloc(ep, ep->shm_tx_pkt_pool, RXR_PKT_FROM_SHM_TX_POOL);
else
pkt_entry = rxr_pkt_entry_alloc(ep, ep->efa_tx_pkt_pool, RXR_PKT_FROM_EFA_TX_POOL);
if (OFI_UNLIKELY(!pkt_entry))
return -FI_EAGAIN;
rxr_pkt_init_read_context(ep, read_entry, iov.iov_len, pkt_entry);
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.desc = &read_entry->mr_desc[iov_idx];
msg.iov_count = 1;
msg.rma_iov = &rma_iov;
msg.rma_iov_count = 1;
msg.context = pkt_entry;
if (read_entry->lower_ep_type == SHM_EP) {
msg.addr = shm_fiaddr;
ret = fi_readmsg(ep->shm_ep, &msg, 0);
} else {
efa_ep = container_of(ep->rdm_ep, struct efa_ep, util_ep.ep_fid);
msg.addr = read_entry->addr;
self_comm = (read_entry->context_type == RXR_READ_CONTEXT_PKT_ENTRY);
if (self_comm)
pkt_entry->flags |= RXR_PKT_ENTRY_LOCAL_READ;
ret = efa_rma_post_read(efa_ep, &msg, 0, self_comm);
}
if (OFI_UNLIKELY(ret)) {
rxr_pkt_entry_release_tx(ep, pkt_entry);
return ret;
}
rxr_ep_record_tx_op_submitted(ep, pkt_entry);
read_entry->bytes_submitted += iov.iov_len;
iov_offset += iov.iov_len;
assert(iov_offset <= read_entry->iov[iov_idx].iov_len);
if (iov_offset == read_entry->iov[iov_idx].iov_len) {
iov_idx += 1;
iov_offset = 0;
}
rma_iov_offset += rma_iov.len;
assert(rma_iov_offset <= read_entry->rma_iov[rma_iov_idx].len);
if (rma_iov_offset == read_entry->rma_iov[rma_iov_idx].len) {
rma_iov_idx += 1;
rma_iov_offset = 0;
}
}
if (read_entry->total_len == total_iov_len) {
assert(iov_idx == read_entry->iov_count);
assert(iov_offset == 0);
}
if (read_entry->total_len == total_rma_iov_len) {
assert(rma_iov_idx == read_entry->rma_iov_count);
assert(rma_iov_offset == 0);
}
return 0;
}
void rxr_read_write_error(struct rxr_ep *ep, struct rxr_read_entry *read_entry,
int err, int prov_errno)
{
struct rxr_tx_entry *tx_entry;
struct rxr_rx_entry *rx_entry;
if (read_entry->context_type == RXR_READ_CONTEXT_TX_ENTRY) {
tx_entry = read_entry->context;
rxr_cq_write_tx_error(ep, tx_entry, err, prov_errno);
} else {
assert(read_entry->context_type == RXR_READ_CONTEXT_RX_ENTRY);
rx_entry = read_entry->context;
rxr_cq_write_rx_error(ep, rx_entry, err, prov_errno);
}
if (read_entry->state == RXR_RDMA_ENTRY_PENDING)
dlist_remove(&read_entry->pending_entry);
}
| 31.081288
| 106
| 0.716506
|
726de88626ac63c8e1e8b66e5df3c794fb135a43
| 186
|
swift
|
Swift
|
Sampleapp/CombineCollection/CombineCollection/API/DogImageListLoader.swift
|
stzn/CombineStudy
|
1de9f1a8f34fe61e8f95438142ced2db080c6472
|
[
"MIT"
] | 27
|
2020-09-20T02:30:26.000Z
|
2022-01-21T15:23:28.000Z
|
Schedulers/CombineCollection_RunOnMainScheduler/CombineCollection/API/DogImageListLoader.swift
|
stzn/CombineStudy
|
1de9f1a8f34fe61e8f95438142ced2db080c6472
|
[
"MIT"
] | null | null | null |
Schedulers/CombineCollection_RunOnMainScheduler/CombineCollection/API/DogImageListLoader.swift
|
stzn/CombineStudy
|
1de9f1a8f34fe61e8f95438142ced2db080c6472
|
[
"MIT"
] | 1
|
2020-09-20T06:30:36.000Z
|
2020-09-20T06:30:36.000Z
|
//
// DogImageListLoader.swift
// CombineCollection
//
//
import Combine
import Foundation
struct DogImageListLoader {
let load: (BreedType) -> AnyPublisher<[DogImage], Error>
}
| 14.307692
| 60
| 0.72043
|
f4cc691825080edff871a76fc0145e4eff1a5d5f
| 588
|
tsx
|
TypeScript
|
template/packages/frontend/stories/Title.stories.tsx
|
Originate/create-originate-app
|
1a0f019b8e1acb5bb712f7cc0bac0f15af2f1621
|
[
"MIT"
] | 6
|
2020-10-26T16:53:38.000Z
|
2021-09-26T06:40:34.000Z
|
template/packages/frontend/stories/Title.stories.tsx
|
Originate/create-originate-app
|
1a0f019b8e1acb5bb712f7cc0bac0f15af2f1621
|
[
"MIT"
] | 196
|
2020-09-08T17:53:25.000Z
|
2022-02-27T09:59:30.000Z
|
template/packages/frontend/stories/Title.stories.tsx
|
Originate/create-originate-app
|
1a0f019b8e1acb5bb712f7cc0bac0f15af2f1621
|
[
"MIT"
] | null | null | null |
import * as React from "react"
import { storiesOf } from "@storybook/react"
import { Title } from "../components/IndexStyles"
import { theme } from "../components/Theme"
import { GlobalStyle } from "../components/GlobalStyles"
import { ThemeProvider } from "styled-components"
storiesOf("Title", module).add("with text", () => {
return (
<ThemeProvider theme={theme}>
<GlobalStyle />
<Title>
Welcome to{" "}
<a href="https://github.com/Originate/create-react-app">
Create Originate App!
</a>
</Title>
</ThemeProvider>
)
})
| 28
| 64
| 0.62415
|
44689eb1c353f9b02a6afaeadb0ae3553e6686c3
| 1,104
|
py
|
Python
|
ratio/cifar10_resnet34_ratio_alpha_0_beta_0.75/ratio.py
|
guoyurong0104/CRL-code
|
276466a64823c5bd1645317b6cfb7ee12d3ba735
|
[
"MIT"
] | 1
|
2022-02-23T04:30:00.000Z
|
2022-02-23T04:30:00.000Z
|
ratio/cifar10_resnet34_ratio_alpha_0_beta_0.75/ratio.py
|
guoyurong0104/CRL-code
|
276466a64823c5bd1645317b6cfb7ee12d3ba735
|
[
"MIT"
] | null | null | null |
ratio/cifar10_resnet34_ratio_alpha_0_beta_0.75/ratio.py
|
guoyurong0104/CRL-code
|
276466a64823c5bd1645317b6cfb7ee12d3ba735
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
#对Variable操作如果直接使用索引,梯度不传播
import torch
import torch.nn as nn
import torch.nn.functional as F
def one_hot(index,classes):
N=index.size(0)
onehot = torch.zeros(N, classes).long().cuda()
onehot_convert=onehot.scatter_(dim=1, index=torch.unsqueeze(index, dim=1), src=torch.ones(N, classes).long().cuda())
return onehot_convert.float()
class ratio(nn.Module):
def __init__(self, eps=1e-7,alpha=1,beta=0.75):
super(ratio, self).__init__()
self.eps = eps
self.alpha = alpha
self.beta = beta
return
def forward(self, input, target):
y = one_hot(target, input.size(-1))
Psoft = torch.nn.functional.softmax(input,dim=1)
Psoft = Psoft.clamp(1e-7, 1.-1e-7)
Loss1=0.0
Loss1+=torch.sum(torch.log((((self.alpha-torch.sum(y*Psoft,1))**self.beta)/(torch.sum(y*Psoft,1))+1e-7)))
Loss1=Loss1/(target.size(0))
return Loss1
| 28.307692
| 120
| 0.630435
|
06bc576c973669ef151ea9d80bba623dde84b7f9
| 210,909
|
py
|
Python
|
opem/Script.py
|
Martenet/opem
|
3b386b14bbd5d2cc5a376a7fc80c7d93dd7523f5
|
[
"MIT"
] | 173
|
2017-12-24T07:35:01.000Z
|
2022-03-08T17:31:20.000Z
|
opem/Script.py
|
Martenet/opem
|
3b386b14bbd5d2cc5a376a7fc80c7d93dd7523f5
|
[
"MIT"
] | 130
|
2017-12-16T16:08:37.000Z
|
2022-03-21T09:46:39.000Z
|
opem/Script.py
|
Martenet/opem
|
3b386b14bbd5d2cc5a376a7fc80c7d93dd7523f5
|
[
"MIT"
] | 45
|
2017-12-16T16:05:58.000Z
|
2022-02-28T17:43:12.000Z
|
# -*- coding: utf-8 -*-
"""Chart.js script."""
JS_SCRIPT = r'''
/*!
* Chart.js
* http://chartjs.org/
* Version: 2.7.1
*
* Copyright 2017 Nick Downie
* Released under the MIT license
* https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function t(e,n,i){function a(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(r)return r(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[o]={exports:{}};e[o][0].call(d.exports,function(t){var n=e[o][1][t];return a(n||t)},d,d.exports,t,e,n,i)}return n[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)a(i[o]);return a}({1:[function(t,e,n){function i(t){if(t){var e=[0,0,0],n=1,i=t.match(/^#([a-fA-F0-9]{3})$/i);if(i){i=i[1];for(a=0;a<e.length;a++)e[a]=parseInt(i[a]+i[a],16)}else if(i=t.match(/^#([a-fA-F0-9]{6})$/i)){i=i[1];for(a=0;a<e.length;a++)e[a]=parseInt(i.slice(2*a,2*a+2),16)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(a=0;a<e.length;a++)e[a]=parseInt(i[a+1]);n=parseFloat(i[4])}else if(i=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(a=0;a<e.length;a++)e[a]=Math.round(2.55*parseFloat(i[a+1]));n=parseFloat(i[4])}else if(i=t.match(/(\w+)/)){if("transparent"==i[1])return[0,0,0,0];if(!(e=c[i[1]]))return}for(var a=0;a<e.length;a++)e[a]=u(e[a],0,255);return n=n||0==n?u(n,0,1):1,e[3]=n,e}}function a(t){if(t){var e=t.match(/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var n=parseFloat(e[4]);return[u(parseInt(e[1]),0,360),u(parseFloat(e[2]),0,100),u(parseFloat(e[3]),0,100),u(isNaN(n)?1:n,0,1)]}}}function r(t){if(t){var e=t.match(/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var n=parseFloat(e[4]);return[u(parseInt(e[1]),0,360),u(parseFloat(e[2]),0,100),u(parseFloat(e[3]),0,100),u(isNaN(n)?1:n,0,1)]}}}function o(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function s(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function l(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function u(t,e,n){return Math.min(Math.max(e,t),n)}function d(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var c=t(5);e.exports={getRgba:i,getHsla:a,getRgb:function(t){var e=i(t);return e&&e.slice(0,3)},getHsl:function(t){var e=a(t);return e&&e.slice(0,3)},getHwb:r,getAlpha:function(t){var e=i(t);return e?e[3]:(e=a(t))?e[3]:(e=r(t))?e[3]:void 0},hexString:function(t){return"#"+d(t[0])+d(t[1])+d(t[2])},rgbString:function(t,e){return e<1||t[3]&&t[3]<1?o(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:o,percentString:function(t,e){return e<1||t[3]&&t[3]<1?s(t,e):"rgb("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%)"},percentaString:s,hslString:function(t,e){return e<1||t[3]&&t[3]<1?l(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:l,hwbString:function(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return h[t.slice(0,3)]}};var h={};for(var f in c)h[c[f]]=f},{5:5}],2:[function(t,e,n){var i=t(4),a=t(1),r=function(t){if(t instanceof r)return t;if(!(this instanceof r))return new r(t);this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var e;"string"==typeof t?(e=a.getRgba(t))?this.setValues("rgb",e):(e=a.getHsla(t))?this.setValues("hsl",e):(e=a.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e))};r.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return a.hexString(this.values.rgb)},rgbString:function(){return a.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return a.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return a.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return a.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return a.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return a.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return a.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;n<t.length;n++){var i=t[n]/255;e[n]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,a=void 0===e?.5:e,r=2*a-1,o=n.alpha()-i.alpha(),s=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-s;return this.rgb(s*n.red()+l*i.red(),s*n.green()+l*i.green(),s*n.blue()+l*i.blue()).alpha(n.alpha()*a+i.alpha()*(1-a))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new r,i=this.values,a=n.values;for(var o in i)i.hasOwnProperty(o)&&(t=i[o],"[object Array]"===(e={}.toString.call(t))?a[o]=t.slice(0):"[object Number]"===e?a[o]=t:console.error("unexpected color value:",t));return n}},r.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},r.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},r.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i<t.length;i++)n[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(n.a=e.alpha),n},r.prototype.setValues=function(t,e){var n,a=this.values,r=this.spaces,o=this.maxes,s=1;if(this.valid=!0,"alpha"===t)s=e;else if(e.length)a[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(n=0;n<t.length;n++)a[t][n]=e[t.charAt(n)];s=e.a}else if(void 0!==e[r[t][0]]){var l=r[t];for(n=0;n<t.length;n++)a[t][n]=e[l[n]];s=e.alpha}if(a.alpha=Math.max(0,Math.min(1,void 0===s?a.alpha:s)),"alpha"===t)return!1;var u;for(n=0;n<t.length;n++)u=Math.max(0,Math.min(o[t][n],a[t][n])),a[t][n]=Math.round(u);for(var d in r)d!==t&&(a[d]=i[t][d](a[t]));return!0},r.prototype.setSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n),this)},r.prototype.setChannel=function(t,e,n){var i=this.values[t];return void 0===n?i[e]:n===i[e]?this:(i[e]=n,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=r),e.exports=r},{1:1,4:4}],3:[function(t,e,n){function i(t){var e,n,i,a=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),(e=Math.min(60*e,360))<0&&(e+=360),i=(s+l)/2,n=l==s?0:i<=.5?u/(l+s):u/(2-l-s),[e,100*n,100*i]}function a(t){var e,n,i,a=t[0],r=t[1],o=t[2],s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return n=0==l?0:u/l*1e3/10,l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),(e=Math.min(60*e,360))<0&&(e+=360),i=l/255*1e3/10,[e,n,i]}function o(t){var e=t[0],n=t[1],a=t[2];return[i(t)[0],100*(1/255*Math.min(e,Math.min(n,a))),100*(a=1-1/255*Math.max(e,Math.max(n,a)))]}function s(t){var e,n,i,a,r=t[0]/255,o=t[1]/255,s=t[2]/255;return a=Math.min(1-r,1-o,1-s),e=(1-r-a)/(1-a)||0,n=(1-o-a)/(1-a)||0,i=(1-s-a)/(1-a)||0,[100*e,100*n,100*i,100*a]}function l(t){return S[JSON.stringify(t)]}function u(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]}function d(t){var e,n,i,a=u(t),r=a[0],o=a[1],s=a[2];return r/=95.047,o/=100,s/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*o-16,n=500*(r-o),i=200*(o-s),[e,n,i]}function c(t){var e,n,i,a,r,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return r=255*l,[r,r,r];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var u=0;u<3;u++)(i=o+1/3*-(u-1))<0&&i++,i>1&&i--,r=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*r;return a}function h(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-n),s=255*i*(1-n*r),l=255*i*(1-n*(1-r)),i=255*i;switch(a){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}}function f(t){var e,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),n=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),a=s+i*(n-s),e){default:case 6:case 0:r=n,g=a,b=s;break;case 1:r=a,g=n,b=s;break;case 2:r=s,g=n,b=a;break;case 3:r=s,g=a,b=n;break;case 4:r=a,g=s,b=n;break;case 5:r=n,g=s,b=a}return[255*r,255*g,255*b]}function m(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100,s=t[3]/100;return e=1-Math.min(1,a*(1-s)+s),n=1-Math.min(1,r*(1-s)+s),i=1-Math.min(1,o*(1-s)+s),[255*e,255*n,255*i]}function p(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100;return e=3.2406*a+-1.5372*r+-.4986*o,n=-.9689*a+1.8758*r+.0415*o,i=.0557*a+-.204*r+1.057*o,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]}function v(t){var e,n,i,a=t[0],r=t[1],o=t[2];return a/=95.047,r/=100,o/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,e=116*r-16,n=500*(a-r),i=200*(r-o),[e,n,i]}function y(t){var e,n,i,a,r=t[0],o=t[1],s=t[2];return r<=8?a=(n=100*r/903.3)/100*7.787+16/116:(n=100*Math.pow((r+16)/116,3),a=Math.pow(n/100,1/3)),e=e/95.047<=.008856?e=95.047*(o/500+a-16/116)/7.787:95.047*Math.pow(o/500+a,3),i=i/108.883<=.008859?i=108.883*(a-s/200-16/116)/7.787:108.883*Math.pow(a-s/200,3),[e,n,i]}function x(t){var e,n,i,a=t[0],r=t[1],o=t[2];return e=Math.atan2(o,r),(n=360*e/2/Math.PI)<0&&(n+=360),i=Math.sqrt(r*r+o*o),[a,i,n]}function _(t){return p(y(t))}function k(t){var e,n,i,a=t[0],r=t[1];return i=t[2]/360*2*Math.PI,e=r*Math.cos(i),n=r*Math.sin(i),[a,e,n]}function w(t){return M[t]}e.exports={rgb2hsl:i,rgb2hsv:a,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:function(t){return x(d(t))},hsl2rgb:c,hsl2hsv:function(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return 0===r?[0,0,0]:(r*=2,a*=r<=1?r:2-r,n=(r+a)/2,e=2*a/(r+a),[i,100*e,100*n])},hsl2hwb:function(t){return o(c(t))},hsl2cmyk:function(t){return s(c(t))},hsl2keyword:function(t){return l(c(t))},hsv2rgb:h,hsv2hsl:function(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return n=(2-a)*r,e=a*r,e/=n<=1?n:2-n,e=e||0,n/=2,[i,100*e,100*n]},hsv2hwb:function(t){return o(h(t))},hsv2cmyk:function(t){return s(h(t))},hsv2keyword:function(t){return l(h(t))},hwb2rgb:f,hwb2hsl:function(t){return i(f(t))},hwb2hsv:function(t){return a(f(t))},hwb2cmyk:function(t){return s(f(t))},hwb2keyword:function(t){return l(f(t))},cmyk2rgb:m,cmyk2hsl:function(t){return i(m(t))},cmyk2hsv:function(t){return a(m(t))},cmyk2hwb:function(t){return o(m(t))},cmyk2keyword:function(t){return l(m(t))},keyword2rgb:w,keyword2hsl:function(t){return i(w(t))},keyword2hsv:function(t){return a(w(t))},keyword2hwb:function(t){return o(w(t))},keyword2cmyk:function(t){return s(w(t))},keyword2lab:function(t){return d(w(t))},keyword2xyz:function(t){return u(w(t))},xyz2rgb:p,xyz2lab:v,xyz2lch:function(t){return x(v(t))},lab2xyz:y,lab2rgb:_,lab2lch:x,lch2lab:k,lch2xyz:function(t){return y(k(t))},lch2rgb:function(t){return _(k(t))}};var M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},S={};for(var D in M)S[JSON.stringify(M[D])]=D},{}],4:[function(t,e,n){var i=t(3),a=function(){return new u};for(var r in i){a[r+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(r);var o=/(\w+)2(\w+)/.exec(r),s=o[1],l=o[2];(a[s]=a[s]||{})[l]=a[r]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var a=0;a<n.length;a++)n[a]=Math.round(n[a]);return n}}(r)}var u=function(){this.convs={}};u.prototype.routeSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n))},u.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},u.prototype.getValues=function(t){var e=this.convs[t];if(!e){var n=this.space,i=this.convs[n];e=a[n][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){u.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=a},{3:3}],5:[function(t,e,n){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],6:[function(t,e,n){!function(t,i){"object"==typeof n&&void 0!==e?e.exports=i():t.moment=i()}(this,function(){"use strict";function n(){return xe.apply(null,arguments)}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function a(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function r(t){var e;for(e in t)return!1;return!0}function o(t){return void 0===t}function s(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function l(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,i=[];for(n=0;n<t.length;++n)i.push(e(t[n],n));return i}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function c(t,e){for(var n in e)d(e,n)&&(t[n]=e[n]);return d(e,"toString")&&(t.toString=e.toString),d(e,"valueOf")&&(t.valueOf=e.valueOf),t}function h(t,e,n,i){return Yt(t,e,n,i,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function g(t){return null==t._pf&&(t._pf=f()),t._pf}function m(t){if(null==t._isValid){var e=g(t),n=ke.call(e.parsedDateParts,function(t){return null!=t}),i=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n);if(t._strict&&(i=i&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return i;t._isValid=i}return t._isValid}function p(t){var e=h(NaN);return null!=t?c(g(e),t):g(e).userInvalidated=!0,e}function v(t,e){var n,i,a;if(o(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),o(e._i)||(t._i=e._i),o(e._f)||(t._f=e._f),o(e._l)||(t._l=e._l),o(e._strict)||(t._strict=e._strict),o(e._tzm)||(t._tzm=e._tzm),o(e._isUTC)||(t._isUTC=e._isUTC),o(e._offset)||(t._offset=e._offset),o(e._pf)||(t._pf=g(e)),o(e._locale)||(t._locale=e._locale),we.length>0)for(n=0;n<we.length;n++)o(a=e[i=we[n]])||(t[i]=a);return t}function y(t){v(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===Me&&(Me=!0,n.updateOffset(this),Me=!1)}function b(t){return t instanceof y||null!=t&&null!=t._isAMomentObject}function x(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function _(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=x(e)),n}function k(t,e,n){var i,a=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),o=0;for(i=0;i<a;i++)(n&&t[i]!==e[i]||!n&&_(t[i])!==_(e[i]))&&o++;return o+r}function w(t){!1===n.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function M(t,e){var i=!0;return c(function(){if(null!=n.deprecationHandler&&n.deprecationHandler(null,t),i){for(var a,r=[],o=0;o<arguments.length;o++){if(a="","object"==typeof arguments[o]){a+="\n["+o+"] ";for(var s in arguments[0])a+=s+": "+arguments[0][s]+", ";a=a.slice(0,-2)}else a=arguments[o];r.push(a)}w(t+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),i=!1}return e.apply(this,arguments)},e)}function S(t,e){null!=n.deprecationHandler&&n.deprecationHandler(t,e),Se[t]||(w(e),Se[t]=!0)}function D(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function C(t,e){var n,i=c({},t);for(n in e)d(e,n)&&(a(t[n])&&a(e[n])?(i[n]={},c(i[n],t[n]),c(i[n],e[n])):null!=e[n]?i[n]=e[n]:delete i[n]);for(n in t)d(t,n)&&!d(e,n)&&a(t[n])&&(i[n]=c({},i[n]));return i}function P(t){null!=t&&this.set(t)}function T(t,e){var n=t.toLowerCase();Te[n]=Te[n+"s"]=Te[e]=t}function A(t){return"string"==typeof t?Te[t]||Te[t.toLowerCase()]:void 0}function I(t){var e,n,i={};for(n in t)d(t,n)&&(e=A(n))&&(i[e]=t[n]);return i}function O(t,e){Ae[t]=e}function F(t){var e=[];for(var n in t)e.push({unit:n,priority:Ae[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function R(t,e){return function(i){return null!=i?(W(this,t,i),n.updateOffset(this,e),this):L(this,t)}}function L(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function W(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function Y(t,e,n){var i=""+Math.abs(t),a=e-i.length;return(t>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+i}function N(t,e,n,i){var a=i;"string"==typeof i&&(a=function(){return this[i]()}),t&&(Re[t]=a),e&&(Re[e[0]]=function(){return Y(a.apply(this,arguments),e[1],e[2])}),n&&(Re[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),t)})}function z(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function B(t){var e,n,i=t.match(Ie);for(e=0,n=i.length;e<n;e++)Re[i[e]]?i[e]=Re[i[e]]:i[e]=z(i[e]);return function(e){var a,r="";for(a=0;a<n;a++)r+=D(i[a])?i[a].call(e,t):i[a];return r}}function V(t,e){return t.isValid()?(e=H(e,t.localeData()),Fe[e]=Fe[e]||B(e),Fe[e](t)):t.localeData().invalidDate()}function H(t,e){var n=5;for(Oe.lastIndex=0;n>=0&&Oe.test(t);)t=t.replace(Oe,function(t){return e.longDateFormat(t)||t}),Oe.lastIndex=0,n-=1;return t}function E(t,e,n){Ke[t]=D(e)?e:function(t,i){return t&&n?n:e}}function j(t,e){return d(Ke,t)?Ke[t](e._strict,e._locale):new RegExp(U(t))}function U(t){return q(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,a){return e||n||i||a}))}function q(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function G(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),s(e)&&(i=function(t,n){n[e]=_(t)}),n=0;n<t.length;n++)Qe[t[n]]=i}function Z(t,e){G(t,function(t,n,i,a){i._w=i._w||{},e(t,i._w,i,a)})}function X(t,e,n){null!=e&&d(Qe,t)&&Qe[t](e,n._a,n,t)}function J(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function K(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=h([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===e?-1!==(a=un.call(this._shortMonthsParse,o))?a:null:-1!==(a=un.call(this._longMonthsParse,o))?a:null:"MMM"===e?-1!==(a=un.call(this._shortMonthsParse,o))?a:-1!==(a=un.call(this._longMonthsParse,o))?a:null:-1!==(a=un.call(this._longMonthsParse,o))?a:-1!==(a=un.call(this._shortMonthsParse,o))?a:null}function Q(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=_(e);else if(e=t.localeData().monthsParse(e),!s(e))return t;return n=Math.min(t.date(),J(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function $(t){return null!=t?(Q(this,t),n.updateOffset(this,!0),this):L(this,"Month")}function tt(){function t(t,e){return e.length-t.length}var e,n,i=[],a=[],r=[];for(e=0;e<12;e++)n=h([2e3,e]),i.push(this.monthsShort(n,"")),a.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(i.sort(t),a.sort(t),r.sort(t),e=0;e<12;e++)i[e]=q(i[e]),a[e]=q(a[e]);for(e=0;e<24;e++)r[e]=q(r[e]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function et(t){return nt(t)?366:365}function nt(t){return t%4==0&&t%100!=0||t%400==0}function it(t,e,n,i,a,r,o){var s=new Date(t,e,n,i,a,r,o);return t<100&&t>=0&&isFinite(s.getFullYear())&&s.setFullYear(t),s}function at(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function rt(t,e,n){var i=7+e-n;return-((7+at(t,0,i).getUTCDay()-e)%7)+i-1}function ot(t,e,n,i,a){var r,o,s=1+7*(e-1)+(7+n-i)%7+rt(t,i,a);return s<=0?o=et(r=t-1)+s:s>et(t)?(r=t+1,o=s-et(t)):(r=t,o=s),{year:r,dayOfYear:o}}function st(t,e,n){var i,a,r=rt(t.year(),e,n),o=Math.floor((t.dayOfYear()-r-1)/7)+1;return o<1?i=o+lt(a=t.year()-1,e,n):o>lt(t.year(),e,n)?(i=o-lt(t.year(),e,n),a=t.year()+1):(a=t.year(),i=o),{week:i,year:a}}function lt(t,e,n){var i=rt(t,e,n),a=rt(t+1,e,n);return(et(t)-i+a)/7}function ut(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function dt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function ct(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=h([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(a=un.call(this._weekdaysParse,o))?a:null:"ddd"===e?-1!==(a=un.call(this._shortWeekdaysParse,o))?a:null:-1!==(a=un.call(this._minWeekdaysParse,o))?a:null:"dddd"===e?-1!==(a=un.call(this._weekdaysParse,o))?a:-1!==(a=un.call(this._shortWeekdaysParse,o))?a:-1!==(a=un.call(this._minWeekdaysParse,o))?a:null:"ddd"===e?-1!==(a=un.call(this._shortWeekdaysParse,o))?a:-1!==(a=un.call(this._weekdaysParse,o))?a:-1!==(a=un.call(this._minWeekdaysParse,o))?a:null:-1!==(a=un.call(this._minWeekdaysParse,o))?a:-1!==(a=un.call(this._weekdaysParse,o))?a:-1!==(a=un.call(this._shortWeekdaysParse,o))?a:null}function ht(){function t(t,e){return e.length-t.length}var e,n,i,a,r,o=[],s=[],l=[],u=[];for(e=0;e<7;e++)n=h([2e3,1]).day(e),i=this.weekdaysMin(n,""),a=this.weekdaysShort(n,""),r=this.weekdays(n,""),o.push(i),s.push(a),l.push(r),u.push(i),u.push(a),u.push(r);for(o.sort(t),s.sort(t),l.sort(t),u.sort(t),e=0;e<7;e++)s[e]=q(s[e]),l[e]=q(l[e]),u[e]=q(u[e]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function ft(){return this.hours()%12||12}function gt(t,e){N(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function mt(t,e){return e._meridiemParse}function pt(t){return t?t.toLowerCase().replace("_","-"):t}function vt(t){for(var e,n,i,a,r=0;r<t.length;){for(e=(a=pt(t[r]).split("-")).length,n=(n=pt(t[r+1]))?n.split("-"):null;e>0;){if(i=yt(a.slice(0,e).join("-")))return i;if(n&&n.length>=e&&k(a,n,!0)>=e-1)break;e--}r++}return null}function yt(n){var i=null;if(!Sn[n]&&void 0!==e&&e&&e.exports)try{i=kn._abbr,t("./locale/"+n),bt(i)}catch(t){}return Sn[n]}function bt(t,e){var n;return t&&(n=o(e)?_t(t):xt(t,e))&&(kn=n),kn._abbr}function xt(t,e){if(null!==e){var n=Mn;if(e.abbr=t,null!=Sn[t])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Sn[t]._config;else if(null!=e.parentLocale){if(null==Sn[e.parentLocale])return Dn[e.parentLocale]||(Dn[e.parentLocale]=[]),Dn[e.parentLocale].push({name:t,config:e}),null;n=Sn[e.parentLocale]._config}return Sn[t]=new P(C(n,e)),Dn[t]&&Dn[t].forEach(function(t){xt(t.name,t.config)}),bt(t),Sn[t]}return delete Sn[t],null}function _t(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return kn;if(!i(t)){if(e=yt(t))return e;t=[t]}return vt(t)}function kt(t){var e,n=t._a;return n&&-2===g(t).overflow&&(e=n[tn]<0||n[tn]>11?tn:n[en]<1||n[en]>J(n[$e],n[tn])?en:n[nn]<0||n[nn]>24||24===n[nn]&&(0!==n[an]||0!==n[rn]||0!==n[on])?nn:n[an]<0||n[an]>59?an:n[rn]<0||n[rn]>59?rn:n[on]<0||n[on]>999?on:-1,g(t)._overflowDayOfYear&&(e<$e||e>en)&&(e=en),g(t)._overflowWeeks&&-1===e&&(e=sn),g(t)._overflowWeekday&&-1===e&&(e=ln),g(t).overflow=e),t}function wt(t){var e,n,i,a,r,o,s=t._i,l=Cn.exec(s)||Pn.exec(s);if(l){for(g(t).iso=!0,e=0,n=An.length;e<n;e++)if(An[e][1].exec(l[1])){a=An[e][0],i=!1!==An[e][2];break}if(null==a)return void(t._isValid=!1);if(l[3]){for(e=0,n=In.length;e<n;e++)if(In[e][1].exec(l[3])){r=(l[2]||" ")+In[e][0];break}if(null==r)return void(t._isValid=!1)}if(!i&&null!=r)return void(t._isValid=!1);if(l[4]){if(!Tn.exec(l[4]))return void(t._isValid=!1);o="Z"}t._f=a+(r||"")+(o||""),At(t)}else t._isValid=!1}function Mt(t){var e,n,i,a,r,o,s,l,u={" GMT":" +0000"," EDT":" -0400"," EST":" -0500"," CDT":" -0500"," CST":" -0600"," MDT":" -0600"," MST":" -0700"," PDT":" -0700"," PST":" -0800"};if(e=t._i.replace(/\([^\)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s|\s$/g,""),n=Fn.exec(e)){if(i=n[1]?"ddd"+(5===n[1].length?", ":" "):"",a="D MMM "+(n[2].length>10?"YYYY ":"YY "),r="HH:mm"+(n[4]?":ss":""),n[1]){var d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][new Date(n[2]).getDay()];if(n[1].substr(0,3)!==d)return g(t).weekdayMismatch=!0,void(t._isValid=!1)}switch(n[5].length){case 2:s=0===l?" +0000":((l="YXWVUTSRQPONZABCDEFGHIKLM".indexOf(n[5][1].toUpperCase())-12)<0?" -":" +")+(""+l).replace(/^-?/,"0").match(/..$/)[0]+"00";break;case 4:s=u[n[5]];break;default:s=u[" GMT"]}n[5]=s,t._i=n.splice(1).join(""),o=" ZZ",t._f=i+a+r+o,At(t),g(t).rfc2822=!0}else t._isValid=!1}function St(t){var e=On.exec(t._i);null===e?(wt(t),!1===t._isValid&&(delete t._isValid,Mt(t),!1===t._isValid&&(delete t._isValid,n.createFromInputFallback(t)))):t._d=new Date(+e[1])}function Dt(t,e,n){return null!=t?t:null!=e?e:n}function Ct(t){var e=new Date(n.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Pt(t){var e,n,i,a,r=[];if(!t._d){for(i=Ct(t),t._w&&null==t._a[en]&&null==t._a[tn]&&Tt(t),null!=t._dayOfYear&&(a=Dt(t._a[$e],i[$e]),(t._dayOfYear>et(a)||0===t._dayOfYear)&&(g(t)._overflowDayOfYear=!0),n=at(a,0,t._dayOfYear),t._a[tn]=n.getUTCMonth(),t._a[en]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[nn]&&0===t._a[an]&&0===t._a[rn]&&0===t._a[on]&&(t._nextDay=!0,t._a[nn]=0),t._d=(t._useUTC?at:it).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[nn]=24)}}function Tt(t){var e,n,i,a,r,o,s,l;if(null!=(e=t._w).GG||null!=e.W||null!=e.E)r=1,o=4,n=Dt(e.GG,t._a[$e],st(Nt(),1,4).year),i=Dt(e.W,1),((a=Dt(e.E,1))<1||a>7)&&(l=!0);else{r=t._locale._week.dow,o=t._locale._week.doy;var u=st(Nt(),r,o);n=Dt(e.gg,t._a[$e],u.year),i=Dt(e.w,u.week),null!=e.d?((a=e.d)<0||a>6)&&(l=!0):null!=e.e?(a=e.e+r,(e.e<0||e.e>6)&&(l=!0)):a=r}i<1||i>lt(n,r,o)?g(t)._overflowWeeks=!0:null!=l?g(t)._overflowWeekday=!0:(s=ot(n,i,a,r,o),t._a[$e]=s.year,t._dayOfYear=s.dayOfYear)}function At(t){if(t._f!==n.ISO_8601)if(t._f!==n.RFC_2822){t._a=[],g(t).empty=!0;var e,i,a,r,o,s=""+t._i,l=s.length,u=0;for(a=H(t._f,t._locale).match(Ie)||[],e=0;e<a.length;e++)r=a[e],(i=(s.match(j(r,t))||[])[0])&&((o=s.substr(0,s.indexOf(i))).length>0&&g(t).unusedInput.push(o),s=s.slice(s.indexOf(i)+i.length),u+=i.length),Re[r]?(i?g(t).empty=!1:g(t).unusedTokens.push(r),X(r,i,t)):t._strict&&!i&&g(t).unusedTokens.push(r);g(t).charsLeftOver=l-u,s.length>0&&g(t).unusedInput.push(s),t._a[nn]<=12&&!0===g(t).bigHour&&t._a[nn]>0&&(g(t).bigHour=void 0),g(t).parsedDateParts=t._a.slice(0),g(t).meridiem=t._meridiem,t._a[nn]=It(t._locale,t._a[nn],t._meridiem),Pt(t),kt(t)}else Mt(t);else wt(t)}function It(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((i=t.isPM(n))&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function Ot(t){var e,n,i,a,r;if(0===t._f.length)return g(t).invalidFormat=!0,void(t._d=new Date(NaN));for(a=0;a<t._f.length;a++)r=0,e=v({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[a],At(e),m(e)&&(r+=g(e).charsLeftOver,r+=10*g(e).unusedTokens.length,g(e).score=r,(null==i||r<i)&&(i=r,n=e));c(t,n||e)}function Ft(t){if(!t._d){var e=I(t._i);t._a=u([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),Pt(t)}}function Rt(t){var e=new y(kt(Lt(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Lt(t){var e=t._i,n=t._f;return t._locale=t._locale||_t(t._l),null===e||void 0===n&&""===e?p({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),b(e)?new y(kt(e)):(l(e)?t._d=e:i(n)?Ot(t):n?At(t):Wt(t),m(t)||(t._d=null),t))}function Wt(t){var e=t._i;o(e)?t._d=new Date(n.now()):l(e)?t._d=new Date(e.valueOf()):"string"==typeof e?St(t):i(e)?(t._a=u(e.slice(0),function(t){return parseInt(t,10)}),Pt(t)):a(e)?Ft(t):s(e)?t._d=new Date(e):n.createFromInputFallback(t)}function Yt(t,e,n,o,s){var l={};return!0!==n&&!1!==n||(o=n,n=void 0),(a(t)&&r(t)||i(t)&&0===t.length)&&(t=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=n,l._i=t,l._f=e,l._strict=o,Rt(l)}function Nt(t,e,n,i){return Yt(t,e,n,i,!1)}function zt(t,e){var n,a;if(1===e.length&&i(e[0])&&(e=e[0]),!e.length)return Nt();for(n=e[0],a=1;a<e.length;++a)e[a].isValid()&&!e[a][t](n)||(n=e[a]);return n}function Bt(t){for(var e in t)if(-1===Wn.indexOf(e)||null!=t[e]&&isNaN(t[e]))return!1;for(var n=!1,i=0;i<Wn.length;++i)if(t[Wn[i]]){if(n)return!1;parseFloat(t[Wn[i]])!==_(t[Wn[i]])&&(n=!0)}return!0}function Vt(t){var e=I(t),n=e.year||0,i=e.quarter||0,a=e.month||0,r=e.week||0,o=e.day||0,s=e.hour||0,l=e.minute||0,u=e.second||0,d=e.millisecond||0;this._isValid=Bt(e),this._milliseconds=+d+1e3*u+6e4*l+1e3*s*60*60,this._days=+o+7*r,this._months=+a+3*i+12*n,this._data={},this._locale=_t(),this._bubble()}function Ht(t){return t instanceof Vt}function Et(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function jt(t,e){N(t,0,0,function(){var t=this.utcOffset(),n="+";return t<0&&(t=-t,n="-"),n+Y(~~(t/60),2)+e+Y(~~t%60,2)})}function Ut(t,e){var n=(e||"").match(t);if(null===n)return null;var i=((n[n.length-1]||[])+"").match(Yn)||["-",0,0],a=60*i[1]+_(i[2]);return 0===a?0:"+"===i[0]?a:-a}function qt(t,e){var i,a;return e._isUTC?(i=e.clone(),a=(b(t)||l(t)?t.valueOf():Nt(t).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+a),n.updateOffset(i,!1),i):Nt(t).local()}function Gt(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Zt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Xt(t,e){var n,i,a,r=t,o=null;return Ht(t)?r={ms:t._milliseconds,d:t._days,M:t._months}:s(t)?(r={},e?r[e]=t:r.milliseconds=t):(o=Nn.exec(t))?(n="-"===o[1]?-1:1,r={y:0,d:_(o[en])*n,h:_(o[nn])*n,m:_(o[an])*n,s:_(o[rn])*n,ms:_(Et(1e3*o[on]))*n}):(o=zn.exec(t))?(n="-"===o[1]?-1:1,r={y:Jt(o[2],n),M:Jt(o[3],n),w:Jt(o[4],n),d:Jt(o[5],n),h:Jt(o[6],n),m:Jt(o[7],n),s:Jt(o[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(a=Qt(Nt(r.from),Nt(r.to)),(r={}).ms=a.milliseconds,r.M=a.months),i=new Vt(r),Ht(t)&&d(t,"_locale")&&(i._locale=t._locale),i}function Jt(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Kt(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Qt(t,e){var n;return t.isValid()&&e.isValid()?(e=qt(e,t),t.isBefore(e)?n=Kt(t,e):((n=Kt(e,t)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function $t(t,e){return function(n,i){var a,r;return null===i||isNaN(+i)||(S(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=n,n=i,i=r),n="string"==typeof n?+n:n,a=Xt(n,i),te(this,a,t),this}}function te(t,e,i,a){var r=e._milliseconds,o=Et(e._days),s=Et(e._months);t.isValid()&&(a=null==a||a,r&&t._d.setTime(t._d.valueOf()+r*i),o&&W(t,"Date",L(t,"Date")+o*i),s&&Q(t,L(t,"Month")+s*i),a&&n.updateOffset(t,o||s))}function ee(t,e){var n,i=12*(e.year()-t.year())+(e.month()-t.month()),a=t.clone().add(i,"months");return n=e-a<0?(e-a)/(a-t.clone().add(i-1,"months")):(e-a)/(t.clone().add(i+1,"months")-a),-(i+n)||0}function ne(t){var e;return void 0===t?this._locale._abbr:(null!=(e=_t(t))&&(this._locale=e),this)}function ie(){return this._locale}function ae(t,e){N(0,[t,t.length],0,e)}function re(t,e,n,i,a){var r;return null==t?st(this,i,a).year:(r=lt(t,i,a),e>r&&(e=r),oe.call(this,t,e,n,i,a))}function oe(t,e,n,i,a){var r=ot(t,e,n,i,a),o=at(r.year,0,r.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function se(t){return t}function le(t,e,n,i){var a=_t(),r=h().set(i,e);return a[n](r,t)}function ue(t,e,n){if(s(t)&&(e=t,t=void 0),t=t||"",null!=e)return le(t,e,n,"month");var i,a=[];for(i=0;i<12;i++)a[i]=le(t,i,n,"month");return a}function de(t,e,n,i){"boolean"==typeof t?(s(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,s(e)&&(n=e,e=void 0),e=e||"");var a=_t(),r=t?a._week.dow:0;if(null!=n)return le(e,(n+r)%7,i,"day");var o,l=[];for(o=0;o<7;o++)l[o]=le(e,(o+r)%7,i,"day");return l}function ce(t,e,n,i){var a=Xt(e,n);return t._milliseconds+=i*a._milliseconds,t._days+=i*a._days,t._months+=i*a._months,t._bubble()}function he(t){return t<0?Math.floor(t):Math.ceil(t)}function fe(t){return 4800*t/146097}function ge(t){return 146097*t/4800}function me(t){return function(){return this.as(t)}}function pe(t){return function(){return this.isValid()?this._data[t]:NaN}}function ve(t,e,n,i,a){return a.relativeTime(e||1,!!n,t,i)}function ye(t,e,n){var i=Xt(t).abs(),a=hi(i.as("s")),r=hi(i.as("m")),o=hi(i.as("h")),s=hi(i.as("d")),l=hi(i.as("M")),u=hi(i.as("y")),d=a<=fi.ss&&["s",a]||a<fi.s&&["ss",a]||r<=1&&["m"]||r<fi.m&&["mm",r]||o<=1&&["h"]||o<fi.h&&["hh",o]||s<=1&&["d"]||s<fi.d&&["dd",s]||l<=1&&["M"]||l<fi.M&&["MM",l]||u<=1&&["y"]||["yy",u];return d[2]=e,d[3]=+t>0,d[4]=n,ve.apply(null,d)}function be(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,i=gi(this._milliseconds)/1e3,a=gi(this._days),r=gi(this._months);e=x((t=x(i/60))/60),i%=60,t%=60;var o=n=x(r/12),s=r%=12,l=a,u=e,d=t,c=i,h=this.asSeconds();return h?(h<0?"-":"")+"P"+(o?o+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||d||c?"T":"")+(u?u+"H":"")+(d?d+"M":"")+(c?c+"S":""):"P0D"}var xe,_e,ke=_e=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;i<n;i++)if(i in e&&t.call(this,e[i],i,e))return!0;return!1},we=n.momentProperties=[],Me=!1,Se={};n.suppressDeprecationWarnings=!1,n.deprecationHandler=null;var De,Ce,Pe=De=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)d(t,e)&&n.push(e);return n},Te={},Ae={},Ie=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Oe=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Fe={},Re={},Le=/\d/,We=/\d\d/,Ye=/\d{3}/,Ne=/\d{4}/,ze=/[+-]?\d{6}/,Be=/\d\d?/,Ve=/\d\d\d\d?/,He=/\d\d\d\d\d\d?/,Ee=/\d{1,3}/,je=/\d{1,4}/,Ue=/[+-]?\d{1,6}/,qe=/\d+/,Ge=/[+-]?\d+/,Ze=/Z|[+-]\d\d:?\d\d/gi,Xe=/Z|[+-]\d\d(?::?\d\d)?/gi,Je=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Ke={},Qe={},$e=0,tn=1,en=2,nn=3,an=4,rn=5,on=6,sn=7,ln=8,un=Ce=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};N("M",["MM",2],"Mo",function(){return this.month()+1}),N("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),N("MMMM",0,0,function(t){return this.localeData().months(this,t)}),T("month","M"),O("month",8),E("M",Be),E("MM",Be,We),E("MMM",function(t,e){return e.monthsShortRegex(t)}),E("MMMM",function(t,e){return e.monthsRegex(t)}),G(["M","MM"],function(t,e){e[tn]=_(t)-1}),G(["MMM","MMMM"],function(t,e,n,i){var a=n._locale.monthsParse(t,i,n._strict);null!=a?e[tn]=a:g(n).invalidMonth=t});var dn=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,cn="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),hn="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),fn=Je,gn=Je;N("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),N(0,["YY",2],0,function(){return this.year()%100}),N(0,["YYYY",4],0,"year"),N(0,["YYYYY",5],0,"year"),N(0,["YYYYYY",6,!0],0,"year"),T("year","y"),O("year",1),E("Y",Ge),E("YY",Be,We),E("YYYY",je,Ne),E("YYYYY",Ue,ze),E("YYYYYY",Ue,ze),G(["YYYYY","YYYYYY"],$e),G("YYYY",function(t,e){e[$e]=2===t.length?n.parseTwoDigitYear(t):_(t)}),G("YY",function(t,e){e[$e]=n.parseTwoDigitYear(t)}),G("Y",function(t,e){e[$e]=parseInt(t,10)}),n.parseTwoDigitYear=function(t){return _(t)+(_(t)>68?1900:2e3)};var mn=R("FullYear",!0);N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),T("week","w"),T("isoWeek","W"),O("week",5),O("isoWeek",5),E("w",Be),E("ww",Be,We),E("W",Be),E("WW",Be,We),Z(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=_(t)});N("d",0,"do","day"),N("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),N("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),N("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),T("day","d"),T("weekday","e"),T("isoWeekday","E"),O("day",11),O("weekday",11),O("isoWeekday",11),E("d",Be),E("e",Be),E("E",Be),E("dd",function(t,e){return e.weekdaysMinRegex(t)}),E("ddd",function(t,e){return e.weekdaysShortRegex(t)}),E("dddd",function(t,e){return e.weekdaysRegex(t)}),Z(["dd","ddd","dddd"],function(t,e,n,i){var a=n._locale.weekdaysParse(t,i,n._strict);null!=a?e.d=a:g(n).invalidWeekday=t}),Z(["d","e","E"],function(t,e,n,i){e[i]=_(t)});var pn="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),vn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),yn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),bn=Je,xn=Je,_n=Je;N("H",["HH",2],0,"hour"),N("h",["hh",2],0,ft),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+ft.apply(this)+Y(this.minutes(),2)}),N("hmmss",0,0,function(){return""+ft.apply(this)+Y(this.minutes(),2)+Y(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+Y(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+Y(this.minutes(),2)+Y(this.seconds(),2)}),gt("a",!0),gt("A",!1),T("hour","h"),O("hour",13),E("a",mt),E("A",mt),E("H",Be),E("h",Be),E("k",Be),E("HH",Be,We),E("hh",Be,We),E("kk",Be,We),E("hmm",Ve),E("hmmss",He),E("Hmm",Ve),E("Hmmss",He),G(["H","HH"],nn),G(["k","kk"],function(t,e,n){var i=_(t);e[nn]=24===i?0:i}),G(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),G(["h","hh"],function(t,e,n){e[nn]=_(t),g(n).bigHour=!0}),G("hmm",function(t,e,n){var i=t.length-2;e[nn]=_(t.substr(0,i)),e[an]=_(t.substr(i)),g(n).bigHour=!0}),G("hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[nn]=_(t.substr(0,i)),e[an]=_(t.substr(i,2)),e[rn]=_(t.substr(a)),g(n).bigHour=!0}),G("Hmm",function(t,e,n){var i=t.length-2;e[nn]=_(t.substr(0,i)),e[an]=_(t.substr(i))}),G("Hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[nn]=_(t.substr(0,i)),e[an]=_(t.substr(i,2)),e[rn]=_(t.substr(a))});var kn,wn=R("Hours",!0),Mn={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:cn,monthsShort:hn,week:{dow:0,doy:6},weekdays:pn,weekdaysMin:yn,weekdaysShort:vn,meridiemParse:/[ap]\.?m?\.?/i},Sn={},Dn={},Cn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Pn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Tn=/Z|[+-]\d\d(?::?\d\d)?/,An=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],In=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],On=/^\/?Date\((\-?\d+)/i,Fn=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;n.createFromInputFallback=M("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),n.ISO_8601=function(){},n.RFC_2822=function(){};var Rn=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:p()}),Ln=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Nt.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:p()}),Wn=["year","quarter","month","week","day","hour","minute","second","millisecond"];jt("Z",":"),jt("ZZ",""),E("Z",Xe),E("ZZ",Xe),G(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ut(Xe,t)});var Yn=/([\+\-]|\d\d)/gi;n.updateOffset=function(){};var Nn=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,zn=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Xt.fn=Vt.prototype,Xt.invalid=function(){return Xt(NaN)};var Bn=$t(1,"add"),Vn=$t(-1,"subtract");n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",n.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Hn=M("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});N(0,["gg",2],0,function(){return this.weekYear()%100}),N(0,["GG",2],0,function(){return this.isoWeekYear()%100}),ae("gggg","weekYear"),ae("ggggg","weekYear"),ae("GGGG","isoWeekYear"),ae("GGGGG","isoWeekYear"),T("weekYear","gg"),T("isoWeekYear","GG"),O("weekYear",1),O("isoWeekYear",1),E("G",Ge),E("g",Ge),E("GG",Be,We),E("gg",Be,We),E("GGGG",je,Ne),E("gggg",je,Ne),E("GGGGG",Ue,ze),E("ggggg",Ue,ze),Z(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=_(t)}),Z(["gg","GG"],function(t,e,i,a){e[a]=n.parseTwoDigitYear(t)}),N("Q",0,"Qo","quarter"),T("quarter","Q"),O("quarter",7),E("Q",Le),G("Q",function(t,e){e[tn]=3*(_(t)-1)}),N("D",["DD",2],"Do","date"),T("date","D"),O("date",9),E("D",Be),E("DD",Be,We),E("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),G(["D","DD"],en),G("Do",function(t,e){e[en]=_(t.match(Be)[0],10)});var En=R("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),T("dayOfYear","DDD"),O("dayOfYear",4),E("DDD",Ee),E("DDDD",Ye),G(["DDD","DDDD"],function(t,e,n){n._dayOfYear=_(t)}),N("m",["mm",2],0,"minute"),T("minute","m"),O("minute",14),E("m",Be),E("mm",Be,We),G(["m","mm"],an);var jn=R("Minutes",!1);N("s",["ss",2],0,"second"),T("second","s"),O("second",15),E("s",Be),E("ss",Be,We),G(["s","ss"],rn);var Un=R("Seconds",!1);N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return 10*this.millisecond()}),N(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),N(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),N(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),N(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),N(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),T("millisecond","ms"),O("millisecond",16),E("S",Ee,Le),E("SS",Ee,We),E("SSS",Ee,Ye);var qn;for(qn="SSSS";qn.length<=9;qn+="S")E(qn,qe);for(qn="S";qn.length<=9;qn+="S")G(qn,function(t,e){e[on]=_(1e3*("0."+t))});var Gn=R("Milliseconds",!1);N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");var Zn=y.prototype;Zn.add=Bn,Zn.calendar=function(t,e){var i=t||Nt(),a=qt(i,this).startOf("day"),r=n.calendarFormat(this,a)||"sameElse",o=e&&(D(e[r])?e[r].call(this,i):e[r]);return this.format(o||this.localeData().calendar(r,this,Nt(i)))},Zn.clone=function(){return new y(this)},Zn.diff=function(t,e,n){var i,a,r,o;return this.isValid()&&(i=qt(t,this)).isValid()?(a=6e4*(i.utcOffset()-this.utcOffset()),"year"===(e=A(e))||"month"===e||"quarter"===e?(o=ee(this,i),"quarter"===e?o/=3:"year"===e&&(o/=12)):(r=this-i,o="second"===e?r/1e3:"minute"===e?r/6e4:"hour"===e?r/36e5:"day"===e?(r-a)/864e5:"week"===e?(r-a)/6048e5:r),n?o:x(o)):NaN},Zn.endOf=function(t){return void 0===(t=A(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))},Zn.format=function(t){t||(t=this.isUtc()?n.defaultFormatUtc:n.defaultFormat);var e=V(this,t);return this.localeData().postformat(e)},Zn.from=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||Nt(t).isValid())?Xt({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Zn.fromNow=function(t){return this.from(Nt(),t)},Zn.to=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||Nt(t).isValid())?Xt({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Zn.toNow=function(t){return this.to(Nt(),t)},Zn.get=function(t){return t=A(t),D(this[t])?this[t]():this},Zn.invalidAt=function(){return g(this).overflow},Zn.isAfter=function(t,e){var n=b(t)?t:Nt(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=A(o(e)?"millisecond":e))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf())},Zn.isBefore=function(t,e){var n=b(t)?t:Nt(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=A(o(e)?"millisecond":e))?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf())},Zn.isBetween=function(t,e,n,i){return("("===(i=i||"()")[0]?this.isAfter(t,n):!this.isBefore(t,n))&&(")"===i[1]?this.isBefore(e,n):!this.isAfter(e,n))},Zn.isSame=function(t,e){var n,i=b(t)?t:Nt(t);return!(!this.isValid()||!i.isValid())&&("millisecond"===(e=A(e||"millisecond"))?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(e).valueOf()<=n&&n<=this.clone().endOf(e).valueOf()))},Zn.isSameOrAfter=function(t,e){return this.isSame(t,e)||this.isAfter(t,e)},Zn.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)},Zn.isValid=function(){return m(this)},Zn.lang=Hn,Zn.locale=ne,Zn.localeData=ie,Zn.max=Ln,Zn.min=Rn,Zn.parsingFlags=function(){return c({},g(this))},Zn.set=function(t,e){if("object"==typeof t)for(var n=F(t=I(t)),i=0;i<n.length;i++)this[n[i].unit](t[n[i].unit]);else if(t=A(t),D(this[t]))return this[t](e);return this},Zn.startOf=function(t){switch(t=A(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this},Zn.subtract=Vn,Zn.toArray=function(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]},Zn.toObject=function(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}},Zn.toDate=function(){return new Date(this.valueOf())},Zn.toISOString=function(){if(!this.isValid())return null;var t=this.clone().utc();return t.year()<0||t.year()>9999?V(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):D(Date.prototype.toISOString)?this.toDate().toISOString():V(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},Zn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a=e+'[")]';return this.format(n+i+"-MM-DD[T]HH:mm:ss.SSS"+a)},Zn.toJSON=function(){return this.isValid()?this.toISOString():null},Zn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Zn.unix=function(){return Math.floor(this.valueOf()/1e3)},Zn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Zn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Zn.year=mn,Zn.isLeapYear=function(){return nt(this.year())},Zn.weekYear=function(t){return re.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Zn.isoWeekYear=function(t){return re.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)},Zn.quarter=Zn.quarters=function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},Zn.month=$,Zn.daysInMonth=function(){return J(this.year(),this.month())},Zn.week=Zn.weeks=function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},Zn.isoWeek=Zn.isoWeeks=function(t){var e=st(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},Zn.weeksInYear=function(){var t=this.localeData()._week;return lt(this.year(),t.dow,t.doy)},Zn.isoWeeksInYear=function(){return lt(this.year(),1,4)},Zn.date=En,Zn.day=Zn.days=function(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=ut(t,this.localeData()),this.add(t-e,"d")):e},Zn.weekday=function(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},Zn.isoWeekday=function(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=dt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7},Zn.dayOfYear=function(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},Zn.hour=Zn.hours=wn,Zn.minute=Zn.minutes=jn,Zn.second=Zn.seconds=Un,Zn.millisecond=Zn.milliseconds=Gn,Zn.utcOffset=function(t,e,i){var a,r=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(null===(t=Ut(Xe,t)))return this}else Math.abs(t)<16&&!i&&(t*=60);return!this._isUTC&&e&&(a=Gt(this)),this._offset=t,this._isUTC=!0,null!=a&&this.add(a,"m"),r!==t&&(!e||this._changeInProgress?te(this,Xt(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,n.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?r:Gt(this)},Zn.utc=function(t){return this.utcOffset(0,t)},Zn.local=function(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Gt(this),"m")),this},Zn.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var t=Ut(Ze,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this},Zn.hasAlignedHourOffset=function(t){return!!this.isValid()&&(t=t?Nt(t).utcOffset():0,(this.utcOffset()-t)%60==0)},Zn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Zn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Zn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Zn.isUtc=Zt,Zn.isUTC=Zt,Zn.zoneAbbr=function(){return this._isUTC?"UTC":""},Zn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Zn.dates=M("dates accessor is deprecated. Use date instead.",En),Zn.months=M("months accessor is deprecated. Use month instead",$),Zn.years=M("years accessor is deprecated. Use year instead",mn),Zn.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}),Zn.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var t={};if(v(t,this),(t=Lt(t))._a){var e=t._isUTC?h(t._a):Nt(t._a);this._isDSTShifted=this.isValid()&&k(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted});var Xn=P.prototype;Xn.calendar=function(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return D(i)?i.call(e,n):i},Xn.longDateFormat=function(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])},Xn.invalidDate=function(){return this._invalidDate},Xn.ordinal=function(t){return this._ordinal.replace("%d",t)},Xn.preparse=se,Xn.postformat=se,Xn.relativeTime=function(t,e,n,i){var a=this._relativeTime[n];return D(a)?a(t,e,n,i):a.replace(/%d/i,t)},Xn.pastFuture=function(t,e){var n=this._relativeTime[t>0?"future":"past"];return D(n)?n(e):n.replace(/%s/i,e)},Xn.set=function(t){var e,n;for(n in t)D(e=t[n])?this[n]=e:this["_"+n]=e;this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Xn.months=function(t,e){return t?i(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||dn).test(e)?"format":"standalone"][t.month()]:i(this._months)?this._months:this._months.standalone},Xn.monthsShort=function(t,e){return t?i(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[dn.test(e)?"format":"standalone"][t.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Xn.monthsParse=function(t,e,n){var i,a,r;if(this._monthsParseExact)return K.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(a=h([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(r="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[i].test(t))return i;if(n&&"MMM"===e&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}},Xn.monthsRegex=function(t){return this._monthsParseExact?(d(this,"_monthsRegex")||tt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=gn),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)},Xn.monthsShortRegex=function(t){return this._monthsParseExact?(d(this,"_monthsRegex")||tt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=fn),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)},Xn.week=function(t){return st(t,this._week.dow,this._week.doy).week},Xn.firstDayOfYear=function(){return this._week.doy},Xn.firstDayOfWeek=function(){return this._week.dow},Xn.weekdays=function(t,e){return t?i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone},Xn.weekdaysMin=function(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin},Xn.weekdaysShort=function(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort},Xn.weekdaysParse=function(t,e,n){var i,a,r;if(this._weekdaysParseExact)return ct.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(a=h([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(a,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(a,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(a,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}},Xn.weekdaysRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=bn),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)},Xn.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=xn),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Xn.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ht.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=_n),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Xn.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},Xn.meridiem=function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},bt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===_(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),n.lang=M("moment.lang is deprecated. Use moment.locale instead.",bt),n.langData=M("moment.langData is deprecated. Use moment.localeData instead.",_t);var Jn=Math.abs,Kn=me("ms"),Qn=me("s"),$n=me("m"),ti=me("h"),ei=me("d"),ni=me("w"),ii=me("M"),ai=me("y"),ri=pe("milliseconds"),oi=pe("seconds"),si=pe("minutes"),li=pe("hours"),ui=pe("days"),di=pe("months"),ci=pe("years"),hi=Math.round,fi={ss:44,s:45,m:45,h:22,d:26,M:11},gi=Math.abs,mi=Vt.prototype;return mi.isValid=function(){return this._isValid},mi.abs=function(){var t=this._data;return this._milliseconds=Jn(this._milliseconds),this._days=Jn(this._days),this._months=Jn(this._months),t.milliseconds=Jn(t.milliseconds),t.seconds=Jn(t.seconds),t.minutes=Jn(t.minutes),t.hours=Jn(t.hours),t.months=Jn(t.months),t.years=Jn(t.years),this},mi.add=function(t,e){return ce(this,t,e,1)},mi.subtract=function(t,e){return ce(this,t,e,-1)},mi.as=function(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if("month"===(t=A(t))||"year"===t)return e=this._days+i/864e5,n=this._months+fe(e),"month"===t?n:n/12;switch(e=this._days+Math.round(ge(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}},mi.asMilliseconds=Kn,mi.asSeconds=Qn,mi.asMinutes=$n,mi.asHours=ti,mi.asDays=ei,mi.asWeeks=ni,mi.asMonths=ii,mi.asYears=ai,mi.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12):NaN},mi._bubble=function(){var t,e,n,i,a,r=this._milliseconds,o=this._days,s=this._months,l=this._data;return r>=0&&o>=0&&s>=0||r<=0&&o<=0&&s<=0||(r+=864e5*he(ge(s)+o),o=0,s=0),l.milliseconds=r%1e3,t=x(r/1e3),l.seconds=t%60,e=x(t/60),l.minutes=e%60,n=x(e/60),l.hours=n%24,o+=x(n/24),a=x(fe(o)),s+=a,o-=he(ge(a)),i=x(s/12),s%=12,l.days=o,l.months=s,l.years=i,this},mi.get=function(t){return t=A(t),this.isValid()?this[t+"s"]():NaN},mi.milliseconds=ri,mi.seconds=oi,mi.minutes=si,mi.hours=li,mi.days=ui,mi.weeks=function(){return x(this.days()/7)},mi.months=di,mi.years=ci,mi.humanize=function(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),n=ye(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)},mi.toISOString=be,mi.toString=be,mi.toJSON=be,mi.locale=ne,mi.localeData=ie,mi.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",be),mi.lang=Hn,N("X",0,0,"unix"),N("x",0,0,"valueOf"),E("x",Ge),E("X",/[+-]?\d+(\.\d{1,3})?/),G("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),G("x",function(t,e,n){n._d=new Date(_(t))}),n.version="2.18.1",function(t){xe=t}(Nt),n.fn=Zn,n.min=function(){return zt("isBefore",[].slice.call(arguments,0))},n.max=function(){return zt("isAfter",[].slice.call(arguments,0))},n.now=function(){return Date.now?Date.now():+new Date},n.utc=h,n.unix=function(t){return Nt(1e3*t)},n.months=function(t,e){return ue(t,e,"months")},n.isDate=l,n.locale=bt,n.invalid=p,n.duration=Xt,n.isMoment=b,n.weekdays=function(t,e,n){return de(t,e,n,"weekdays")},n.parseZone=function(){return Nt.apply(null,arguments).parseZone()},n.localeData=_t,n.isDuration=Ht,n.monthsShort=function(t,e){return ue(t,e,"monthsShort")},n.weekdaysMin=function(t,e,n){return de(t,e,n,"weekdaysMin")},n.defineLocale=xt,n.updateLocale=function(t,e){if(null!=e){var n,i=Mn;null!=Sn[t]&&(i=Sn[t]._config),(n=new P(e=C(i,e))).parentLocale=Sn[t],Sn[t]=n,bt(t)}else null!=Sn[t]&&(null!=Sn[t].parentLocale?Sn[t]=Sn[t].parentLocale:null!=Sn[t]&&delete Sn[t]);return Sn[t]},n.locales=function(){return Pe(Sn)},n.weekdaysShort=function(t,e,n){return de(t,e,n,"weekdaysShort")},n.normalizeUnits=A,n.relativeTimeRounding=function(t){return void 0===t?hi:"function"==typeof t&&(hi=t,!0)},n.relativeTimeThreshold=function(t,e){return void 0!==fi[t]&&(void 0===e?fi[t]:(fi[t]=e,"s"===t&&(fi.ss=e-1),!0))},n.calendarFormat=function(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},n.prototype=Zn,n})},{}],7:[function(t,e,n){var i=t(29)();i.helpers=t(45),t(27)(i),i.defaults=t(25),i.Element=t(26),i.elements=t(40),i.Interaction=t(28),i.platform=t(48),t(31)(i),t(22)(i),t(23)(i),t(24)(i),t(30)(i),t(33)(i),t(32)(i),t(35)(i),t(54)(i),t(52)(i),t(53)(i),t(55)(i),t(56)(i),t(57)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(21)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i);var a=[];a.push(t(49)(i),t(50)(i),t(51)(i)),i.plugins.register(a),i.platform.initialize(),e.exports=i,"undefined"!=typeof window&&(window.Chart=i),i.canvasHelpers=i.helpers.canvas},{10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,35:35,40:40,45:45,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,8:8,9:9}],8:[function(t,e,n){"use strict";e.exports=function(t){t.Bar=function(e,n){return n.type="bar",new t(e,n)}}},{}],9:[function(t,e,n){"use strict";e.exports=function(t){t.Bubble=function(e,n){return n.type="bubble",new t(e,n)}}},{}],10:[function(t,e,n){"use strict";e.exports=function(t){t.Doughnut=function(e,n){return n.type="doughnut",new t(e,n)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t){t.Line=function(e,n){return n.type="line",new t(e,n)}}},{}],12:[function(t,e,n){"use strict";e.exports=function(t){t.PolarArea=function(e,n){return n.type="polarArea",new t(e,n)}}},{}],13:[function(t,e,n){"use strict";e.exports=function(t){t.Radar=function(e,n){return n.type="radar",new t(e,n)}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t){t.Scatter=function(e,n){return n.type="scatter",new t(e,n)}}},{}],15:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("bar",{hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}}),i._set("horizontalBar",{hover:{mode:"index",axis:"y"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var n="";return t.length>0&&(t[0].yLabel?n=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(n=e.labels[t[0].index])),n},label:function(t,e){return(e.datasets[t.datasetIndex].label||"")+": "+t.xLabel}},mode:"index",axis:"y"}}),e.exports=function(t){t.controllers.bar=t.DatasetController.extend({dataElementType:a.Rectangle,initialize:function(){var e,n=this;t.DatasetController.prototype.initialize.apply(n,arguments),(e=n.getMeta()).stack=n.getDataset().stack,e.bar=!0},update:function(t){var e,n,i=this,a=i.getMeta().data;for(i._ruler=i.getRuler(),e=0,n=a.length;e<n;++e)i.updateElement(a[e],e,t)},updateElement:function(t,e,n){var i=this,a=i.chart,o=i.getMeta(),s=i.getDataset(),l=t.custom||{},u=a.options.elements.rectangle;t._xScale=i.getScaleForId(o.xAxisID),t._yScale=i.getScaleForId(o.yAxisID),t._datasetIndex=i.index,t._index=e,t._model={datasetLabel:s.label,label:a.data.labels[e],borderSkipped:l.borderSkipped?l.borderSkipped:u.borderSkipped,backgroundColor:l.backgroundColor?l.backgroundColor:r.valueAtIndexOrDefault(s.backgroundColor,e,u.backgroundColor),borderColor:l.borderColor?l.borderColor:r.valueAtIndexOrDefault(s.borderColor,e,u.borderColor),borderWidth:l.borderWidth?l.borderWidth:r.valueAtIndexOrDefault(s.borderWidth,e,u.borderWidth)},i.updateElementGeometry(t,e,n),t.pivot()},updateElementGeometry:function(t,e,n){var i=this,a=t._model,r=i.getValueScale(),o=r.getBasePixel(),s=r.isHorizontal(),l=i._ruler||i.getRuler(),u=i.calculateBarValuePixels(i.index,e),d=i.calculateBarIndexPixels(i.index,e,l);a.horizontal=s,a.base=n?o:u.base,a.x=s?n?o:u.head:d.center,a.y=s?d.center:n?o:u.head,a.height=s?d.size:void 0,a.width=s?void 0:d.size},getValueScaleId:function(){return this.getMeta().yAxisID},getIndexScaleId:function(){return this.getMeta().xAxisID},getValueScale:function(){return this.getScaleForId(this.getValueScaleId())},getIndexScale:function(){return this.getScaleForId(this.getIndexScaleId())},getStackCount:function(t){var e,n,i=this,a=i.chart,r=i.getIndexScale().options.stacked,o=void 0===t?a.data.datasets.length:t+1,s=[];for(e=0;e<o;++e)(n=a.getDatasetMeta(e)).bar&&a.isDatasetVisible(e)&&(!1===r||!0===r&&-1===s.indexOf(n.stack)||void 0===r&&(void 0===n.stack||-1===s.indexOf(n.stack)))&&s.push(n.stack);return s.length},getStackIndex:function(t){return this.getStackCount(t)-1},getRuler:function(){var t,e,n=this,i=n.getIndexScale(),a=n.getStackCount(),r=n.index,o=[],s=i.isHorizontal(),l=s?i.left:i.top,u=l+(s?i.width:i.height);for(t=0,e=n.getMeta().data.length;t<e;++t)o.push(i.getPixelForValue(null,t,r));return{pixels:o,start:l,end:u,stackCount:a,scale:i}},calculateBarValuePixels:function(t,e){var n,i,a,r,o,s,l=this,u=l.chart,d=l.getMeta(),c=l.getValueScale(),h=u.data.datasets,f=c.getRightValue(h[t].data[e]),g=c.options.stacked,m=d.stack,p=0;if(g||void 0===g&&void 0!==m)for(n=0;n<t;++n)(i=u.getDatasetMeta(n)).bar&&i.stack===m&&i.controller.getValueScaleId()===c.id&&u.isDatasetVisible(n)&&(a=c.getRightValue(h[n].data[e]),(f<0&&a<0||f>=0&&a>0)&&(p+=a));return r=c.getPixelForValue(p),o=c.getPixelForValue(p+f),s=(o-r)/2,{size:s,base:r,head:o,center:o+s/2}},calculateBarIndexPixels:function(t,e,n){var i,a,o,s,l,u,d=this,c=n.scale.options,h=d.getStackIndex(t),f=n.pixels,g=f[e],m=f.length,p=n.start,v=n.end;return 1===m?(i=g>p?g-p:v-g,a=g<v?v-g:g-p):(e>0&&(i=(g-f[e-1])/2,e===m-1&&(a=i)),e<m-1&&(a=(f[e+1]-g)/2,0===e&&(i=a))),o=i*c.categoryPercentage,s=a*c.categoryPercentage,l=(o+s)/n.stackCount,u=l*c.barPercentage,u=Math.min(r.valueOrDefault(c.barThickness,u),r.valueOrDefault(c.maxBarThickness,1/0)),g-=o,g+=l*h,g+=(l-u)/2,{size:u,base:g,head:g+u,center:g+u/2}},draw:function(){var t=this,e=t.chart,n=t.getValueScale(),i=t.getMeta().data,a=t.getDataset(),o=i.length,s=0;for(r.canvas.clipArea(e.ctx,e.chartArea);s<o;++s)isNaN(n.getRightValue(a.data[s]))||i[s].draw();r.canvas.unclipArea(e.ctx)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model;a.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:r.valueAtIndexOrDefault(e.hoverBackgroundColor,n,r.getHoverColor(a.backgroundColor)),a.borderColor=i.hoverBorderColor?i.hoverBorderColor:r.valueAtIndexOrDefault(e.hoverBorderColor,n,r.getHoverColor(a.borderColor)),a.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:r.valueAtIndexOrDefault(e.hoverBorderWidth,n,a.borderWidth)},removeHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model,o=this.chart.options.elements.rectangle;a.backgroundColor=i.backgroundColor?i.backgroundColor:r.valueAtIndexOrDefault(e.backgroundColor,n,o.backgroundColor),a.borderColor=i.borderColor?i.borderColor:r.valueAtIndexOrDefault(e.borderColor,n,o.borderColor),a.borderWidth=i.borderWidth?i.borderWidth:r.valueAtIndexOrDefault(e.borderWidth,n,o.borderWidth)}}),t.controllers.horizontalBar=t.controllers.bar.extend({getValueScaleId:function(){return this.getMeta().xAxisID},getIndexScaleId:function(){return this.getMeta().yAxisID}})}},{25:25,40:40,45:45}],16:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("bubble",{hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var n=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return n+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}}),e.exports=function(t){t.controllers.bubble=t.DatasetController.extend({dataElementType:a.Point,update:function(t){var e=this,n=e.getMeta().data;r.each(n,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){var i=this,a=i.getMeta(),r=t.custom||{},o=i.getScaleForId(a.xAxisID),s=i.getScaleForId(a.yAxisID),l=i._resolveElementOptions(t,e),u=i.getDataset().data[e],d=i.index,c=n?o.getPixelForDecimal(.5):o.getPixelForValue("object"==typeof u?u:NaN,e,d),h=n?s.getBasePixel():s.getPixelForValue(u,e,d);t._xScale=o,t._yScale=s,t._options=l,t._datasetIndex=d,t._index=e,t._model={backgroundColor:l.backgroundColor,borderColor:l.borderColor,borderWidth:l.borderWidth,hitRadius:l.hitRadius,pointStyle:l.pointStyle,radius:n?0:l.radius,skip:r.skip||isNaN(c)||isNaN(h),x:c,y:h},t.pivot()},setHoverStyle:function(t){var e=t._model,n=t._options;e.backgroundColor=r.valueOrDefault(n.hoverBackgroundColor,r.getHoverColor(n.backgroundColor)),e.borderColor=r.valueOrDefault(n.hoverBorderColor,r.getHoverColor(n.borderColor)),e.borderWidth=r.valueOrDefault(n.hoverBorderWidth,n.borderWidth),e.radius=n.radius+n.hoverRadius},removeHoverStyle:function(t){var e=t._model,n=t._options;e.backgroundColor=n.backgroundColor,e.borderColor=n.borderColor,e.borderWidth=n.borderWidth,e.radius=n.radius},_resolveElementOptions:function(t,e){var n,i,a,o=this,s=o.chart,l=s.data.datasets[o.index],u=t.custom||{},d=s.options.elements.point,c=r.options.resolve,h=l.data[e],f={},g={chart:s,dataIndex:e,dataset:l,datasetIndex:o.index},m=["backgroundColor","borderColor","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","pointStyle"];for(n=0,i=m.length;n<i;++n)f[a=m[n]]=c([u[a],l[a],d[a]],g,e);return f.radius=c([u.radius,h?h.r:void 0,l.radius,d.radius],g,e),f}})}},{25:25,40:40,45:45}],17:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("doughnut",{animation:{animateRotate:!0,animateScale:!1},hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),o=e.datasets[0],s=a.data[i],l=s&&s.custom||{},u=r.valueAtIndexOrDefault,d=t.options.elements.arc;return{text:n,fillStyle:l.backgroundColor?l.backgroundColor:u(o.backgroundColor,i,d.backgroundColor),strokeStyle:l.borderColor?l.borderColor:u(o.borderColor,i,d.borderColor),lineWidth:l.borderWidth?l.borderWidth:u(o.borderWidth,i,d.borderWidth),hidden:isNaN(o.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)(a=o.getDatasetMeta(n)).data[r]&&(a.data[r].hidden=!a.data[r].hidden);o.update()}},cutoutPercentage:50,rotation:-.5*Math.PI,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,e){var n=e.labels[t.index],i=": "+e.datasets[t.datasetIndex].data[t.index];return r.isArray(n)?(n=n.slice())[0]+=i:n+=i,n}}}}),i._set("pie",r.clone(i.doughnut)),i._set("pie",{cutoutPercentage:0}),e.exports=function(t){t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:a.Arc,linkScales:r.noop,getRingIndex:function(t){for(var e=0,n=0;n<t;++n)this.chart.isDatasetVisible(n)&&++e;return e},update:function(t){var e=this,n=e.chart,i=n.chartArea,a=n.options,o=a.elements.arc,s=i.right-i.left-o.borderWidth,l=i.bottom-i.top-o.borderWidth,u=Math.min(s,l),d={x:0,y:0},c=e.getMeta(),h=a.cutoutPercentage,f=a.circumference;if(f<2*Math.PI){var g=a.rotation%(2*Math.PI),m=(g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0))+f,p={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(m),y:Math.sin(m)},y=g<=0&&m>=0||g<=2*Math.PI&&2*Math.PI<=m,b=g<=.5*Math.PI&&.5*Math.PI<=m||g<=2.5*Math.PI&&2.5*Math.PI<=m,x=g<=-Math.PI&&-Math.PI<=m||g<=Math.PI&&Math.PI<=m,_=g<=.5*-Math.PI&&.5*-Math.PI<=m||g<=1.5*Math.PI&&1.5*Math.PI<=m,k=h/100,w={x:x?-1:Math.min(p.x*(p.x<0?1:k),v.x*(v.x<0?1:k)),y:_?-1:Math.min(p.y*(p.y<0?1:k),v.y*(v.y<0?1:k))},M={x:y?1:Math.max(p.x*(p.x>0?1:k),v.x*(v.x>0?1:k)),y:b?1:Math.max(p.y*(p.y>0?1:k),v.y*(v.y>0?1:k))},S={width:.5*(M.x-w.x),height:.5*(M.y-w.y)};u=Math.min(s/S.width,l/S.height),d={x:-.5*(M.x+w.x),y:-.5*(M.y+w.y)}}n.borderWidth=e.getMaxBorderWidth(c.data),n.outerRadius=Math.max((u-n.borderWidth)/2,0),n.innerRadius=Math.max(h?n.outerRadius/100*h:0,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),n.offsetX=d.x*n.outerRadius,n.offsetY=d.y*n.outerRadius,c.total=e.calculateTotal(),e.outerRadius=n.outerRadius-n.radiusLength*e.getRingIndex(e.index),e.innerRadius=Math.max(e.outerRadius-n.radiusLength,0),r.each(c.data,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){var i=this,a=i.chart,o=a.chartArea,s=a.options,l=s.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,c=s.rotation,h=s.rotation,f=i.getDataset(),g=n&&l.animateRotate?0:t.hidden?0:i.calculateCircumference(f.data[e])*(s.circumference/(2*Math.PI)),m=n&&l.animateScale?0:i.innerRadius,p=n&&l.animateScale?0:i.outerRadius,v=r.valueAtIndexOrDefault;r.extend(t,{_datasetIndex:i.index,_index:e,_model:{x:u+a.offsetX,y:d+a.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:p,innerRadius:m,label:v(f.label,e,a.data.labels[e])}});var y=t._model;this.removeHoverStyle(t),n&&l.animateRotate||(y.startAngle=0===e?s.rotation:i.getMeta().data[e-1]._model.endAngle,y.endAngle=y.startAngle+y.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,e=this.getDataset(),n=this.getMeta(),i=0;return r.each(n.data,function(n,a){t=e.data[a],isNaN(t)||n.hidden||(i+=Math.abs(t))}),i},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,n,i=0,a=this.index,r=t.length,o=0;o<r;o++)e=t[o]._model?t[o]._model.borderWidth:0,i=(n=t[o]._chart?t[o]._chart.config.data.datasets[a].hoverBorderWidth:0)>(i=e>i?e:i)?n:i;return i}})}},{25:25,40:40,45:45}],18:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("line",{showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}}),e.exports=function(t){function e(t,e){return r.valueOrDefault(t.showLine,e.showLines)}t.controllers.line=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,update:function(t){var n,i,a,o=this,s=o.getMeta(),l=s.dataset,u=s.data||[],d=o.chart.options,c=d.elements.line,h=o.getScaleForId(s.yAxisID),f=o.getDataset(),g=e(f,d);for(g&&(a=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=o.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:a.tension?a.tension:r.valueOrDefault(f.lineTension,c.tension),backgroundColor:a.backgroundColor?a.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:a.borderWidth?a.borderWidth:f.borderWidth||c.borderWidth,borderColor:a.borderColor?a.borderColor:f.borderColor||c.borderColor,borderCapStyle:a.borderCapStyle?a.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:a.borderDash?a.borderDash:f.borderDash||c.borderDash,borderDashOffset:a.borderDashOffset?a.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:a.borderJoinStyle?a.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:a.fill?a.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:a.steppedLine?a.steppedLine:r.valueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:a.cubicInterpolationMode?a.cubicInterpolationMode:r.valueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode)},l.pivot()),n=0,i=u.length;n<i;++n)o.updateElement(u[n],n,t);for(g&&0!==l._model.tension&&o.updateBezierControlPoints(),n=0,i=u.length;n<i;++n)u[n].pivot()},getPointBackgroundColor:function(t,e){var n=this.chart.options.elements.point.backgroundColor,i=this.getDataset(),a=t.custom||{};return a.backgroundColor?n=a.backgroundColor:i.pointBackgroundColor?n=r.valueAtIndexOrDefault(i.pointBackgroundColor,e,n):i.backgroundColor&&(n=i.backgroundColor),n},getPointBorderColor:function(t,e){var n=this.chart.options.elements.point.borderColor,i=this.getDataset(),a=t.custom||{};return a.borderColor?n=a.borderColor:i.pointBorderColor?n=r.valueAtIndexOrDefault(i.pointBorderColor,e,n):i.borderColor&&(n=i.borderColor),n},getPointBorderWidth:function(t,e){var n=this.chart.options.elements.point.borderWidth,i=this.getDataset(),a=t.custom||{};return isNaN(a.borderWidth)?!isNaN(i.pointBorderWidth)||r.isArray(i.pointBorderWidth)?n=r.valueAtIndexOrDefault(i.pointBorderWidth,e,n):isNaN(i.borderWidth)||(n=i.borderWidth):n=a.borderWidth,n},updateElement:function(t,e,n){var i,a,o=this,s=o.getMeta(),l=t.custom||{},u=o.getDataset(),d=o.index,c=u.data[e],h=o.getScaleForId(s.yAxisID),f=o.getScaleForId(s.xAxisID),g=o.chart.options.elements.point;void 0!==u.radius&&void 0===u.pointRadius&&(u.pointRadius=u.radius),void 0!==u.hitRadius&&void 0===u.pointHitRadius&&(u.pointHitRadius=u.hitRadius),i=f.getPixelForValue("object"==typeof c?c:NaN,e,d),a=n?h.getBasePixel():o.calculatePointY(c,e,d),t._xScale=f,t._yScale=h,t._datasetIndex=d,t._index=e,t._model={x:i,y:a,skip:l.skip||isNaN(i)||isNaN(a),radius:l.radius||r.valueAtIndexOrDefault(u.pointRadius,e,g.radius),pointStyle:l.pointStyle||r.valueAtIndexOrDefault(u.pointStyle,e,g.pointStyle),backgroundColor:o.getPointBackgroundColor(t,e),borderColor:o.getPointBorderColor(t,e),borderWidth:o.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||r.valueAtIndexOrDefault(u.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,n){var i,a,r,o=this,s=o.chart,l=o.getMeta(),u=o.getScaleForId(l.yAxisID),d=0,c=0;if(u.options.stacked){for(i=0;i<n;i++)if(a=s.data.datasets[i],"line"===(r=s.getDatasetMeta(i)).type&&r.yAxisID===u.id&&s.isDatasetVisible(i)){var h=Number(u.getRightValue(a.data[e]));h<0?c+=h||0:d+=h||0}var f=Number(u.getRightValue(t));return f<0?u.getPixelForValue(c+f):u.getPixelForValue(d+f)}return u.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,n){return Math.max(Math.min(t,n),e)}var e,n,i,a,o=this,s=o.getMeta(),l=o.chart.chartArea,u=s.data||[];if(s.dataset._model.spanGaps&&(u=u.filter(function(t){return!t._model.skip})),"monotone"===s.dataset._model.cubicInterpolationMode)r.splineCurveMonotone(u);else for(e=0,n=u.length;e<n;++e)i=u[e]._model,a=r.splineCurve(r.previousItem(u,e)._model,i,r.nextItem(u,e)._model,s.dataset._model.tension),i.controlPointPreviousX=a.previous.x,i.controlPointPreviousY=a.previous.y,i.controlPointNextX=a.next.x,i.controlPointNextY=a.next.y;if(o.chart.options.elements.line.capBezierPoints)for(e=0,n=u.length;e<n;++e)(i=u[e]._model).controlPointPreviousX=t(i.controlPointPreviousX,l.left,l.right),i.controlPointPreviousY=t(i.controlPointPreviousY,l.top,l.bottom),i.controlPointNextX=t(i.controlPointNextX,l.left,l.right),i.controlPointNextY=t(i.controlPointNextY,l.top,l.bottom)},draw:function(){var t=this,n=t.chart,i=t.getMeta(),a=i.data||[],o=n.chartArea,s=a.length,l=0;for(r.canvas.clipArea(n.ctx,o),e(t.getDataset(),n.options)&&i.dataset.draw(),r.canvas.unclipArea(n.ctx);l<s;++l)a[l].draw(o)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,i=t.custom||{},a=t._model;a.radius=i.hoverRadius||r.valueAtIndexOrDefault(e.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),a.backgroundColor=i.hoverBackgroundColor||r.valueAtIndexOrDefault(e.pointHoverBackgroundColor,n,r.getHoverColor(a.backgroundColor)),a.borderColor=i.hoverBorderColor||r.valueAtIndexOrDefault(e.pointHoverBorderColor,n,r.getHoverColor(a.borderColor)),a.borderWidth=i.hoverBorderWidth||r.valueAtIndexOrDefault(e.pointHoverBorderWidth,n,a.borderWidth)},removeHoverStyle:function(t){var e=this,n=e.chart.data.datasets[t._datasetIndex],i=t._index,a=t.custom||{},o=t._model;void 0!==n.radius&&void 0===n.pointRadius&&(n.pointRadius=n.radius),o.radius=a.radius||r.valueAtIndexOrDefault(n.pointRadius,i,e.chart.options.elements.point.radius),o.backgroundColor=e.getPointBackgroundColor(t,i),o.borderColor=e.getPointBorderColor(t,i),o.borderWidth=e.getPointBorderWidth(t,i)}})}},{25:25,40:40,45:45}],19:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("polarArea",{scale:{type:"radialLinear",angleLines:{display:!1},gridLines:{circular:!0},pointLabels:{display:!1},ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),o=e.datasets[0],s=a.data[i].custom||{},l=r.valueAtIndexOrDefault,u=t.options.elements.arc;return{text:n,fillStyle:s.backgroundColor?s.backgroundColor:l(o.backgroundColor,i,u.backgroundColor),strokeStyle:s.borderColor?s.borderColor:l(o.borderColor,i,u.borderColor),lineWidth:s.borderWidth?s.borderWidth:l(o.borderWidth,i,u.borderWidth),hidden:isNaN(o.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)(a=o.getDatasetMeta(n)).data[r].hidden=!a.data[r].hidden;o.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}}),e.exports=function(t){t.controllers.polarArea=t.DatasetController.extend({dataElementType:a.Arc,linkScales:r.noop,update:function(t){var e=this,n=e.chart,i=n.chartArea,a=e.getMeta(),o=n.options,s=o.elements.arc,l=Math.min(i.right-i.left,i.bottom-i.top);n.outerRadius=Math.max((l-s.borderWidth/2)/2,0),n.innerRadius=Math.max(o.cutoutPercentage?n.outerRadius/100*o.cutoutPercentage:1,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),e.outerRadius=n.outerRadius-n.radiusLength*e.index,e.innerRadius=e.outerRadius-n.radiusLength,a.count=e.countVisibleElements(),r.each(a.data,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){for(var i=this,a=i.chart,o=i.getDataset(),s=a.options,l=s.animation,u=a.scale,d=a.data.labels,c=i.calculateCircumference(o.data[e]),h=u.xCenter,f=u.yCenter,g=0,m=i.getMeta(),p=0;p<e;++p)isNaN(o.data[p])||m.data[p].hidden||++g;var v=s.startAngle,y=t.hidden?0:u.getDistanceFromCenterForValue(o.data[e]),b=v+c*g,x=b+(t.hidden?0:c),_=l.animateScale?0:u.getDistanceFromCenterForValue(o.data[e]);r.extend(t,{_datasetIndex:i.index,_index:e,_scale:u,_model:{x:h,y:f,innerRadius:0,outerRadius:n?_:y,startAngle:n&&l.animateRotate?v:b,endAngle:n&&l.animateRotate?v:x,label:r.valueAtIndexOrDefault(d,e,d[e])}}),i.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),e=this.getMeta(),n=0;return r.each(e.data,function(e,i){isNaN(t.data[i])||e.hidden||n++}),n},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{25:25,40:40,45:45}],20:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("radar",{scale:{type:"radialLinear"},elements:{line:{tension:0}}}),e.exports=function(t){t.controllers.radar=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,linkScales:r.noop,update:function(t){var e=this,n=e.getMeta(),i=n.dataset,a=n.data,o=i.custom||{},s=e.getDataset(),l=e.chart.options.elements.line,u=e.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),r.extend(n.dataset,{_datasetIndex:e.index,_scale:u,_children:a,_loop:!0,_model:{tension:o.tension?o.tension:r.valueOrDefault(s.lineTension,l.tension),backgroundColor:o.backgroundColor?o.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:s.borderWidth||l.borderWidth,borderColor:o.borderColor?o.borderColor:s.borderColor||l.borderColor,fill:o.fill?o.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:o.borderCapStyle?o.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:o.borderDash?o.borderDash:s.borderDash||l.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle}}),n.dataset.pivot(),r.each(a,function(n,i){e.updateElement(n,i,t)},e),e.updateBezierControlPoints()},updateElement:function(t,e,n){var i=this,a=t.custom||{},o=i.getDataset(),s=i.chart.scale,l=i.chart.options.elements.point,u=s.getPointPositionForValue(e,o.data[e]);void 0!==o.radius&&void 0===o.pointRadius&&(o.pointRadius=o.radius),void 0!==o.hitRadius&&void 0===o.pointHitRadius&&(o.pointHitRadius=o.hitRadius),r.extend(t,{_datasetIndex:i.index,_index:e,_scale:s,_model:{x:n?s.xCenter:u.x,y:n?s.yCenter:u.y,tension:a.tension?a.tension:r.valueOrDefault(o.lineTension,i.chart.options.elements.line.tension),radius:a.radius?a.radius:r.valueAtIndexOrDefault(o.pointRadius,e,l.radius),backgroundColor:a.backgroundColor?a.backgroundColor:r.valueAtIndexOrDefault(o.pointBackgroundColor,e,l.backgroundColor),borderColor:a.borderColor?a.borderColor:r.valueAtIndexOrDefault(o.pointBorderColor,e,l.borderColor),borderWidth:a.borderWidth?a.borderWidth:r.valueAtIndexOrDefault(o.pointBorderWidth,e,l.borderWidth),pointStyle:a.pointStyle?a.pointStyle:r.valueAtIndexOrDefault(o.pointStyle,e,l.pointStyle),hitRadius:a.hitRadius?a.hitRadius:r.valueAtIndexOrDefault(o.pointHitRadius,e,l.hitRadius)}}),t._model.skip=a.skip?a.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,e=this.getMeta();r.each(e.data,function(n,i){var a=n._model,o=r.splineCurve(r.previousItem(e.data,i,!0)._model,a,r.nextItem(e.data,i,!0)._model,a.tension);a.controlPointPreviousX=Math.max(Math.min(o.previous.x,t.right),t.left),a.controlPointPreviousY=Math.max(Math.min(o.previous.y,t.bottom),t.top),a.controlPointNextX=Math.max(Math.min(o.next.x,t.right),t.left),a.controlPointNextY=Math.max(Math.min(o.next.y,t.bottom),t.top),n.pivot()})},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model;a.radius=n.hoverRadius?n.hoverRadius:r.valueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),a.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:r.valueAtIndexOrDefault(e.pointHoverBackgroundColor,i,r.getHoverColor(a.backgroundColor)),a.borderColor=n.hoverBorderColor?n.hoverBorderColor:r.valueAtIndexOrDefault(e.pointHoverBorderColor,i,r.getHoverColor(a.borderColor)),a.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:r.valueAtIndexOrDefault(e.pointHoverBorderWidth,i,a.borderWidth)},removeHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model,o=this.chart.options.elements.point;a.radius=n.radius?n.radius:r.valueAtIndexOrDefault(e.pointRadius,i,o.radius),a.backgroundColor=n.backgroundColor?n.backgroundColor:r.valueAtIndexOrDefault(e.pointBackgroundColor,i,o.backgroundColor),a.borderColor=n.borderColor?n.borderColor:r.valueAtIndexOrDefault(e.pointBorderColor,i,o.borderColor),a.borderWidth=n.borderWidth?n.borderWidth:r.valueAtIndexOrDefault(e.pointBorderWidth,i,o.borderWidth)}})}},{25:25,40:40,45:45}],21:[function(t,e,n){"use strict";t(25)._set("scatter",{hover:{mode:"single"},scales:{xAxes:[{id:"x-axis-1",type:"linear",position:"bottom"}],yAxes:[{id:"y-axis-1",type:"linear",position:"left"}]},showLines:!1,tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}}),e.exports=function(t){t.controllers.scatter=t.controllers.line}},{25:25}],22:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{animation:{duration:1e3,easing:"easeOutQuart",onProgress:r.noop,onComplete:r.noop}}),e.exports=function(t){t.Animation=a.extend({chart:null,currentStep:0,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,n,i){var a,r,o=this.animations;for(e.chart=t,i||(t.animating=!0),a=0,r=o.length;a<r;++a)if(o[a].chart===t)return void(o[a]=e);o.push(e),1===o.length&&this.requestAnimationFrame()},cancelAnimation:function(t){var e=r.findIndex(this.animations,function(e){return e.chart===t});-1!==e&&(this.animations.splice(e,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=r.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),n=0;t.dropFrames>1&&(n=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1),t.advance(1+n);var i=Date.now();t.dropFrames+=(i-e)/t.frameDuration,t.animations.length>0&&t.requestAnimationFrame()},advance:function(t){for(var e,n,i=this.animations,a=0;a<i.length;)n=(e=i[a]).chart,e.currentStep=(e.currentStep||0)+t,e.currentStep=Math.min(e.currentStep,e.numSteps),r.callback(e.render,[n,e],n),r.callback(e.onAnimationProgress,[e],n),e.currentStep>=e.numSteps?(r.callback(e.onAnimationComplete,[e],n),n.animating=!1,i.splice(a,1)):++a}},Object.defineProperty(t.Animation.prototype,"animationObject",{get:function(){return this}}),Object.defineProperty(t.Animation.prototype,"chartInstance",{get:function(){return this.chart},set:function(t){this.chart=t}})}},{25:25,26:26,45:45}],23:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(28),o=t(48);e.exports=function(t){function e(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=a.configMerge(i.global,i[t.type],t.options||{}),t}function n(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}function s(t){return"top"===t||"bottom"===t}var l=t.plugins;t.types={},t.instances={},t.controllers={},a.extend(t.prototype,{construct:function(n,i){var r=this;i=e(i);var s=o.acquireContext(n,i),l=s&&s.canvas,u=l&&l.height,d=l&&l.width;r.id=a.uid(),r.ctx=s,r.canvas=l,r.config=i,r.width=d,r.height=u,r.aspectRatio=u?d/u:null,r.options=i.options,r._bufferedRender=!1,r.chart=r,r.controller=r,t.instances[r.id]=r,Object.defineProperty(r,"data",{get:function(){return r.config.data},set:function(t){r.config.data=t}}),s&&l?(r.initialize(),r.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return l.notify(t,"beforeInit"),a.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),l.notify(t,"afterInit"),t},clear:function(){return a.canvas.clear(this),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,r=n.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(a.getMaximumWidth(i))),s=Math.max(0,Math.floor(r?o/r:a.getMaximumHeight(i)));if((e.width!==o||e.height!==s)&&(i.width=e.width=o,i.height=e.height=s,i.style.width=o+"px",i.style.height=s+"px",a.retinaScale(e,n.devicePixelRatio),!t)){var u={width:o,height:s};l.notify(e,"resize",[u]),e.options.onResize&&e.options.onResize(e,u),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;a.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),a.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),n&&(n.id=n.id||"scale")},buildScales:function(){var e=this,n=e.options,i=e.scales={},r=[];n.scales&&(r=r.concat((n.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(n.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),n.scale&&r.push({options:n.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),a.each(r,function(n){var r=n.options,o=a.valueOrDefault(r.type,n.dtype),l=t.scaleService.getScaleConstructor(o);if(l){s(r.position)!==s(n.dposition)&&(r.position=n.dposition);var u=new l({id:r.id,options:r,ctx:e.ctx,chart:e});i[u.id]=u,u.mergeTicksOptions(),n.isDefault&&(e.scale=u)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,n=[],i=[];return a.each(e.data.datasets,function(a,r){var o=e.getDatasetMeta(r),s=a.type||e.config.type;if(o.type&&o.type!==s&&(e.destroyDatasetMeta(r),o=e.getDatasetMeta(r)),o.type=s,n.push(o.type),o.controller)o.controller.updateIndex(r);else{var l=t.controllers[o.type];if(void 0===l)throw new Error('"'+o.type+'" is not a chart type.');o.controller=new l(e,r),i.push(o.controller)}},e),i},resetElements:function(){var t=this;a.each(t.data.datasets,function(e,n){t.getDatasetMeta(n).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t){var e=this;if(t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]}),n(e),!1!==l.notify(e,"beforeUpdate")){e.tooltip._data=e.data;var i=e.buildOrUpdateControllers();a.each(e.data.datasets,function(t,n){e.getDatasetMeta(n).controller.buildOrUpdateElements()},e),e.updateLayout(),a.each(i,function(t){t.reset()}),e.updateDatasets(),e.tooltip.initialize(),e.lastActive=[],l.notify(e,"afterUpdate"),e._bufferedRender?e._bufferedRequest={duration:t.duration,easing:t.easing,lazy:t.lazy}:e.render(t)}},updateLayout:function(){var e=this;!1!==l.notify(e,"beforeLayout")&&(t.layoutService.update(this,this.width,this.height),l.notify(e,"afterScaleUpdate"),l.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(!1!==l.notify(t,"beforeDatasetsUpdate")){for(var e=0,n=t.data.datasets.length;e<n;++e)t.updateDataset(e);l.notify(t,"afterDatasetsUpdate")}},updateDataset:function(t){var e=this,n=e.getDatasetMeta(t),i={meta:n,index:t};!1!==l.notify(e,"beforeDatasetUpdate",[i])&&(n.controller.update(),l.notify(e,"afterDatasetUpdate",[i]))},render:function(e){var n=this;e&&"object"==typeof e||(e={duration:e,lazy:arguments[1]});var i=e.duration,r=e.lazy;if(!1!==l.notify(n,"beforeRender")){var o=n.options.animation,s=function(t){l.notify(n,"afterRender"),a.callback(o&&o.onComplete,[t],n)};if(o&&(void 0!==i&&0!==i||void 0===i&&0!==o.duration)){var u=new t.Animation({numSteps:(i||o.duration)/16.66,easing:e.easing||o.easing,render:function(t,e){var n=a.easing.effects[e.easing],i=e.currentStep,r=i/e.numSteps;t.draw(n(r),r,i)},onAnimationProgress:o.onProgress,onAnimationComplete:s});t.animationService.addAnimation(n,u,i,r)}else n.draw(),s(new t.Animation({numSteps:0,chart:n}));return n}},draw:function(t){var e=this;e.clear(),a.isNullOrUndef(t)&&(t=1),e.transition(t),!1!==l.notify(e,"beforeDraw",[t])&&(a.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.scale&&e.scale.draw(),e.drawDatasets(t),e._drawTooltip(t),l.notify(e,"afterDraw",[t]))},transition:function(t){for(var e=this,n=0,i=(e.data.datasets||[]).length;n<i;++n)e.isDatasetVisible(n)&&e.getDatasetMeta(n).controller.transition(t);e.tooltip.transition(t)},drawDatasets:function(t){var e=this;if(!1!==l.notify(e,"beforeDatasetsDraw",[t])){for(var n=(e.data.datasets||[]).length-1;n>=0;--n)e.isDatasetVisible(n)&&e.drawDataset(n,t);l.notify(e,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,i=n.getDatasetMeta(t),a={meta:i,index:t,easingValue:e};!1!==l.notify(n,"beforeDatasetDraw",[a])&&(i.controller.draw(e),l.notify(n,"afterDatasetDraw",[a]))},_drawTooltip:function(t){var e=this,n=e.tooltip,i={tooltip:n,easingValue:t};!1!==l.notify(e,"beforeTooltipDraw",[i])&&(n.draw(),l.notify(e,"afterTooltipDraw",[i]))},getElementAtEvent:function(t){return r.modes.single(this,t)},getElementsAtEvent:function(t){return r.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return r.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=r.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return r.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e<n;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroyDatasetMeta:function(t){var e=this.id,n=this.data.datasets[t],i=n._meta&&n._meta[e];i&&(i.controller.destroy(),delete n._meta[e])},destroy:function(){var e,n,i=this,r=i.canvas;for(i.stop(),e=0,n=i.data.datasets.length;e<n;++e)i.destroyDatasetMeta(e);r&&(i.unbindEvents(),a.canvas.clear(i),o.releaseContext(i.ctx),i.canvas=null,i.ctx=null),l.notify(i,"destroy"),delete t.instances[i.id]},toBase64Image:function(){return this.canvas.toDataURL.apply(this.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e)},bindEvents:function(){var t=this,e=t._listeners={},n=function(){t.eventHandler.apply(t,arguments)};a.each(t.options.events,function(i){o.addEventListener(t,i,n),e[i]=n}),t.options.responsive&&(n=function(){t.resize()},o.addEventListener(t,"resize",n),e.resize=n)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,a.each(e,function(e,n){o.removeEventListener(t,n,e)}))},updateHoverStyle:function(t,e,n){var i,a,r,o=n?"setHoverStyle":"removeHoverStyle";for(a=0,r=t.length;a<r;++a)(i=t[a])&&this.getDatasetMeta(i._datasetIndex).controller[o](i)},eventHandler:function(t){var e=this,n=e.tooltip;if(!1!==l.notify(e,"beforeEvent",[t])){e._bufferedRender=!0,e._bufferedRequest=null;var i=e.handleEvent(t);i|=n&&n.handleEvent(t),l.notify(e,"afterEvent",[t]);var a=e._bufferedRequest;return a?e.render(a):i&&!e.animating&&(e.stop(),e.render(e.options.hover.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e=this,n=e.options||{},i=n.hover,r=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,i.mode,i),a.callback(n.onHover||n.hover.onHover,[t.native,e.active],e),"mouseup"!==t.type&&"click"!==t.type||n.onClick&&n.onClick.call(e,t.native,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,i.mode,!1),e.active.length&&i.mode&&e.updateHoverStyle(e.active,i.mode,!0),r=!a.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,r}}),t.Controller=t}},{25:25,28:28,45:45,48:48}],24:[function(t,e,n){"use strict";var i=t(45);e.exports=function(t){function e(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),a.forEach(function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),a=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),r=a.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[n]&&t[n].apply(t,e)}),r}})}))}function n(t,e){var n=t._chartjs;if(n){var i=n.listeners,r=i.indexOf(e);-1!==r&&i.splice(r,1),i.length>0||(a.forEach(function(e){delete t[e]}),delete t._chartjs)}}var a=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.getDataset();null===e.xAxisID&&(e.xAxisID=n.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=n.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&n(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),a=n.getDataset().data||[],r=i.data;for(t=0,e=a.length;t<e;++t)r[t]=r[t]||n.createMetaData(t);i.dataset=i.dataset||n.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t=this,i=t.getDataset(),a=i.data||(i.data=[]);t._data!==a&&(t._data&&n(t._data,t),e(a,t),t._data=a),t.resyncElements()},update:i.noop,transition:function(t){for(var e=this.getMeta(),n=e.data||[],i=n.length,a=0;a<i;++a)n[a].transition(t);e.dataset&&e.dataset.transition(t)},draw:function(){var t=this.getMeta(),e=t.data||[],n=e.length,i=0;for(t.dataset&&t.dataset.draw();i<n;++i)e[i].draw()},removeHoverStyle:function(t,e){var n=this.chart.data.datasets[t._datasetIndex],a=t._index,r=t.custom||{},o=i.valueAtIndexOrDefault,s=t._model;s.backgroundColor=r.backgroundColor?r.backgroundColor:o(n.backgroundColor,a,e.backgroundColor),s.borderColor=r.borderColor?r.borderColor:o(n.borderColor,a,e.borderColor),s.borderWidth=r.borderWidth?r.borderWidth:o(n.borderWidth,a,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,a=t.custom||{},r=i.valueAtIndexOrDefault,o=i.getHoverColor,s=t._model;s.backgroundColor=a.hoverBackgroundColor?a.hoverBackgroundColor:r(e.hoverBackgroundColor,n,o(s.backgroundColor)),s.borderColor=a.hoverBorderColor?a.hoverBorderColor:r(e.hoverBorderColor,n,o(s.borderColor)),s.borderWidth=a.hoverBorderWidth?a.hoverBorderWidth:r(e.hoverBorderWidth,n,s.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),n=t.getDataset().data,i=e.data.length,a=n.length;a<i?e.data.splice(a,i-a):a>i&&t.insertElements(i,a-i)},insertElements:function(t,e){for(var n=0;n<e;++n)this.addElementAndReset(t+n)},onDataPush:function(){this.insertElements(this.getDataset().data.length-1,arguments.length)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),t.DatasetController.extend=i.inherits}},{45:45}],25:[function(t,e,n){"use strict";var i=t(45);e.exports={_set:function(t,e){return i.merge(this[t]||(this[t]={}),e)}}},{45:45}],26:[function(t,e,n){"use strict";function i(t,e,n,i){var r,o,s,l,u,d,c,h,f,g=Object.keys(n);for(r=0,o=g.length;r<o;++r)if(s=g[r],d=n[s],e.hasOwnProperty(s)||(e[s]=d),(l=e[s])!==d&&"_"!==s[0]){if(t.hasOwnProperty(s)||(t[s]=l),u=t[s],(c=typeof d)===typeof u)if("string"===c){if((h=a(u)).valid&&(f=a(d)).valid){e[s]=f.mix(h,i).rgbString();continue}}else if("number"===c&&isFinite(u)&&isFinite(d)){e[s]=u+(d-u)*i;continue}e[s]=d}}var a=t(2),r=t(45),o=function(t){r.extend(this,t),this.initialize.apply(this,arguments)};r.extend(o.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=r.clone(t._model)),t._start={},t},transition:function(t){var e=this,n=e._model,a=e._start,r=e._view;return n&&1!==t?(r||(r=e._view={}),a||(a=e._start={}),i(a,r,n,t),e):(e._view=n,e._start=null,e)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return r.isNumber(this._model.x)&&r.isNumber(this._model.y)}}),o.extend=r.inherits,e.exports=o},{2:2,45:45}],27:[function(t,e,n){"use strict";var i=t(2),a=t(25),r=t(45);e.exports=function(t){function e(t,e,n){var i;return"string"==typeof t?(i=parseInt(t,10),-1!==t.indexOf("%")&&(i=i/100*e.parentNode[n])):i=t,i}function n(t){return void 0!==t&&null!==t&&"none"!==t}function o(t,i,a){var r=document.defaultView,o=t.parentNode,s=r.getComputedStyle(t)[i],l=r.getComputedStyle(o)[i],u=n(s),d=n(l),c=Number.POSITIVE_INFINITY;return u||d?Math.min(u?e(s,t,a):c,d?e(l,o,a):c):"none"}r.configMerge=function(){return r.merge(r.clone(arguments[0]),[].slice.call(arguments,1),{merger:function(e,n,i,a){var o=n[e]||{},s=i[e];"scales"===e?n[e]=r.scaleMerge(o,s):"scale"===e?n[e]=r.merge(o,[t.scaleService.getScaleDefaults(s.type),s]):r._merger(e,n,i,a)}})},r.scaleMerge=function(){return r.merge(r.clone(arguments[0]),[].slice.call(arguments,1),{merger:function(e,n,i,a){if("xAxes"===e||"yAxes"===e){var o,s,l,u=i[e].length;for(n[e]||(n[e]=[]),o=0;o<u;++o)l=i[e][o],s=r.valueOrDefault(l.type,"xAxes"===e?"category":"linear"),o>=n[e].length&&n[e].push({}),!n[e][o].type||l.type&&l.type!==n[e][o].type?r.merge(n[e][o],[t.scaleService.getScaleDefaults(s),l]):r.merge(n[e][o],l)}else r._merger(e,n,i,a)}})},r.where=function(t,e){if(r.isArray(t)&&Array.prototype.filter)return t.filter(e);var n=[];return r.each(t,function(t){e(t)&&n.push(t)}),n},r.findIndex=Array.prototype.findIndex?function(t,e,n){return t.findIndex(e,n)}:function(t,e,n){n=void 0===n?t:n;for(var i=0,a=t.length;i<a;++i)if(e.call(n,t[i],i,t))return i;return-1},r.findNextWhere=function(t,e,n){r.isNullOrUndef(n)&&(n=-1);for(var i=n+1;i<t.length;i++){var a=t[i];if(e(a))return a}},r.findPreviousWhere=function(t,e,n){r.isNullOrUndef(n)&&(n=t.length);for(var i=n-1;i>=0;i--){var a=t[i];if(e(a))return a}},r.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},r.almostEquals=function(t,e,n){return Math.abs(t-e)<n},r.almostWhole=function(t,e){var n=Math.round(t);return n-e<t&&n+e>t},r.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},r.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},r.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},r.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},r.toRadians=function(t){return t*(Math.PI/180)},r.toDegrees=function(t){return t*(180/Math.PI)},r.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),r=Math.atan2(i,n);return r<-.5*Math.PI&&(r+=2*Math.PI),{angle:r,distance:a}},r.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},r.aliasPixel=function(t){return t%2==0?0:.5},r.splineCurve=function(t,e,n,i){var a=t.skip?e:t,r=e,o=n.skip?e:n,s=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),l=Math.sqrt(Math.pow(o.x-r.x,2)+Math.pow(o.y-r.y,2)),u=s/(s+l),d=l/(s+l),c=i*(u=isNaN(u)?0:u),h=i*(d=isNaN(d)?0:d);return{previous:{x:r.x-c*(o.x-a.x),y:r.y-c*(o.y-a.y)},next:{x:r.x+h*(o.x-a.x),y:r.y+h*(o.y-a.y)}}},r.EPSILON=Number.EPSILON||1e-14,r.splineCurveMonotone=function(t){var e,n,i,a,o=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=o.length;for(e=0;e<s;++e)if(!(i=o[e]).model.skip){if(n=e>0?o[e-1]:null,(a=e<s-1?o[e+1]:null)&&!a.model.skip){var l=a.model.x-i.model.x;i.deltaK=0!==l?(a.model.y-i.model.y)/l:0}!n||n.model.skip?i.mK=i.deltaK:!a||a.model.skip?i.mK=n.deltaK:this.sign(n.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(n.deltaK+i.deltaK)/2}var u,d,c,h;for(e=0;e<s-1;++e)i=o[e],a=o[e+1],i.model.skip||a.model.skip||(r.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=a.mK=0:(u=i.mK/i.deltaK,d=a.mK/i.deltaK,(h=Math.pow(u,2)+Math.pow(d,2))<=9||(c=3/Math.sqrt(h),i.mK=u*c*i.deltaK,a.mK=d*c*i.deltaK)));var f;for(e=0;e<s;++e)(i=o[e]).model.skip||(n=e>0?o[e-1]:null,a=e<s-1?o[e+1]:null,n&&!n.model.skip&&(f=(i.model.x-n.model.x)/3,i.model.controlPointPreviousX=i.model.x-f,i.model.controlPointPreviousY=i.model.y-f*i.mK),a&&!a.model.skip&&(f=(a.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+f,i.model.controlPointNextY=i.model.y+f*i.mK))},r.nextItem=function(t,e,n){return n?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},r.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},r.niceNum=function(t,e){var n=Math.floor(r.log10(t)),i=t/Math.pow(10,n);return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*Math.pow(10,n)},r.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},r.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,o=t.currentTarget||t.srcElement,s=o.getBoundingClientRect(),l=a.touches;l&&l.length>0?(n=l[0].clientX,i=l[0].clientY):(n=a.clientX,i=a.clientY);var u=parseFloat(r.getStyle(o,"padding-left")),d=parseFloat(r.getStyle(o,"padding-top")),c=parseFloat(r.getStyle(o,"padding-right")),h=parseFloat(r.getStyle(o,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return n=Math.round((n-s.left-u)/f*o.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*o.height/e.currentDevicePixelRatio),{x:n,y:i}},r.getConstraintWidth=function(t){return o(t,"max-width","clientWidth")},r.getConstraintHeight=function(t){return o(t,"max-height","clientHeight")},r.getMaximumWidth=function(t){var e=t.parentNode;if(!e)return t.clientWidth;var n=parseInt(r.getStyle(e,"padding-left"),10),i=parseInt(r.getStyle(e,"padding-right"),10),a=e.clientWidth-n-i,o=r.getConstraintWidth(t);return isNaN(o)?a:Math.min(a,o)},r.getMaximumHeight=function(t){var e=t.parentNode;if(!e)return t.clientHeight;var n=parseInt(r.getStyle(e,"padding-top"),10),i=parseInt(r.getStyle(e,"padding-bottom"),10),a=e.clientHeight-n-i,o=r.getConstraintHeight(t);return isNaN(o)?a:Math.min(a,o)},r.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},r.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||window.devicePixelRatio||1;if(1!==n){var i=t.canvas,a=t.height,r=t.width;i.height=a*n,i.width=r*n,t.ctx.scale(n,n),i.style.height=a+"px",i.style.width=r+"px"}},r.fontString=function(t,e,n){return e+" "+t+"px "+n},r.longestText=function(t,e,n,i){var a=(i=i||{}).data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},o=i.garbageCollect=[],i.font=e),t.font=e;var s=0;r.each(n,function(e){void 0!==e&&null!==e&&!0!==r.isArray(e)?s=r.measureText(t,a,o,s,e):r.isArray(e)&&r.each(e,function(e){void 0===e||null===e||r.isArray(e)||(s=r.measureText(t,a,o,s,e))})});var l=o.length/2;if(l>n.length){for(var u=0;u<l;u++)delete a[o[u]];o.splice(0,l)}return s},r.measureText=function(t,e,n,i,a){var r=e[a];return r||(r=e[a]=t.measureText(a).width,n.push(a)),r>i&&(i=r),i},r.numberOfLabelLines=function(t){var e=1;return r.each(t,function(t){r.isArray(t)&&t.length>e&&(e=t.length)}),e},r.color=i?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),i(t)}:function(t){return console.error("Color.js not found!"),t},r.getHoverColor=function(t){return t instanceof CanvasPattern?t:r.color(t).saturate(.5).darken(.1).rgbString()}}},{2:2,25:25,45:45}],28:[function(t,e,n){"use strict";function i(t,e){return t.native?{x:t.x,y:t.y}:u.getRelativePosition(t,e)}function a(t,e){var n,i,a,r,o;for(i=0,r=t.data.datasets.length;i<r;++i)if(t.isDatasetVisible(i))for(a=0,o=(n=t.getDatasetMeta(i)).data.length;a<o;++a){var s=n.data[a];s._view.skip||e(s)}}function r(t,e){var n=[];return a(t,function(t){t.inRange(e.x,e.y)&&n.push(t)}),n}function o(t,e,n,i){var r=Number.POSITIVE_INFINITY,o=[];return a(t,function(t){if(!n||t.inRange(e.x,e.y)){var a=t.getCenterPoint(),s=i(e,a);s<r?(o=[t],r=s):s===r&&o.push(t)}}),o}function s(t){var e=-1!==t.indexOf("x"),n=-1!==t.indexOf("y");return function(t,i){var a=e?Math.abs(t.x-i.x):0,r=n?Math.abs(t.y-i.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(r,2))}}function l(t,e,n){var a=i(e,t);n.axis=n.axis||"x";var l=s(n.axis),u=n.intersect?r(t,a):o(t,a,!1,l),d=[];return u.length?(t.data.datasets.forEach(function(e,n){if(t.isDatasetVisible(n)){var i=t.getDatasetMeta(n).data[u[0]._index];i&&!i._view.skip&&d.push(i)}}),d):[]}var u=t(45);e.exports={modes:{single:function(t,e){var n=i(e,t),r=[];return a(t,function(t){if(t.inRange(n.x,n.y))return r.push(t),r}),r.slice(0,1)},label:l,index:l,dataset:function(t,e,n){var a=i(e,t);n.axis=n.axis||"xy";var l=s(n.axis),u=n.intersect?r(t,a):o(t,a,!1,l);return u.length>0&&(u=t.getDatasetMeta(u[0]._datasetIndex).data),u},"x-axis":function(t,e){return l(t,e,{intersect:!1})},point:function(t,e){return r(t,i(e,t))},nearest:function(t,e,n){var a=i(e,t);n.axis=n.axis||"xy";var r=s(n.axis),l=o(t,a,n.intersect,r);return l.length>1&&l.sort(function(t,e){var n=t.getArea()-e.getArea();return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),l.slice(0,1)},x:function(t,e,n){var r=i(e,t),o=[],s=!1;return a(t,function(t){t.inXRange(r.x)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),n.intersect&&!s&&(o=[]),o},y:function(t,e,n){var r=i(e,t),o=[],s=!1;return a(t,function(t){t.inYRange(r.y)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),n.intersect&&!s&&(o=[]),o}}}},{45:45}],29:[function(t,e,n){"use strict";t(25)._set("global",{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},layout:{padding:{top:0,right:0,bottom:0,left:0}}}),e.exports=function(){var t=function(t,e){return this.construct(t,e),this};return t.Chart=t,t}},{25:25}],30:[function(t,e,n){"use strict";var i=t(45);e.exports=function(t){function e(t,e){return i.where(t,function(t){return t.position===e})}function n(t,e){t.forEach(function(t,e){return t._tmpIndex_=e,t}),t.sort(function(t,n){var i=e?n:t,a=e?t:n;return i.weight===a.weight?i._tmpIndex_-a._tmpIndex_:i.weight-a.weight}),t.forEach(function(t){delete t._tmpIndex_})}t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,t.boxes.push(e)},removeBox:function(t,e){var n=t.boxes?t.boxes.indexOf(e):-1;-1!==n&&t.boxes.splice(n,1)},configure:function(t,e,n){for(var i,a=["fullWidth","position","weight"],r=a.length,o=0;o<r;++o)i=a[o],n.hasOwnProperty(i)&&(e[i]=n[i])},update:function(t,a,r){function o(t){var e=i.findNextWhere(D,function(e){return e.box===t});if(e)if(t.isHorizontal()){var n={left:Math.max(I,C),right:Math.max(O,P),top:0,bottom:0};t.update(t.fullWidth?b:M,x/2,n)}else t.update(e.minSize.width,S)}function s(t){t.isHorizontal()?(t.left=t.fullWidth?d:I,t.right=t.fullWidth?a-c:I+M,t.top=B,t.bottom=B+t.height,B=t.bottom):(t.left=z,t.right=z+t.width,t.top=F,t.bottom=F+S,z=t.right)}if(t){var l=t.options.layout||{},u=i.options.toPadding(l.padding),d=u.left,c=u.right,h=u.top,f=u.bottom,g=e(t.boxes,"left"),m=e(t.boxes,"right"),p=e(t.boxes,"top"),v=e(t.boxes,"bottom"),y=e(t.boxes,"chartArea");n(g,!0),n(m,!1),n(p,!0),n(v,!1);var b=a-d-c,x=r-h-f,_=x/2,k=(a-b/2)/(g.length+m.length),w=(r-_)/(p.length+v.length),M=b,S=x,D=[];i.each(g.concat(m,p,v),function(t){var e,n=t.isHorizontal();n?(e=t.update(t.fullWidth?b:M,w),S-=e.height):(e=t.update(k,_),M-=e.width),D.push({horizontal:n,minSize:e,box:t})});var C=0,P=0,T=0,A=0;i.each(p.concat(v),function(t){if(t.getPadding){var e=t.getPadding();C=Math.max(C,e.left),P=Math.max(P,e.right)}}),i.each(g.concat(m),function(t){if(t.getPadding){var e=t.getPadding();T=Math.max(T,e.top),A=Math.max(A,e.bottom)}});var I=d,O=c,F=h,R=f;i.each(g.concat(m),o),i.each(g,function(t){I+=t.width}),i.each(m,function(t){O+=t.width}),i.each(p.concat(v),o),i.each(p,function(t){F+=t.height}),i.each(v,function(t){R+=t.height}),i.each(g.concat(m),function(t){var e=i.findNextWhere(D,function(e){return e.box===t}),n={left:0,right:0,top:F,bottom:R};e&&t.update(e.minSize.width,S,n)}),I=d,O=c,F=h,R=f,i.each(g,function(t){I+=t.width}),i.each(m,function(t){O+=t.width}),i.each(p,function(t){F+=t.height}),i.each(v,function(t){R+=t.height});var L=Math.max(C-I,0);I+=L,O+=Math.max(P-O,0);var W=Math.max(T-F,0);F+=W,R+=Math.max(A-R,0);var Y=r-F-R,N=a-I-O;N===M&&Y===S||(i.each(g,function(t){t.height=Y}),i.each(m,function(t){t.height=Y}),i.each(p,function(t){t.fullWidth||(t.width=N)}),i.each(v,function(t){t.fullWidth||(t.width=N)}),S=Y,M=N);var z=d+L,B=h+W;i.each(g.concat(p),s),z+=M,B+=S,i.each(m,s),i.each(v,s),t.chartArea={left:I,top:F,right:I+M,bottom:F+S},i.each(y,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(M,S)})}}}}},{45:45}],31:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{plugins:{}}),e.exports=function(t){t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,n){var i,a,r,o,s,l=this.descriptors(t),u=l.length;for(i=0;i<u;++i)if(a=l[i],r=a.plugin,"function"==typeof(s=r[e])&&((o=[t].concat(n||[])).push(a.options),!1===s.apply(r,o)))return!1;return!0},descriptors:function(t){var e=t._plugins||(t._plugins={});if(e.id===this._cacheId)return e.descriptors;var n=[],a=[],o=t&&t.config||{},s=o.options&&o.options.plugins||{};return this._plugins.concat(o.plugins||[]).forEach(function(t){if(-1===n.indexOf(t)){var e=t.id,o=s[e];!1!==o&&(!0===o&&(o=r.clone(i.global.plugins[e])),n.push(t),a.push({plugin:t,options:o||{}}))}}),e.descriptors=a,e.id=this._cacheId,a}},t.pluginService=t.plugins,t.PluginBase=a.extend({})}},{25:25,26:26,45:45}],32:[function(t,e,n){"use strict";function i(t){var e,n,i=[];for(e=0,n=t.length;e<n;++e)i.push(t[e].label);return i}function a(t,e,n){var i=t.getPixelForTick(e);return n&&(i-=0===e?(t.getPixelForTick(1)-i)/2:(i-t.getPixelForTick(e-1))/2),i}var r=t(25),o=t(26),s=t(45),l=t(34);r._set("scale",{display:!0,position:"left",offset:!1,gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",zeroLineBorderDash:[],zeroLineBorderDashOffset:0,offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{display:!1,labelString:"",lineHeight:1.2,padding:{top:4,bottom:4}},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:l.formatters.values,minor:{},major:{}}}),e.exports=function(t){function e(t,e,n){return s.isArray(e)?s.longestText(t,n,e):t.measureText(e).width}function n(t){var e=s.valueOrDefault,n=r.global,i=e(t.fontSize,n.defaultFontSize),a=e(t.fontStyle,n.defaultFontStyle),o=e(t.fontFamily,n.defaultFontFamily);return{size:i,style:a,family:o,font:s.fontString(i,a,o)}}function l(t){return s.options.toLineHeight(s.valueOrDefault(t.lineHeight,1.2),s.valueOrDefault(t.fontSize,r.global.defaultFontSize))}t.Scale=o.extend({getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},getTicks:function(){return this._ticks},mergeTicksOptions:function(){var t=this.options.ticks;!1===t.minor&&(t.minor={display:!1}),!1===t.major&&(t.major={display:!1});for(var e in t)"major"!==e&&"minor"!==e&&(void 0===t.minor[e]&&(t.minor[e]=t[e]),void 0===t.major[e]&&(t.major[e]=t[e]))},beforeUpdate:function(){s.callback(this.options.beforeUpdate,[this])},update:function(t,e,n){var i,a,r,o,l,u,d=this;for(d.beforeUpdate(),d.maxWidth=t,d.maxHeight=e,d.margins=s.extend({left:0,right:0,top:0,bottom:0},n),d.longestTextCache=d.longestTextCache||{},d.beforeSetDimensions(),d.setDimensions(),d.afterSetDimensions(),d.beforeDataLimits(),d.determineDataLimits(),d.afterDataLimits(),d.beforeBuildTicks(),l=d.buildTicks()||[],d.afterBuildTicks(),d.beforeTickToLabelConversion(),r=d.convertTicksToLabels(l)||d.ticks,d.afterTickToLabelConversion(),d.ticks=r,i=0,a=r.length;i<a;++i)o=r[i],(u=l[i])?u.label=o:l.push(u={label:o,major:!1});return d._ticks=l,d.beforeCalculateTickRotation(),d.calculateTickRotation(),d.afterCalculateTickRotation(),d.beforeFit(),d.fit(),d.afterFit(),d.afterUpdate(),d.minSize},afterUpdate:function(){s.callback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){s.callback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){s.callback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){s.callback(this.options.beforeDataLimits,[this])},determineDataLimits:s.noop,afterDataLimits:function(){s.callback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){s.callback(this.options.beforeBuildTicks,[this])},buildTicks:s.noop,afterBuildTicks:function(){s.callback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){s.callback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback,this)},afterTickToLabelConversion:function(){s.callback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){s.callback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,a=t.options.ticks,r=i(t._ticks),o=n(a);e.font=o.font;var l=a.minRotation||0;if(r.length&&t.options.display&&t.isHorizontal())for(var u,d=s.longestText(e,o.font,r,t.longestTextCache),c=d,h=t.getPixelForTick(1)-t.getPixelForTick(0)-6;c>h&&l<a.maxRotation;){var f=s.toRadians(l);if(u=Math.cos(f),Math.sin(f)*d>t.maxHeight){l--;break}l++,c=u*d}t.labelRotation=l},afterCalculateTickRotation:function(){s.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){s.callback(this.options.beforeFit,[this])},fit:function(){var t=this,a=t.minSize={width:0,height:0},r=i(t._ticks),o=t.options,u=o.ticks,d=o.scaleLabel,c=o.gridLines,h=o.display,f=t.isHorizontal(),g=n(u),m=o.gridLines.tickMarkLength;if(a.width=f?t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:h&&c.drawTicks?m:0,a.height=f?h&&c.drawTicks?m:0:t.maxHeight,d.display&&h){var p=l(d)+s.options.toPadding(d.padding).height;f?a.height+=p:a.width+=p}if(u.display&&h){var v=s.longestText(t.ctx,g.font,r,t.longestTextCache),y=s.numberOfLabelLines(r),b=.5*g.size,x=t.options.ticks.padding;if(f){t.longestLabelWidth=v;var _=s.toRadians(t.labelRotation),k=Math.cos(_),w=Math.sin(_)*v+g.size*y+b*(y-1)+b;a.height=Math.min(t.maxHeight,a.height+w+x),t.ctx.font=g.font;var M=e(t.ctx,r[0],g.font),S=e(t.ctx,r[r.length-1],g.font);0!==t.labelRotation?(t.paddingLeft="bottom"===o.position?k*M+3:k*b+3,t.paddingRight="bottom"===o.position?k*b+3:k*S+3):(t.paddingLeft=M/2+3,t.paddingRight=S/2+3)}else u.mirror?v=0:v+=x+b,a.width=Math.min(t.maxWidth,a.width+v),t.paddingTop=g.size/2,t.paddingBottom=g.size/2}t.handleMargins(),t.width=a.width,t.height=a.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){s.callback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(s.isNullOrUndef(t))return NaN;if("number"==typeof t&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},getLabelForIndex:s.noop,getPixelForValue:s.noop,getValueForPixel:s.noop,getPixelForTick:function(t){var e=this,n=e.options.offset;if(e.isHorizontal()){var i=(e.width-(e.paddingLeft+e.paddingRight))/Math.max(e._ticks.length-(n?0:1),1),a=i*t+e.paddingLeft;n&&(a+=i/2);var r=e.left+Math.round(a);return r+=e.isFullWidth()?e.margins.left:0}var o=e.height-(e.paddingTop+e.paddingBottom);return e.top+t*(o/(e._ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var n=(e.width-(e.paddingLeft+e.paddingRight))*t+e.paddingLeft,i=e.left+Math.round(n);return i+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,i,a,r=this,o=r.isHorizontal(),l=r.options.ticks.minor,u=t.length,d=s.toRadians(r.labelRotation),c=Math.cos(d),h=r.longestLabelWidth*c,f=[];for(l.maxTicksLimit&&(a=l.maxTicksLimit),o&&(e=!1,(h+l.autoSkipPadding)*u>r.width-(r.paddingLeft+r.paddingRight)&&(e=1+Math.floor((h+l.autoSkipPadding)*u/(r.width-(r.paddingLeft+r.paddingRight)))),a&&u>a&&(e=Math.max(e,Math.floor(u/a)))),n=0;n<u;n++)i=t[n],(e>1&&n%e>0||n%e==0&&n+e>=u)&&n!==u-1&&delete i.label,f.push(i);return f},draw:function(t){var e=this,i=e.options;if(i.display){var o=e.ctx,u=r.global,d=i.ticks.minor,c=i.ticks.major||d,h=i.gridLines,f=i.scaleLabel,g=0!==e.labelRotation,m=e.isHorizontal(),p=d.autoSkip?e._autoSkip(e.getTicks()):e.getTicks(),v=s.valueOrDefault(d.fontColor,u.defaultFontColor),y=n(d),b=s.valueOrDefault(c.fontColor,u.defaultFontColor),x=n(c),_=h.drawTicks?h.tickMarkLength:0,k=s.valueOrDefault(f.fontColor,u.defaultFontColor),w=n(f),M=s.options.toPadding(f.padding),S=s.toRadians(e.labelRotation),D=[],C="right"===i.position?e.left:e.right-_,P="right"===i.position?e.left+_:e.right,T="bottom"===i.position?e.top:e.bottom-_,A="bottom"===i.position?e.top+_:e.bottom;if(s.each(p,function(n,r){if(!s.isNullOrUndef(n.label)){var o,l,c,f,v=n.label;r===e.zeroLineIndex&&i.offset===h.offsetGridLines?(o=h.zeroLineWidth,l=h.zeroLineColor,c=h.zeroLineBorderDash,f=h.zeroLineBorderDashOffset):(o=s.valueAtIndexOrDefault(h.lineWidth,r),l=s.valueAtIndexOrDefault(h.color,r),c=s.valueOrDefault(h.borderDash,u.borderDash),f=s.valueOrDefault(h.borderDashOffset,u.borderDashOffset));var y,b,x,k,w,M,I,O,F,R,L="middle",W="middle",Y=d.padding;if(m){var N=_+Y;"bottom"===i.position?(W=g?"middle":"top",L=g?"right":"center",R=e.top+N):(W=g?"middle":"bottom",L=g?"left":"center",R=e.bottom-N);var z=a(e,r,h.offsetGridLines&&p.length>1);z<e.left&&(l="rgba(0,0,0,0)"),z+=s.aliasPixel(o),F=e.getPixelForTick(r)+d.labelOffset,y=x=w=I=z,b=T,k=A,M=t.top,O=t.bottom}else{var B,V="left"===i.position;d.mirror?(L=V?"left":"right",B=Y):(L=V?"right":"left",B=_+Y),F=V?e.right-B:e.left+B;var H=a(e,r,h.offsetGridLines&&p.length>1);H<e.top&&(l="rgba(0,0,0,0)"),H+=s.aliasPixel(o),R=e.getPixelForTick(r)+d.labelOffset,y=C,x=P,w=t.left,I=t.right,b=k=M=O=H}D.push({tx1:y,ty1:b,tx2:x,ty2:k,x1:w,y1:M,x2:I,y2:O,labelX:F,labelY:R,glWidth:o,glColor:l,glBorderDash:c,glBorderDashOffset:f,rotation:-1*S,label:v,major:n.major,textBaseline:W,textAlign:L})}}),s.each(D,function(t){if(h.display&&(o.save(),o.lineWidth=t.glWidth,o.strokeStyle=t.glColor,o.setLineDash&&(o.setLineDash(t.glBorderDash),o.lineDashOffset=t.glBorderDashOffset),o.beginPath(),h.drawTicks&&(o.moveTo(t.tx1,t.ty1),o.lineTo(t.tx2,t.ty2)),h.drawOnChartArea&&(o.moveTo(t.x1,t.y1),o.lineTo(t.x2,t.y2)),o.stroke(),o.restore()),d.display){o.save(),o.translate(t.labelX,t.labelY),o.rotate(t.rotation),o.font=t.major?x.font:y.font,o.fillStyle=t.major?b:v,o.textBaseline=t.textBaseline,o.textAlign=t.textAlign;var e=t.label;if(s.isArray(e))for(var n=0,i=0;n<e.length;++n)o.fillText(""+e[n],0,i),i+=1.5*y.size;else o.fillText(e,0,0);o.restore()}}),f.display){var I,O,F=0,R=l(f)/2;if(m)I=e.left+(e.right-e.left)/2,O="bottom"===i.position?e.bottom-R-M.bottom:e.top+R+M.top;else{var L="left"===i.position;I=L?e.left+R+M.top:e.right-R-M.top,O=e.top+(e.bottom-e.top)/2,F=L?-.5*Math.PI:.5*Math.PI}o.save(),o.translate(I,O),o.rotate(F),o.textAlign="center",o.textBaseline="middle",o.fillStyle=k,o.font=w.font,o.fillText(f.labelString,0,0),o.restore()}if(h.drawBorder){o.lineWidth=s.valueAtIndexOrDefault(h.lineWidth,0),o.strokeStyle=s.valueAtIndexOrDefault(h.color,0);var W=e.left,Y=e.right,N=e.top,z=e.bottom,B=s.aliasPixel(o.lineWidth);m?(N=z="top"===i.position?e.bottom:e.top,N+=B,z+=B):(W=Y="left"===i.position?e.right:e.left,W+=B,Y+=B),o.beginPath(),o.moveTo(W,N),o.lineTo(Y,z),o.stroke()}}}})}},{25:25,26:26,34:34,45:45}],33:[function(t,e,n){"use strict";var i=t(25),a=t(45);e.exports=function(t){t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,e,n){this.constructors[t]=e,this.defaults[t]=a.clone(n)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(t){return this.defaults.hasOwnProperty(t)?a.merge({},[i.scale,this.defaults[t]]):{}},updateScaleDefaults:function(t,e){var n=this;n.defaults.hasOwnProperty(t)&&(n.defaults[t]=a.extend(n.defaults[t],e))},addScalesToLayout:function(e){a.each(e.scales,function(n){n.fullWidth=n.options.fullWidth,n.position=n.options.position,n.weight=n.options.weight,t.layoutService.addBox(e,n)})}}}},{25:25,45:45}],34:[function(t,e,n){"use strict";var i=t(45);e.exports={generators:{linear:function(t,e){var n,a=[];if(t.stepSize&&t.stepSize>0)n=t.stepSize;else{var r=i.niceNum(e.max-e.min,!1);n=i.niceNum(r/(t.maxTicks-1),!0)}var o=Math.floor(e.min/n)*n,s=Math.ceil(e.max/n)*n;t.min&&t.max&&t.stepSize&&i.almostWhole((t.max-t.min)/t.stepSize,n/1e3)&&(o=t.min,s=t.max);var l=(s-o)/n;l=i.almostEquals(l,Math.round(l),n/1e3)?Math.round(l):Math.ceil(l),a.push(void 0!==t.min?t.min:o);for(var u=1;u<l;++u)a.push(o+u*n);return a.push(void 0!==t.max?t.max:s),a},logarithmic:function(t,e){var n,a,r=[],o=i.valueOrDefault,s=o(t.min,Math.pow(10,Math.floor(i.log10(e.min)))),l=Math.floor(i.log10(e.max)),u=Math.ceil(e.max/Math.pow(10,l));0===s?(n=Math.floor(i.log10(e.minNotZero)),a=Math.floor(e.minNotZero/Math.pow(10,n)),r.push(s),s=a*Math.pow(10,n)):(n=Math.floor(i.log10(s)),a=Math.floor(s/Math.pow(10,n)));do{r.push(s),10===++a&&(a=1,++n),s=a*Math.pow(10,n)}while(n<l||n===l&&a<u);var d=o(t.max,s);return r.push(d),r}},formatters:{values:function(t){return i.isArray(t)?t:""+t},linear:function(t,e,n){var a=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(a)>1&&t!==Math.floor(t)&&(a=t-Math.floor(t));var r=i.log10(Math.abs(a)),o="";if(0!==t){var s=-1*Math.floor(r);s=Math.max(Math.min(s,20),0),o=t.toFixed(s)}else o="0";return o},logarithmic:function(t,e,n){var a=t/Math.pow(10,Math.floor(i.log10(t)));return 0===t?"0":1===a||2===a||5===a||0===e||e===n.length-1?t.toExponential():""}}}},{45:45}],35:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{tooltips:{enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,callbacks:{beforeTitle:r.noop,title:function(t,e){var n="",i=e.labels,a=i?i.length:0;if(t.length>0){var r=t[0];r.xLabel?n=r.xLabel:a>0&&r.index<a&&(n=i[r.index])}return n},afterTitle:r.noop,beforeBody:r.noop,beforeLabel:r.noop,label:function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),n+=t.yLabel},labelColor:function(t,e){var n=e.getDatasetMeta(t.datasetIndex).data[t.index]._view;return{borderColor:n.borderColor,backgroundColor:n.backgroundColor}},labelTextColor:function(){return this._options.bodyFontColor},afterLabel:r.noop,afterBody:r.noop,beforeFooter:r.noop,footer:r.noop,afterFooter:r.noop}}}),e.exports=function(t){function e(t,e){var n=r.color(t);return n.alpha(e*n.alpha()).rgbaString()}function n(t,e){return e&&(r.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function o(t){var e=t._xScale,n=t._yScale||t._scale,i=t._index,a=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,a):"",yLabel:n?n.getLabelForIndex(i,a):"",index:i,datasetIndex:a,x:t._model.x,y:t._model.y}}function s(t){var e=i.global,n=r.valueOrDefault;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,bodyFontColor:t.bodyFontColor,_bodyFontFamily:n(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:n(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:n(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:n(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:n(t.titleFontStyle,e.defaultFontStyle),titleFontSize:n(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:n(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:n(t.footerFontStyle,e.defaultFontStyle),footerFontSize:n(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function l(t,e){var n=t._chart.ctx,i=2*e.yPadding,a=0,o=e.body,s=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);s+=e.beforeBody.length+e.afterBody.length;var l=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=l*d,i+=l?(l-1)*e.titleSpacing:0,i+=l?e.titleMarginBottom:0,i+=s*c,i+=s?(s-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){a=Math.max(a,n.measureText(t).width+f)};return n.font=r.fontString(d,e._titleFontStyle,e._titleFontFamily),r.each(e.title,g),n.font=r.fontString(c,e._bodyFontStyle,e._bodyFontFamily),r.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,r.each(o,function(t){r.each(t.before,g),r.each(t.lines,g),r.each(t.after,g)}),f=0,n.font=r.fontString(h,e._footerFontStyle,e._footerFontFamily),r.each(e.footer,g),a+=2*e.xPadding,{width:a,height:i}}function u(t,e){var n=t._model,i=t._chart,a=t._chart.chartArea,r="center",o="center";n.y<e.height?o="top":n.y>i.height-e.height&&(o="bottom");var s,l,u,d,c,h=(a.left+a.right)/2,f=(a.top+a.bottom)/2;"center"===o?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(n.x)?(r="left",u(n.x)&&(r="center",o=c(n.y))):l(n.x)&&(r="right",d(n.x)&&(r="center",o=c(n.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:r,yAlign:g.yAlign?g.yAlign:o}}function d(t,e,n){var i=t.x,a=t.y,r=t.caretSize,o=t.caretPadding,s=t.cornerRadius,l=n.xAlign,u=n.yAlign,d=r+o,c=s+o;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?a+=d:a-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:a}}t.Tooltip=a.extend({initialize:function(){this._model=s(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options.callbacks,i=e.beforeTitle.apply(t,arguments),a=e.title.apply(t,arguments),r=e.afterTitle.apply(t,arguments),o=[];return o=n(o,i),o=n(o,a),o=n(o,r)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return r.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,a=i._options.callbacks,o=[];return r.each(t,function(t){var r={before:[],lines:[],after:[]};n(r.before,a.beforeLabel.call(i,t,e)),n(r.lines,a.label.call(i,t,e)),n(r.after,a.afterLabel.call(i,t,e)),o.push(r)}),o},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return r.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),a=e.footer.apply(t,arguments),r=e.afterFooter.apply(t,arguments),o=[];return o=n(o,i),o=n(o,a),o=n(o,r)},update:function(e){var n,i,a=this,c=a._options,h=a._model,f=a._model=s(c),g=a._active,m=a._data,p={xAlign:h.xAlign,yAlign:h.yAlign},v={x:h.x,y:h.y},y={width:h.width,height:h.height},b={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var x=[],_=[];b=t.Tooltip.positioners[c.position].call(a,g,a._eventPosition);var k=[];for(n=0,i=g.length;n<i;++n)k.push(o(g[n]));c.filter&&(k=k.filter(function(t){return c.filter(t,m)})),c.itemSort&&(k=k.sort(function(t,e){return c.itemSort(t,e,m)})),r.each(k,function(t){x.push(c.callbacks.labelColor.call(a,t,a._chart)),_.push(c.callbacks.labelTextColor.call(a,t,a._chart))}),f.title=a.getTitle(k,m),f.beforeBody=a.getBeforeBody(k,m),f.body=a.getBody(k,m),f.afterBody=a.getAfterBody(k,m),f.footer=a.getFooter(k,m),f.x=Math.round(b.x),f.y=Math.round(b.y),f.caretPadding=c.caretPadding,f.labelColors=x,f.labelTextColors=_,f.dataPoints=k,v=d(f,y=l(this,f),p=u(this,y))}else f.opacity=0;return f.xAlign=p.xAlign,f.yAlign=p.yAlign,f.x=v.x,f.y=v.y,f.width=y.width,f.height=y.height,f.caretX=b.x,f.caretY=b.y,a._model=f,e&&c.custom&&c.custom.call(a,f),a},drawCaret:function(t,e){var n=this._chart.ctx,i=this._view,a=this.getCaretPosition(t,e,i);n.lineTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,n){var i,a,r,o,s,l,u=n.caretSize,d=n.cornerRadius,c=n.xAlign,h=n.yAlign,f=t.x,g=t.y,m=e.width,p=e.height;if("center"===h)s=g+p/2,"left"===c?(a=(i=f)-u,r=i,o=s+u,l=s-u):(a=(i=f+m)+u,r=i,o=s-u,l=s+u);else if("left"===c?(i=(a=f+d+u)-u,r=a+u):"right"===c?(i=(a=f+m-d-u)-u,r=a+u):(i=(a=f+m/2)-u,r=a+u),"top"===h)s=(o=g)-u,l=o;else{s=(o=g+p)+u,l=o;var v=r;r=i,i=v}return{x1:i,x2:a,x3:r,y1:o,y2:s,y3:l}},drawTitle:function(t,n,i,a){var o=n.title;if(o.length){i.textAlign=n._titleAlign,i.textBaseline="top";var s=n.titleFontSize,l=n.titleSpacing;i.fillStyle=e(n.titleFontColor,a),i.font=r.fontString(s,n._titleFontStyle,n._titleFontFamily);var u,d;for(u=0,d=o.length;u<d;++u)i.fillText(o[u],t.x,t.y),t.y+=s+l,u+1===o.length&&(t.y+=n.titleMarginBottom-l)}},drawBody:function(t,n,i,a){var o=n.bodyFontSize,s=n.bodySpacing,l=n.body;i.textAlign=n._bodyAlign,i.textBaseline="top",i.font=r.fontString(o,n._bodyFontStyle,n._bodyFontFamily);var u=0,d=function(e){i.fillText(e,t.x+u,t.y),t.y+=o+s};i.fillStyle=e(n.bodyFontColor,a),r.each(n.beforeBody,d);var c=n.displayColors;u=c?o+2:0,r.each(l,function(s,l){var u=e(n.labelTextColors[l],a);i.fillStyle=u,r.each(s.before,d),r.each(s.lines,function(r){c&&(i.fillStyle=e(n.legendColorBackground,a),i.fillRect(t.x,t.y,o,o),i.lineWidth=1,i.strokeStyle=e(n.labelColors[l].borderColor,a),i.strokeRect(t.x,t.y,o,o),i.fillStyle=e(n.labelColors[l].backgroundColor,a),i.fillRect(t.x+1,t.y+1,o-2,o-2),i.fillStyle=u),d(r)}),r.each(s.after,d)}),u=0,r.each(n.afterBody,d),t.y-=s},drawFooter:function(t,n,i,a){var o=n.footer;o.length&&(t.y+=n.footerMarginTop,i.textAlign=n._footerAlign,i.textBaseline="top",i.fillStyle=e(n.footerFontColor,a),i.font=r.fontString(n.footerFontSize,n._footerFontStyle,n._footerFontFamily),r.each(o,function(e){i.fillText(e,t.x,t.y),t.y+=n.footerFontSize+n.footerSpacing}))},drawBackground:function(t,n,i,a,r){i.fillStyle=e(n.backgroundColor,r),i.strokeStyle=e(n.borderColor,r),i.lineWidth=n.borderWidth;var o=n.xAlign,s=n.yAlign,l=t.x,u=t.y,d=a.width,c=a.height,h=n.cornerRadius;i.beginPath(),i.moveTo(l+h,u),"top"===s&&this.drawCaret(t,a),i.lineTo(l+d-h,u),i.quadraticCurveTo(l+d,u,l+d,u+h),"center"===s&&"right"===o&&this.drawCaret(t,a),i.lineTo(l+d,u+c-h),i.quadraticCurveTo(l+d,u+c,l+d-h,u+c),"bottom"===s&&this.drawCaret(t,a),i.lineTo(l+h,u+c),i.quadraticCurveTo(l,u+c,l,u+c-h),"center"===s&&"left"===o&&this.drawCaret(t,a),i.lineTo(l,u+h),i.quadraticCurveTo(l,u,l+h,u),i.closePath(),i.fill(),n.borderWidth>0&&i.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(this.drawBackground(i,e,t,n,a),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,a),this.drawBody(i,e,t,a),this.drawFooter(i,e,t,a))}},handleEvent:function(t){var e=this,n=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),!(i=!r.arrayEquals(e._active,e._lastActive)))return!1;if(e._lastActive=e._active,n.enabled||n.custom){e._eventPosition={x:t.x,y:t.y};var a=e._model;e.update(!0),e.pivot(),i|=a.x!==e._model.x||a.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,n,i=0,a=0,r=0;for(e=0,n=t.length;e<n;++e){var o=t[e];if(o&&o.hasValue()){var s=o.tooltipPosition();i+=s.x,a+=s.y,++r}}return{x:Math.round(i/r),y:Math.round(a/r)}},nearest:function(t,e){var n,i,a,o=e.x,s=e.y,l=Number.POSITIVE_INFINITY;for(n=0,i=t.length;n<i;++n){var u=t[n];if(u&&u.hasValue()){var d=u.getCenterPoint(),c=r.distanceBetweenPoints(e,d);c<l&&(l=c,a=u)}}if(a){var h=a.tooltipPosition();o=h.x,s=h.y}return{x:o,y:s}}}}},{25:25,26:26,45:45}],36:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{elements:{arc:{backgroundColor:i.global.defaultColor,borderColor:"#fff",borderWidth:2}}}),e.exports=a.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,e){var n=this._view;if(n){for(var i=r.getAngleFromPoint(n,{x:t,y:e}),a=i.angle,o=i.distance,s=n.startAngle,l=n.endAngle;l<s;)l+=2*Math.PI;for(;a>l;)a-=2*Math.PI;for(;a<s;)a+=2*Math.PI;var u=a>=s&&a<=l,d=o>=n.innerRadius&&o<=n.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t=this._chart.ctx,e=this._view,n=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,n,i),t.arc(e.x,e.y,e.innerRadius,i,n,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})},{25:25,26:26,45:45}],37:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45),o=i.global;i._set("global",{elements:{line:{tension:.4,backgroundColor:o.defaultColor,borderWidth:3,borderColor:o.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0}}}),e.exports=a.extend({draw:function(){var t,e,n,i,a=this,s=a._view,l=a._chart.ctx,u=s.spanGaps,d=a._children.slice(),c=o.elements.line,h=-1;for(a._loop&&d.length&&d.push(d[0]),l.save(),l.lineCap=s.borderCapStyle||c.borderCapStyle,l.setLineDash&&l.setLineDash(s.borderDash||c.borderDash),l.lineDashOffset=s.borderDashOffset||c.borderDashOffset,l.lineJoin=s.borderJoinStyle||c.borderJoinStyle,l.lineWidth=s.borderWidth||c.borderWidth,l.strokeStyle=s.borderColor||o.defaultColor,l.beginPath(),h=-1,t=0;t<d.length;++t)e=d[t],n=r.previousItem(d,t),i=e._view,0===t?i.skip||(l.moveTo(i.x,i.y),h=t):(n=-1===h?n:d[h],i.skip||(h!==t-1&&!u||-1===h?l.moveTo(i.x,i.y):r.canvas.lineTo(l,n._view,e._view),h=t));l.stroke(),l.restore()}})},{25:25,26:26,45:45}],38:[function(t,e,n){"use strict";function i(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2)}var a=t(25),r=t(26),o=t(45),s=a.global.defaultColor;a._set("global",{elements:{point:{radius:3,pointStyle:"circle",backgroundColor:s,borderColor:s,borderWidth:1,hitRadius:1,hoverRadius:4,hoverBorderWidth:1}}}),e.exports=r.extend({inRange:function(t,e){var n=this._view;return!!n&&Math.pow(t-n.x,2)+Math.pow(e-n.y,2)<Math.pow(n.hitRadius+n.radius,2)},inLabelRange:i,inXRange:i,inYRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2)},getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(t){var e=this._view,n=this._model,i=this._chart.ctx,r=e.pointStyle,l=e.radius,u=e.x,d=e.y,c=o.color,h=0;e.skip||(i.strokeStyle=e.borderColor||s,i.lineWidth=o.valueOrDefault(e.borderWidth,a.global.elements.point.borderWidth),i.fillStyle=e.backgroundColor||s,void 0!==t&&(n.x<t.left||1.01*t.right<n.x||n.y<t.top||1.01*t.bottom<n.y)&&(n.x<t.left?h=(u-n.x)/(t.left-n.x):1.01*t.right<n.x?h=(n.x-u)/(n.x-t.right):n.y<t.top?h=(d-n.y)/(t.top-n.y):1.01*t.bottom<n.y&&(h=(n.y-d)/(n.y-t.bottom)),h=Math.round(100*h)/100,i.strokeStyle=c(i.strokeStyle).alpha(h).rgbString(),i.fillStyle=c(i.fillStyle).alpha(h).rgbString()),o.canvas.drawPoint(i,r,l,u,d))}})},{25:25,26:26,45:45}],39:[function(t,e,n){"use strict";function i(t){return void 0!==t._view.width}function a(t){var e,n,a,r,o=t._view;if(i(t)){var s=o.width/2;e=o.x-s,n=o.x+s,a=Math.min(o.y,o.base),r=Math.max(o.y,o.base)}else{var l=o.height/2;e=Math.min(o.x,o.base),n=Math.max(o.x,o.base),a=o.y-l,r=o.y+l}return{left:e,top:a,right:n,bottom:r}}var r=t(25),o=t(26);r._set("global",{elements:{rectangle:{backgroundColor:r.global.defaultColor,borderColor:r.global.defaultColor,borderSkipped:"bottom",borderWidth:0}}}),e.exports=o.extend({draw:function(){function t(t){return v[(y+t)%4]}var e,n,i,a,r,o,s,l=this._chart.ctx,u=this._view,d=u.borderWidth;if(u.horizontal?(e=u.base,n=u.x,i=u.y-u.height/2,a=u.y+u.height/2,r=n>e?1:-1,o=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,n=u.x+u.width/2,i=u.y,r=1,o=(a=u.base)>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-n),Math.abs(i-a)),h=(d=d>c?c:d)/2,f=e+("left"!==s?h*r:0),g=n+("right"!==s?-h*r:0),m=i+("top"!==s?h*o:0),p=a+("bottom"!==s?-h*o:0);f!==g&&(i=m,a=p),m!==p&&(e=f,n=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,a],[e,i],[n,i],[n,a]],y=["bottom","left","top","right"].indexOf(s,0);-1===y&&(y=0);var b=t(0);l.moveTo(b[0],b[1]);for(var x=1;x<4;x++)b=t(x),l.lineTo(b[0],b[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var n=!1;if(this._view){var i=a(this);n=t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}return n},inLabelRange:function(t,e){var n=this;if(!n._view)return!1;var r=a(n);return i(n)?t>=r.left&&t<=r.right:e>=r.top&&e<=r.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,e,n=this._view;return i(this)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})},{25:25,26:26}],40:[function(t,e,n){"use strict";e.exports={},e.exports.Arc=t(36),e.exports.Line=t(37),e.exports.Point=t(38),e.exports.Rectangle=t(39)},{36:36,37:37,38:38,39:39}],41:[function(t,e,n){"use strict";var i=t(42),n=e.exports={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,a,r){if(r){var o=Math.min(r,i/2),s=Math.min(r,a/2);t.moveTo(e+o,n),t.lineTo(e+i-o,n),t.quadraticCurveTo(e+i,n,e+i,n+s),t.lineTo(e+i,n+a-s),t.quadraticCurveTo(e+i,n+a,e+i-o,n+a),t.lineTo(e+o,n+a),t.quadraticCurveTo(e,n+a,e,n+a-s),t.lineTo(e,n+s),t.quadraticCurveTo(e,n,e+o,n)}else t.rect(e,n,i,a)},drawPoint:function(t,e,n,i,a){var r,o,s,l,u,d;if(!e||"object"!=typeof e||"[object HTMLImageElement]"!==(r=e.toString())&&"[object HTMLCanvasElement]"!==r){if(!(isNaN(n)||n<=0)){switch(e){default:t.beginPath(),t.arc(i,a,n,0,2*Math.PI),t.closePath(),t.fill();break;case"triangle":t.beginPath(),u=(o=3*n/Math.sqrt(3))*Math.sqrt(3)/2,t.moveTo(i-o/2,a+u/3),t.lineTo(i+o/2,a+u/3),t.lineTo(i,a-2*u/3),t.closePath(),t.fill();break;case"rect":d=1/Math.SQRT2*n,t.beginPath(),t.fillRect(i-d,a-d,2*d,2*d),t.strokeRect(i-d,a-d,2*d,2*d);break;case"rectRounded":var c=n/Math.SQRT2,h=i-c,f=a-c,g=Math.SQRT2*n;t.beginPath(),this.roundedRect(t,h,f,g,g,n/2),t.closePath(),t.fill();break;case"rectRot":d=1/Math.SQRT2*n,t.beginPath(),t.moveTo(i-d,a),t.lineTo(i,a+d),t.lineTo(i+d,a),t.lineTo(i,a-d),t.closePath(),t.fill();break;case"cross":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"crossRot":t.beginPath(),s=Math.cos(Math.PI/4)*n,l=Math.sin(Math.PI/4)*n,t.moveTo(i-s,a-l),t.lineTo(i+s,a+l),t.moveTo(i-s,a+l),t.lineTo(i+s,a-l),t.closePath();break;case"star":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),s=Math.cos(Math.PI/4)*n,l=Math.sin(Math.PI/4)*n,t.moveTo(i-s,a-l),t.lineTo(i+s,a+l),t.moveTo(i-s,a+l),t.lineTo(i+s,a-l),t.closePath();break;case"line":t.beginPath(),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"dash":t.beginPath(),t.moveTo(i,a),t.lineTo(i+n,a),t.closePath()}t.stroke()}}else t.drawImage(e,i-e.width/2,a-e.height/2,e.width,e.height)},clipArea:function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},unclipArea:function(t){t.restore()},lineTo:function(t,e,n,i){if(n.steppedLine)return"after"===n.steppedLine&&!i||"after"!==n.steppedLine&&i?t.lineTo(e.x,n.y):t.lineTo(n.x,e.y),void t.lineTo(n.x,n.y);n.tension?t.bezierCurveTo(i?e.controlPointPreviousX:e.controlPointNextX,i?e.controlPointPreviousY:e.controlPointNextY,i?n.controlPointNextX:n.controlPointPreviousX,i?n.controlPointNextY:n.controlPointPreviousY,n.x,n.y):t.lineTo(n.x,n.y)}};i.clear=n.clear,i.drawRoundedRectangle=function(t){t.beginPath(),n.roundedRect.apply(n,arguments),t.closePath()}},{42:42}],42:[function(t,e,n){"use strict";var i={noop:function(){},uid:function(){var t=0;return function(){return t++}}(),isNullOrUndef:function(t){return null===t||void 0===t},isArray:Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},isObject:function(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)},valueOrDefault:function(t,e){return void 0===t?e:t},valueAtIndexOrDefault:function(t,e,n){return i.valueOrDefault(i.isArray(t)?t[e]:t,n)},callback:function(t,e,n){if(t&&"function"==typeof t.call)return t.apply(n,e)},each:function(t,e,n,a){var r,o,s;if(i.isArray(t))if(o=t.length,a)for(r=o-1;r>=0;r--)e.call(n,t[r],r);else for(r=0;r<o;r++)e.call(n,t[r],r);else if(i.isObject(t))for(o=(s=Object.keys(t)).length,r=0;r<o;r++)e.call(n,t[s[r]],s[r])},arrayEquals:function(t,e){var n,a,r,o;if(!t||!e||t.length!==e.length)return!1;for(n=0,a=t.length;n<a;++n)if(r=t[n],o=e[n],r instanceof Array&&o instanceof Array){if(!i.arrayEquals(r,o))return!1}else if(r!==o)return!1;return!0},clone:function(t){if(i.isArray(t))return t.map(i.clone);if(i.isObject(t)){for(var e={},n=Object.keys(t),a=n.length,r=0;r<a;++r)e[n[r]]=i.clone(t[n[r]]);return e}return t},_merger:function(t,e,n,a){var r=e[t],o=n[t];i.isObject(r)&&i.isObject(o)?i.merge(r,o,a):e[t]=i.clone(o)},_mergerIf:function(t,e,n){var a=e[t],r=n[t];i.isObject(a)&&i.isObject(r)?i.mergeIf(a,r):e.hasOwnProperty(t)||(e[t]=i.clone(r))},merge:function(t,e,n){var a,r,o,s,l,u=i.isArray(e)?e:[e],d=u.length;if(!i.isObject(t))return t;for(a=(n=n||{}).merger||i._merger,r=0;r<d;++r)if(e=u[r],i.isObject(e))for(l=0,s=(o=Object.keys(e)).length;l<s;++l)a(o[l],t,e,n);return t},mergeIf:function(t,e){return i.merge(t,e,{merger:i._mergerIf})},extend:function(t){for(var e=1,n=arguments.length;e<n;++e)i.each(arguments[e],function(e,n){t[n]=e});return t},inherits:function(t){var e=this,n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},a=function(){this.constructor=n};return a.prototype=e.prototype,n.prototype=new a,n.extend=i.inherits,t&&i.extend(n.prototype,t),n.__super__=e.prototype,n}};e.exports=i,i.callCallback=i.callback,i.indexOf=function(t,e,n){return Array.prototype.indexOf.call(t,e,n)},i.getValueOrDefault=i.valueOrDefault,i.getValueAtIndexOrDefault=i.valueAtIndexOrDefault},{}],43:[function(t,e,n){"use strict";var i=t(42),a={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return(t-=1)*t*t+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-((t-=1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return(t-=1)*t*t*t*t+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return 1-Math.cos(t*(Math.PI/2))},easeOutSine:function(t){return Math.sin(t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return t>=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-a.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*a.easeInBounce(2*t):.5*a.easeOutBounce(2*t-1)+.5}};e.exports={effects:a},i.easingEffects=a},{42:42}],44:[function(t,e,n){"use strict";var i=t(42);e.exports={toLineHeight:function(t,e){var n=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!n||"normal"===n[1])return 1.2*e;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100}return e*t},toPadding:function(t){var e,n,a,r;return i.isObject(t)?(e=+t.top||0,n=+t.right||0,a=+t.bottom||0,r=+t.left||0):e=n=a=r=+t||0,{top:e,right:n,bottom:a,left:r,height:e+a,width:r+n}},resolve:function(t,e,n){var a,r,o;for(a=0,r=t.length;a<r;++a)if(void 0!==(o=t[a])&&(void 0!==e&&"function"==typeof o&&(o=o(e)),void 0!==n&&i.isArray(o)&&(o=o[n]),void 0!==o))return o}}},{42:42}],45:[function(t,e,n){"use strict";e.exports=t(42),e.exports.easing=t(43),e.exports.canvas=t(41),e.exports.options=t(44)},{41:41,42:42,43:43,44:44}],46:[function(t,e,n){e.exports={acquireContext:function(t){return t&&t.canvas&&(t=t.canvas),t&&t.getContext("2d")||null}}},{}],47:[function(t,e,n){"use strict";function i(t,e){var n=p.getStyle(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?Number(i[1]):void 0}function a(t,e){var n=t.style,a=t.getAttribute("height"),r=t.getAttribute("width");if(t[v]={initial:{height:a,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===r||""===r){var o=i(t,"width");void 0!==o&&(t.width=o)}if(null===a||""===a)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var s=i(t,"height");void 0!==o&&(t.height=s)}return t}function r(t,e,n){t.addEventListener(e,n,w)}function o(t,e,n){t.removeEventListener(e,n,w)}function s(t,e,n,i,a){return{type:t,chart:e,native:a||null,x:void 0!==n?n:null,y:void 0!==i?i:null}}function l(t,e){var n=k[t.type]||t.type,i=p.getRelativePosition(t,e);return s(n,e,i.x,i.y,t)}function u(t,e){var n=!1,i=[];return function(){i=Array.prototype.slice.call(arguments),e=e||this,n||(n=!0,p.requestAnimFrame.call(window,function(){n=!1,t.apply(e,i)}))}}function d(t){var e=document.createElement("div"),n=y+"size-monitor",i="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1;";e.style.cssText=i,e.className=n,e.innerHTML='<div class="'+n+'-expand" style="'+i+'"><div style="position:absolute;width:1000000px;height:1000000px;left:0;top:0"></div></div><div class="'+n+'-shrink" style="'+i+'"><div style="position:absolute;width:200%;height:200%;left:0; top:0"></div></div>';var a=e.childNodes[0],o=e.childNodes[1];e._reset=function(){a.scrollLeft=1e6,a.scrollTop=1e6,o.scrollLeft=1e6,o.scrollTop=1e6};var s=function(){e._reset(),t()};return r(a,"scroll",s.bind(a,"expand")),r(o,"scroll",s.bind(o,"shrink")),e}function c(t,e){var n=t[v]||(t[v]={}),i=n.renderProxy=function(t){t.animationName===x&&e()};p.each(_,function(e){r(t,e,i)}),n.reflow=!!t.offsetParent,t.classList.add(b)}function h(t){var e=t[v]||{},n=e.renderProxy;n&&(p.each(_,function(e){o(t,e,n)}),delete e.renderProxy),t.classList.remove(b)}function f(t,e,n){var i=t[v]||(t[v]={}),a=i.resizer=d(u(function(){if(i.resizer)return e(s("resize",n))}));c(t,function(){if(i.resizer){var e=t.parentNode;e&&e!==a.parentNode&&e.insertBefore(a,e.firstChild),a._reset()}})}function g(t){var e=t[v]||{},n=e.resizer;delete e.resizer,h(t),n&&n.parentNode&&n.parentNode.removeChild(n)}function m(t,e){var n=t._style||document.createElement("style");t._style||(t._style=n,e="/* Chart.js */\n"+e,n.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n)),n.appendChild(document.createTextNode(e))}var p=t(45),v="$chartjs",y="chartjs-",b=y+"render-monitor",x=y+"render-animation",_=["animationstart","webkitAnimationStart"],k={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},w=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};e.exports={_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,initialize:function(){var t="from{opacity:0.99}to{opacity:1}";m(this,"@-webkit-keyframes "+x+"{"+t+"}@keyframes "+x+"{"+t+"}."+b+"{-webkit-animation:"+x+" 0.001s;animation:"+x+" 0.001s;}")},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(a(t,e),n):null},releaseContext:function(t){var e=t.canvas;if(e[v]){var n=e[v].initial;["height","width"].forEach(function(t){var i=n[t];p.isNullOrUndef(i)?e.removeAttribute(t):e.setAttribute(t,i)}),p.each(n.style||{},function(t,n){e.style[n]=t}),e.width=e.width,delete e[v]}},addEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=n[v]||(n[v]={});r(i,e,(a.proxies||(a.proxies={}))[t.id+"_"+e]=function(e){n(l(e,t))})}else f(i,n,t)},removeEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=((n[v]||{}).proxies||{})[t.id+"_"+e];a&&o(i,e,a)}else g(i)}},p.addEvent=r,p.removeEvent=o},{45:45}],48:[function(t,e,n){"use strict";var i=t(45),a=t(46),r=t(47),o=r._enabled?r:a;e.exports=i.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},o)},{45:45,46:46,47:47}],49:[function(t,e,n){"use strict";var i=t(25),a=t(40),r=t(45);i._set("global",{plugins:{filler:{propagate:!0}}}),e.exports=function(){function t(t,e,n){var i,a=t._model||{},r=a.fill;if(void 0===r&&(r=!!a.backgroundColor),!1===r||null===r)return!1;if(!0===r)return"origin";if(i=parseFloat(r,10),isFinite(i)&&Math.floor(i)===i)return"-"!==r[0]&&"+"!==r[0]||(i=e+i),!(i===e||i<0||i>=n)&&i;switch(r){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return r;default:return!1}}function e(t){var e,n=t.el._model||{},i=t.el._scale||{},a=t.fill,r=null;if(isFinite(a))return null;if("start"===a?r=void 0===n.scaleBottom?i.bottom:n.scaleBottom:"end"===a?r=void 0===n.scaleTop?i.top:n.scaleTop:void 0!==n.scaleZero?r=n.scaleZero:i.getBasePosition?r=i.getBasePosition():i.getBasePixel&&(r=i.getBasePixel()),void 0!==r&&null!==r){if(void 0!==r.x&&void 0!==r.y)return r;if("number"==typeof r&&isFinite(r))return e=i.isHorizontal(),{x:e?r:null,y:e?null:r}}return null}function n(t,e,n){var i,a=t[e].fill,r=[e];if(!n)return a;for(;!1!==a&&-1===r.indexOf(a);){if(!isFinite(a))return a;if(!(i=t[a]))return!1;if(i.visible)return a;r.push(a),a=i.fill}return!1}function o(t){var e=t.fill,n="dataset";return!1===e?null:(isFinite(e)||(n="boundary"),d[n](t))}function s(t){return t&&!t.skip}function l(t,e,n,i,a){var o;if(i&&a){for(t.moveTo(e[0].x,e[0].y),o=1;o<i;++o)r.canvas.lineTo(t,e[o-1],e[o]);for(t.lineTo(n[a-1].x,n[a-1].y),o=a-1;o>0;--o)r.canvas.lineTo(t,n[o],n[o-1],!0)}}function u(t,e,n,i,a,r){var o,u,d,c,h,f,g,m=e.length,p=i.spanGaps,v=[],y=[],b=0,x=0;for(t.beginPath(),o=0,u=m+!!r;o<u;++o)h=n(c=e[d=o%m]._view,d,i),f=s(c),g=s(h),f&&g?(b=v.push(c),x=y.push(h)):b&&x&&(p?(f&&v.push(c),g&&y.push(h)):(l(t,v,y,b,x),b=x=0,v=[],y=[]));l(t,v,y,b,x),t.closePath(),t.fillStyle=a,t.fill()}var d={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),a=i&&n.isDatasetVisible(e)&&i.dataset._children||[],r=a.length||0;return r?function(t,e){return e<r&&a[e]._view||null}:null},boundary:function(t){var e=t.boundary,n=e?e.x:null,i=e?e.y:null;return function(t){return{x:null===n?t.x:n,y:null===i?t.y:i}}}};return{id:"filler",afterDatasetsUpdate:function(i,r){var s,l,u,d,c=(i.data.datasets||[]).length,h=r.propagate,f=[];for(l=0;l<c;++l)d=null,(u=(s=i.getDatasetMeta(l)).dataset)&&u._model&&u instanceof a.Line&&(d={visible:i.isDatasetVisible(l),fill:t(u,l,c),chart:i,el:u}),s.$filler=d,f.push(d);for(l=0;l<c;++l)(d=f[l])&&(d.fill=n(f,l,h),d.boundary=e(d),d.mapper=o(d))},beforeDatasetDraw:function(t,e){var n=e.meta.$filler;if(n){var a=t.ctx,o=n.el,s=o._view,l=o._children||[],d=n.mapper,c=s.backgroundColor||i.global.defaultColor;d&&c&&l.length&&(r.canvas.clipArea(a,t.chartArea),u(a,l,d,s,c,o._loop),r.canvas.unclipArea(a))}}}}},{25:25,40:40,45:45}],50:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{legend:{display:!0,position:"top",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return r.isArray(e.datasets)?e.datasets.map(function(e,n){return{text:e.label,fillStyle:r.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(n),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:n}},this):[]}}},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var n=0;n<t.data.datasets.length;n++)e.push('<li><span style="background-color:'+t.data.datasets[n].backgroundColor+'"></span>'),t.data.datasets[n].label&&e.push(t.data.datasets[n].label),e.push("</li>");return e.push("</ul>"),e.join("")}}),e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function n(e,n){var i=new t.Legend({ctx:e.ctx,options:n,chart:e});o.configure(e,i,n),o.addBox(e,i),e.legend=i}var o=t.layoutService,s=r.noop;return t.Legend=a.extend({initialize:function(t){r.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:s,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:s,beforeSetDimensions:s,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:s,beforeBuildLabels:s,buildLabels:function(){var t=this,e=t.options.labels||{},n=r.callback(e.generateLabels,[t.chart],t)||[];e.filter&&(n=n.filter(function(n){return e.filter(n,t.chart.data)})),t.options.reverse&&n.reverse(),t.legendItems=n},afterBuildLabels:s,beforeFit:s,fit:function(){var t=this,n=t.options,a=n.labels,o=n.display,s=t.ctx,l=i.global,u=r.valueOrDefault,d=u(a.fontSize,l.defaultFontSize),c=u(a.fontStyle,l.defaultFontStyle),h=u(a.fontFamily,l.defaultFontFamily),f=r.fontString(d,c,h),g=t.legendHitBoxes=[],m=t.minSize,p=t.isHorizontal();if(p?(m.width=t.maxWidth,m.height=o?10:0):(m.width=o?10:0,m.height=t.maxHeight),o)if(s.font=f,p){var v=t.lineWidths=[0],y=t.legendItems.length?d+a.padding:0;s.textAlign="left",s.textBaseline="top",r.each(t.legendItems,function(n,i){var r=e(a,d)+d/2+s.measureText(n.text).width;v[v.length-1]+r+a.padding>=t.width&&(y+=d+a.padding,v[v.length]=t.left),g[i]={left:0,top:0,width:r,height:d},v[v.length-1]+=r+a.padding}),m.height+=y}else{var b=a.padding,x=t.columnWidths=[],_=a.padding,k=0,w=0,M=d+b;r.each(t.legendItems,function(t,n){var i=e(a,d)+d/2+s.measureText(t.text).width;w+M>m.height&&(_+=k+a.padding,x.push(k),k=0,w=0),k=Math.max(k,i),w+=M,g[n]={left:0,top:0,width:i,height:d}}),_+=k,x.push(k),m.width+=_}t.width=m.width,t.height=m.height},afterFit:s,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,n=t.options,a=n.labels,o=i.global,s=o.elements.line,l=t.width,u=t.lineWidths;if(n.display){var d,c=t.ctx,h=r.valueOrDefault,f=h(a.fontColor,o.defaultFontColor),g=h(a.fontSize,o.defaultFontSize),m=h(a.fontStyle,o.defaultFontStyle),p=h(a.fontFamily,o.defaultFontFamily),v=r.fontString(g,m,p);c.textAlign="left",c.textBaseline="middle",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var y=e(a,g),b=t.legendHitBoxes,x=function(t,e,i){if(!(isNaN(y)||y<=0)){c.save(),c.fillStyle=h(i.fillStyle,o.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,o.defaultColor);var a=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),n.labels&&n.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=t+u,f=e+u;r.canvas.drawPoint(c,i.pointStyle,l,d,f)}else a||c.strokeRect(t,e,y,g),c.fillRect(t,e,y,g);c.restore()}},_=function(t,e,n,i){var a=g/2,r=y+a+t,o=e+a;c.fillText(n.text,r,o),n.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(r,o),c.lineTo(r+i,o),c.stroke())},k=t.isHorizontal();d=k?{x:t.left+(l-u[0])/2,y:t.top+a.padding,line:0}:{x:t.left+a.padding,y:t.top+a.padding,line:0};var w=g+a.padding;r.each(t.legendItems,function(e,n){var i=c.measureText(e.text).width,r=y+g/2+i,o=d.x,s=d.y;k?o+r>=l&&(s=d.y+=w,d.line++,o=d.x=t.left+(l-u[d.line])/2):s+w>t.bottom&&(o=d.x=o+t.columnWidths[d.line]+a.padding,s=d.y=t.top+a.padding,d.line++),x(o,s,e),b[n].left=o,b[n].top=s,_(o,s,e,i),k?d.x+=r+a.padding:d.y+=w})}},handleEvent:function(t){var e=this,n=e.options,i="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===i){if(!n.onHover)return}else{if("click"!==i)return;if(!n.onClick)return}var r=t.x,o=t.y;if(r>=e.left&&r<=e.right&&o>=e.top&&o<=e.bottom)for(var s=e.legendHitBoxes,l=0;l<s.length;++l){var u=s[l];if(r>=u.left&&r<=u.left+u.width&&o>=u.top&&o<=u.top+u.height){if("click"===i){n.onClick.call(e,t.native,e.legendItems[l]),a=!0;break}if("mousemove"===i){n.onHover.call(e,t.native,e.legendItems[l]),a=!0;break}}}return a}}),{id:"legend",beforeInit:function(t){var e=t.options.legend;e&&n(t,e)},beforeUpdate:function(t){var e=t.options.legend,a=t.legend;e?(r.mergeIf(e,i.global.legend),a?(o.configure(t,a,e),a.options=e):n(t,e)):a&&(o.removeBox(t,a),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}}}},{25:25,26:26,45:45}],51:[function(t,e,n){"use strict";var i=t(25),a=t(26),r=t(45);i._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,lineHeight:1.2,padding:10,position:"top",text:"",weight:2e3}}),e.exports=function(t){function e(e,i){var a=new t.Title({ctx:e.ctx,options:i,chart:e});n.configure(e,a,i),n.addBox(e,a),e.titleBlock=a}var n=t.layoutService,o=r.noop;return t.Title=a.extend({initialize:function(t){var e=this;r.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:o,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:o,beforeSetDimensions:o,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:o,beforeBuildLabels:o,buildLabels:o,afterBuildLabels:o,beforeFit:o,fit:function(){var t=this,e=r.valueOrDefault,n=t.options,a=n.display,o=e(n.fontSize,i.global.defaultFontSize),s=t.minSize,l=r.isArray(n.text)?n.text.length:1,u=r.options.toLineHeight(n.lineHeight,o),d=a?l*u+2*n.padding:0;t.isHorizontal()?(s.width=t.maxWidth,s.height=d):(s.width=d,s.height=t.maxHeight),t.width=s.width,t.height=s.height},afterFit:o,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=r.valueOrDefault,a=t.options,o=i.global;if(a.display){var s,l,u,d=n(a.fontSize,o.defaultFontSize),c=n(a.fontStyle,o.defaultFontStyle),h=n(a.fontFamily,o.defaultFontFamily),f=r.fontString(d,c,h),g=r.options.toLineHeight(a.lineHeight,d),m=g/2+a.padding,p=0,v=t.top,y=t.left,b=t.bottom,x=t.right;e.fillStyle=n(a.fontColor,o.defaultFontColor),e.font=f,t.isHorizontal()?(l=y+(x-y)/2,u=v+m,s=x-y):(l="left"===a.position?y+m:x-m,u=v+(b-v)/2,s=b-v,p=Math.PI*("left"===a.position?-.5:.5)),e.save(),e.translate(l,u),e.rotate(p),e.textAlign="center",e.textBaseline="middle";var _=a.text;if(r.isArray(_))for(var k=0,w=0;w<_.length;++w)e.fillText(_[w],0,k,s),k+=g;else e.fillText(_,0,0,s);e.restore()}}}),{id:"title",beforeInit:function(t){var n=t.options.title;n&&e(t,n)},beforeUpdate:function(a){var o=a.options.title,s=a.titleBlock;o?(r.mergeIf(o,i.global.title),s?(n.configure(a,s,o),s.options=o):e(a,o)):s&&(t.layoutService.removeBox(a,s),delete a.titleBlock)}}}},{25:25,26:26,45:45}],52:[function(t,e,n){"use strict";e.exports=function(t){var e=t.Scale.extend({getLabels:function(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,e=t.getLabels();t.minIndex=0,t.maxIndex=e.length-1;var n;void 0!==t.options.ticks.min&&(n=e.indexOf(t.options.ticks.min),t.minIndex=-1!==n?n:t.minIndex),void 0!==t.options.ticks.max&&(n=e.indexOf(t.options.ticks.max),t.maxIndex=-1!==n?n:t.maxIndex),t.min=e[t.minIndex],t.max=e[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.isHorizontal();return i.yLabels&&!a?n.getRightValue(i.datasets[e].data[t]):n.ticks[t-n.minIndex]},getPixelForValue:function(t,e){var n,i=this,a=i.options.offset,r=Math.max(i.maxIndex+1-i.minIndex-(a?0:1),1);if(void 0!==t&&null!==t&&(n=i.isHorizontal()?t.x:t.y),void 0!==n||void 0!==t&&isNaN(e)){var o=i.getLabels();t=n||t;var s=o.indexOf(t);e=-1!==s?s:e}if(i.isHorizontal()){var l=i.width/r,u=l*(e-i.minIndex);return a&&(u+=l/2),i.left+Math.round(u)}var d=i.height/r,c=d*(e-i.minIndex);return a&&(c+=d/2),i.top+Math.round(c)},getPixelForTick:function(t){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null)},getValueForPixel:function(t){var e=this,n=e.options.offset,i=Math.max(e._ticks.length-(n?0:1),1),a=e.isHorizontal(),r=(a?e.width:e.height)/i;return t-=a?e.left:e.top,n&&(t-=r/2),(t<=0?0:Math.round(t/r))+e.minIndex},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",e,{position:"bottom"})}},{}],53:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(34);e.exports=function(t){var e={position:"left",ticks:{callback:r.formatters.linear}},n=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return o?t.xAxisID===e.id:t.yAxisID===e.id}var e=this,n=e.options,i=e.chart,r=i.data.datasets,o=e.isHorizontal();e.min=null,e.max=null;var s=n.stacked;if(void 0===s&&a.each(r,function(e,n){if(!s){var a=i.getDatasetMeta(n);i.isDatasetVisible(n)&&t(a)&&void 0!==a.stack&&(s=!0)}}),n.stacked||s){var l={};a.each(r,function(r,o){var s=i.getDatasetMeta(o),u=[s.type,void 0===n.stacked&&void 0===s.stack?o:"",s.stack].join(".");void 0===l[u]&&(l[u]={positiveValues:[],negativeValues:[]});var d=l[u].positiveValues,c=l[u].negativeValues;i.isDatasetVisible(o)&&t(s)&&a.each(r.data,function(t,i){var a=+e.getRightValue(t);isNaN(a)||s.data[i].hidden||(d[i]=d[i]||0,c[i]=c[i]||0,n.relativePoints?d[i]=100:a<0?c[i]+=a:d[i]+=a)})}),a.each(l,function(t){var n=t.positiveValues.concat(t.negativeValues),i=a.min(n),r=a.max(n);e.min=null===e.min?i:Math.min(e.min,i),e.max=null===e.max?r:Math.max(e.max,r)})}else a.each(r,function(n,r){var o=i.getDatasetMeta(r);i.isDatasetVisible(r)&&t(o)&&a.each(n.data,function(t,n){var i=+e.getRightValue(t);isNaN(i)||o.data[n].hidden||(null===e.min?e.min=i:i<e.min&&(e.min=i),null===e.max?e.max=i:i>e.max&&(e.max=i))})});e.min=isFinite(e.min)&&!isNaN(e.min)?e.min:0,e.max=isFinite(e.max)&&!isNaN(e.max)?e.max:1,this.handleTickRangeOptions()},getTickLimit:function(){var t,e=this,n=e.options.ticks;if(e.isHorizontal())t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.width/50));else{var r=a.valueOrDefault(n.fontSize,i.global.defaultFontSize);t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.height/(2*r)))}return t},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,n=this,i=n.start,a=+n.getRightValue(t),r=n.end-i;return n.isHorizontal()?(e=n.left+n.width/r*(a-i),Math.round(e)):(e=n.bottom-n.height/r*(a-i),Math.round(e))},getValueForPixel:function(t){var e=this,n=e.isHorizontal(),i=n?e.width:e.height,a=(n?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",n,e)}},{25:25,34:34,45:45}],54:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e=i.noop;t.LinearScaleBase=t.Scale.extend({getRightValue:function(e){return"string"==typeof e?+e:t.Scale.prototype.getRightValue.call(this,e)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=i.sign(t.min),a=i.sign(t.max);n<0&&a<0?t.max=0:n>0&&a>0&&(t.min=0)}var r=void 0!==e.min||void 0!==e.suggestedMin,o=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),r!==o&&t.min>=t.max&&(r?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:e,handleDirectionalChanges:e,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),r={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,stepSize:i.valueOrDefault(e.fixedStepSize,e.stepSize)},o=t.ticks=a.generators.linear(r,t);t.handleDirectionalChanges(),t.max=i.max(o),t.min=i.min(o),e.reverse?(o.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{34:34,45:45}],55:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e={position:"left",ticks:{callback:a.formatters.logarithmic}},n=t.Scale.extend({determineDataLimits:function(){function t(t){return l?t.xAxisID===e.id:t.yAxisID===e.id}var e=this,n=e.options,a=n.ticks,r=e.chart,o=r.data.datasets,s=i.valueOrDefault,l=e.isHorizontal();e.min=null,e.max=null,e.minNotZero=null;var u=n.stacked;if(void 0===u&&i.each(o,function(e,n){if(!u){var i=r.getDatasetMeta(n);r.isDatasetVisible(n)&&t(i)&&void 0!==i.stack&&(u=!0)}}),n.stacked||u){var d={};i.each(o,function(a,o){var s=r.getDatasetMeta(o),l=[s.type,void 0===n.stacked&&void 0===s.stack?o:"",s.stack].join(".");r.isDatasetVisible(o)&&t(s)&&(void 0===d[l]&&(d[l]=[]),i.each(a.data,function(t,i){var a=d[l],r=+e.getRightValue(t);isNaN(r)||s.data[i].hidden||(a[i]=a[i]||0,n.relativePoints?a[i]=100:a[i]+=r)}))}),i.each(d,function(t){var n=i.min(t),a=i.max(t);e.min=null===e.min?n:Math.min(e.min,n),e.max=null===e.max?a:Math.max(e.max,a)})}else i.each(o,function(n,a){var o=r.getDatasetMeta(a);r.isDatasetVisible(a)&&t(o)&&i.each(n.data,function(t,n){var i=+e.getRightValue(t);isNaN(i)||o.data[n].hidden||(null===e.min?e.min=i:i<e.min&&(e.min=i),null===e.max?e.max=i:i>e.max&&(e.max=i),0!==i&&(null===e.minNotZero||i<e.minNotZero)&&(e.minNotZero=i))})});e.min=s(a.min,e.min),e.max=s(a.max,e.max),e.min===e.max&&(0!==e.min&&null!==e.min?(e.min=Math.pow(10,Math.floor(i.log10(e.min))-1),e.max=Math.pow(10,Math.floor(i.log10(e.max))+1)):(e.min=1,e.max=10))},buildTicks:function(){var t=this,e=t.options.ticks,n={min:e.min,max:e.max},r=t.ticks=a.generators.logarithmic(n,t);t.isHorizontal()||r.reverse(),t.max=i.max(r),t.min=i.min(r),e.reverse?(r.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),t.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},getPixelForValue:function(t){var e,n,a,r=this,o=r.start,s=+r.getRightValue(t),l=r.options.ticks;return r.isHorizontal()?(a=i.log10(r.end)-i.log10(o),0===s?n=r.left:(e=r.width,n=r.left+e/a*(i.log10(s)-i.log10(o)))):(e=r.height,0!==o||l.reverse?0===r.end&&l.reverse?(a=i.log10(r.start)-i.log10(r.minNotZero),n=s===r.end?r.top:s===r.minNotZero?r.top+.02*e:r.top+.02*e+.98*e/a*(i.log10(s)-i.log10(r.minNotZero))):0===s?n=l.reverse?r.top:r.bottom:(a=i.log10(r.end)-i.log10(o),e=r.height,n=r.bottom-e/a*(i.log10(s)-i.log10(o))):(a=i.log10(r.end)-i.log10(r.minNotZero),n=s===o?r.bottom:s===r.minNotZero?r.bottom-.02*e:r.bottom-.02*e-.98*e/a*(i.log10(s)-i.log10(r.minNotZero)))),n},getValueForPixel:function(t){var e,n,a=this,r=i.log10(a.end)-i.log10(a.start);return a.isHorizontal()?(n=a.width,e=a.start*Math.pow(10,(t-a.left)*r/n)):(n=a.height,e=Math.pow(10,(a.bottom-t)*r/n)/a.start),e}});t.scaleService.registerScaleType("logarithmic",n,e)}},{34:34,45:45}],56:[function(t,e,n){"use strict";var i=t(25),a=t(45),r=t(34);e.exports=function(t){function e(t){var e=t.options;return e.angleLines.display||e.pointLabels.display?t.chart.data.labels.length:0}function n(t){var e=t.options.pointLabels,n=a.valueOrDefault(e.fontSize,p.defaultFontSize),i=a.valueOrDefault(e.fontStyle,p.defaultFontStyle),r=a.valueOrDefault(e.fontFamily,p.defaultFontFamily);return{size:n,style:i,family:r,font:a.fontString(n,i,r)}}function o(t,e,n){return a.isArray(n)?{w:a.longestText(t,t.font,n),h:n.length*e+1.5*(n.length-1)*e}:{w:t.measureText(n).width,h:e}}function s(t,e,n,i,a){return t===i||t===a?{start:e-n/2,end:e+n/2}:t<i||t>a?{start:e-n-5,end:e}:{start:e,end:e+n+5}}function l(t){var i,r,l,u=n(t),d=Math.min(t.height/2,t.width/2),c={r:t.width,l:0,t:t.height,b:0},h={};t.ctx.font=u.font,t._pointLabelSizes=[];var f=e(t);for(i=0;i<f;i++){l=t.getPointPosition(i,d),r=o(t.ctx,u.size,t.pointLabels[i]||""),t._pointLabelSizes[i]=r;var g=t.getIndexAngle(i),m=a.toDegrees(g)%360,p=s(m,l.x,r.w,0,180),v=s(m,l.y,r.h,90,270);p.start<c.l&&(c.l=p.start,h.l=g),p.end>c.r&&(c.r=p.end,h.r=g),v.start<c.t&&(c.t=v.start,h.t=g),v.end>c.b&&(c.b=v.end,h.b=g)}t.setReductions(d,c,h)}function u(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function d(t){return 0===t||180===t?"center":t<180?"left":"right"}function c(t,e,n,i){if(a.isArray(e))for(var r=n.y,o=1.5*i,s=0;s<e.length;++s)t.fillText(e[s],n.x,r),r+=o;else t.fillText(e,n.x,n.y)}function h(t,e,n){90===t||270===t?n.y-=e.h/2:(t>270||t<90)&&(n.y-=e.h)}function f(t){var i=t.ctx,r=a.valueOrDefault,o=t.options,s=o.angleLines,l=o.pointLabels;i.lineWidth=s.lineWidth,i.strokeStyle=s.color;var u=t.getDistanceFromCenterForValue(o.ticks.reverse?t.min:t.max),f=n(t);i.textBaseline="top";for(var g=e(t)-1;g>=0;g--){if(s.display){var m=t.getPointPosition(g,u);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(m.x,m.y),i.stroke(),i.closePath()}if(l.display){var v=t.getPointPosition(g,u+5),y=r(l.fontColor,p.defaultFontColor);i.font=f.font,i.fillStyle=y;var b=t.getIndexAngle(g),x=a.toDegrees(b);i.textAlign=d(x),h(x,t._pointLabelSizes[g],v),c(i,t.pointLabels[g]||"",v,f.size)}}}function g(t,n,i,r){var o=t.ctx;if(o.strokeStyle=a.valueAtIndexOrDefault(n.color,r-1),o.lineWidth=a.valueAtIndexOrDefault(n.lineWidth,r-1),t.options.gridLines.circular)o.beginPath(),o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),o.closePath(),o.stroke();else{var s=e(t);if(0===s)return;o.beginPath();var l=t.getPointPosition(0,i);o.moveTo(l.x,l.y);for(var u=1;u<s;u++)l=t.getPointPosition(u,i),o.lineTo(l.x,l.y);o.closePath(),o.stroke()}}function m(t){return a.isNumber(t)?t:0}var p=i.global,v={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:r.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}},y=t.LinearScaleBase.extend({setDimensions:function(){var t=this,e=t.options,n=e.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var i=a.min([t.height,t.width]),r=a.valueOrDefault(n.fontSize,p.defaultFontSize);t.drawingArea=e.display?i/2-(r/2+n.backdropPaddingY):i/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;a.each(e.data.datasets,function(r,o){if(e.isDatasetVisible(o)){var s=e.getDatasetMeta(o);a.each(r.data,function(e,a){var r=+t.getRightValue(e);isNaN(r)||s.data[a].hidden||(n=Math.min(r,n),i=Math.max(r,i))})}}),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,e=a.valueOrDefault(t.fontSize,p.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*e)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){this.options.pointLabels.display?l(this):u(this)},setReductions:function(t,e,n){var i=this,a=e.l/Math.sin(n.l),r=Math.max(e.r-i.width,0)/Math.sin(n.r),o=-e.t/Math.cos(n.t),s=-Math.max(e.b-i.height,0)/Math.cos(n.b);a=m(a),r=m(r),o=m(o),s=m(s),i.drawingArea=Math.min(Math.round(t-(a+r)/2),Math.round(t-(o+s)/2)),i.setCenterPoint(a,r,o,s)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=n+a.drawingArea,l=a.height-i-a.drawingArea;a.xCenter=Math.round((o+r)/2+a.left),a.yCenter=Math.round((s+l)/2+a.top)},getIndexAngle:function(t){return t*(2*Math.PI/e(this))+(this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var n=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this,i=n.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+n.xCenter,y:Math.round(Math.sin(i)*e)+n.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,n=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0)},draw:function(){var t=this,e=t.options,n=e.gridLines,i=e.ticks,r=a.valueOrDefault;if(e.display){var o=t.ctx,s=this.getIndexAngle(0),l=r(i.fontSize,p.defaultFontSize),u=r(i.fontStyle,p.defaultFontStyle),d=r(i.fontFamily,p.defaultFontFamily),c=a.fontString(l,u,d);a.each(t.ticks,function(e,a){if(a>0||i.reverse){var u=t.getDistanceFromCenterForValue(t.ticksAsNumbers[a]);if(n.display&&0!==a&&g(t,n,u,a),i.display){var d=r(i.fontColor,p.defaultFontColor);if(o.font=c,o.save(),o.translate(t.xCenter,t.yCenter),o.rotate(s),i.showLabelBackdrop){var h=o.measureText(e).width;o.fillStyle=i.backdropColor,o.fillRect(-h/2-i.backdropPaddingX,-u-l/2-i.backdropPaddingY,h+2*i.backdropPaddingX,l+2*i.backdropPaddingY)}o.textAlign="center",o.textBaseline="middle",o.fillStyle=d,o.fillText(e,0,-u),o.restore()}}}),(e.angleLines.display||e.pointLabels.display)&&f(t)}}});t.scaleService.registerScaleType("radialLinear",y,v)}},{25:25,34:34,45:45}],57:[function(t,e,n){"use strict";function i(t,e){return t-e}function a(t){var e,n,i,a={},r=[];for(e=0,n=t.length;e<n;++e)a[i=t[e]]||(a[i]=!0,r.push(i));return r}function r(t,e,n,i){if("linear"===i||!t.length)return[{time:e,pos:0},{time:n,pos:1}];var a,r,o,s,l,u=[],d=[e];for(a=0,r=t.length;a<r;++a)(s=t[a])>e&&s<n&&d.push(s);for(d.push(n),a=0,r=d.length;a<r;++a)l=d[a+1],o=d[a-1],s=d[a],void 0!==o&&void 0!==l&&Math.round((l+o)/2)===s||u.push({time:s,pos:a/(r-1)});return u}function o(t,e,n){for(var i,a,r,o=0,s=t.length-1;o>=0&&o<=s;){if(i=o+s>>1,a=t[i-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]<n)o=i+1;else{if(!(a[e]>n))return{lo:a,hi:r};s=i-1}}return{lo:r,hi:null}}function s(t,e,n,i){var a=o(t,e,n),r=a.lo?a.hi?a.lo:t[t.length-2]:t[0],s=a.lo?a.hi?a.hi:t[t.length-1]:t[1],l=s[e]-r[e],u=l?(n-r[e])/l:0,d=(s[i]-r[i])*u;return r[i]+d}function l(t,e){var n=e.parser,i=e.parser||e.format;return"function"==typeof n?n(t):"string"==typeof t&&"string"==typeof i?v(t,i):(t instanceof v||(t=v(t)),t.isValid()?t:"function"==typeof i?i(t):t)}function u(t,e){if(b.isNullOrUndef(t))return null;var n=e.options.time,i=l(e.getRightValue(t),n);return i.isValid()?(n.round&&i.startOf(n.round),i.valueOf()):null}function d(t,e,n,i){var a,r,o,s=e-t,l=k[n],u=l.size,d=l.steps;if(!d)return Math.ceil(s/((i||1)*u));for(a=0,r=d.length;a<r&&(o=d[a],!(Math.ceil(s/(u*o))<=i));++a);return o}function c(t,e,n,i){var a,r,o,s=w.length;for(a=w.indexOf(t);a<s-1;++a)if(r=k[w[a]],o=r.steps?r.steps[r.steps.length-1]:_,r.common&&Math.ceil((n-e)/(o*r.size))<=i)return w[a];return w[s-1]}function h(t,e,n,i){var a,r,o=v.duration(v(i).diff(v(n)));for(a=w.length-1;a>=w.indexOf(e);a--)if(r=w[a],k[r].common&&o.as(r)>=t.length)return r;return w[e?w.indexOf(e):0]}function f(t){for(var e=w.indexOf(t)+1,n=w.length;e<n;++e)if(k[w[e]].common)return w[e]}function g(t,e,n,i){var a,r=i.time,o=r.unit||c(r.minUnit,t,e,n),s=f(o),l=b.valueOrDefault(r.stepSize,r.unitStepSize),u="week"===o&&r.isoWeekday,h=i.ticks.major.enabled,g=k[o],m=v(t),p=v(e),y=[];for(l||(l=d(t,e,o,n)),u&&(m=m.isoWeekday(u),p=p.isoWeekday(u)),m=m.startOf(u?"day":o),(p=p.startOf(u?"day":o))<e&&p.add(1,o),a=v(m),h&&s&&!u&&!r.round&&(a.startOf(s),a.add(~~((m-a)/(g.size*l))*l,o));a<p;a.add(l,o))y.push(+a);return y.push(+a),y}function m(t,e,n,i,a){var r,o,l=0,u=0;return a.offset&&e.length&&(a.time.min||(r=e.length>1?e[1]:i,o=e[0],l=(s(t,"time",r,"pos")-s(t,"time",o,"pos"))/2),a.time.max||(r=e[e.length-1],o=e.length>1?e[e.length-2]:n,u=(s(t,"time",r,"pos")-s(t,"time",o,"pos"))/2)),{left:l,right:u}}function p(t,e){var n,i,a,r,o=[];for(n=0,i=t.length;n<i;++n)a=t[n],r=!!e&&a===+v(a).startOf(e),o.push({value:a,major:r});return o}var v=t(6);v="function"==typeof v?v:window.moment;var y=t(25),b=t(45),x=Number.MIN_SAFE_INTEGER||-9007199254740991,_=Number.MAX_SAFE_INTEGER||9007199254740991,k={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:2628e6,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},w=Object.keys(k);e.exports=function(t){var e=t.Scale.extend({initialize:function(){if(!v)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");this.mergeTicksOptions(),t.Scale.prototype.initialize.call(this)},update:function(){var e=this,n=e.options;return n.time&&n.time.format&&console.warn("options.time.format is deprecated and replaced by options.time.parser."),t.Scale.prototype.update.apply(e,arguments)},getRightValue:function(e){return e&&void 0!==e.t&&(e=e.t),t.Scale.prototype.getRightValue.call(this,e)},determineDataLimits:function(){var t,e,n,r,o,s,l=this,d=l.chart,c=l.options.time,h=_,f=x,g=[],m=[],p=[];for(t=0,n=d.data.labels.length;t<n;++t)p.push(u(d.data.labels[t],l));for(t=0,n=(d.data.datasets||[]).length;t<n;++t)if(d.isDatasetVisible(t))if(o=d.data.datasets[t].data,b.isObject(o[0]))for(m[t]=[],e=0,r=o.length;e<r;++e)s=u(o[e],l),g.push(s),m[t][e]=s;else g.push.apply(g,p),m[t]=p.slice(0);else m[t]=[];p.length&&(p=a(p).sort(i),h=Math.min(h,p[0]),f=Math.max(f,p[p.length-1])),g.length&&(g=a(g).sort(i),h=Math.min(h,g[0]),f=Math.max(f,g[g.length-1])),h=u(c.min,l)||h,f=u(c.max,l)||f,h=h===_?+v().startOf("day"):h,f=f===x?+v().endOf("day")+1:f,l.min=Math.min(h,f),l.max=Math.max(h+1,f),l._horizontal=l.isHorizontal(),l._table=[],l._timestamps={data:g,datasets:m,labels:p}},buildTicks:function(){var t,e,n,i=this,a=i.min,o=i.max,s=i.options,l=s.time,d=[],c=[];switch(s.ticks.source){case"data":d=i._timestamps.data;break;case"labels":d=i._timestamps.labels;break;case"auto":default:d=g(a,o,i.getLabelCapacity(a),s)}for("ticks"===s.bounds&&d.length&&(a=d[0],o=d[d.length-1]),a=u(l.min,i)||a,o=u(l.max,i)||o,t=0,e=d.length;t<e;++t)(n=d[t])>=a&&n<=o&&c.push(n);return i.min=a,i.max=o,i._unit=l.unit||h(c,l.minUnit,i.min,i.max),i._majorUnit=f(i._unit),i._table=r(i._timestamps.data,a,o,s.distribution),i._offsets=m(i._table,c,a,o,s),p(c,i._majorUnit)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.options.time,r=i.labels&&t<i.labels.length?i.labels[t]:"",o=i.datasets[e].data[t];return b.isObject(o)&&(r=n.getRightValue(o)),a.tooltipFormat&&(r=l(r,a).format(a.tooltipFormat)),r},tickFormatFunction:function(t,e,n,i){var a=this,r=a.options,o=t.valueOf(),s=r.time.displayFormats,l=s[a._unit],u=a._majorUnit,d=s[u],c=t.clone().startOf(u).valueOf(),h=r.ticks.major,f=h.enabled&&u&&d&&o===c,g=t.format(i||(f?d:l)),m=f?h:r.ticks.minor,p=b.valueOrDefault(m.callback,m.userCallback);return p?p(g,e,n):g},convertTicksToLabels:function(t){var e,n,i=[];for(e=0,n=t.length;e<n;++e)i.push(this.tickFormatFunction(v(t[e].value),e,t));return i},getPixelForOffset:function(t){var e=this,n=e._horizontal?e.width:e.height,i=e._horizontal?e.left:e.top,a=s(e._table,"time",t,"pos");return i+n*(e._offsets.left+a)/(e._offsets.left+1+e._offsets.right)},getPixelForValue:function(t,e,n){var i=this,a=null;if(void 0!==e&&void 0!==n&&(a=i._timestamps.datasets[n][e]),null===a&&(a=u(t,i)),null!==a)return i.getPixelForOffset(a)},getPixelForTick:function(t){var e=this.getTicks();return t>=0&&t<e.length?this.getPixelForOffset(e[t].value):null},getValueForPixel:function(t){var e=this,n=e._horizontal?e.width:e.height,i=e._horizontal?e.left:e.top,a=(n?(t-i)/n:0)*(e._offsets.left+1+e._offsets.left)-e._offsets.right,r=s(e._table,"pos",a,"time");return v(r)},getLabelWidth:function(t){var e=this,n=e.options.ticks,i=e.ctx.measureText(t).width,a=b.toRadians(n.maxRotation),r=Math.cos(a),o=Math.sin(a);return i*r+b.valueOrDefault(n.fontSize,y.global.defaultFontSize)*o},getLabelCapacity:function(t){var e=this,n=e.options.time.displayFormats.millisecond,i=e.tickFormatFunction(v(t),0,[],n),a=e.getLabelWidth(i),r=e.isHorizontal()?e.width:e.height;return Math.floor(r/a)}});t.scaleService.registerScaleType("time",e,{position:"bottom",distribution:"linear",bounds:"data",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}})}},{25:25,45:45,6:6}]},{},[7])(7)});
'''
LINE_CHART = '''
<div style="width:{4};margin:15px;">
<canvas id="{3}" width="100" height="100"></canvas>
</div>
<script>
var ctx = document.getElementById("{3}").getContext('2d');
var myChart = new Chart(ctx, {{
type: 'line',
data: {{
labels: {0},
datasets: [{5}]
}},
options: {{
scales: {{
yAxes: [{{
ticks: {{
beginAtZero:false,
}},
scaleLabel: {{
display: true,
labelString: '{1}'
}}
}}],
xAxes: [{{
ticks: {{
beginAtZero:false,
}},
scaleLabel: {{
display: true,
labelString: '{2}'
}}
}}]
}}
}}
}});
</script>
'''
MULTI_AXES_LINE_CHART = '''
<div style="width:{5};margin:15px;">
<canvas id="{4}" width="100" height="100"></canvas>
</div>
<script>
var ctx = document.getElementById("{4}").getContext('2d');
var myChart = new Chart(ctx, {{
type: 'line',
data: {{
labels: {0},
datasets: [{6}]
}},
options: {{
scales: {{
yAxes: [{{
id: 'A',
position: 'left',
ticks: {{
beginAtZero:false,
}},
scaleLabel: {{
display: true,
labelString: '{1}'
}}
}},
{{
id: 'B',
position: 'right',
ticks: {{
beginAtZero:false,
}},
scaleLabel: {{
display: true,
labelString: '{2}'
}}
}}],
xAxes: [{{
ticks: {{
beginAtZero:false,
}},
scaleLabel: {{
display: true,
labelString: '{3}'
}}
}}]
}}
}}
}});
</script>
'''
CHART_DATA = '''
{{
label: '{0}',
fill:false,
data: {1},
borderColor:'{2}',
borderWidth: 1
}}
'''
MULTI_AXES_CHART_DATA = '''
{{
label: '{0}',
fill:false,
data: {1},
borderColor:'{2}',
borderWidth: 1,
yAxisID: {3}
}}
'''
| 1,687.272
| 208,031
| 0.687794
|
7b127291a4c09a31933284ffd9d006abb255a03a
| 12,432
|
lua
|
Lua
|
ExtraShipClassesCore/data/scripts/lib/esccutil.lua
|
Sathaerz/Avorion-Mods
|
524893d792284fd00689e2f4a2ae6cec0189501c
|
[
"Unlicense"
] | null | null | null |
ExtraShipClassesCore/data/scripts/lib/esccutil.lua
|
Sathaerz/Avorion-Mods
|
524893d792284fd00689e2f4a2ae6cec0189501c
|
[
"Unlicense"
] | null | null | null |
ExtraShipClassesCore/data/scripts/lib/esccutil.lua
|
Sathaerz/Avorion-Mods
|
524893d792284fd00689e2f4a2ae6cec0189501c
|
[
"Unlicense"
] | null | null | null |
package.path = package.path .. ";data/scripts/lib/?.lua"
package.path = package.path .. ";data/scripts/?.lua"
include ("galaxy")
--See pirategenerator.lua for a better description of exactly what these ships do.
--fairly standard table of spawns by danger level. Scorchers (very dangerous shield-killing ships) don't start showing up until danger level 6.
--Devastators (the ultimate bullet sponge) don't show up until danger level 10.
local dangerLevel_StandardSpawnTables = {
{Level = 1, Table = {"Outlaw", "Outlaw", "Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate"}},
{Level = 2, Table = {"Outlaw", "Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Pirate", "Pirate", "Marauder", "Marauder"}},
{Level = 3, Table = {"Outlaw", "Outlaw", "Bandit", "Bandit", "Pirate", "Pirate", "Marauder", "Marauder", "Raider", "Raider"}},
{Level = 4, Table = {"Bandit", "Bandit", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider"}},
{Level = 5, Table = {"Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider", "Ravager", "Ravager"}},
{Level = 6, Table = {"Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider", "Ravager", "Ravager", "Scorcher", "Scorcher"}},
{Level = 7, Table = {"Disruptor", "Disruptor", "Raider", "Raider", "Ravager", "Ravager", "Scorcher", "Scorcher", "Prowler", "Prowler"}},
{Level = 8, Table = {"Disruptor", "Disruptor", "Raider", "Ravager", "Scorcher", "Scorcher", "Prowler", "Prowler", "Pillager", "Pillager"}},
{Level = 9, Table = {"Disruptor", "Disruptor", "Scorcher", "Scorcher", "Scorcher", "Prowler", "Prowler", "Prowler", "Pillager", "Pillager"}},
{Level = 10, Table = {"Disruptor", "Disruptor", "Scorcher", "Scorcher", "Scorcher", "Prowler", "Pillager", "Pillager", "Pillager", "Devastator"}}
}
--low threat standard table of spawns by danger level. Custom ships (which are much more dangerous than the standard pirates) aren't even represented until
--threat level 10, where we have a mere 10% chance to spawn a prowler (not that threatening compared to a scorcher, pillager or devastator)
local dangerLevel_LowThreatSpawnTables = {
{Level = 1, Table = {"Outlaw", "Outlaw", "Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate"}},
{Level = 2, Table = {"Outlaw", "Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Pirate"}},
{Level = 3, Table = {"Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Pirate", "Marauder"}},
{Level = 4, Table = {"Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Pirate", "Marauder", "Marauder"}},
{Level = 5, Table = {"Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder"}},
{Level = 6, Table = {"Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider"}},
{Level = 7, Table = {"Bandit", "Bandit", "Pirate", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider"}},
{Level = 8, Table = {"Bandit", "Pirate", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider"}},
{Level = 9, Table = {"Pirate", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider", "Ravager"}},
{Level = 10, Table = {"Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider", "Ravager", "Prowler"}}
}
--high threat standard table of spawns by danger level. Custom ships show up early and the table caps off with a 50/50 scorcher / devastator split.
local dangerLevel_HighThreatSpawnTables = {
{Level = 1, Table = {"Outlaw", "Outlaw", "Outlaw", "Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate"}},
{Level = 2, Table = {"Outlaw", "Outlaw", "Bandit", "Bandit", "Bandit", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder"}},
{Level = 3, Table = {"Bandit", "Bandit", "Pirate", "Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider"}},
{Level = 4, Table = {"Pirate", "Marauder", "Marauder", "Marauder", "Raider", "Raider", "Raider", "Ravager", "Ravager", "Ravager"}},
{Level = 5, Table = {"Marauder", "Raider", "Raider", "Raider", "Ravager", "Ravager", "Ravager", "Scorcher", "Scorcher", "Scorcher"}},
{Level = 6, Table = {"Raider", "Ravager", "Ravager", "Ravager", "Scorcher", "Scorcher", "Scorcher", "Prowler", "Prowler", "Prowler"}},
{Level = 7, Table = {"Ravager", "Scorcher", "Scorcher", "Scorcher", "Prowler", "Prowler", "Prowler", "Pillager", "Pillager", "Pillager"}},
{Level = 8, Table = {"Scorcher", "Scorcher", "Scorcher", "Prowler", "Pillager", "Pillager", "Pillager", "Devastator", "Devastator", "Devastator"}},
{Level = 9, Table = {"Scorcher", "Scorcher", "Scorcher", "Pillager", "Pillager", "Devastator", "Devastator", "Devastator", "Devastator", "Devastator"}},
--50/50 split, so no need for more than this.
{Level = 10, Table = {"Scorcher", "Devastator"}}
}
--standard table for a faction.
local dangerLevel_factionStandardSpawnTable = {
{Level = 1, Table = {"L", "L", "L", "L", "L", "L", "L", "L", "L", "L"}},
{Level = 2, Table = {"L", "L", "L", "L", "L", "L", "L", "L", "M", "M"}},
{Level = 3, Table = {"L", "L", "L", "L", "L", "L", "M", "M", "M", "M"}},
{Level = 4, Table = {"L", "L", "L", "L", "M", "M", "M", "M", "M", "M"}},
{Level = 5, Table = {"L", "L", "M", "M", "M", "M", "M", "M", "M", "M"}},
{Level = 6, Table = {"M", "M", "M", "M", "M", "M", "M", "M", "M", "M"}},
{Level = 7, Table = {"M", "M", "M", "M", "M", "M", "M", "M", "H", "H"}},
{Level = 8, Table = {"M", "M", "M", "M", "M", "M", "H", "H", "H", "H"}},
{Level = 9, Table = {"M", "M", "M", "M", "H", "H", "H", "H", "H", "H"}},
{Level = 10, Table = {"M", "M", "H", "H", "H", "H", "H", "H", "H", "H"}}
}
local ESCCUtil = {}
local self = ESCCUtil
self.RandomCalled = 0
self._Debug = 0
--If you want to just get the table to do something with it - such as adding a jammer
function ESCCUtil.getStandardTable(dangerLevel, threatLevel, _Faction)
local _MethodName = "[ESCC] Get Standardized Spawn Table"
--Get standard if not specified.
threatLevel = threatLevel or "Standard"
_Faction = _Faction or false --Most usages of this will be for pirates.
ESCCUtil.Log(_MethodName, "Grabbing " .. tostring(threatLevel) .. " table for danger level " .. tostring(dangerLevel))
--Set which spawn table set we're looking through
local tbl = {}
if _Faction then
tbl = dangerLevel_factionStandardSpawnTable
else
if threatLevel == "Low" then
tbl = dangerLevel_LowThreatSpawnTables
elseif threatLevel == "High" then
tbl = dangerLevel_HighThreatSpawnTables
elseif threatLevel == "Standard" then
tbl = dangerLevel_StandardSpawnTables
end
end
if not tbl then
ESCULog.Error(_MethodName, "Could not set tbl - function will likely error on return.")
end
for _, lt in pairs(tbl) do
if lt.Level == dangerLevel then
ESCCUtil.Log(_MethodName, "Found requested table. Returning value.")
return lt.Table
end
end
end
function ESCCUtil.getStandardWave(_DangerLevel, _WaveShips, _ThreatLevel, _Faction)
local _MethodName = "[ESCC] Get Standard Pirate Wave"
_ThreatLevel = _ThreatLevel or "Standard"
_Faction = _Faction or false --This will be used for pirates most of the time.
ESCCUtil.Log(_MethodName, "Getting wave table for " .. tostring(_WaveShips) .. " at danger level " .. tostring(_DangerLevel) .. " at threat level " .. tostring(_ThreatLevel) .. " _Faction is " .. tostring(_Faction))
local _SpawnTable = self.getStandardTable(_DangerLevel, _ThreatLevel, _Faction)
local _EnemyTable = {}
local _Rgen = self.getRand()
for _ = 1, _WaveShips do
table.insert(_EnemyTable, _SpawnTable[_Rgen:getInt(1, #_SpawnTable)])
end
return _EnemyTable
end
function ESCCUtil.countEntitiesByValue(_Value)
--We know this works, and the spam messages can be quite annoying. There's no need to add debugging to this.
local _Entities = {Sector():getEntitiesByScriptValue(_Value)}
if _Entities then
return #_Entities
else
return 0
end
end
function ESCCUtil.getStandardTemplateBlacklist()
local _MethodName = "[ESCC] Get Standard Template Blacklist"
ESCCUtil.Log(_MethodName, "Beginning...")
local templateBlacklist = {
"sectors/asteroidshieldboss",
"sectors/ancientgates",
"sectors/containerfield",
"sectors/cultists",
"sectors/pirateasteroidfield",
"sectors/piratefight",
"sectors/piratestation",
"sectors/resistancecell",
"sectors/researchsatellite",
"sectors/smugglerhideout",
"sectors/wreckagefield",
"sectors/xsotanasteroids",
"sectors/xsotanbreeders",
"sectors/xsotantransformed"
}
return templateBlacklist
end
function ESCCUtil.getRand()
local _MethodName = "[ESCC] Get Random Number Generator"
ESCCUtil.Log(_MethodName, "Beginning...")
self.RandomCalled = self.RandomCalled + random():getInt(1, 720)
return Random(Seed(os.time() + self.RandomCalled))
end
function ESCCUtil.clampToNearest(_Value, _Clamp, _Round)
_Round = _Round or "Down"
local _ClampCoefficient = math.floor(_Value / _Clamp)
if _Round == "Up" then
_ClampCoefficient = math.ceil(_Value / _Clamp)
end
return _ClampCoefficient * _Clamp
end
function ESCCUtil.getIndex(_Table, _Element)
local _MethodName = "[ESCC] Get Index of Table"
if not _Table or not _Element then
ESCULog.Error(_MethodName, "Cannot get random element - either the table or the element was not provided")
return
end
for _IDX, _VAL in pairs(_Table) do
if _VAL == _Element then
return _IDX
end
end
--Standard C# practice.
return -1
end
function ESCCUtil.getSaneColor(_R, _G, _B)
--For some reason OpenGL does colors by floats which is just wack.
local _Rfactor = _R / 255
local _Gfactor = _G / 255
local _Bfactor = _B / 255
return ColorRGB(_Rfactor, _Gfactor, _Bfactor)
end
function ESCCUtil.getDistanceToCenter(_X, _Y)
local _MethodName = "[ESCC] Get Distance to Center"
local _Dist = math.sqrt((_X * _X) + (_Y * _Y))
ESCCUtil.Log(_MethodName, "Distance to center is: " .. _Dist)
return _Dist
end
function ESCCUtil.getPosOnRing(x_in, y_in, dist)
--local slope = y_in/x_in
--local x = dist/math.sqrt(slope^2 + 1)
--if x_in < 0 then x = -x end
--local y = slope*x
--return x, y
local _Dist1 = math.sqrt((x_in * x_in) + (y_in * y_in))
local _Pos = vec2(x_in, y_in) * (dist/_Dist1)
return math.floor(_Pos.x), math.floor(_Pos.y)
end
function ESCCUtil.playerBeatStory(_Player)
if _Player:getValue("story_completed") or _Player:getValue("wormhole_guardian_destroyed") then
return true
else
return false
end
end
function ESCCUtil.allPiratesDepart()
local _Pirates = {Sector():getEntitiesByScriptValue("is_pirate")}
local _Rgen = ESCCUtil.getRand()
for _, _P in pairs(_Pirates) do
_P:addScriptOnce("entity/utility/delayeddelete.lua", _Rgen:getFloat(3, 6))
end
end
function ESCCUtil.allXsotanDepart()
local _Ships = {Sector():getEntitiesByScriptValue("is_xsotan")}
local _Rgen = ESCCUtil.getRand()
for _, _S in pairs(_Ships) do
_S:addScriptOnce("entity/utility/delayeddelete.lua", _Rgen:getFloat(2, 5))
end
end
--region #CLIENT CALLS
function ESCCUtil.compatibleJumpAnimation(_Entity, _Direction, _Color, _Intensity)
local _Sector = Sector()
local _Version = GameVersion()
if _Version.major > 1 then
_Sector:createHyperspaceJumpAnimation(_Entity, _Direction, _Color, _Intensity)
else
_Sector:createHyperspaceAnimation(_Entity, _Direction, _Color, _Intensity)
end
end
--endregion
--region #LOGGING
function ESCCUtil.Log(_MethodName, _Msg, _OverrideDebug)
local _LocalDebug = ESCCUtil._Debug or 0
if _OverrideDebug == 1 then
_LocalDebug = 1
end
if _LocalDebug == 1 then
print("[ESCC Utility] - [" .. _MethodName .. "] - " .. _Msg)
end
end
--endregion
return ESCCUtil
| 45.538462
| 219
| 0.636422
|
2a7536c6fb7208489b539d4a32f3f3de28116b5f
| 8,377
|
rs
|
Rust
|
db/src/lib.rs
|
tmokenc/tomoka-rs
|
4824962b38bca7a774e03e5d03cbe801ad9e87c8
|
[
"MIT"
] | null | null | null |
db/src/lib.rs
|
tmokenc/tomoka-rs
|
4824962b38bca7a774e03e5d03cbe801ad9e87c8
|
[
"MIT"
] | null | null | null |
db/src/lib.rs
|
tmokenc/tomoka-rs
|
4824962b38bca7a774e03e5d03cbe801ad9e87c8
|
[
"MIT"
] | null | null | null |
use bincode::config::{BigEndian, DefaultOptions, Options, WithOtherEndian};
use lazy_static::lazy_static;
use log::error;
use serde::de::DeserializeOwned;
use serde::ser::Serialize;
use sled::{Db, Tree};
use std::error::Error;
use std::marker::PhantomData;
use std::path::Path;
use std::sync::Arc;
type Manager = Arc<Db>;
type Result<T> = std::result::Result<T, Box<dyn Error + Sync + Send>>;
type Encoder = WithOtherEndian<DefaultOptions, BigEndian>;
lazy_static! {
static ref ENCODER: Encoder = DefaultOptions::new().with_big_endian();
}
#[derive(Clone)]
/// It's safe to clone because all the inners are already inside Arcs
pub struct DbInstance {
tree: Option<Tree>,
manager: Manager,
}
impl Drop for DbInstance {
fn drop(&mut self) {
self.manager.flush().ok();
}
}
#[derive(Debug, Default)]
pub struct Batch(sled::Batch);
impl Batch {
pub fn new() -> Self {
Default::default()
}
pub fn remove<S: Serialize>(&mut self, key: &S) -> Result<()> {
let data = ENCODER.serialize(key)?;
self.0.remove(data);
Ok(())
}
pub fn insert<K: Serialize, V: Serialize>(&mut self, key: &K, val: &V) -> Result<()> {
let k = ENCODER.serialize(key)?;
let v = ENCODER.serialize(val)?;
self.0.insert(k, v);
Ok(())
}
}
impl From<Batch> for sled::Batch {
fn from(b: Batch) -> sled::Batch {
b.0
}
}
pub struct Iter<K: DeserializeOwned, V: DeserializeOwned> {
iter: sled::Iter,
_marker: PhantomData<(K, V)>,
}
pub struct IterKey<K: DeserializeOwned> {
iter: sled::Iter,
_marker: PhantomData<K>,
}
impl<K: DeserializeOwned, V: DeserializeOwned> Iter<K, V> {
pub(crate) fn new(iter: sled::Iter) -> Self {
Self {
iter,
_marker: PhantomData,
}
}
pub fn keys(self) -> IterKey<K> {
IterKey {
iter: self.iter,
_marker: PhantomData,
}
}
}
impl<K: DeserializeOwned, V: DeserializeOwned> Iterator for Iter<K, V> {
type Item = (K, V);
fn next(&mut self) -> Option<Self::Item> {
self.iter
.by_ref()
.filter_map(|v| v.ok())
.find_map(|(ref key, ref val)| {
let data = (|| {
let k = ENCODER.deserialize(key)?;
let v = ENCODER.deserialize(val)?;
bincode::Result::<(K, V)>::Ok((k, v))
})();
match data {
Ok(e) => Some(e),
Err(why) => {
error!("Cannot deserialize data | {}", why);
None
}
}
})
}
}
impl<K: DeserializeOwned> Iterator for IterKey<K> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.iter
.by_ref()
.filter_map(|v| v.ok())
.map(|(key, _)| key)
.find_map(|ref key| match ENCODER.deserialize(key) {
Ok(e) => Some(e),
Err(why) => {
error!("Cannot deserialize key | {}", why);
None
}
})
}
}
impl DbInstance {
pub fn new<'a, P, N>(path: P, name: N) -> Result<Self>
where
P: AsRef<Path>,
N: Into<Option<&'a [u8]>>,
{
let manager = get_db_manager(path)?;
let db = Self::from_manager(manager, name.into())?;
Ok(db)
}
pub fn from_manager<N: AsRef<[u8]>>(manager: Manager, name: Option<N>) -> Result<Self> {
let tree = match name {
Some(n) => Some(manager.open_tree(n)?),
None => None,
};
Ok(Self { tree, manager })
}
pub fn open<N: AsRef<[u8]>>(&self, tree: N) -> Result<Self> {
let manager = Arc::clone(&self.manager);
Self::from_manager(manager, Some(tree))
}
pub fn get<K, V>(&self, key: &K) -> Result<Option<V>>
where
K: Serialize,
V: DeserializeOwned,
{
let k = ENCODER.serialize(key)?;
let res = self
.tree()
.get(&k)?
.and_then(|ref v| ENCODER.deserialize(v).ok());
Ok(res)
}
pub fn get_all<K, V>(&self) -> Iter<K, V>
where
K: DeserializeOwned,
V: DeserializeOwned,
{
let iter = self.tree().iter();
Iter::<K, V>::new(iter)
}
pub fn get_all_keys<K: DeserializeOwned>(&self) -> IterKey<K> {
IterKey {
iter: self.tree().iter(),
_marker: PhantomData,
}
}
pub fn insert<K, V>(&self, key: &K, value: &V) -> Result<()>
where
K: Serialize,
V: Serialize,
{
let k = ENCODER.serialize(key)?;
let v = ENCODER.serialize(value)?;
self.tree().insert(&k, v)?;
Ok(())
}
pub fn remove<K: Serialize>(&self, key: &K) -> Result<()> {
let k = ENCODER.serialize(key)?;
self.tree().remove(&k)?;
Ok(())
}
pub fn remove_many<K: Serialize, I: IntoIterator<Item = K>>(&self, keys: I) -> Result<()> {
let mut batch = sled::Batch::default();
for key in keys {
let k = ENCODER.serialize(&key)?;
batch.remove(k);
}
self.tree().apply_batch(batch)?;
Ok(())
}
pub fn batch(&self, batch: Batch) -> Result<()> {
self.tree().apply_batch(batch.into())?;
Ok(())
}
#[inline]
pub fn clear(&self) -> Result<()> {
self.tree().clear().map_err(|e| Box::new(e) as Box<_>)
}
#[inline]
pub fn tree(&self) -> &Tree {
match &self.tree {
Some(t) => t,
None => &**self.manager,
}
}
#[inline]
pub fn manager(&self) -> Manager {
Arc::clone(&self.manager)
}
}
// use tokio::runtime::Handle as TokioHandler;
// impl DbInstance {
// #[inline]
// pub async fn get_async<K, V>(&self, key: &K) -> Result<Option<V>>
// where
// K: Serialize,
// V: DeserializeOwned,
// {
// TokioHandler::try_current()?.spawn_blocking(move || self.get(key))
// }
//
// #[inline]
// pub async fn insert_async<K, V>(&self, key: &K, value: &V) -> Result<()>
// where
// K: Serialize,
// V: Serialize,
// {
// TokioHandler::try_current()?.spawn_blocking(move || self.insert(key, value))
// }
//
// #[inline]
// pub async fn remove_async<K: Serialize>(&self, key: &K) -> Result<()> {
// TokioHandler::try_current()?.spawn_blocking(move || self.remove(key))
// }
//
// #[inline]
// pub async fn remove_many_async<K: Serialize, I: IntoIterator<Item = K>>(&self, keys: I) -> Result<()> {
// TokioHandler::try_current()?.spawn_blocking(move || self.remove_many(keys))
// }
//
// #[inline]
// pub async fn batch_async(&self, batch: Batch) -> Result<()> {
// TokioHandler::try_current()?.spawn_blocking(move || self.batch(batch))
// }
//
// #[inline]
// pub async fn clear_async(&self) -> Result<()> {
// TokioHandler::try_current()?.spawn_blocking(move || self.clear())
// }
//
// }
#[inline]
pub fn get_db_manager(path: impl AsRef<Path>) -> Result<Manager> {
sled::Config::new()
.path(path)
.use_compression(true)
.open()
.map(Arc::new)
.map_err(|v| Box::new(v) as Box<_>)
}
/// Retry until we able to get to database
/// Return `None` if cannot get the instance after the retry counts
/// Passing `None` to the `retry` will make the loop run forever until we have the database instance
pub async fn get_db_instance<P, R>(path: P, retry: R) -> Option<DbInstance>
where
P: AsRef<Path>,
R: Into<Option<usize>>,
{
let mut retry = retry.into();
let path = path.as_ref().to_owned();
loop {
match DbInstance::new(&path, None) {
Ok(db) => break Some(db),
Err(why) => {
log::error!("{}", why);
if let Some(retry) = retry.as_mut() {
if *retry == 0 {
break None;
}
*retry -= 1;
}
let wait = core::time::Duration::from_millis(500);
tokio::time::delay_for(wait).await;
}
}
}
}
| 26.178125
| 110
| 0.508535
|
017074689565ee19675f0aaf7ad5d16b21998947
| 2,598
|
asm
|
Assembly
|
libtool/src/gmp-6.1.2/mpn/sparc64/ultrasparct3/add_n.asm
|
kroggen/aergo
|
05af317eaa1b62b21dc0144ef74a9e7acb14fb87
|
[
"MIT"
] | 1,602
|
2015-01-06T11:26:31.000Z
|
2022-03-30T06:17:21.000Z
|
libtool/src/gmp-6.1.2/mpn/sparc64/ultrasparct3/add_n.asm
|
kroggen/aergo
|
05af317eaa1b62b21dc0144ef74a9e7acb14fb87
|
[
"MIT"
] | 11,789
|
2015-01-05T04:50:15.000Z
|
2022-03-31T23:39:19.000Z
|
libtool/src/gmp-6.1.2/mpn/sparc64/ultrasparct3/add_n.asm
|
kroggen/aergo
|
05af317eaa1b62b21dc0144ef74a9e7acb14fb87
|
[
"MIT"
] | 498
|
2015-01-08T18:58:18.000Z
|
2022-03-20T15:37:45.000Z
|
dnl SPARC v9 mpn_add_n for T3/T4.
dnl Contributed to the GNU project by David Miller.
dnl Copyright 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC T3: 8
C UltraSPARC T4: 3
C INPUT PARAMETERS
define(`rp', `%i0')
define(`up', `%i1')
define(`vp', `%i2')
define(`n', `%i3')
define(`cy', `%i4')
define(`u0_off', `%l2')
define(`u1_off', `%l3')
define(`loop_n', `%l6')
define(`tmp', `%l7')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_add_nc)
save %sp, -176, %sp
b,a L(ent)
EPILOGUE()
PROLOGUE(mpn_add_n)
save %sp, -176, %sp
mov 0, cy
L(ent):
subcc n, 1, n
be L(final_one)
cmp %g0, cy
ldx [up + 0], %o4
sllx n, 3, tmp
ldx [vp + 0], %o5
add up, tmp, u0_off
ldx [up + 8], %g5
neg tmp, loop_n
ldx [vp + 8], %g1
add u0_off, 8, u1_off
sub loop_n, -(2 * 8), loop_n
brgez,pn loop_n, L(loop_tail)
add vp, (2 * 8), vp
b,a L(top)
ALIGN(16)
L(top):
addxccc(%o4, %o5, tmp)
ldx [vp + 0], %o5
add rp, (2 * 8), rp
ldx [loop_n + u0_off], %o4
add vp, (2 * 8), vp
stx tmp, [rp - 16]
addxccc(%g1, %g5, tmp)
ldx [vp - 8], %g1
ldx [loop_n + u1_off], %g5
sub loop_n, -(2 * 8), loop_n
brlz loop_n, L(top)
stx tmp, [rp - 8]
L(loop_tail):
addxccc(%o4, %o5, %g3)
add loop_n, u0_off, up
addxccc(%g1, %g5, %g5)
stx %g3, [rp + 0]
brgz,pt loop_n, L(done)
stx %g5, [rp + 8]
add rp, (2 * 8), rp
L(final_one):
ldx [up+0], %o4
ldx [vp+0], %o5
addxccc(%o4, %o5, %g3)
stx %g3, [rp+0]
L(done):
addxc(%g0, %g0, %i0)
ret
restore
EPILOGUE()
| 20.456693
| 79
| 0.653965
|
6df8f052f270a66124cacce6d99424916729449e
| 1,253
|
c
|
C
|
src/draw/vfxs/sheared_rectangle.c
|
Stellaris-code/DanmakuParanoia
|
8745ee76d66a6267974c7597b1e771027f4f3e97
|
[
"MIT"
] | null | null | null |
src/draw/vfxs/sheared_rectangle.c
|
Stellaris-code/DanmakuParanoia
|
8745ee76d66a6267974c7597b1e771027f4f3e97
|
[
"MIT"
] | null | null | null |
src/draw/vfxs/sheared_rectangle.c
|
Stellaris-code/DanmakuParanoia
|
8745ee76d66a6267974c7597b1e771027f4f3e97
|
[
"MIT"
] | null | null | null |
#include "draw/vfx.h"
#include <string.h>
#include "math/easing.h"
#include "draw/draw.h"
bool vfx_sheared_rectangle_draw(void* databuf, float time)
{
vfx_sheared_rectangle_info_t info;
memcpy(&info, databuf, sizeof(info)); // standard-compliant type-punning
if (info.persist)
{
if (time > info.effect_duration*2.f)
return true;
}
else
{
if (time > info.effect_duration)
return true;
}
bool invert = time > info.effect_duration/2.f;
if (info.persist)
invert = false;
const float progression = easeInOutCubic(time/(info.effect_duration/2.f));
float actual_len;
if (!invert)
actual_len = info.max_length * progression;
else
actual_len = info.max_length * (progression - 1);
vector2d_t vert[4] =
{
{0.0f, invert ? actual_len : 0.0f},
{0.0f, invert ? info.max_length :actual_len},
{info.width, invert ? actual_len : 0.0f},
{info.width, invert ? info.max_length : actual_len}
};
if (actual_len < 0)
SWAP(vert[0], vert[3]);
draw_sheared_quad(info.shearing, vert, info.pos, info.angle, info.col);
return false; // effect is not finished yet
}
| 25.571429
| 78
| 0.605746
|
a41c2bffd5d696b80b7e98205814e1f9454788a5
| 1,234
|
php
|
PHP
|
src/Finder/Rql.php
|
Lukeboy25/jsonapi-rql-finder-bundle
|
5165375885892d5cdff8346e18d2f4f22b05e035
|
[
"MIT"
] | 7
|
2018-10-10T07:52:59.000Z
|
2020-06-18T15:04:02.000Z
|
src/Finder/Rql.php
|
Lukeboy25/jsonapi-rql-finder-bundle
|
5165375885892d5cdff8346e18d2f4f22b05e035
|
[
"MIT"
] | 5
|
2019-09-13T10:01:03.000Z
|
2022-03-21T15:17:16.000Z
|
src/Finder/Rql.php
|
Lukeboy25/jsonapi-rql-finder-bundle
|
5165375885892d5cdff8346e18d2f4f22b05e035
|
[
"MIT"
] | 3
|
2019-01-23T08:47:02.000Z
|
2022-03-14T08:39:31.000Z
|
<?php
namespace Mnugter\JsonApiRqlFinderBundle\Finder;
use AndreasGlaser\DoctrineRql\Factory\ORMVisitorFactory;
use Doctrine\ORM\QueryBuilder;
use Paknahad\JsonApiBundle\Helper\FieldManager;
use Paknahad\JsonApiBundle\Helper\Filter\FinderInterface;
use Symfony\Component\HttpFoundation\Request;
class Rql implements FinderInterface
{
/**
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
/**
* @var \Doctrine\ORM\QueryBuilder $query
*/
protected $query;
/**
* {@inheritdoc}
*/
public function setRequest(Request $request): void
{
$this->request = $request;
}
/**
* {@inheritdoc}
*/
public function setQuery(QueryBuilder $query): void
{
$this->query = $query;
}
/**
* {@inheritdoc}
*/
public function setFieldManager(FieldManager $fieldManager): void
{
}
/**
* {@inheritdoc}
*/
public function filterQuery(): void {
$rql = $this->request->get('rql');
if ($rql) {
ORMVisitorFactory::appendFiltersOnly($this->query, $rql);
}
}
/**
* {@inheritdoc}
*/
public function sortQuery(): void
{
}
}
| 18.984615
| 69
| 0.601297
|
b728245881598bd173e019180fb2863faf68151d
| 1,845
|
cpp
|
C++
|
1135/main.cpp
|
Heliovic/PAT_Solutions
|
7c5dd554654045308f2341713c3e52cc790beb59
|
[
"MIT"
] | 2
|
2019-03-18T12:55:38.000Z
|
2019-09-07T10:11:26.000Z
|
1135/main.cpp
|
Heliovic/My_PAT_Answer
|
7c5dd554654045308f2341713c3e52cc790beb59
|
[
"MIT"
] | null | null | null |
1135/main.cpp
|
Heliovic/My_PAT_Answer
|
7c5dd554654045308f2341713c3e52cc790beb59
|
[
"MIT"
] | null | null | null |
#include <cstdio>
//#include <cstdlib>
#define MAX_N 64
#define RED -1
#define BLACK 1
using namespace std;
struct node
{
int type, data;
node* lc;
node* rc;
node() {lc = rc = NULL;}
};
int K, N;
node* root = NULL;
int black_cnt = -1;
bool is_rbtree = true;
void insert_bst(int data, node* & r, int type)
{
if (r == NULL)
{
r = new node;
r->data = data;
r->type = type;
return;
}
if (data < r->data)
insert_bst(data, r->lc, type);
else
insert_bst(data, r->rc, type);
}
int dfs(node* r)
{
if (!is_rbtree)
return -1;
if (r == NULL)
{
return 1;
}
/*system("pause");
printf("%d\n", r->data);*/
if (r->type == RED)
{
if ((r->lc != NULL && r->lc->type == RED) || (r->rc != NULL && r->rc->type == RED))
{
is_rbtree = false;
return -1;
}
}
int lcnt = dfs(r->lc);
int rcnt = dfs(r->rc);
if (lcnt != rcnt)
is_rbtree = false;
return r->type == BLACK ? lcnt + 1 : lcnt;
}
void pre(node* r)
{
if (r == NULL)
return;
printf("%d ", r->data);
pre(r->lc);
pre(r->rc);
}
int main()
{
scanf("%d", &K);
while (K--)
{
root = NULL;
black_cnt = -1;
is_rbtree = true;
scanf("%d", &N);
for (int i = 0; i < N; i++)
{
int t;
scanf("%d", &t);
if (t < 0)
insert_bst(-t, root, RED);
else
insert_bst(t, root, BLACK);
}
if (root->type == RED)
{
printf("No\n");
continue;
}
//pre(root);
dfs(root);
if (is_rbtree)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
| 15.769231
| 91
| 0.416802
|
27aadd89ed46b9210456bf83c422b5cc7edaa5bf
| 74
|
sql
|
SQL
|
framework/resources/Functional/text_storage/testcases/drill4919_5.sql
|
dkondriu/drill-test-framework
|
919d931f987cd615b9184584371ca5513f8e9e7a
|
[
"Apache-2.0"
] | null | null | null |
framework/resources/Functional/text_storage/testcases/drill4919_5.sql
|
dkondriu/drill-test-framework
|
919d931f987cd615b9184584371ca5513f8e9e7a
|
[
"Apache-2.0"
] | null | null | null |
framework/resources/Functional/text_storage/testcases/drill4919_5.sql
|
dkondriu/drill-test-framework
|
919d931f987cd615b9184584371ca5513f8e9e7a
|
[
"Apache-2.0"
] | null | null | null |
select Id, col1, col2 from `/drill/testdata/text_storage/drill4919.tcsv`;
| 37
| 73
| 0.783784
|
9fc8fdb848c363fda9d5c3bc34a45130b926cace
| 2,600
|
rs
|
Rust
|
src/bin/timebase.rs
|
RafaelOrtizRC/timebase
|
5b7eb439984183e53f85050e9aa38096ebd5457a
|
[
"MIT"
] | null | null | null |
src/bin/timebase.rs
|
RafaelOrtizRC/timebase
|
5b7eb439984183e53f85050e9aa38096ebd5457a
|
[
"MIT"
] | null | null | null |
src/bin/timebase.rs
|
RafaelOrtizRC/timebase
|
5b7eb439984183e53f85050e9aa38096ebd5457a
|
[
"MIT"
] | null | null | null |
use clap::{crate_authors, crate_description, crate_version, App, Arg, SubCommand};
use slog::debug;
use timebase::LOGGER;
use timebase::{client, dmz, server};
fn main() {
let matches = App::new("Timebase")
.version(crate_version!())
.author(crate_authors!("\n"))
.about(crate_description!())
.subcommand(
SubCommand::with_name("client")
.about("receive information from the server")
.arg(
Arg::with_name("interface")
.short("i")
.long("interface")
.help("the interface to intercept and modify communications on")
.takes_value(true)
.required(true)
.value_name("INTERFACE NAME"),
),
)
.subcommand(
SubCommand::with_name("server")
.about("send information to the client")
.arg(
Arg::with_name("interface")
.short("i")
.long("interface")
.help("the interface to intercept and modify communications on")
.takes_value(true)
.required(true)
.value_name("INTERFACE NAME"),
),
)
.subcommand(
SubCommand::with_name("dmz")
.about("send information to the server")
.arg(
Arg::with_name("interface")
.short("i")
.long("interface")
.help("the interface to intercept and modify communications on")
.takes_value(true)
.required(true)
.value_name("INTERFACE NAME"),
),
)
.get_matches();
if let Some(matches) = matches.subcommand_matches("server") {
debug!(LOGGER, "Starting timebase server.");
let interface = matches.value_of("interface").unwrap();
server::load_filter(interface).unwrap();
} else if let Some(matches) = matches.subcommand_matches("client") {
let interface = matches.value_of("interface").unwrap();
client::run_client(interface);
} else if let Some(matches) = matches.subcommand_matches("dmz") {
let interface = matches.value_of("interface").unwrap();
dmz::run_dmz(interface).unwrap();
} else {
println!("Please specify `client`, `dmz`, or `server`.");
}
}
| 39.393939
| 88
| 0.495
|
23fc89053a37b946b4cf4bbe19798c77ecdca7ac
| 2,225
|
js
|
JavaScript
|
src/lib/properties/view.js
|
davepgreene/propsd
|
64bfc819f3b3bd91d0b32874e33dfdb206043434
|
[
"MIT"
] | 21
|
2016-04-29T23:01:02.000Z
|
2022-02-16T07:15:01.000Z
|
src/lib/properties/view.js
|
davepgreene/propsd
|
64bfc819f3b3bd91d0b32874e33dfdb206043434
|
[
"MIT"
] | 272
|
2016-01-11T16:41:01.000Z
|
2021-09-01T02:31:43.000Z
|
src/lib/properties/view.js
|
davepgreene/propsd
|
64bfc819f3b3bd91d0b32874e33dfdb206043434
|
[
"MIT"
] | 11
|
2016-07-14T13:23:23.000Z
|
2022-02-16T07:15:01.000Z
|
'use strict';
/**
* A View aggregates the initialized events of multiple sources and safely
* forwards their update events to a parent Properties object.
*/
class View {
/**
* Constructor
* @param {Properties} parent
* @param {Array} sources
*/
constructor(parent, sources) {
this.parent = parent;
this.sources = sources instanceof Array ? sources : [];
/**
* Create a statically bound method to register/deregister update events
*/
this.onUpdate = function onUpdate() {
/**
* This is safe because the onUpdate handler is only registered to
* sources after they have all initialized, and is removed before the View
* is replaced.
*/
this.parent.build();
}.bind(this);
}
/**
* Register a source to the View.
*
* The only use of this method in the codebase is during testing.
*
* @deprecated
* @param {*} source
*/
register(source) {
this.sources.push(source);
}
/**
* Initialize registered sources. Waits for all sources' `initialize` promises
* to resolve, then deregisters the current active View's listeners from its
* sources, then registers its own listeners for sources' update events, then
* sets itself as the active view and builds the Properties instance.
*
* @return {Promise<View>}
*/
activate() {
const current = this.parent.active;
// Already active
if (this.parent.active === this) {
return Promise.resolve(this);
}
this.parent.active = this;
// Wait for all sources to initialize
return Promise.all(this.sources.map((source) => source.initialize()))
.then(() => {
// Deregister current active view's update listeners
current.destroy();
// Register for sources' update events
this.sources.forEach((source) => {
source.addListener('update', this.onUpdate);
});
// Rebuild properties
return this.parent.build().then(() => this);
});
}
/**
* Deregister handler from sources' update events
*/
destroy() {
this.sources.forEach((source) => {
source.removeListener('update', this.onUpdate);
});
}
}
module.exports = View;
| 26.176471
| 80
| 0.627416
|
b7cc98a2a46d5b3d1dd617d15de154a5730d8183
| 176
|
sql
|
SQL
|
resources/sql/autopatches/20151215.phame.1.autotitle.sql
|
Rob--W/phabricator
|
8272f3f7fa92179931a2fc7ca33909492cfc644d
|
[
"Apache-2.0"
] | 8,840
|
2015-01-02T03:04:43.000Z
|
2022-03-29T05:24:18.000Z
|
resources/sql/autopatches/20151215.phame.1.autotitle.sql
|
Rob--W/phabricator
|
8272f3f7fa92179931a2fc7ca33909492cfc644d
|
[
"Apache-2.0"
] | 73
|
2015-01-06T11:05:32.000Z
|
2021-12-02T17:50:10.000Z
|
resources/sql/autopatches/20151215.phame.1.autotitle.sql
|
Rob--W/phabricator
|
8272f3f7fa92179931a2fc7ca33909492cfc644d
|
[
"Apache-2.0"
] | 1,335
|
2015-01-04T03:15:40.000Z
|
2022-03-30T23:34:27.000Z
|
ALTER TABLE {$NAMESPACE}_phame.phame_post
DROP KEY phameTitle;
ALTER TABLE {$NAMESPACE}_phame.phame_post
CHANGE phameTitle phameTitle VARCHAR(64) COLLATE {$COLLATE_SORT};
| 29.333333
| 67
| 0.801136
|
c6927b3a1ce8470988406dd5e4148cdc4c895a04
| 1,532
|
py
|
Python
|
usage_graph.py
|
msteknoadam/bill-plot
|
a9383a172cc6eb2ef61f43bb268275383784cbce
|
[
"MIT"
] | null | null | null |
usage_graph.py
|
msteknoadam/bill-plot
|
a9383a172cc6eb2ef61f43bb268275383784cbce
|
[
"MIT"
] | null | null | null |
usage_graph.py
|
msteknoadam/bill-plot
|
a9383a172cc6eb2ef61f43bb268275383784cbce
|
[
"MIT"
] | null | null | null |
import csv
import matplotlib.pyplot as plt
import matplotlib
periods = []
electricity = []
water = []
with open('monthly_bills.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
print(f'Column names are {row}')
line_count += 1
else:
# print(f'\t{row[0]} - {row[1]} - {row[2]}')
periods.append(row[0])
try:
electricity.append(float(row[1]))
except:
# Use last month's value if the current value is not defined etc.
electricity.append(electricity[-1])
try:
water.append(float(row[2]))
except:
# Use last month's value if the current value is not defined etc.
water.append(water[-1])
line_count += 1
# print(f'Processed {line_count} lines.')
print("Periods:", periods)
print("Electricity:", electricity)
print("Water", water)
matplotlib.rcParams['figure.figsize'] = (10.0, 7.5)
plt.plot(periods, electricity, 'r', label="Electricity")
plt.plot(periods, water, 'b', label="Water")
plt.plot(periods, electricity, 'ro')
plt.plot(periods, water, 'bo')
plt.xticks(periods, rotation='vertical')
plt.subplots_adjust(bottom=0.15)
plt.title('Electricity and Water Bills Per Payment Period')
plt.xlabel('Period')
plt.ylabel('Bill (₺)')
plt.ylim(bottom=0)
plt.legend(handlelength=3)
plt.savefig('example-plot.png')
plt.show()
| 30.039216
| 81
| 0.607702
|
2710daf7290be3182aacc4167467907f125bdbc0
| 418
|
lua
|
Lua
|
11_logical_operators_cont.lua
|
pabloariasal/lua_tutorial
|
42f784027c2c7d756f728b1235c3fd13b3ce7b53
|
[
"Apache-2.0"
] | null | null | null |
11_logical_operators_cont.lua
|
pabloariasal/lua_tutorial
|
42f784027c2c7d756f728b1235c3fd13b3ce7b53
|
[
"Apache-2.0"
] | null | null | null |
11_logical_operators_cont.lua
|
pabloariasal/lua_tutorial
|
42f784027c2c7d756f728b1235c3fd13b3ce7b53
|
[
"Apache-2.0"
] | null | null | null |
-- Logical operators work with all types
-- In Lua Everything is true but nil and false
-- Logical operators short-circuiting
--[[
false and x = false
true and x = x
true or x = true
false or x = x
--]]
print(4 and 5) -- 5
print(nil or 13) -- 13
-- compute the minimum of two numbers
min (x < y) and x or y
-- Initialize x to v only if x undefined
x = x or v
-- same as:
if not x then x = v end
| 18.173913
| 46
| 0.629187
|
3925b2784023edda66e35c0c33a7eb363d9b6d50
| 123
|
py
|
Python
|
home/iot/urls.py
|
he0119/smart-home
|
bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683
|
[
"MIT"
] | null | null | null |
home/iot/urls.py
|
he0119/smart-home
|
bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683
|
[
"MIT"
] | 223
|
2020-02-21T06:16:56.000Z
|
2022-03-01T22:24:19.000Z
|
home/iot/urls.py
|
he0119/smart-home
|
bdd3a59a8c46c0fdc07ac3049bf589c7f95a2683
|
[
"MIT"
] | null | null | null |
from django.urls import path
from . import views
app_name = "iot"
urlpatterns = [
path("", views.iot, name="iot"),
]
| 13.666667
| 36
| 0.650407
|
23f8c8ba349b6c882a23dde8b6ff608b24d9ee76
| 389
|
js
|
JavaScript
|
models/comments.model.js
|
mtwn105/REST-API-Node
|
f512ab243590aa2b3eeff8bf6d2b6644f8a13d11
|
[
"MIT"
] | 2
|
2021-10-02T12:27:27.000Z
|
2021-10-13T02:39:36.000Z
|
models/comments.model.js
|
mtwn105/REST-API-Node
|
f512ab243590aa2b3eeff8bf6d2b6644f8a13d11
|
[
"MIT"
] | 35
|
2021-10-01T19:38:22.000Z
|
2021-11-05T16:32:55.000Z
|
models/comments.model.js
|
mtwn105/REST-API-Node
|
f512ab243590aa2b3eeff8bf6d2b6644f8a13d11
|
[
"MIT"
] | 19
|
2021-10-02T06:22:23.000Z
|
2021-10-31T02:09:49.000Z
|
const mongoose = require("mongoose");
const { ObjectId } = mongoose.Schema.Types;
const Comments = mongoose.model(
"Comments",
new mongoose.Schema({
description: {
type: String,
required: true,
},
orderId: {
type: ObjectId,
required: true,
},
userId: {
type: ObjectId,
required: true,
},
})
);
module.exports = Comments;
| 16.913043
| 43
| 0.580977
|
7b79392464ee45291e471ce0b7f033c4dbab04c3
| 392
|
rb
|
Ruby
|
ruby/learning/gui_tk/03.btn_command_.rb
|
zhaoace/codecraft
|
bf06267e86bd7386714911b0df4aa0ca0a91d882
|
[
"Unlicense"
] | null | null | null |
ruby/learning/gui_tk/03.btn_command_.rb
|
zhaoace/codecraft
|
bf06267e86bd7386714911b0df4aa0ca0a91d882
|
[
"Unlicense"
] | null | null | null |
ruby/learning/gui_tk/03.btn_command_.rb
|
zhaoace/codecraft
|
bf06267e86bd7386714911b0df4aa0ca0a91d882
|
[
"Unlicense"
] | null | null | null |
require 'tk'
# click button will change label color
msg= "你好。"
root = TkRoot.new{title "title nihao"}
lable_msg = TkLabel.new (root) {
text msg
pack :padx=>2, :pady=>2, :side=>'top'
font "arial 20 "
}
TkButton.new(root){
text "bianse"
pack :padx => 2, :pady =>2 , :side => 'bottom'
command {
lable_msg.configure('foreground'=>'red')
}
}
Tk.mainloop
| 15.076923
| 48
| 0.591837
|
7b159e4c6b5980f1ae2196f6a40eefd7d3cafdf3
| 267
|
rb
|
Ruby
|
app/misc/sql_util.rb
|
fengb/nvst
|
1a2099ba34b18da017c85a3d1943d203717aca4a
|
[
"MIT"
] | 1
|
2015-10-01T13:35:02.000Z
|
2015-10-01T13:35:02.000Z
|
app/misc/sql_util.rb
|
fengb/nvst
|
1a2099ba34b18da017c85a3d1943d203717aca4a
|
[
"MIT"
] | 17
|
2015-02-24T03:27:58.000Z
|
2022-03-30T22:25:12.000Z
|
app/misc/sql_util.rb
|
fengb/nvst
|
1a2099ba34b18da017c85a3d1943d203717aca4a
|
[
"MIT"
] | null | null | null |
module SqlUtil
def self.sanitize(sql, *args)
ActiveRecord::Base.send(:sanitize_sql_array, [sql, *args])
end
def self.execute(sql, *args)
if args.present?
sql = sanitize(sql, *args)
end
ActiveRecord::Base.connection.execute(sql)
end
end
| 20.538462
| 62
| 0.674157
|
0a4a51568eba60cc44186f690089c37c4fcf4ea2
| 8,540
|
cs
|
C#
|
src/Cake.Module.Shared/CakeEngineBase.cs
|
JuergenRB/Cake.BuildSystems.Module
|
3a7f5b4ed3d4178903a351d3a171fcddb90b87b3
|
[
"MIT"
] | 23
|
2017-04-26T17:24:07.000Z
|
2020-10-27T10:42:42.000Z
|
src/Cake.Module.Shared/CakeEngineBase.cs
|
JuergenRB/Cake.BuildSystems.Module
|
3a7f5b4ed3d4178903a351d3a171fcddb90b87b3
|
[
"MIT"
] | 64
|
2021-02-02T19:23:52.000Z
|
2022-01-13T15:19:53.000Z
|
src/Cake.Module.Shared/CakeEngineBase.cs
|
biohazard999/Cake.BuildSystems.Module
|
0c7ad22f67e85211de4d1e5f8418e4c3be174796
|
[
"MIT"
] | 12
|
2017-09-19T15:57:15.000Z
|
2021-01-27T16:36:20.000Z
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Cake.Core;
namespace Cake.Module.Shared
{
/// <summary>
/// Base-implementation for a wrapped <see cref="ICakeEngine"/> - the base Shared Engine used by CI modules.
/// </summary>
public abstract class CakeEngineBase : ICakeEngine
{
/// <summary>
/// Gets the wrapped <see cref="ICakeEngine"/>.
/// </summary>
#pragma warning disable SA1401
// ReSharper disable once InconsistentNaming
protected readonly ICakeEngine _engine;
#pragma warning restore SA1401
/// <summary>
/// Initializes a new instance of the <see cref="CakeEngineBase"/> class.
/// </summary>
/// <param name="implementation">The wrapped <see cref="ICakeEngine"/>.</param>
protected CakeEngineBase(ICakeEngine implementation)
{
_engine = implementation;
}
#pragma warning disable CS0618
/// <inheritdoc cref="ICakeEngine.Setup"/>
[Obsolete]
public event EventHandler<SetupEventArgs> Setup
{
add { _engine.Setup += value; }
remove { _engine.Setup -= value; }
}
#pragma warning restore CS0618
/// <inheritdoc cref="ICakeEngine.BeforeSetup"/>
public event EventHandler<BeforeSetupEventArgs> BeforeSetup
{
add { _engine.BeforeSetup += value; }
remove { _engine.BeforeSetup -= value; }
}
/// <inheritdoc cref="ICakeEngine.AfterSetup"/>
public event EventHandler<AfterSetupEventArgs> AfterSetup
{
add { _engine.AfterSetup += value; }
remove { _engine.AfterSetup -= value; }
}
#pragma warning disable CS0618
/// <inheritdoc cref="ICakeEngine.Teardown"/>
[Obsolete]
public event EventHandler<TeardownEventArgs> Teardown
{
add { _engine.Teardown += value; }
remove { _engine.Teardown -= value; }
}
#pragma warning restore CS0618
/// <inheritdoc cref="ICakeEngine.BeforeTeardown"/>
public event EventHandler<BeforeTeardownEventArgs> BeforeTeardown
{
add { _engine.BeforeTeardown += value; }
remove { _engine.BeforeTeardown -= value; }
}
/// <inheritdoc cref="ICakeEngine.AfterTeardown"/>
public event EventHandler<AfterTeardownEventArgs> AfterTeardown
{
add { _engine.AfterTeardown += value; }
remove { _engine.AfterTeardown -= value; }
}
#pragma warning disable CS0618
/// <inheritdoc cref="ICakeEngine.TaskSetup"/>
[Obsolete]
public event EventHandler<TaskSetupEventArgs> TaskSetup
{
add { _engine.TaskSetup += value; }
remove { _engine.TaskSetup -= value; }
}
#pragma warning restore CS0618
/// <inheritdoc cref="ICakeEngine.BeforeTaskSetup"/>
public event EventHandler<BeforeTaskSetupEventArgs> BeforeTaskSetup
{
add { _engine.BeforeTaskSetup += value; }
remove { _engine.BeforeTaskSetup -= value; }
}
/// <inheritdoc cref="ICakeEngine.AfterTaskSetup"/>
public event EventHandler<AfterTaskSetupEventArgs> AfterTaskSetup
{
add { _engine.AfterTaskSetup += value; }
remove { _engine.AfterTaskSetup -= value; }
}
#pragma warning disable CS0618
/// <inheritdoc cref="ICakeEngine.TaskTeardown"/>
[Obsolete]
public event EventHandler<TaskTeardownEventArgs> TaskTeardown
{
add { _engine.TaskTeardown += value; }
remove { _engine.TaskTeardown -= value; }
}
#pragma warning restore CS0618
/// <inheritdoc cref="ICakeEngine.BeforeTaskTeardown"/>
public event EventHandler<BeforeTaskTeardownEventArgs> BeforeTaskTeardown
{
add { _engine.BeforeTaskTeardown += value; }
remove { _engine.BeforeTaskTeardown -= value; }
}
/// <inheritdoc cref="ICakeEngine.AfterTaskTeardown"/>
public event EventHandler<AfterTaskTeardownEventArgs> AfterTaskTeardown
{
add { _engine.AfterTaskTeardown += value; }
remove { _engine.AfterTaskTeardown -= value; }
}
/// <inheritdoc />
IReadOnlyList<ICakeTaskInfo> ICakeEngine.Tasks => _engine.Tasks;
/// <summary>Gets all registered tasks.</summary>
/// <value>The registered tasks.</value>
public IReadOnlyList<ICakeTaskInfo> Tasks => _engine.Tasks;
/// <summary>Registers a new task.</summary>
/// <param name="name">The name of the task.</param>
/// <returns>A <see cref="T:Cake.Core.CakeTaskBuilder`1" />.</returns>
public CakeTaskBuilder RegisterTask(string name)
{
return _engine.RegisterTask(name);
}
/// <inheritdoc />
public void RegisterSetupAction(Action<ISetupContext> action)
{
_engine.RegisterSetupAction(action);
}
/// <inheritdoc />
public void RegisterSetupAction<TData>(Func<ISetupContext, TData> action)
where TData : class
{
_engine.RegisterSetupAction(action);
}
/// <summary>
/// Allows registration of an action that's executed before any tasks are run.
/// If setup fails, no tasks will be executed but teardown will be performed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void RegisterSetupAction(Action<ICakeContext> action)
{
_engine.RegisterSetupAction(action);
}
/// <summary>
/// Allows registration of an action that's executed after all other tasks have been run.
/// If a setup action or a task fails with or without recovery, the specified teardown action will still be executed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void RegisterTeardownAction(Action<ITeardownContext> action)
{
_engine.RegisterTeardownAction(action);
}
/// <inheritdoc />
public void RegisterTeardownAction<TData>(Action<ITeardownContext, TData> action)
where TData : class
{
_engine.RegisterTeardownAction(action);
}
/// <summary>
/// Runs the specified target using the specified <see cref="T:Cake.Core.IExecutionStrategy" />.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="strategy">The execution strategy.</param>
/// <param name="settings">The execution settings.</param>
/// <returns>
/// The resulting report.
/// </returns>
public Task<CakeReport> RunTargetAsync(ICakeContext context, IExecutionStrategy strategy, ExecutionSettings settings)
{
return _engine.RunTargetAsync(context, strategy, settings);
}
/// <summary>
/// Allows registration of an action that's executed before each task is run.
/// If the task setup fails, the task will not be executed but the task's teardown will be performed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void RegisterTaskSetupAction(Action<ITaskSetupContext> action)
{
_engine.RegisterTaskSetupAction(action);
}
/// <inheritdoc />
public void RegisterTaskSetupAction<TData>(Action<ITaskSetupContext, TData> action)
where TData : class
{
_engine.RegisterTaskSetupAction(action);
}
/// <summary>
/// Allows registration of an action that's executed after each task has been run.
/// If a task setup action or a task fails with or without recovery, the specified task teardown action will still be
/// executed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void RegisterTaskTeardownAction(Action<ITaskTeardownContext> action)
{
_engine.RegisterTaskTeardownAction(action);
}
/// <inheritdoc />
public void RegisterTaskTeardownAction<TData>(Action<ITaskTeardownContext, TData> action)
where TData : class
{
_engine.RegisterTaskTeardownAction(action);
}
}
}
| 36.969697
| 129
| 0.610422
|
3c75783e5d3b1d6cfed744739627171103a5a13b
| 5,155
|
swift
|
Swift
|
Sources/SafariView/SafariViewPresenter.swift
|
ericlewis/BetterSafariView
|
b3660c429a671283ee41ed3974aedfa868e44181
|
[
"MIT"
] | null | null | null |
Sources/SafariView/SafariViewPresenter.swift
|
ericlewis/BetterSafariView
|
b3660c429a671283ee41ed3974aedfa868e44181
|
[
"MIT"
] | null | null | null |
Sources/SafariView/SafariViewPresenter.swift
|
ericlewis/BetterSafariView
|
b3660c429a671283ee41ed3974aedfa868e44181
|
[
"MIT"
] | null | null | null |
#if os(iOS)
import SwiftUI
import SafariServices
@_spi(Private) import Shared
struct SafariViewPresenter<Item: Identifiable>: UIViewRepresentable {
// MARK: Representation
@Binding var item: Item?
var onDismiss: (() -> Void)? = nil
var representationBuilder: (Item) -> SafariView
// MARK: UIViewRepresentable
func makeCoordinator() -> Coordinator {
return Coordinator(parent: self)
}
func makeUIView(context: Context) -> UIView {
return context.coordinator.uiView
}
func updateUIView(_ uiView: UIView, context: Context) {
// Keep the coordinator updated with a new presenter struct.
context.coordinator.parent = self
context.coordinator.item = item
}
}
extension SafariViewPresenter {
class Coordinator: NSObject, SFSafariViewControllerDelegate {
// MARK: Parent Copying
var parent: SafariViewPresenter
init(parent: SafariViewPresenter) {
self.parent = parent
}
// MARK: View Controller Holding
let uiView = UIView()
private weak var safariViewController: SFSafariViewController?
// MARK: Item Handling
var item: Item? {
didSet(oldItem) {
handleItemChange(from: oldItem, to: item)
}
}
// Ensure the proper presentation handler is executed only once
// during a one SwiftUI view update life cycle.
private func handleItemChange(from oldItem: Item?, to newItem: Item?) {
switch (oldItem, newItem) {
case (.none, .none):
()
case let (.none, .some(newItem)):
presentSafariViewController(with: newItem)
case let (.some(oldItem), .some(newItem)) where oldItem.id != newItem.id:
dismissSafariViewController() {
self.presentSafariViewController(with: newItem)
}
case let (.some, .some(newItem)):
updateSafariViewController(with: newItem)
case (.some, .none):
dismissSafariViewController()
}
}
// MARK: Presentation Handlers
private func presentSafariViewController(with item: Item) {
let representation = parent.representationBuilder(item)
let safariViewController = SFSafariViewController(url: representation.url, configuration: representation.configuration)
safariViewController.delegate = self
representation.applyModification(to: safariViewController)
// Present a Safari view controller from the `viewController` of `UIViewRepresentable`, instead of `UIViewControllerRepresentable`.
// This fixes an issue where the Safari view controller is not presented properly
// when the `UIViewControllerRepresentable` is detached from the root view controller (e.g. `UIViewController` contained in `UITableViewCell`)
// while allowing it to be presented even on the modal sheets.
// Thanks to: Bohdan Hernandez Navia (@boherna)
guard let presentingViewController = uiView._viewController else {
self.resetItemBinding()
return
}
presentingViewController.present(safariViewController, animated: true)
self.safariViewController = safariViewController
}
private func updateSafariViewController(with item: Item) {
guard let safariViewController = safariViewController else {
return
}
let representation = parent.representationBuilder(item)
representation.applyModification(to: safariViewController)
}
private func dismissSafariViewController(completion: (() -> Void)? = nil) {
guard let safariViewController = safariViewController else {
return
}
safariViewController.dismiss(animated: true) {
self.handleDismissal()
completion?()
}
}
// MARK: Dismissal Handlers
// Used when the `viewController` of `uiView` does not exist during the preparation of presentation.
private func resetItemBinding() {
parent.item = nil
}
// Used when the Safari view controller is finished by an item change during view update.
private func handleDismissal() {
parent.onDismiss?()
}
// Used when the Safari view controller is finished by a user interaction.
private func resetItemBindingAndHandleDismissal() {
parent.item = nil
parent.onDismiss?()
}
// MARK: SFSafariViewControllerDelegate
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
resetItemBindingAndHandleDismissal()
}
}
}
#endif
| 35.551724
| 154
| 0.598642
|
4210b9871fda059da814c76abc10f852e52f7099
| 792
|
cs
|
C#
|
Test/LanguageServerTest/IntegrationTests/CounterExampleIntegrationTest/VariousExamples.cs
|
just-me-/dafny-language-server
|
e54dab51b83c0d07fa13363d8e9778b16258ef37
|
[
"MIT"
] | null | null | null |
Test/LanguageServerTest/IntegrationTests/CounterExampleIntegrationTest/VariousExamples.cs
|
just-me-/dafny-language-server
|
e54dab51b83c0d07fa13363d8e9778b16258ef37
|
[
"MIT"
] | null | null | null |
Test/LanguageServerTest/IntegrationTests/CounterExampleIntegrationTest/VariousExamples.cs
|
just-me-/dafny-language-server
|
e54dab51b83c0d07fa13363d8e9778b16258ef37
|
[
"MIT"
] | null | null | null |
using NUnit.Framework;
using System.Collections.Generic;
using Files = TestCommons.Paths;
namespace CounterExampleIntegrationTest
{
[TestFixture]
public class Various : CounterExampleBase
{
[Test]
public void LoopInvariant()
{
GetCounterExamples(Files.ce_li);
List<string> expecation = new List<string>()
{
"L12 C24: b = 0; n = 5881; "
};
VerifyResults(expecation);
}
[Test]
public void RandomInternetExample()
{
GetCounterExamples(Files.ce_lp);
List<string> expecation = new List<string>()
{
"L11 C16: x = 37084; y = 1; "
};
VerifyResults(expecation);
}
}
}
| 24.75
| 56
| 0.525253
|
7d6c1810bc8430b88f1a5bd4ff07b17bd27d0ded
| 1,844
|
lua
|
Lua
|
doc/write_examples.lua
|
FaceDeer/namegen
|
12362740d4015d2ee7ee373004debbf61039ab15
|
[
"MIT"
] | 1
|
2020-01-30T10:23:44.000Z
|
2020-01-30T10:23:44.000Z
|
doc/write_examples.lua
|
FaceDeer/name_generator
|
12362740d4015d2ee7ee373004debbf61039ab15
|
[
"MIT"
] | null | null | null |
doc/write_examples.lua
|
FaceDeer/name_generator
|
12362740d4015d2ee7ee373004debbf61039ab15
|
[
"MIT"
] | 1
|
2020-07-03T16:42:37.000Z
|
2020-07-03T16:42:37.000Z
|
local inspect = require("inspect")
local name_generator = require("name_generator")
local DEST = "examples.rst"
local dest = ""
math.randomseed(1)
math.random()
local sets = name_generator.get_sets()
table.sort(sets)
local groups = {
{"Books"},
{"Creatures"},
{"Potions"},
{"Towns"},
{"Inns"},
}
for _, set in ipairs(sets) do
if string.find(set, "books$") then
Books = groups[1]
Books[#Books + 1] = set
elseif string.find(set, "potions$") then
Potions = groups[3]
Potions[#Potions + 1] = set
elseif string.find(set, "towns$") then
Towns = groups[4]
Towns[#Towns + 1] = set
elseif string.find(set, "inns$") then
Inns = groups[5]
Inns[#Inns + 1] = set
else
Creatures = groups[2]
Creatures[#Creatures + 1] = set
end
end
for _, t in ipairs(groups) do
local group = t[1]
dest = dest .. ("\n" .. string.format([[%s]], group))
dest = dest .. ("\n" .. string.gsub(group, ".", "-") .. "---\n")
for i = 2, #t do
local set = t[i]
-- print(group, set)
dest = dest .. ("\n" .. string.format([["%s"]], set))
dest = dest .. ("\n" .. string.gsub(set, ".", "*") .. "***\n")
dest = dest .. ("\n" .. ".. code-block:: lua" .. "\n")
local names = {}
local s = 0
while s < 30 do
local str = name_generator.generate(set)
if names[str] == nil then
names[str] = str
s = s + 1
end
end
local names, old = {}, names
for _, v in pairs(old) do
names[#names + 1] = v
end
table.sort(names)
dest = dest .. ("\n " .. inspect(names):gsub("[{}]", "") .. "\n\n")
end
end
local file = io.open(DEST, "w+")
file:write(dest)
file:close()
| 24.918919
| 76
| 0.494577
|
d576735fcf92a803f0cb8bc6fad2ed884672c58a
| 657
|
sh
|
Shell
|
thumbulator/bareBench/correctness.sh
|
impedimentToProgress/ratchet
|
4a0f4994ee7e16819849fc0a1a1dbb04921a25fd
|
[
"MIT"
] | 4
|
2018-12-31T04:46:13.000Z
|
2021-02-04T15:11:03.000Z
|
thumbulator/bareBench/correctness.sh
|
impedimentToProgress/ratchet
|
4a0f4994ee7e16819849fc0a1a1dbb04921a25fd
|
[
"MIT"
] | null | null | null |
thumbulator/bareBench/correctness.sh
|
impedimentToProgress/ratchet
|
4a0f4994ee7e16819849fc0a1a1dbb04921a25fd
|
[
"MIT"
] | 3
|
2017-10-28T16:15:33.000Z
|
2021-11-16T05:11:43.000Z
|
#!/bin/bash
ROOTS=( "crc/" "rsa/" "FFT/" "dijkstra/" "picojpeg/" "stringsearch/" "sha/" "basicmath/" )
#ROOTS=( "dijkstra/" )
#ROOTS=( "stringsearch/" )
function correctness {
cmd="(../sim_main $1/main.bin 2>&1 | grep
[0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]* | grep -v
[0-9]*,[0-9]*,0,[0-9]*,[0-9]*,[0-9]*)"
RESULT=$(eval $cmd)
if [ -n "$RESULT" ]; then
echo "$1 has idempotency violations!"
else
echo "$1 is okay!"
fi
}
echo "PID: $$"
for root in "${ROOTS[@]}"
do
#cmd="(../sim_main $root/main.bin 2>&1 | python check_idem.py - 0x40000000 > $root/results/correctness.txt) &"
correctness $root &
done
wait
echo "All done!"
| 21.9
| 113
| 0.561644
|
c9a9b2d11bbe3f91d68d5bdc127808f39ff84663
| 235
|
lua
|
Lua
|
ProgrammingInLua/ch09/9.2.lua
|
Tic-tics/Algorithm-Museum
|
21412552b6e80d05d60634a583d4f2696d98ee35
|
[
"MIT"
] | null | null | null |
ProgrammingInLua/ch09/9.2.lua
|
Tic-tics/Algorithm-Museum
|
21412552b6e80d05d60634a583d4f2696d98ee35
|
[
"MIT"
] | null | null | null |
ProgrammingInLua/ch09/9.2.lua
|
Tic-tics/Algorithm-Museum
|
21412552b6e80d05d60634a583d4f2696d98ee35
|
[
"MIT"
] | null | null | null |
#!/usr/local/bin/lua
function F (x)
return {
set = function (y) x = y end,
get = function () return x end
}
end
o1 = F(10)
o2 = F(20)
print(o1.get(), o2.get())
o2.set(100)
o1.set(300)
print(o1.get(), o2.get())
| 15.666667
| 38
| 0.540426
|
406153a5bd4e4d6330cb9765630e5c55e83194a1
| 218
|
ts
|
TypeScript
|
js_modules/dagit/packages/core/src/configeditor/ConfigEditorHelpContext.ts
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 4,606
|
2018-06-21T17:45:20.000Z
|
2022-03-31T23:39:42.000Z
|
js_modules/dagit/packages/core/src/configeditor/ConfigEditorHelpContext.ts
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 6,221
|
2018-06-12T04:36:01.000Z
|
2022-03-31T21:43:05.000Z
|
js_modules/dagit/packages/core/src/configeditor/ConfigEditorHelpContext.ts
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 619
|
2018-08-22T22:43:09.000Z
|
2022-03-31T22:48:06.000Z
|
import {ConfigEditorRunConfigSchemaFragment_allConfigTypes} from './types/ConfigEditorRunConfigSchemaFragment';
export interface ConfigEditorHelpContext {
type: ConfigEditorRunConfigSchemaFragment_allConfigTypes;
}
| 36.333333
| 111
| 0.880734
|
40d094b345effb64b08d99d558cfe198d07030c4
| 2,835
|
lua
|
Lua
|
scripts/HC01-JP/c100287005.lua
|
JSY1728/ygopro-pre-script
|
7c4a08e38c8f4a1181b41c9fb49ee8698f7754aa
|
[
"Unlicense"
] | null | null | null |
scripts/HC01-JP/c100287005.lua
|
JSY1728/ygopro-pre-script
|
7c4a08e38c8f4a1181b41c9fb49ee8698f7754aa
|
[
"Unlicense"
] | null | null | null |
scripts/HC01-JP/c100287005.lua
|
JSY1728/ygopro-pre-script
|
7c4a08e38c8f4a1181b41c9fb49ee8698f7754aa
|
[
"Unlicense"
] | null | null | null |
--真紅き魂
--
--Script by Trishula9
function c100287005.initial_effect(c)
--change name
aux.EnableChangeCode(c,74677422,LOCATION_MZONE+LOCATION_GRAVE)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE+LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,100287005)
e1:SetCondition(c100287005.spcon)
e1:SetCost(c100287005.spcost)
e1:SetTarget(c100287005.sptg)
e1:SetOperation(c100287005.spop)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,100287005+100+EFFECT_COUNT_CODE_DUEL)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e2:SetTarget(c100287005.damtg)
e2:SetOperation(c100287005.damop)
c:RegisterEffect(e2)
end
function c100287005.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp)
end
function c100287005.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c100287005.spfilter(c,e,tp)
return not c:IsCode(100287005) and c:IsSetCard(0x3b) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100287005.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0
and Duel.IsExistingMatchingCard(c100287005.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c100287005.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c100287005.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c100287005.damfilter(c)
return c:IsFaceup() and c:IsCode(74677422)
end
function c100287005.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c100287005.damfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100287005.damfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c100287005.damfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetFirst():GetBaseAttack())
end
function c100287005.damop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Damage(1-tp,tc:GetBaseAttack(),REASON_EFFECT)
end
end
| 39.375
| 112
| 0.807055
|
12cb64151df42720b50675acd3e36c58c3f44f56
| 1,200
|
cs
|
C#
|
MonoGame32/Asset/AssetsManager.cs
|
PilzHere/MonoGame32
|
030ef3ae309d78a2e8de8bbf9eb142842539e71c
|
[
"MIT"
] | null | null | null |
MonoGame32/Asset/AssetsManager.cs
|
PilzHere/MonoGame32
|
030ef3ae309d78a2e8de8bbf9eb142842539e71c
|
[
"MIT"
] | null | null | null |
MonoGame32/Asset/AssetsManager.cs
|
PilzHere/MonoGame32
|
030ef3ae309d78a2e8de8bbf9eb142842539e71c
|
[
"MIT"
] | null | null | null |
using System;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame32.Asset
{
public class AssetsManager
{
private ContentManager _contentManager;
public AssetsManager(ContentManager contentManager)
{
_contentManager = contentManager;
}
public void LoadAllAssets()
{
Console.WriteLine("Load all assets.");
LoadTextures();
}
public string DefaultTexture = "Textures/default";
private void LoadTextures()
{
_contentManager.Load<Texture2D>(DefaultTexture);
}
public Texture2D GetTexture(string location)
{
// If it's not loaded yet, it willl load.
// If it IS loaded, it will reuse the loaded.
//Texture2D texture2D = _contentManager.Load<Texture2D>(location);
return _contentManager.Load<Texture2D>(location);
}
public void Dispose()
{
Console.WriteLine("Unloading all assets.");
_contentManager.Unload(); // Disposes all loaded assets.
_contentManager.Dispose();
}
}
}
| 26.086957
| 78
| 0.6
|
db0e0829889bac58eb848238dccff45977d25b57
| 2,098
|
swift
|
Swift
|
UnitTests/Explore/TestExploreRequesterParserPaging.swift
|
turingcorp/autoplaza
|
d006a163e36b74cde4d1949ab5fde20d7c3b1185
|
[
"MIT"
] | null | null | null |
UnitTests/Explore/TestExploreRequesterParserPaging.swift
|
turingcorp/autoplaza
|
d006a163e36b74cde4d1949ab5fde20d7c3b1185
|
[
"MIT"
] | null | null | null |
UnitTests/Explore/TestExploreRequesterParserPaging.swift
|
turingcorp/autoplaza
|
d006a163e36b74cde4d1949ab5fde20d7c3b1185
|
[
"MIT"
] | null | null | null |
import XCTest
@testable import autoplaza
class TestExploreRequesterParserPaging:XCTestCase {
private var parser:ExploreRequesterParserPaging!
private var jsonSuccess:Data!
private var jsonError:Data!
private var dictionarySuccess:[String:Any]!
private var dictionaryError:[String:Any]!
private struct Constants {
static let total:Int = 110690
static let offset:Int = 33
static let limit:Int = 1
}
override func setUp() {
super.setUp()
let jsonParser:ExploreRequesterParser = ExploreRequesterParser()
self.parser = ExploreRequesterParserPaging()
self.jsonSuccess = JsonMocker.paging01
self.jsonError = JsonMocker.pagingError01
do {
try self.dictionarySuccess = jsonParser.getJsonFrom(data:self.jsonSuccess)
try self.dictionaryError = jsonParser.getJsonFrom(data:self.jsonError)
} catch {}
}
func testInit() {
XCTAssertNotNil(self.parser, "Failed to load parser")
XCTAssertNotNil(self.jsonSuccess, "Failed to load json success")
XCTAssertNotNil(self.jsonError, "Failed to load json error")
XCTAssertNotNil(self.dictionarySuccess, "Failed to load dictionary success")
XCTAssertNotNil(self.dictionaryError, "Failed to load dictionary error")
}
func testThrowErrorOnWrongJson() {
XCTAssertThrowsError(try self.parser.parse(json:self.dictionaryError))
}
func testNotThrowOnSuccess() {
XCTAssertNoThrow(try self.parser.parse(json:self.dictionarySuccess))
}
func testParsingValues() {
let paging:SearchPaging
do {
try paging = self.parser.parse(json:self.dictionarySuccess)
} catch {
return
}
print(self.dictionarySuccess)
XCTAssertEqual(paging.total, Constants.total, "Total not parsed properly")
XCTAssertEqual(paging.limit, Constants.limit, "Limit not parsed properly")
XCTAssertEqual(paging.offset, Constants.offset, "Offset not parsed properly")
}
}
| 36.172414
| 86
| 0.677788
|
bb557dae9fd06f81cf50e291b4f4bb3783ad148e
| 14,766
|
cs
|
C#
|
src/PowerShell/Commands/GetPartnerUserSignInActivity.cs
|
rvdintercept/Partner-Center-PowerShell
|
8fbf3346cf8b86a8214389b29e725efcba14702c
|
[
"MIT"
] | 65
|
2019-05-08T15:47:24.000Z
|
2022-01-20T10:56:59.000Z
|
src/PowerShell/Commands/GetPartnerUserSignInActivity.cs
|
rvdintercept/Partner-Center-PowerShell
|
8fbf3346cf8b86a8214389b29e725efcba14702c
|
[
"MIT"
] | 191
|
2019-05-07T23:22:42.000Z
|
2022-03-25T12:05:08.000Z
|
src/PowerShell/Commands/GetPartnerUserSignInActivity.cs
|
rvdintercept/Partner-Center-PowerShell
|
8fbf3346cf8b86a8214389b29e725efcba14702c
|
[
"MIT"
] | 31
|
2019-05-28T19:14:25.000Z
|
2022-03-09T07:22:44.000Z
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Store.PartnerCenter.PowerShell.Commands
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Management.Automation;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Graph;
using Models.Authentication;
using Network;
[Cmdlet(VerbsCommon.Get, "PartnerUserSignInActivity"), OutputType(typeof(SignIn))]
public class GetPartnerUserSignInActivity : PartnerAsyncCmdlet
{
/// <summary>
/// The error code thrown when attempting to request sign activites at the tenant level from a tenant that does not have Azure AD Premium.
/// </summary>
private const string RequestFromNonPremiumTenant = "Authentication_RequestFromNonPremiumTenantOrB2CTenant";
/// <summary>
/// Represents the default amount of time used when calculating a random delta in the delay between retries.
/// </summary>
private static readonly TimeSpan DefaultClientBackoff = TimeSpan.FromSeconds(10.0);
/// <summary>
/// Represents the default maximum amount of time used when calculating the exponential delay between retries.
/// </summary>
private static readonly TimeSpan DefaultMaxBackoff = TimeSpan.FromSeconds(30.0);
/// <summary>
/// Represents the default minimum amount of time used when calculating the exponential delay between retries.
/// </summary>
private static readonly TimeSpan DefaultMinBackoff = TimeSpan.FromSeconds(1.0);
/// <summary>
/// The queue of paged Microsoft Graph request operations.
/// </summary>
private static readonly Queue<IBaseRequest> PagedRequests = new Queue<IBaseRequest>();
/// <summary>
/// Gets or sets the end date portion of the query.
/// </summary>
[Parameter(HelpMessage = "The end date of the activity logs.", Mandatory = false)]
public DateTime? EndDate { get; set; }
/// <summary>
/// Gets or sets the start date portion of the query.
/// </summary>
[Parameter(HelpMessage = "The start date of the activity logs.", Mandatory = false)]
public DateTime? StartDate { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
[Parameter(HelpMessage = "The identifier for the user.", Mandatory = false)]
[ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled | RegexOptions.IgnoreCase)]
public string UserId { get; set; }
/// <summary>
/// Executes the operations associated with the cmdlet.
/// </summary>
public override void ExecuteCmdlet()
{
Scheduler.RunTask(async () =>
{
GraphServiceClient client = PartnerSession.Instance.ClientFactory.CreateGraphServiceClient() as GraphServiceClient;
IAuditLogRootSignInsCollectionPage collection;
List<QueryOption> queryOptions = null;
List<SignIn> signIns;
string filter = string.Empty;
client.AuthenticationProvider = new GraphAuthenticationProvider();
if (StartDate != null)
{
filter = AppendValue(filter, $"createdDateTime ge {StartDate.Value.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)}");
}
if (EndDate != null)
{
filter = AppendValue(filter, $"createdDateTime le {EndDate.Value.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)}");
}
if (!string.IsNullOrEmpty(UserId))
{
filter = AppendValue(filter, $"userId eq '{UserId}'");
}
if (!string.IsNullOrEmpty(filter))
{
queryOptions = new List<QueryOption>
{
new QueryOption("$filter", $"({filter})")
};
}
try
{
collection = await client.AuditLogs.SignIns.Request(queryOptions).Top(500).GetAsync(CancellationToken).ConfigureAwait(false);
signIns = new List<SignIn>(collection.CurrentPage);
while (collection.NextPageRequest != null)
{
collection = await collection.NextPageRequest.GetAsync(CancellationToken).ConfigureAwait(false);
signIns.AddRange(collection.CurrentPage);
}
}
catch (ServiceException ex)
{
if (!ex.Error.Code.Equals(RequestFromNonPremiumTenant, StringComparison.InvariantCultureIgnoreCase))
{
throw;
}
signIns = await GetSignInActivitiesAsync(client).ConfigureAwait(false);
}
WriteObject(signIns, true);
}, true);
}
private async Task<List<SignIn>> GetSignInActivitiesAsync(IGraphServiceClient client)
{
BatchRequestContent batchRequestContent;
BatchResponseContent batchResponseContent;
IGraphServiceUsersCollectionPage userCollection;
List<SignIn> signIns;
List<User> users;
string filter = string.Empty;
userCollection = await client.Users.Request().Top(500).GetAsync().ConfigureAwait(false);
users = new List<User>(userCollection.CurrentPage);
while (userCollection.NextPageRequest != null)
{
userCollection = await userCollection.NextPageRequest.GetAsync().ConfigureAwait(false);
users.AddRange(userCollection.CurrentPage);
}
if (StartDate != null)
{
filter = AppendValue(filter, $"createdDateTime ge {StartDate.Value.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)}");
}
if (EndDate != null)
{
filter = AppendValue(filter, $"createdDateTime le {EndDate.Value.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture)}");
}
signIns = new List<SignIn>();
foreach (IEnumerable<User> batch in Batch(users, 5))
{
batchRequestContent = new BatchRequestContent();
foreach (User user in batch)
{
batchRequestContent.AddBatchRequestStep(client.AuditLogs.SignIns.Request(new List<QueryOption>
{
new QueryOption("$filter", $"({AppendValue(filter, $"userId eq '{user.Id}'")})")
}));
}
batchResponseContent = await client.Batch.Request().PostAsync(batchRequestContent, CancellationToken).ConfigureAwait(false);
await ParseBatchResponseAsync(client, batchRequestContent, batchResponseContent, signIns).ConfigureAwait(false);
}
while (PagedRequests.Count != 0)
{
await ProcessPagedRequestsAsync(client, signIns).ConfigureAwait(false);
}
return signIns;
}
private static string AppendValue(string baseValue, string appendValue)
{
if (string.IsNullOrEmpty(baseValue))
{
return appendValue;
}
return $"{baseValue} and {appendValue}";
}
private static IEnumerable<IEnumerable<T>> Batch<T>(IEnumerable<T> entities, int batchSize)
{
int size = 0;
while (size < entities.Count())
{
yield return entities.Skip(size).Take(batchSize);
size += batchSize;
}
}
private static bool IsTransient(HttpResponseMessage response)
{
if (response.StatusCode == HttpStatusCode.RequestTimeout ||
response.StatusCode == (HttpStatusCode)429 ||
(response.StatusCode >= HttpStatusCode.InternalServerError &&
response.StatusCode != HttpStatusCode.NotImplemented &&
response.StatusCode != HttpStatusCode.HttpVersionNotSupported))
{
return true;
}
return false;
}
private async Task ParseBatchResponseAsync(IGraphServiceClient client, BatchRequestContent batchRequestContent, BatchResponseContent batchResponseContent, List<SignIn> signIns, int retryCount = 0)
{
AuditLogRootRestrictedSignInsCollectionResponse collection;
Dictionary<string, HttpResponseMessage> responses;
client.AssertNotNull(nameof(client));
batchRequestContent.AssertNotNull(nameof(batchRequestContent));
batchResponseContent.AssertNotNull(nameof(batchResponseContent));
signIns.AssertNotNull(nameof(signIns));
responses = await batchResponseContent.GetResponsesAsync().ConfigureAwait(false);
foreach (KeyValuePair<string, HttpResponseMessage> item in responses.Where(item => item.Value.IsSuccessStatusCode))
{
collection = await batchResponseContent
.GetResponseByIdAsync<AuditLogRootRestrictedSignInsCollectionResponse>(item.Key).ConfigureAwait(false);
collection.AdditionalData.TryGetValue("@odata.nextLink", out object nextPageLink);
string nextPageLinkString = nextPageLink as string;
if (!string.IsNullOrEmpty(nextPageLinkString))
{
collection.Value.InitializeNextPageRequest(client, nextPageLinkString);
}
if (collection.Value.NextPageRequest != null)
{
PagedRequests.Enqueue(collection.Value.NextPageRequest);
}
signIns.AddRange(collection.Value);
}
if (PagedRequests.Count >= 5)
{
await ProcessPagedRequestsAsync(client, signIns).ConfigureAwait(false);
}
await RetryRequestWithTransientFaultAsync(client, batchRequestContent, responses, signIns, ++retryCount).ConfigureAwait(false);
}
private async Task ProcessPagedRequestsAsync(IGraphServiceClient client, List<SignIn> signIns)
{
BatchRequestContent batchRequestContent;
BatchResponseContent batchResponseContent;
int numberOfRequests;
client.AssertNotNull(nameof(client));
signIns.AssertNotNull(nameof(signIns));
if (PagedRequests.Count == 0)
{
return;
}
batchRequestContent = new BatchRequestContent();
numberOfRequests = PagedRequests.Count > 5 ? 5 : PagedRequests.Count;
for (int i = 0; i < numberOfRequests; i++)
{
batchRequestContent.AddBatchRequestStep(PagedRequests.Dequeue());
}
batchResponseContent = await client.Batch.Request().PostAsync(batchRequestContent, CancellationToken).ConfigureAwait(false);
await ParseBatchResponseAsync(client, batchRequestContent, batchResponseContent, signIns).ConfigureAwait(false);
}
private async Task RetryRequestWithTransientFaultAsync(IGraphServiceClient client, BatchRequestContent batchRequestContent, Dictionary<string, HttpResponseMessage> responses, List<SignIn> signIns, int retryCount)
{
BatchRequestContent retryBatchRequestContent = new BatchRequestContent();
BatchResponseContent batchResponseContent;
Random random;
double delta;
client.AssertNotNull(nameof(client));
batchRequestContent.AssertNotNull(nameof(batchRequestContent));
responses.AssertNotNull(nameof(responses));
if (responses.Any(r => IsTransient(r.Value)))
{
if (retryCount <= 3)
{
foreach (KeyValuePair<string, HttpResponseMessage> item in responses.Where(r => IsTransient(r.Value)))
{
retryBatchRequestContent.AddBatchRequestStep(batchRequestContent.BatchRequestSteps[item.Key]);
}
random = new Random();
delta = (Math.Pow(2.0, retryCount) - 1.0) *
random.Next((int)(DefaultClientBackoff.TotalMilliseconds * 0.8), (int)(DefaultClientBackoff.TotalMilliseconds * 1.2));
await Task.Delay((int)Math.Min(DefaultMinBackoff.TotalMilliseconds + delta, DefaultMaxBackoff.TotalMilliseconds), CancellationToken).ConfigureAwait(false);
batchResponseContent = await client.Batch.Request().PostAsync(retryBatchRequestContent, CancellationToken).ConfigureAwait(false);
await ParseBatchResponseAsync(client, retryBatchRequestContent, batchResponseContent, signIns, retryCount).ConfigureAwait(false);
}
else
{
ErrorResponse errorResponse;
List<ServiceException> exceptions = new List<ServiceException>();
ResponseHandler responseHandler = new ResponseHandler(new Serializer());
string rawResponseBody;
foreach (KeyValuePair<string, HttpResponseMessage> item in responses.Where(item => !item.Value.IsSuccessStatusCode))
{
rawResponseBody = null;
if (item.Value.Content?.Headers.ContentType.MediaType == "application/json")
{
rawResponseBody = await item.Value.Content.ReadAsStringAsync().ConfigureAwait(false);
}
errorResponse = await responseHandler.HandleResponse<ErrorResponse>(item.Value).ConfigureAwait(false);
exceptions.Add(new ServiceException(errorResponse.Error, item.Value.Headers, item.Value.StatusCode, rawResponseBody));
}
throw new AggregateException(exceptions);
}
}
}
}
}
| 43.175439
| 220
| 0.598808
|
719676fad01e55b9f6781b08bdbe0d660bd71a72
| 4,051
|
swift
|
Swift
|
Classes/UIKit/ViewController+Extension.swift
|
kongzichixiangjiao/GAExtension
|
9c457ff368375fbe5920c83934824388a59f5c50
|
[
"MIT"
] | null | null | null |
Classes/UIKit/ViewController+Extension.swift
|
kongzichixiangjiao/GAExtension
|
9c457ff368375fbe5920c83934824388a59f5c50
|
[
"MIT"
] | null | null | null |
Classes/UIKit/ViewController+Extension.swift
|
kongzichixiangjiao/GAExtension
|
9c457ff368375fbe5920c83934824388a59f5c50
|
[
"MIT"
] | null | null | null |
//
// ViewController+Extension.swift
// YE
//
// Created by 侯佳男 on 2017/12/8.
// Copyright © 2017年 侯佳男. All rights reserved.
//
/*
* 交换方法viewWillAppear、viewDidDisappear方法
* 获取storyboard的root vc
* push pop present相关犯法
*/
import UIKit
public extension UIViewController {
func ga_storyboardRootVC(name: String) -> UIViewController? {
if name.isEmpty {
print("error ga_storyboardRootVC name字符串为空")
return nil
}
guard let vc = UIStoryboard(name: name, bundle: nil).instantiateInitialViewController() else {
print("error ga_storyboardRootVC 没有viewcontroller")
return nil
}
return vc
}
}
// MARK: - Push Pop 方法
public extension UIViewController {
/// PUSH
func ga_push(vc: UIViewController, animated: Bool = true) {
guard let nv = self.navigationController else {
print("没有navigationController")
return
}
nv.pushViewController(vc, animated: animated)
}
/// PUSH XIB 只能展示VC view
func ga_pushXIB(nibName: String, animated: Bool = true) {
guard let nv = self.navigationController else {
print("没有navigationController")
return
}
let vc = UIViewController(nibName: nibName, bundle: nil)
nv.pushViewController(vc, animated: animated)
}
/// POP
func ga_pop(animated: Bool = true) {
guard let nv = self.navigationController else {
print("没有navigationController")
return
}
nv.popViewController(animated: animated)
}
/// POPTO
func ga_popTo(vc: UIViewController, animted: Bool = true) {
guard let nv = self.navigationController else {
print("没有navigationController")
return
}
for item in nv.viewControllers {
if item == vc {
nv.popToViewController(vc, animated: true)
return
}
}
print("没有目标UIViewController")
}
/// POPROOT
func ga_popRoot(animated: Bool = true) {
guard let nv = self.navigationController else {
print("没有navigationController")
return
}
nv.popToRootViewController(animated: true);
}
/// PRESENT
func ga_present(animated: Bool = true) {
present(self, animated: animated, completion: nil)
}
// storyboar PUSH
func ga_push(storyboardName name: String, animated: Bool = true) {
if name.isEmpty {
print("name字符串为空")
return
}
guard let vc = UIStoryboard(name: name, bundle: nil).instantiateInitialViewController() else {
print("没有viewcontroller")
return
}
ga_push(vc: vc, animated: animated)
}
// storyboar PUSH
func ga_push(storyboardName name: String, vcIdentifier identifier: String, animated: Bool = true) {
if name.isEmpty || identifier.isEmpty {
print("字符串有空")
return
}
let vc = UIStoryboard(name: name, bundle: nil).instantiateViewController(withIdentifier: identifier)
ga_push(vc: vc, animated: animated)
}
}
public extension UIViewController {
func ga_resentVC(vc: UIViewController) -> UIViewController? {
guard let p = vc.presentedViewController else {
return self
}
return ga_resentVC(vc: p)
}
}
public extension UIViewController {
func ga_storyboardVC<T: UIViewController>(type: T.Type, storyboardName: String) -> T {
let vc = UIStoryboard(name: storyboardName, bundle: nil).instantiateViewController(withIdentifier: String(describing: type)) as! T
return vc
}
}
// plist View controller-based status bar appearance YES
public extension UIAlertController {
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
override var shouldAutorotate: Bool {
return false
}
}
| 29.569343
| 138
| 0.616885
|
2be50cd9bc33862524dd95ff1007400b4e8504d0
| 2,222
|
lua
|
Lua
|
hammerspoon/hs-anycomplete/anycomplete.lua
|
anmoljagetia/dotfiles
|
2e832cf7e9c436014ddce9ab47a22f16157e99e3
|
[
"MIT"
] | 58
|
2015-09-19T08:38:14.000Z
|
2022-02-01T01:21:30.000Z
|
link/hammerspoon/anycomplete/anycomplete.lua
|
marcusramberg/dotfiles
|
07a0576eaa0a233a2125ddcb2bb04a5fe5033674
|
[
"MIT"
] | 2
|
2018-06-23T15:07:00.000Z
|
2019-02-11T14:44:46.000Z
|
hammerspoon/hs-anycomplete/anycomplete.lua
|
anmoljagetia/dotfiles
|
2e832cf7e9c436014ddce9ab47a22f16157e99e3
|
[
"MIT"
] | 41
|
2015-09-24T12:34:53.000Z
|
2019-09-19T01:31:45.000Z
|
local mod = {}
-- Anycomplete
function mod.anycomplete()
local GOOGLE_ENDPOINT = 'https://suggestqueries.google.com/complete/search?client=firefox&q=%s'
local current = hs.application.frontmostApplication()
local tab = nil
local copy = nil
local choices = {}
local chooser = hs.chooser.new(function(choosen)
if copy then copy:delete() end
if tab then tab:delete() end
current:activate()
hs.eventtap.keyStrokes(choosen.text)
end)
-- Removes all items in list
function reset()
chooser:choices({})
end
tab = hs.hotkey.bind('', 'tab', function()
local id = chooser:selectedRow()
local item = choices[id]
-- If no row is selected, but tab was pressed
if not item then return end
chooser:query(item.text)
reset()
updateChooser()
end)
copy = hs.hotkey.bind('cmd', 'c', function()
local id = chooser:selectedRow()
local item = choices[id]
if item then
chooser:hide()
hs.pasteboard.setContents(item.text)
hs.alert.show("Copied to clipboard", 1)
else
hs.alert.show("No search result to copy", 1)
end
end)
function updateChooser()
local string = chooser:query()
local query = hs.http.encodeForQuery(string)
-- Reset list when no query is given
if string:len() == 0 then return reset() end
hs.http.asyncGet(string.format(GOOGLE_ENDPOINT, query), nil, function(status, data)
if not data then return end
local ok, results = pcall(function() return hs.json.decode(data) end)
if not ok then return end
choices = hs.fnutils.imap(results[2], function(result)
return {
["text"] = result,
}
end)
chooser:choices(choices)
end)
end
chooser:queryChangedCallback(updateChooser)
chooser:searchSubText(false)
chooser:show()
end
function mod.registerDefaultBindings(mods, key)
mods = mods or {"cmd", "alt", "ctrl"}
key = key or "G"
hs.hotkey.bind(mods, key, mod.anycomplete)
end
return mod
| 27.432099
| 99
| 0.594059
|
40971ea23e1f300e6b4a8ede5921122a8d49ea1c
| 1,586
|
ts
|
TypeScript
|
src/plugins/find-replace/__tests__/integration/replace.ts
|
acezard/editor-core-fork
|
1e4e7ac28b36603a6dae32821b5cc26eab7114f0
|
[
"Apache-2.0"
] | null | null | null |
src/plugins/find-replace/__tests__/integration/replace.ts
|
acezard/editor-core-fork
|
1e4e7ac28b36603a6dae32821b5cc26eab7114f0
|
[
"Apache-2.0"
] | null | null | null |
src/plugins/find-replace/__tests__/integration/replace.ts
|
acezard/editor-core-fork
|
1e4e7ac28b36603a6dae32821b5cc26eab7114f0
|
[
"Apache-2.0"
] | null | null | null |
import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
import {
fullpage,
editable,
getDocFromElement,
} from '../../../../__tests__/integration/_helpers';
import {
goToEditorTestingExample,
mountEditor,
} from '../../../../__tests__/__helpers/testing-example-helpers';
import replaceAdf from './__fixtures__/replace-adf.json';
import { findReplaceSelectors } from '../../../../__tests__/__helpers/page-objects/_find-replace';
BrowserTestCase(
'replace.ts: modifying find text before replace should not restore stale pluginState replace text',
{ skip: ['safari', 'edge'] },
async (client: any, testName: string) => {
const page = await goToEditorTestingExample(client);
await mountEditor(page, {
appearance: fullpage.appearance,
defaultValue: replaceAdf,
allowFindReplace: true,
});
await page.click(findReplaceSelectors.toolbarButton);
await page.clear(findReplaceSelectors.findInput);
await page.type(findReplaceSelectors.findInput, 'one');
await page.keys('Enter');
await page.type(findReplaceSelectors.replaceInput, 'HI');
await page.click(findReplaceSelectors.replaceButton);
await page.clear(findReplaceSelectors.replaceInput);
await page.type(findReplaceSelectors.replaceInput, 'HO');
await page.clear(findReplaceSelectors.findInput);
await page.type(findReplaceSelectors.findInput, 'two');
await page.click(findReplaceSelectors.replaceButton);
const doc = await page.$eval(editable, getDocFromElement);
expect(doc).toMatchCustomDocSnapshot(testName);
},
);
| 35.244444
| 101
| 0.73203
|
7da933fc16a9208ff81a88d344763f6f431f16a9
| 581
|
css
|
CSS
|
swifttools/src/routes/Public/Css/SectionView.css
|
React-App/React
|
2227a1f10b08c5782784d52f69de09f5cd04e96a
|
[
"Apache-2.0"
] | null | null | null |
swifttools/src/routes/Public/Css/SectionView.css
|
React-App/React
|
2227a1f10b08c5782784d52f69de09f5cd04e96a
|
[
"Apache-2.0"
] | null | null | null |
swifttools/src/routes/Public/Css/SectionView.css
|
React-App/React
|
2227a1f10b08c5782784d52f69de09f5cd04e96a
|
[
"Apache-2.0"
] | null | null | null |
/**
* Created by zhangshumeng on 2018/5/14
*/
.sectionView {
background-color: white;
line-height: 60px;
}
.sectionView_bg {
margin-left: 24px;
margin-right: 24px;
display: inline-flex;
flex-direction: row;
align-items: center;
}
.sectionView_bg_leftTitle {
color: black;
font-size: 20px;
}
.sectionView_bg_rightBgImg {
line-height: 16px;
display: inline-flex;
align-items: center;
justify-content: center;
float: right;
margin-right: 24px;
margin-top: 22px;
}
.sectionView_bg_rightImg {
height: 16px;
}
| 15.702703
| 40
| 0.64716
|
0d082cee1478da6518dad3ca958e47b8374912ad
| 1,960
|
kt
|
Kotlin
|
app/src/main/java/arch/Resource.kt
|
li2/Wipro_Assessment
|
010d25e9d53b5b1d6355daa96b56071b82c28aae
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/arch/Resource.kt
|
li2/Wipro_Assessment
|
010d25e9d53b5b1d6355daa96b56071b82c28aae
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/arch/Resource.kt
|
li2/Wipro_Assessment
|
010d25e9d53b5b1d6355daa96b56071b82c28aae
|
[
"Apache-2.0"
] | 1
|
2018-07-30T12:03:50.000Z
|
2018-07-30T12:03:50.000Z
|
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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.
*/
// https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/vo/Resource.kt
// https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/vo/Resource.java
package arch
import java.net.HttpURLConnection
/**
* A generic class that holds a value with its loading status. The value is from [ApiResponse].
* @param <T>
*/
data class Resource<T>(val status: Status, val data: T?, val code: Int, val errorMessage: String?, val throwable: Throwable?) {
companion object {
// TODO how to distinguish data is cached or fetched from network?
fun <T> success(data: T?): Resource<T> {
return Resource(Status.SUCCESS, data, HttpURLConnection.HTTP_OK, null, null)
}
// add two more fields to let client know the error code / throwable (especially for custom Throwable). notebyweiyi
fun <T> error(data: T?, errorMessage: String, code: Int, throwable: Throwable?): Resource<T> {
return Resource(Status.ERROR, data, code, errorMessage, throwable)
}
fun <T> loading(data: T?): Resource<T> {
return Resource(Status.LOADING, data, HttpURLConnection.HTTP_OK, null, null)
}
}
}
| 42.608696
| 161
| 0.711224
|
dd8a1500472c3338857a2078c84ce29aabc025a7
| 2,138
|
java
|
Java
|
ui/src/main/java/de/ipb_halle/lbac/message/TagWordMessage.java
|
sneumann/CRIMSy
|
3c7f3a0e656884bb7f0c5b67b3651e34b810fa5e
|
[
"Apache-2.0"
] | null | null | null |
ui/src/main/java/de/ipb_halle/lbac/message/TagWordMessage.java
|
sneumann/CRIMSy
|
3c7f3a0e656884bb7f0c5b67b3651e34b810fa5e
|
[
"Apache-2.0"
] | null | null | null |
ui/src/main/java/de/ipb_halle/lbac/message/TagWordMessage.java
|
sneumann/CRIMSy
|
3c7f3a0e656884bb7f0c5b67b3651e34b810fa5e
|
[
"Apache-2.0"
] | null | null | null |
/*
* Leibniz Bioactives Cloud
* Copyright 2017 Leibniz-Institut f. Pflanzenbiochemie
*
* 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 de.ipb_halle.lbac.message;
import java.util.Objects;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class TagWordMessage extends Message {
private int maxResult;
public static class Builder extends Message.Builder<Builder> {
private final MessageType HEADER = MessageType.TAGWORD;
private int maxResult = 50;
private String tagWord;
/**
* set defaults for builder
*
* @param - payload
*/
public Builder() {
super.Header(HEADER);
super.Clazz(String.class);
}
public Builder setMaxResult (int maxResult){
if (maxResult > 0) this.maxResult = maxResult;
return this;
}
public Builder setTagWord(String tagWord){
this.tagWord = Objects.requireNonNull(tagWord);
super.body = this.tagWord;
return this;
}
/**
* build status message
*
* @return - status message
*/
@Override
public TagWordMessage build() {
return new TagWordMessage(this);
}
@Override
protected Builder self() {
return this;
}
}
//*** getter ***
public int getMaxResult() {
return maxResult;
}
private TagWordMessage(Builder builder) {
super(builder);
this.maxResult = builder.maxResult;
}
}
| 26.073171
| 75
| 0.61319
|
af24557690e209d72c82c387118de6b26e58a134
| 9,647
|
py
|
Python
|
conf/node.py
|
LaudateCorpus1/ZFM
|
c92db4637010c304fe7df5057813f591a3577322
|
[
"Apache-2.0"
] | null | null | null |
conf/node.py
|
LaudateCorpus1/ZFM
|
c92db4637010c304fe7df5057813f591a3577322
|
[
"Apache-2.0"
] | null | null | null |
conf/node.py
|
LaudateCorpus1/ZFM
|
c92db4637010c304fe7df5057813f591a3577322
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python3
#
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP.
# Licensed under the Apache v2.0 license.
#
import re
import os
import sys
import json
import copy
import pprint
# ----------------------------------------------------------------------------------------------------------------------
class Node():
def __init__(self, zfm_dir, node_type, node_name, node_profile, type_constants, routing_data):
#
# Determine the number of ports.
#
if node_type == 'Switch':
uid_type = 1
switch_range = type_constants['SWITCHES']
port_range = type_constants['SWITCH_PORTS']
elif node_type == 'Compute':
uid_type = 2
switch_range = [0, 0]
port_range = type_constants['FABRIC_ADAPTER_PORTS']
elif node_type == 'IO':
uid_type = 3
switch_range = [0, 0]
port_range = type_constants['FABRIC_ADAPTER_PORTS']
elif node_type == 'Memory':
uid_type = 4
switch_range = [0, 0]
port_range = type_constants['SWITCH_PORTS']
num_ports = (1 + switch_range[1] - switch_range[0]) * (1 + port_range[1] - port_range[0])
port_start = port_range[0]
port_end = port_start + num_ports
#
# Node specific values.
#
ip_string, topoid, geoid_string, enabled, gcids = node_profile
geoid = geoid_string.split('.')
if ':' not in ip_string:
ip_string += ':8081'
#
# Derived values.
#
uid = (uid_type << 28) | int('0x{}'.format(topoid.replace('.', '')), 0)
#
# Point to the correct directory for my attributes and create it (if needed).
#
if node_type == 'Switch': dir_name = 'switch_nodes'
elif node_type == 'Compute': dir_name = 'compute_nodes'
elif node_type == 'IO': dir_name = 'io_nodes'
elif node_type == 'Memory' : dir_name = 'memory_nodes'
self.dir = os.path.join(zfm_dir, dir_name)
try:
os.makedirs(self.dir, exist_ok=True)
except:
print('can\'t create attribute directory for {} nodes'.format(node_type))
sys.exit(1)
#
# Port configuration. Some of the nodes have port ranges which don't start at 0.
#
ports = []
for i in range(port_start):
ports.append({ 'State' : 'Notused' })
for i in range(port_start,port_end):
ports.append({ 'State' : 'Disabled' })
#
# The actual node.
#
self.routing_data = routing_data
self.config = {
'name' : node_name,
'type' : node_type,
'hostname' : ip_string,
'FQDN' : ip_string,
'address' : ip_string,
'UID' : uid,
'TopoID' : topoid,
'GeoID' : { 'RackID': geoid[0], 'ChassisID' : geoid[1], 'SlotID' : geoid[2], 'NodeID' : geoid[3] },
'AsicID' : { 'ComponentID' : 1 },
'Active' : 'Enabled' if enabled else 'Disabled',
'GCIDs' : list(int(gcid,0) for gcid in gcids),
'attributes' : os.path.join(self.dir, '{}.json'.format(node_name)),
'portStart' : port_start,
'portEnd' : port_end,
'ports' : ports,
}
def configuration(self):
return self.config
def name(self):
return self.config['name']
def node_type(self):
return self.config['type']
def GCIDs(self):
return self.config['GCIDs']
def UID(self):
return self.config['UID']
def isActive(self):
return self.config['Active'] == 'Enabled'
def setRemote(self, port, dst_node, dst_port):
self.config['ports'][port]['State'] = 'Enabled'
self.config['ports'][port]['Remote'] = { 'Node': dst_node.name(),
'Port': dst_port,
'UID': dst_node.UID() }
def profile(self):
return self.config
def write(self):
#
# Loop over the attributes and collect them for writing to the config file.
#
node_data = {}
for attribute_name, attribute_data in self.attributes.items():
attribute_name = attribute_name.replace('.', '/')
node_data[attribute_name] = attribute_data
#
# Write the data to this nodes config file.
#
try:
with open(self.config['attributes'], 'w') as f:
json.dump(node_data,f,indent=4, separators=(",", ": "))
except:
print('can\'t write attribute data for node {}'.format(self.config['node_name']))
sys.exit(1)
# ----------------------------------------------------------------------------------------------------------------------
def create_attributes(self, type_attributes):
attributes = copy.deepcopy(type_attributes)
#
# Create the Location data.
#
if '/redfish.v1.Chassis.1' in attributes:
chassis = attributes['/redfish.v1.Chassis.1']
oem_location = chassis.get('Oem', {}).get('Hpe', {}).get('Location', None)
if oem_location is not None:
chassis['Oem']['Hpe']['Location'] = self.config['GeoID']
return attributes
# ----------------------------------------------------------------------------------------------------------------------
def get(self, tokens):
x = self.routing_data
for a in tokens:
x = x.get(a, {})
return x
def update_route_set(self, attr_name, attr_data, tokens):
entry = self.get(tokens)
if entry:
for key,value in entry.items():
attr_data[key] = value
def update_vcat(self, attr_name, attr_data, tokens):
entry = self.get(tokens)
if entry:
for key in sorted(entry.keys(), key=int):
value = entry[key]
attr_data['VCATEntry'].append({ 'TH' : value['Threshold'], 'VCMask' : value['VCMask'] })
def update_Switch_routing(self):
for attr_name,attr_data in self.attributes.items():
#
# redfish.v1.Fabrics.GenZ.Switches.Switch{SWITCHES}.Ports.{SWITCH_PORTS}.LPRT.{CIDS}.RouteSet.{VCS}
# redfish.v1.Fabrics.GenZ.Switches.Switch{SWITCHES}.Ports.{SWITCH_PORTS}.MPRT.{CIDS}.RouteSet.{VCS}
#
m = re.match(r'.*Switch(\d+).Ports.(\d+).(LPRT|MPRT).(\d+).RouteSet.(\d+)$', attr_name)
if m:
p = str(60*(int(m.group(1))-1) + int(m.group(2)))
self.update_route_set(attr_name, attr_data, ['Ports', p, m.group(3), m.group(4), 'Entries', m.group(5)])
#
# redfish.v1.Fabrics.GenZ.Switches.Switch{SWITCHES}.Ports.{SWITCH_PORTS}.VCAT.{VCS}
#
m = re.match(r'.*Switch(\d+).Ports.(\d+).VCAT.(\d+)$', attr_name)
if m:
p = str(60*(int(m.group(1))-1) + int(m.group(2)))
self.update_vcat(attr_name, attr_data, ['Ports', p, 'VCAT', m.group(3)])
def update_Compute_routing(self):
for attr_name,attr_data in self.attributes.items():
#
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.Ports.{FABRIC_ADAPTER_PORTS}.LPRT.{CIDS}.RouteSet.{VCS}
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.Ports.{FABRIC_ADAPTER_PORTS}.MPRT.{CIDS}.RouteSet.{VCS}
#
m = re.match(r'.*FabricAdapters.(\d+).Ports.(\d+).(LPRT|MPRT).(\d+).RouteSet.(\d+)$', attr_name)
if m:
p = str(60*(int(m.group(1))-1) + int(m.group(2)))
self.update_route_set(attr_name, attr_data, ['Ports', p, m.group(3), m.group(4), 'Entries', m.group(5)])
#
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.Ports.{FABRIC_ADAPTER_PORTS}.VCAT.{VCS}
#
m = re.match(r'FabricAdapters.(\d+).Ports.(\d+).VCAT.(\d+)$', attr_name)
if m:
self.update_vcat(attr_name, attr_data, ['Ports', m.group(2), 'VCAT', m.group(3)])
#
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.SSDT.{CIDS}.RouteSet.{VCS}
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.MSDT.{CIDS}.RouteSet.{VCS}
#
m = re.match(r'.*FabricAdapters.(\d+).(SSDT|MSDT).(\d+).RouteSet.(\d+)$', attr_name)
if m:
self.update_route_set(attr_name, attr_data, [m.group(2), m.group(3), 'Entries', m.group(4)])
#
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.REQ-VCAT.{VCS}
# redfish.v1.Systems.1.FabricAdapters.{FABRIC_ADAPTERS}.RSP-VCAT.{VCS}
#
m = re.match(r'.*FabricAdapters.(\d+).(REQ-VCAT|RSP-VCAT).(\d+)$', attr_name)
if m:
self.update_vcat(attr_name, attr_data, [m.group(2), m.group(3)])
def update_IO_routing(self):
self.update_Compute_routing()
def update_Memory_routing(self):
self.update_Switch_routing()
def update_routing(self):
if self.node_type() == 'Switch' : self.update_Switch_routing()
if self.node_type() == 'Compute' : self.update_Compute_routing()
if self.node_type() == 'IO' : self.update_IO_routing()
if self.node_type() == 'Memory' : self.update_Memory_routing()
# ----------------------------------------------------------------------------------------------------------------------
| 34.826715
| 123
| 0.523479
|
c6e92300ac61a4690c85701fd479dc25aee8421e
| 1,494
|
py
|
Python
|
cannab/merge_oof.py
|
ktncktnc/SpaceNet_Off_Nadir_Solutions
|
2a9ef1c3b72fb749c808ddb8593a85cb16b9f1ca
|
[
"Apache-2.0"
] | 164
|
2019-01-31T16:37:09.000Z
|
2022-03-31T02:47:49.000Z
|
cannab/merge_oof.py
|
xiaofanglegoc/SpaceNet_Off_Nadir_Solutions
|
812f151d244565f29987ebec7683ef42622ae16e
|
[
"Apache-2.0"
] | 3
|
2019-11-20T03:32:29.000Z
|
2021-12-20T05:52:50.000Z
|
cannab/merge_oof.py
|
xiaofanglegoc/SpaceNet_Off_Nadir_Solutions
|
812f151d244565f29987ebec7683ef42622ae16e
|
[
"Apache-2.0"
] | 36
|
2019-02-08T19:12:35.000Z
|
2021-12-23T06:52:35.000Z
|
# -*- coding: utf-8 -*-
import os
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OMP_NUM_THREADS"] = "1"
from os import path, makedirs
import numpy as np
np.random.seed(1)
import random
random.seed(1)
import timeit
import cv2
import pandas as pd
from multiprocessing import Pool
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
df = pd.read_csv('train_folds.csv')
pred_folders = [
'pred_50_9ch_oof_0',
'pred_92_9ch_oof_0',
'pred_154_9ch_oof_0',
'pred_101_9ch_oof_0'
]
coefs = [2, 2, 2, 1]
def process_image(fid):
fid = fid + '.png'
used_msks = []
for pr_f in pred_folders:
msk1 = cv2.imread(path.join('/wdata/', pr_f, '{0}.png'.format(fid.split('.')[0])), cv2.IMREAD_UNCHANGED)
used_msks.append(msk1)
msk = np.zeros_like(used_msks[0], dtype='float')
for i in range(len(pred_folders)):
p = used_msks[i]
msk += (coefs[i] * p.astype('float'))
msk /= np.sum(coefs)
cv2.imwrite(path.join('/wdata/merged_oof', fid), msk.astype('uint8'), [cv2.IMWRITE_PNG_COMPRESSION, 9])
if __name__ == '__main__':
t0 = timeit.default_timer()
makedirs('/wdata/merged_oof', exist_ok=True)
val_files = df[df['fold'] < 8]['id'].values
with Pool() as pool:
results = pool.map(process_image, val_files)
elapsed = timeit.default_timer() - t0
print('Time: {:.3f} min'.format(elapsed / 60))
| 24.9
| 113
| 0.62249
|
a3d8e2277cdc785da9325a9a58f384c3a2a2dc2a
| 1,073
|
sql
|
SQL
|
Protein_Sequences/Legacy/T_Protein_Names_Revised.sql
|
viswaratha12/dbwarden
|
3931accda4fb401d21b6cb272fe3d6959915ceb8
|
[
"Apache-2.0"
] | 2
|
2018-04-03T05:18:15.000Z
|
2020-04-23T04:00:25.000Z
|
Protein_Sequences/Legacy/T_Protein_Names_Revised.sql
|
viswaratha12/dbwarden
|
3931accda4fb401d21b6cb272fe3d6959915ceb8
|
[
"Apache-2.0"
] | null | null | null |
Protein_Sequences/Legacy/T_Protein_Names_Revised.sql
|
viswaratha12/dbwarden
|
3931accda4fb401d21b6cb272fe3d6959915ceb8
|
[
"Apache-2.0"
] | 4
|
2016-05-14T17:56:55.000Z
|
2020-01-23T12:02:25.000Z
|
/****** Object: Table [dbo].[x_T_Protein_Names_Revised] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[x_T_Protein_Names_Revised](
[Reference_ID] [int] NOT NULL,
[Name] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Annotation_Type_ID] [int] NOT NULL,
[Reference_Fingerprint] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DateAdded] [datetime] NULL,
[Protein_ID] [int] NOT NULL,
CONSTRAINT [PK_T_Protein_Names_Revised] PRIMARY KEY CLUSTERED
(
[Reference_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_T_Protein_Names_Revised] ******/
CREATE NONCLUSTERED INDEX [IX_T_Protein_Names_Revised] ON [dbo].[x_T_Protein_Names_Revised]
(
[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
| 37
| 169
| 0.735322
|
c47f8acd78f5f6aeff4c10ffae4bba33d5089c6f
| 2,623
|
cpp
|
C++
|
qt/qt_common/qtoglcontext.cpp
|
keksikex/omim
|
cf75e55bc6d96f3488af9d5977c4bee422a366c3
|
[
"Apache-2.0"
] | null | null | null |
qt/qt_common/qtoglcontext.cpp
|
keksikex/omim
|
cf75e55bc6d96f3488af9d5977c4bee422a366c3
|
[
"Apache-2.0"
] | null | null | null |
qt/qt_common/qtoglcontext.cpp
|
keksikex/omim
|
cf75e55bc6d96f3488af9d5977c4bee422a366c3
|
[
"Apache-2.0"
] | null | null | null |
#include "qt/qt_common/qtoglcontext.hpp"
#include "base/assert.hpp"
#include "base/logging.hpp"
#include "base/macros.hpp"
#include "base/math.hpp"
#include "base/stl_add.hpp"
#include "drape/glfunctions.hpp"
namespace qt
{
namespace common
{
// QtRenderOGLContext ------------------------------------------------------------------------------
QtRenderOGLContext::QtRenderOGLContext(QOpenGLContext * rootContext, QOffscreenSurface * surface)
: m_surface(surface)
, m_ctx(my::make_unique<QOpenGLContext>())
{
m_ctx->setFormat(rootContext->format());
m_ctx->setShareContext(rootContext);
m_ctx->create();
ASSERT(m_ctx->isValid(), ());
}
void QtRenderOGLContext::Present()
{
if (!m_resizeLock)
LockFrame();
m_resizeLock = false;
GLFunctions::glFinish();
std::swap(m_frontFrame, m_backFrame);
UnlockFrame();
}
void QtRenderOGLContext::MakeCurrent()
{
VERIFY(m_ctx->makeCurrent(m_surface), ());
}
void QtRenderOGLContext::DoneCurrent()
{
m_ctx->doneCurrent();
}
void QtRenderOGLContext::SetDefaultFramebuffer()
{
if (m_backFrame == nullptr)
return;
m_backFrame->bind();
}
void QtRenderOGLContext::Resize(int w, int h)
{
LockFrame();
m_resizeLock = true;
QSize size(my::NextPowOf2(w), my::NextPowOf2(h));
m_texRect =
QRectF(0.0, 0.0, w / static_cast<float>(size.width()), h / static_cast<float>(size.height()));
m_frontFrame = my::make_unique<QOpenGLFramebufferObject>(size, QOpenGLFramebufferObject::Depth);
m_backFrame = my::make_unique<QOpenGLFramebufferObject>(size, QOpenGLFramebufferObject::Depth);
}
void QtRenderOGLContext::LockFrame()
{
m_lock.lock();
}
QRectF const & QtRenderOGLContext::GetTexRect() const
{
return m_texRect;
}
GLuint QtRenderOGLContext::GetTextureHandle() const
{
if (!m_frontFrame)
return 0;
return m_frontFrame->texture();
}
void QtRenderOGLContext::UnlockFrame()
{
m_lock.unlock();
}
// QtUploadOGLContext ------------------------------------------------------------------------------
QtUploadOGLContext::QtUploadOGLContext(QOpenGLContext * rootContext, QOffscreenSurface * surface)
: m_surface(surface), m_ctx(my::make_unique<QOpenGLContext>())
{
m_ctx->setFormat(rootContext->format());
m_ctx->setShareContext(rootContext);
m_ctx->create();
ASSERT(m_ctx->isValid(), ());
}
void QtUploadOGLContext::MakeCurrent()
{
m_ctx->makeCurrent(m_surface);
}
void QtUploadOGLContext::DoneCurrent()
{
m_ctx->doneCurrent();
}
void QtUploadOGLContext::Present()
{
ASSERT(false, ());
}
void QtUploadOGLContext::SetDefaultFramebuffer()
{
ASSERT(false, ());
}
} // namespace common
} // namespace qt
| 21.325203
| 100
| 0.682043
|
43eb77b141b40a62a08bb7130fe3c38e53d80040
| 2,245
|
ts
|
TypeScript
|
src/app/services/catalog/catalog.service.ts
|
EiNyeinChanWai/fineract-cn-fims-web-app
|
a79c1d2572459b564f7febb79e9db977f711b701
|
[
"Apache-2.0"
] | 13
|
2018-04-17T16:56:08.000Z
|
2021-11-10T19:25:58.000Z
|
src/app/services/catalog/catalog.service.ts
|
EiNyeinChanWai/fineract-cn-fims-web-app
|
a79c1d2572459b564f7febb79e9db977f711b701
|
[
"Apache-2.0"
] | 13
|
2018-04-01T06:01:45.000Z
|
2019-12-09T22:15:39.000Z
|
src/app/services/catalog/catalog.service.ts
|
EiNyeinChanWai/fineract-cn-fims-web-app
|
a79c1d2572459b564f7febb79e9db977f711b701
|
[
"Apache-2.0"
] | 180
|
2018-01-24T12:56:26.000Z
|
2022-01-27T04:26:01.000Z
|
/**
* 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.
*/
import {Inject, Injectable} from '@angular/core';
import {HttpClient} from '../http/http.service';
import {Observable} from 'rxjs/Observable';
import {Catalog} from './domain/catalog.model';
import {Field} from './domain/field.model';
@Injectable()
export class CatalogService {
constructor(@Inject('customerBaseUrl') private baseUrl: string, private http: HttpClient) {
}
fetchCatalogs(): Observable<Catalog[]> {
return this.http.get(`${this.baseUrl}/catalogs`);
}
createCatalog(catalog: Catalog): Observable<void> {
return this.http.post(`${this.baseUrl}/catalogs`, catalog);
}
updateCatalog(catalog: Catalog): Observable<void> {
return this.http.put(`${this.baseUrl}/catalogs/${catalog.identifier}`, catalog);
}
deleteCatalog(catalog: Catalog): Observable<void> {
return this.http.delete(`${this.baseUrl}/catalogs/${catalog.identifier}`, {});
}
findCatalog(identifier: string, silent: boolean = false): Observable<Catalog> {
return this.http.get(`${this.baseUrl}/catalogs/${identifier}`, {}, silent);
}
updateField(catalogIdentifier: string, field: Field): Observable<void> {
return this.http.put(`${this.baseUrl}/catalogs/${catalogIdentifier}/fields/${field.identifier}`, field);
}
deleteField(catalogIdentifier: string, field: Field): Observable<void> {
return this.http.delete(`${this.baseUrl}/catalogs/${catalogIdentifier}/fields/${field.identifier}`, );
}
}
| 38.050847
| 108
| 0.722494
|
ef58fd66cb2f848b3ca634e5332ffd52b32a9103
| 382
|
js
|
JavaScript
|
web/src/sagas/index.js
|
sergej-kurakin/multiproxy
|
e75795a3d1126dbd0a4c7c250875c9663b05d0b2
|
[
"MIT"
] | 13
|
2018-06-30T11:03:34.000Z
|
2020-07-30T18:07:29.000Z
|
web/src/sagas/index.js
|
sergej-kurakin/multiproxy
|
e75795a3d1126dbd0a4c7c250875c9663b05d0b2
|
[
"MIT"
] | 1
|
2018-11-18T21:03:16.000Z
|
2018-11-18T21:03:16.000Z
|
web/src/sagas/index.js
|
sergej-kurakin/multiproxy
|
e75795a3d1126dbd0a4c7c250875c9663b05d0b2
|
[
"MIT"
] | 2
|
2018-12-12T20:49:55.000Z
|
2020-04-20T14:39:57.000Z
|
import 'regenerator-runtime/runtime';
import { takeEvery, takeLatest } from 'redux-saga/effects';
import { LOAD_SELECTED_ENV, SELECT_ENV } from '../actions';
import loadSelectedEnv from './loadSelectedEnv';
import selectEnv from './selectEnv';
export default function* sagas() {
yield takeEvery(LOAD_SELECTED_ENV, loadSelectedEnv);
yield takeLatest(SELECT_ENV, selectEnv);
}
| 29.384615
| 59
| 0.769634
|
7d8977d741fe3a23402dbd21fe4cc7eba772af8b
| 812
|
css
|
CSS
|
assets/css/tietovisa_screen.css
|
LSDsuperfruit/CodeIgniterProjekti
|
0419e7b4d0bb569f94e93f2f571bebb4d6d48321
|
[
"MIT"
] | null | null | null |
assets/css/tietovisa_screen.css
|
LSDsuperfruit/CodeIgniterProjekti
|
0419e7b4d0bb569f94e93f2f571bebb4d6d48321
|
[
"MIT"
] | null | null | null |
assets/css/tietovisa_screen.css
|
LSDsuperfruit/CodeIgniterProjekti
|
0419e7b4d0bb569f94e93f2f571bebb4d6d48321
|
[
"MIT"
] | null | null | null |
/* tietovisa_screen.css */
.kysymys {
margin: 10px;
padding: 20px;
border: 1px solid #333;
border-radius: 3px;
}
.info {
margin: 20px 0;
}
.navi {
margin-bottom: 20px;
}
/*
.painikkeet {
margin-bottom: 10px;
clear: both;
}
.painikkeet a {
display: inline-block;
width: 10em;
text-align: center;
font-family: sans-serif;
margin: 0px;
padding: 10px;
border-radius: 5px;
background-color: red;
color: white;
text-decoration: none;
}
.painikkeet a:hover {
background-color: green;
}
*
form ul {
list-style-type: none;
margin: 0;
padding: 0;
}
form li {
margin: 10px;
}
*/
dl {
width: 200px;
margin: 10px;
border: solid 1px #777;
padding: 10px;
}
dt {
margin: 0;
padding: 5px;
font-weight: bold;
background-color: #eee;
clear: both;
}
dd {
margin: 0;
padding: 0;
padding: 5px;
}
| 11.768116
| 26
| 0.651478
|
09eec47386bde22591a7810601fa374d39690590
| 3,309
|
rs
|
Rust
|
cap-primitives/src/posish/fs/read_dir_inner.rs
|
ghcom275/cap-std
|
fd3bacf238f7fe516551c6ac175fbdfb7ca7db83
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1
|
2020-11-16T02:24:15.000Z
|
2020-11-16T02:24:15.000Z
|
cap-primitives/src/posish/fs/read_dir_inner.rs
|
ghcom275/cap-std
|
fd3bacf238f7fe516551c6ac175fbdfb7ca7db83
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null |
cap-primitives/src/posish/fs/read_dir_inner.rs
|
ghcom275/cap-std
|
fd3bacf238f7fe516551c6ac175fbdfb7ca7db83
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null |
use crate::fs::{
open_dir, open_dir_unchecked, open_entry_impl, read_dir_unchecked, remove_dir_unchecked,
remove_file_unchecked, stat_unchecked, DirEntryInner, FollowSymlinks, Metadata, OpenOptions,
ReadDir,
};
use posish::fs::Dir;
#[cfg(unix)]
use std::os::unix::{
ffi::OsStrExt,
io::{AsRawFd, FromRawFd},
};
#[cfg(target_os = "wasi")]
use std::os::wasi::{
ffi::OsStrExt,
io::{AsRawFd, FromRawFd},
};
use std::{
ffi::OsStr,
fmt, fs, io,
mem::ManuallyDrop,
path::{Component, Path},
sync::Arc,
};
pub(crate) struct ReadDirInner {
posish: Arc<Dir>,
}
impl ReadDirInner {
pub(crate) fn new(start: &fs::File, path: &Path) -> io::Result<Self> {
Ok(Self {
posish: Arc::new(Dir::from(open_dir(start, path)?)?),
})
}
pub(crate) fn new_unchecked(start: &fs::File, path: &Path) -> io::Result<Self> {
let dir = open_dir_unchecked(start, path)?;
Ok(Self {
posish: Arc::new(Dir::from(dir)?),
})
}
pub(super) fn open(&self, file_name: &OsStr, options: &OpenOptions) -> io::Result<fs::File> {
unsafe { open_entry_impl(&self.to_std_file(), file_name, options) }
}
pub(super) fn metadata(&self, file_name: &OsStr) -> io::Result<Metadata> {
unsafe { stat_unchecked(&self.to_std_file(), file_name.as_ref(), FollowSymlinks::No) }
}
pub(super) fn remove_file(&self, file_name: &OsStr) -> io::Result<()> {
unsafe { remove_file_unchecked(&self.to_std_file(), file_name.as_ref()) }
}
pub(super) fn remove_dir(&self, file_name: &OsStr) -> io::Result<()> {
unsafe { remove_dir_unchecked(&self.to_std_file(), file_name.as_ref()) }
}
pub(super) fn self_metadata(&self) -> io::Result<Metadata> {
unsafe { self.to_std_file().metadata().map(Metadata::from_std) }
}
pub(super) fn read_dir(&self, file_name: &OsStr) -> io::Result<ReadDir> {
unsafe { read_dir_unchecked(&self.to_std_file(), file_name.as_ref()) }
}
/// # Safety
///
/// The resulting `fs::File` shouldn't outlive `self`.
unsafe fn to_std_file(&self) -> ManuallyDrop<fs::File> {
ManuallyDrop::<fs::File>::new(fs::File::from_raw_fd(self.posish.as_raw_fd()))
}
}
impl Iterator for ReadDirInner {
type Item = io::Result<DirEntryInner>;
fn next(&mut self) -> Option<Self::Item> {
loop {
let entry = match self.posish.read()? {
Err(e) => return Some(Err(e)),
Ok(entry) => entry,
};
let file_name = entry.file_name().to_bytes();
if file_name != Component::CurDir.as_os_str().as_bytes()
&& file_name != Component::ParentDir.as_os_str().as_bytes()
{
let clone = Arc::clone(&self.posish);
return Some(Ok(DirEntryInner {
posish: entry,
read_dir: Self { posish: clone },
}));
}
}
}
}
impl fmt::Debug for ReadDirInner {
// Like libstd's version, but doesn't print the path.
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut b = f.debug_struct("ReadDir");
let fd = self.posish.as_raw_fd();
b.field("fd", &fd);
b.finish()
}
}
| 30.925234
| 97
| 0.576307
|
1963e271f99c7cb0a632958b31d727855b165aa7
| 45
|
lua
|
Lua
|
data.lua
|
Xman1109/More_Exoskeletons
|
c0fc14e978bc7ee2a0a7dd1589da3a1f74c1fe81
|
[
"MIT"
] | null | null | null |
data.lua
|
Xman1109/More_Exoskeletons
|
c0fc14e978bc7ee2a0a7dd1589da3a1f74c1fe81
|
[
"MIT"
] | null | null | null |
data.lua
|
Xman1109/More_Exoskeletons
|
c0fc14e978bc7ee2a0a7dd1589da3a1f74c1fe81
|
[
"MIT"
] | null | null | null |
require("prototypes/items/steel-exoskeleton")
| 45
| 45
| 0.844444
|
c6987afa2f85e606bc8dd860351e78f1b56c0b68
| 607
|
rs
|
Rust
|
carbide_core/src/environment/environment_font_size.rs
|
HolgerGottChriestensen/conrod
|
48b80a0c8915b2d478a445f1e5a8e0f396598652
|
[
"Apache-2.0",
"MIT"
] | 8
|
2021-03-11T04:54:40.000Z
|
2022-02-20T16:02:16.000Z
|
carbide_core/src/environment/environment_font_size.rs
|
HolgerGottChriestensen/conrod
|
48b80a0c8915b2d478a445f1e5a8e0f396598652
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
carbide_core/src/environment/environment_font_size.rs
|
HolgerGottChriestensen/conrod
|
48b80a0c8915b2d478a445f1e5a8e0f396598652
|
[
"Apache-2.0",
"MIT"
] | 1
|
2021-11-24T18:11:04.000Z
|
2021-11-24T18:11:04.000Z
|
use crate::prelude::EnvironmentFontSizeState;
use crate::state::*;
use crate::state::WidgetState;
#[derive(Hash, Eq, PartialEq, Clone, Debug)]
pub enum EnvironmentFontSize {
LargeTitle,
Title,
Title2,
Title3,
Headline,
Body,
Callout,
Subhead,
Footnote,
Caption,
Caption2,
Custom(String),
}
impl Default for EnvironmentFontSize {
fn default() -> Self {
EnvironmentFontSize::Body
}
}
impl Into<U32State> for EnvironmentFontSize {
fn into(self) -> U32State {
WidgetState::new(Box::new(EnvironmentFontSizeState::new(self)))
}
}
| 18.96875
| 71
| 0.654036
|
1a86ad20df48158c6c33bdf81370ad348f9e9e50
| 301
|
py
|
Python
|
Server/Code/view/auth/auth.py
|
HueyPark/Unreal-Knights
|
9a08dd15c65d8853f1322bf6de4b892cd88c571a
|
[
"MIT"
] | null | null | null |
Server/Code/view/auth/auth.py
|
HueyPark/Unreal-Knights
|
9a08dd15c65d8853f1322bf6de4b892cd88c571a
|
[
"MIT"
] | null | null | null |
Server/Code/view/auth/auth.py
|
HueyPark/Unreal-Knights
|
9a08dd15c65d8853f1322bf6de4b892cd88c571a
|
[
"MIT"
] | null | null | null |
from flask import jsonify, request
from logic.auth import AuthLogic
class AuthView:
@staticmethod
def login():
json = request.json
user_id = json['id']
password = json['password']
jwt = AuthLogic.create_jwt(user_id, password)
return jsonify(jwt=jwt)
| 21.5
| 53
| 0.644518
|
da84eafa62ff0f178928ba8dc11b6733adb8ebbb
| 1,049
|
ts
|
TypeScript
|
packages/@surface/htmlx-element/internal/decorators/event.ts
|
SurfaceJS/Modules
|
aa444e71c36c87c8533e1506942c4c0f2126da6a
|
[
"MIT"
] | 2
|
2020-03-26T17:25:19.000Z
|
2021-02-20T19:22:03.000Z
|
packages/@surface/htmlx-element/internal/decorators/event.ts
|
SurfaceJS/Modules
|
aa444e71c36c87c8533e1506942c4c0f2126da6a
|
[
"MIT"
] | null | null | null |
packages/@surface/htmlx-element/internal/decorators/event.ts
|
SurfaceJS/Modules
|
aa444e71c36c87c8533e1506942c4c0f2126da6a
|
[
"MIT"
] | null | null | null |
import type { Indexer } from "@surface/core";
import { DisposableMetadata, HookableMetadata } from "@surface/core";
/**
* Creates an event handler using the decorated method.
* @type Event listener type.
* @options Event listener options.
*/
export default function event<K extends keyof HTMLElementEventMap>(type: K, options?: boolean | AddEventListenerOptions): (target: HTMLElement, propertyKey: string | symbol) => void
{
return (target: HTMLElement, propertyKey: string | symbol) =>
{
const action = (element: HTMLElement): void =>
{
const listener = (event: HTMLElementEventMap[K]): unknown => (element as object as Indexer<Function>)[propertyKey as string]!.call(element, event);
element.addEventListener(type, listener, options);
DisposableMetadata.from(element).add({ dispose: () => element.removeEventListener(type, listener) });
};
HookableMetadata.from(target.constructor as typeof HTMLElement).initializers.push(action);
};
}
| 43.708333
| 181
| 0.677788
|
eca32176987efec5817a636d4c4bfc0993866b85
| 430
|
dart
|
Dart
|
bluewater_app/lib/src/features/categories/data/datasource/categories_remote_datasource.dart
|
Cafe-Store/bluewater-app
|
ce08411b38d9317bd16395a8a6d391eb67a24846
|
[
"MIT"
] | null | null | null |
bluewater_app/lib/src/features/categories/data/datasource/categories_remote_datasource.dart
|
Cafe-Store/bluewater-app
|
ce08411b38d9317bd16395a8a6d391eb67a24846
|
[
"MIT"
] | null | null | null |
bluewater_app/lib/src/features/categories/data/datasource/categories_remote_datasource.dart
|
Cafe-Store/bluewater-app
|
ce08411b38d9317bd16395a8a6d391eb67a24846
|
[
"MIT"
] | null | null | null |
import 'package:dio/dio.dart';
import 'package:injectable/injectable.dart';
import 'package:retrofit/retrofit.dart';
import '../model/category_model.dart';
part 'categories_remote_datasource.g.dart';
@injectable
@RestApi()
abstract class CategoriesRemoteDataSource {
@factoryMethod
factory CategoriesRemoteDataSource(Dio dio) = _CategoriesRemoteDataSource;
@GET('/categories')
Future<List<CategoryModel>> findAll();
}
| 23.888889
| 76
| 0.783721
|
386b3767fc7a70d919c516fcdf04aff1db285064
| 393
|
php
|
PHP
|
src/kwai/Modules/Club/Repositories/MemberQuery.php
|
fbraem/kwai
|
3584231d48491703c299eaf6821feddad5e4524d
|
[
"MIT"
] | 1
|
2022-02-18T02:44:11.000Z
|
2022-02-18T02:44:11.000Z
|
src/kwai/Modules/Club/Repositories/MemberQuery.php
|
fbraem/kwai
|
3584231d48491703c299eaf6821feddad5e4524d
|
[
"MIT"
] | 6
|
2020-12-09T19:36:26.000Z
|
2021-11-04T21:28:06.000Z
|
src/kwai/Modules/Club/Repositories/MemberQuery.php
|
fbraem/kwai
|
3584231d48491703c299eaf6821feddad5e4524d
|
[
"MIT"
] | null | null | null |
<?php
/**
* @package Modules
* @subpackage Club
*/
declare(strict_types=1);
namespace Kwai\Modules\Club\Repositories;
use Kwai\Core\Infrastructure\Repositories\Query;
/**
* Interface MemberQuery
*/
interface MemberQuery extends Query
{
/**
* Add a filter for the given id
*
* @param int $id
* @return self
*/
public function filterId(int $id): self;
}
| 15.72
| 48
| 0.648855
|
cf030ced9d76e78d46fdd3a4bcc2aef702b62ff3
| 705
|
php
|
PHP
|
test/TestAsset/NotAutoloaderModule/Module.php
|
bcremer/laminas-modulemanager
|
ebba90ef21a00aa2c0694a256019ed095d32a480
|
[
"BSD-3-Clause"
] | 1
|
2021-07-10T21:16:52.000Z
|
2021-07-10T21:16:52.000Z
|
test/TestAsset/NotAutoloaderModule/Module.php
|
bcremer/laminas-modulemanager
|
ebba90ef21a00aa2c0694a256019ed095d32a480
|
[
"BSD-3-Clause"
] | null | null | null |
test/TestAsset/NotAutoloaderModule/Module.php
|
bcremer/laminas-modulemanager
|
ebba90ef21a00aa2c0694a256019ed095d32a480
|
[
"BSD-3-Clause"
] | null | null | null |
<?php
/**
* @see https://github.com/laminas/laminas-modulemanager for the canonical source repository
* @copyright https://github.com/laminas/laminas-modulemanager/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-modulemanager/blob/master/LICENSE.md New BSD License
*/
namespace NotAutoloaderModule;
class Module
{
public $getAutoloaderConfigCalled = false;
public function getAutoloaderConfig()
{
$this->getAutoloaderConfigCalled = true;
return [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
'Foo' => __DIR__ . '/src/Foo',
],
],
];
}
}
| 26.111111
| 101
| 0.614184
|
af2ae192d788b5ccfe9e49229f89e5f62f28799e
| 5,858
|
py
|
Python
|
client/driver/utils.py
|
yangdsh/ottertune
|
9dbb30bcb1c9ae27feb24662630b4768ccb9009c
|
[
"Apache-2.0"
] | 3
|
2019-09-27T07:57:08.000Z
|
2019-09-27T09:06:04.000Z
|
client/driver/utils.py
|
yangdsh/ottertune
|
9dbb30bcb1c9ae27feb24662630b4768ccb9009c
|
[
"Apache-2.0"
] | null | null | null |
client/driver/utils.py
|
yangdsh/ottertune
|
9dbb30bcb1c9ae27feb24662630b4768ccb9009c
|
[
"Apache-2.0"
] | null | null | null |
import importlib
import os
from fabric.api import hide, local, settings, task
from fabric.api import get as _get, put as _put, run as _run, sudo as _sudo
dconf = None # pylint: disable=invalid-name
def load_driver_conf():
# The default config file is 'driver_config.py' but you can use
# set the env 'DRIVER_CONFIG' to the path of a different config
# file to override it.
global dconf # pylint: disable=global-statement,invalid-name
if not dconf:
driver_conf = os.environ.get('DRIVER_CONFIG', 'driver_config')
if driver_conf.endswith('.py'):
driver_conf = driver_conf[:-len('.py')]
mod = importlib.import_module(driver_conf)
dconf = mod
# Generate the login string of the host connection
if dconf.HOST_CONN == 'local':
login_str = 'localhost'
elif dconf.HOST_CONN == 'remote':
if not dconf.LOGIN_HOST:
raise ValueError("LOGIN_HOST must be set if HOST_CONN=remote")
login_str = dconf.LOGIN_HOST
if dconf.LOGIN_NAME:
login_str = '{}@{}'.format(dconf.LOGIN_NAME, login_str)
if dconf.LOGIN_PORT:
login_str += ':{}'.format(dconf.LOGIN_PORT)
elif dconf.HOST_CONN == 'docker':
if not dconf.CONTAINER_NAME:
raise ValueError("CONTAINER_NAME must be set if HOST_CONN=docker")
login_str = 'localhost'
else:
raise ValueError(("Invalid HOST_CONN: {}. Valid values are "
"'local', 'remote', or 'docker'.").format(dconf.HOST_CONN))
dconf.LOGIN = login_str
return dconf
def parse_bool(value):
if not isinstance(value, bool):
value = str(value).lower() == 'true'
return value
def get_content(response):
content_type = response.headers.get('Content-Type', '')
if content_type == 'application/json':
content = response.json()
else:
content = response.content
if isinstance(content, bytes):
content = content.decode('utf-8')
return content
@task
def run(cmd, capture=True, **kwargs):
capture = parse_bool(capture)
try:
if dconf.HOST_CONN == 'remote':
res = _run(cmd, **kwargs)
elif dconf.HOST_CONN == 'local':
res = local(cmd, capture=capture, **kwargs)
else: # docker
opts = ''
cmdd = cmd
if cmd.endswith('&'):
cmdd = cmd[:-1].strip()
opts = '-d '
res = local('docker exec {} -ti {} /bin/bash -c "{}"'.format(
opts, dconf.CONTAINER_NAME, cmdd), capture=capture, **kwargs)
except TypeError as e:
err = str(e).strip()
if 'unexpected keyword argument' in err:
offender = err.rsplit(' ', 1)[-1][1:-1]
kwargs.pop(offender)
res = run(cmd, **kwargs)
else:
raise e
return res
@task
def sudo(cmd, user=None, capture=True, **kwargs):
capture = parse_bool(capture)
if dconf.HOST_CONN == 'remote':
res = _sudo(cmd, user=user, **kwargs)
elif dconf.HOST_CONN == 'local':
pre_cmd = 'sudo '
if user:
pre_cmd += '-u {} '.format(user)
res = local(pre_cmd + cmd, capture=capture, **kwargs)
else: # docker
user = user or 'root'
opts = '-ti -u {}'.format(user or 'root')
if user == 'root':
opts += ' -w /'
res = local('docker exec {} {} /bin/bash -c "{}"'.format(
opts, dconf.CONTAINER_NAME, cmd), capture=capture)
return res
@task
def get(remote_path, local_path, use_sudo=False):
use_sudo = parse_bool(use_sudo)
if dconf.HOST_CONN == 'remote':
res = _get(remote_path, local_path, use_sudo=use_sudo)
elif dconf.HOST_CONN == 'local':
pre_cmd = 'sudo ' if use_sudo else ''
opts = '-r' if os.path.isdir(remote_path) else ''
res = local('{}cp {} {} {}'.format(pre_cmd, opts, remote_path, local_path))
else: # docker
res = local('docker cp {}:{} {}'.format(dconf.CONTAINER_NAME, remote_path, local_path))
return res
@task
def put(local_path, remote_path, use_sudo=False):
use_sudo = parse_bool(use_sudo)
if dconf.HOST_CONN == 'remote':
res = _put(local_path, remote_path, use_sudo=use_sudo)
elif dconf.HOST_CONN == 'local':
pre_cmd = 'sudo ' if use_sudo else ''
opts = '-r' if os.path.isdir(local_path) else ''
res = local('{}cp {} {} {}'.format(pre_cmd, opts, local_path, remote_path))
else: # docker
res = local('docker cp {} {}:{}'.format(local_path, dconf.CONTAINER_NAME, remote_path))
return res
@task
def run_sql_script(scriptfile, *args):
if dconf.DB_TYPE == 'oracle':
if dconf.HOST_CONN != 'local':
scriptdir = '/home/oracle/oracleScripts'
remote_path = os.path.join(scriptdir, scriptfile)
if not file_exists(remote_path):
run('mkdir -p {}'.format(scriptdir))
put(os.path.join('./oracleScripts', scriptfile), remote_path)
sudo('chown -R oracle:oinstall /home/oracle/oracleScripts')
res = run('sh {} {}'.format(remote_path, ' '.join(args)))
else:
raise Exception("Database Type {} Not Implemented !".format(dconf.DB_TYPE))
return res
@task
def file_exists(filename):
with settings(warn_only=True), hide('warnings'): # pylint: disable=not-context-manager
res = run('[ -f {} ]'.format(filename))
return res.return_code == 0
@task
def dir_exists(dirname):
with settings(warn_only=True), hide('warnings'): # pylint: disable=not-context-manager
res = run('[ -d {} ]'.format(dirname))
return res.return_code == 0
class FabricException(Exception):
pass
| 32.364641
| 95
| 0.589962
|
75181ae61a51d3b07c46da0b1608ff332305bb64
| 87,660
|
swift
|
Swift
|
DEPNotify Set-up Helper/ViewController.swift
|
BIG-RAT/DEPNotify-Set-up-Helper
|
4ec4f660b81368c600b106d0b234ce37f13688c7
|
[
"MIT"
] | 15
|
2020-05-31T22:25:04.000Z
|
2022-03-29T22:07:06.000Z
|
DEPNotify Set-up Helper/ViewController.swift
|
BIG-RAT/DEPNotify-Set-up-Helper
|
4ec4f660b81368c600b106d0b234ce37f13688c7
|
[
"MIT"
] | null | null | null |
DEPNotify Set-up Helper/ViewController.swift
|
BIG-RAT/DEPNotify-Set-up-Helper
|
4ec4f660b81368c600b106d0b234ce37f13688c7
|
[
"MIT"
] | 2
|
2020-12-22T08:19:23.000Z
|
2021-07-15T14:56:22.000Z
|
//
// ViewController.swift
// DEPNotify Set-up Helper
//
// Created by Leslie Helou on 2/24/20.
// Copyright © 2020 Leslie Helou. All rights reserved.
//
import AppKit
import Cocoa
import Foundation
class Setting: NSObject {
@objc dynamic var keyName: String
@objc dynamic var keyValue: String
init(keyName: String, keyValue: String) {
self.keyName = keyName
self.keyValue = keyValue
}
}
class ViewController: NSViewController, NSTextFieldDelegate {
@objc dynamic var settingsArray = [Setting]()
@IBOutlet weak var jamfServer_TextField: NSTextField!
@IBOutlet weak var jamfUser_TextField: NSTextField!
@IBOutlet weak var jamfUserPwd_TextField: NSSecureTextField!
@IBOutlet weak var savePassword_Button: NSButton!
@IBAction func savePassword_Action(_ sender: Any) {
savePasswordSetting()
}
@IBOutlet var preview_Button: NSButton!
@IBOutlet weak var settings_ScrollView: NSScrollView!
var jamfCreds = ""
let REG_POPUP_LABEL_Array = ["REG_POPUP_LABEL_1_OPTIONS", "REG_POPUP_LABEL_2_OPTIONS", "REG_POPUP_LABEL_3_OPTIONS", "REG_POPUP_LABEL_4_OPTIONS"]
@IBOutlet weak var settings_TableView: NSTableView!
@IBOutlet weak var policies_TableView: NSTableView!
var policiesTableArray: [String]?
var uniquePolicyNameIdDict = [String:String]() // links 'policyName - (id)' to policy id
var sortedNameArray = [String]()
var currentSettingValue = ""
// var settingsDictionary = [String:String]()
// var settingsTableDict = [String:String]()
let userDefaults = UserDefaults.standard
let fileManager = FileManager.default
var DEPNotifyPath = URL(string: "/Applications/Utilities/DEPNotify.app")
var DEPNotifyBinary = ""
// determine if we're using dark mode
var isDarkMode: Bool {
let mode = userDefaults.string(forKey: "AppleInterfaceStyle")
return mode == "Dark"
}
@objc func interfaceModeChanged(sender: NSNotification) {
DispatchQueue.main.async {
if self.isDarkMode {
self.view.layer?.backgroundColor = CGColor(red: 0x24/255.0, green: 0x24/255.0, blue: 0x24/255.0, alpha: 1.0)
} else {
self.view.layer?.backgroundColor = CGColor(red: 0xE9/255.0, green: 0xE9/255.0, blue: 0xE9/255.0, alpha: 1.0)
}
}
}
@IBAction func resetValues_Action(_ sender: Any) {
for theKey in keys.nameArray {
userDefaults.removeObject(forKey: "\(theKey)")
}
userDefaults.synchronize()
refreshKeysTable()
}
@IBAction func refreshPolicies_Action(_ sender: Any) {
var firstPolicy = true
let jamfCreds = "\(jamfUser_TextField.stringValue):\(jamfUserPwd_TextField.stringValue)"
let jamfUtf8Creds = jamfCreds.data(using: String.Encoding.utf8)
let jamfBase64Creds = (jamfUtf8Creds?.base64EncodedString())!
policy.attributeDict.removeAll()
policy.runList = ""
if !(jamfServer_TextField.stringValue == "" || jamfUser_TextField.stringValue == "" || jamfUserPwd_TextField.stringValue == "" ) {
Json().getRecord(theServer: jamfServer_TextField.stringValue, base64Creds: jamfBase64Creds, theEndpoint: "policies") {
(result: [String:AnyObject]) in
// print("json returned scripts: \(result)")
if let _ = result["policies"], result.count > 0 {
// save credentials, if marked - start
if self.savePassword_Button.state.rawValue == 1 {
let regexKey = try! NSRegularExpression(pattern: "http(.*?)://", options:.caseInsensitive)
let credKey = regexKey.stringByReplacingMatches(in: self.jamfServer_TextField.stringValue, options: [], range: NSRange(0..<self.jamfServer_TextField.stringValue.utf16.count), withTemplate: "")
Credentials2().save(service: "DEPNotifyHelper - "+credKey, account: self.jamfUser_TextField.stringValue, data: self.jamfUserPwd_TextField.stringValue)
}
// save credentials, if marked - end
let policiesArray = result["policies"] as! [Dictionary<String, Any>]
let policiesArrayCount = policiesArray.count
// print("found \(policiesArrayCount) policies")
for i in (0..<policiesArrayCount) {
let thePolicy = policiesArray[i] as [String : AnyObject]
// print("thePolicy: \(thePolicy)")
if let policyId = thePolicy["id"], let policyName = thePolicy["name"] {
// filter out policies created with Jamf (Casper) Remote
let nameCheck = policyName as! String
if nameCheck.range(of:"[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] at", options: .regularExpression) == nil && nameCheck != "Update Inventory" {
if !firstPolicy {
self.policiesTableArray?.append("\(policyName) - (\(policyId))")
} else {
self.policiesTableArray = ["\(policyName) - (\(policyId))"]
firstPolicy = false
}
policy.attributeDict["\(policyId)"] = ["name":"\(policyName)","trigger":""]
self.uniquePolicyNameIdDict["\(policyName) - (\(policyId))"] = "\(policyId)"
}
}
} // for i in - end
// print("policy.attributeDict: \(String(describing: policy.attributeDict))")
// print("uniquePolicyNameIdDict: \(String(describing: self.uniquePolicyNameIdDict))")
self.policies_TableView.reloadData()
}
} // Json().getRecord - end
} else {
Alert().display(header: "Attention:", message: "Must supply a Jamf Server, Jamf User and associated password to refresh.")
}
}
@IBAction func generateScript_Action(_ sender: Any) {
var firstPolicy = true
for i in (0..<settingsArray.count) {
let rawKeyName = friendlyToRawName(friendlyName: settingsArray[i].keyName)
// print("settingsArray: \(rawKeyName) : \(settingsArray[i].keyValue)")
// Convert comma seperated valus to expected format, one option per line
if REG_POPUP_LABEL_Array.firstIndex(of: rawKeyName) != nil {
// print("found popup label: \(rawKeyName) : \(settingsArray[i].keyValue)")
var tmpValue = settingsArray[i].keyValue
tmpValue = tmpValue.replacingOccurrences(of: ", ", with: ",").replacingOccurrences(of: "\"", with: "")
let tmpValueArray = tmpValue.split(separator: ",")
keys.settingsDict[rawKeyName] = "\(tmpValueArray)".replacingOccurrences(of: "[", with: "").replacingOccurrences(of: "]", with: "").replacingOccurrences(of: ",", with: "\n")
} else {
keys.settingsDict[rawKeyName] = settingsArray[i].keyValue
}
}
// create array of policies to run - start
for i in (0..<policy.attributeDict.count) {
if policies_TableView.isRowSelected(i) {
let policyId = self.uniquePolicyNameIdDict["\(policiesTableArray![i])"]!
let originalPolicyName = policiesTableArray![i].replacingOccurrences(of: " - (\(policyId))", with: "").replacingOccurrences(of: ",", with: "-")
if firstPolicy {
// print("selected first policy: \(policiesTableArray![i])")
firstPolicy = false
policy.runList = "\"\(originalPolicyName),\(policyId)\""
} else {
// print("selected policy: \(policiesTableArray![i])")
policy.runList = policy.runList + "\n\"\(originalPolicyName),\(policyId)\""
}
}
}
keys.settingsDict["POLICY_ARRAY"] = "\(policy.runList)"
// print("policy.runList: \(policy.runList)")
// create array of policies to run - end
let desktopDirectory = fileManager.urls(for: .desktopDirectory, in: .userDomainMask)[0]
var scriptName = "depNotify.sh"
var exportURL = desktopDirectory.appendingPathComponent(scriptName)
var currentScript = """
#!/bin/bash
# Version 2.0.6
#########################################################################################
# License information
#########################################################################################
# Copyright 2018 Jamf Professional Services
# 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.
#########################################################################################
# General Information
#########################################################################################
# This script is designed to make implementation of DEPNotify very easy with limited
# scripting knowledge. The section below has variables that may be modified to customize
# the end user experience. DO NOT modify things in or below the CORE LOGIC area unless
# major testing and validation is performed.
# More information at: https://github.com/jamfprofessionalservices/DEP-Notify
#########################################################################################
# Testing Mode
#########################################################################################
# Testing flag will enable the following things to change:
# Auto removal of BOM files to reduce errors
# Sleep commands instead of policies or other changes being called
# Quit Key set to command + control + x
TESTING_MODE=\(keys.settingsDict["TESTING_MODE"]!) # Set variable to true or false
#########################################################################################
# General Appearance
#########################################################################################
# Flag the app to open fullscreen or as a window
FULLSCREEN=\(keys.settingsDict["FULLSCREEN"]!) # Set variable to true or false
# Banner image can be 600px wide by 100px high. Images will be scaled to fit
# If this variable is left blank, the generic image will appear. If using custom Self
# Service branding, please see the Customized Self Service Branding area below
BANNER_IMAGE_PATH="\(keys.settingsDict["BANNER_IMAGE_PATH"]!)"
# Update the variable below replacing "Organization" with the actual name of your organization. Example "ACME Corp Inc."
ORG_NAME="\(keys.settingsDict["ORG_NAME"]!)"
# Main heading that will be displayed under the image
# If this variable is left blank, the generic banner will appear
BANNER_TITLE="\(keys.settingsDict["BANNER_TITLE"]!)"
# Update the variable below replacing "email helpdesk@company.com" with the actual plaintext instructions for your organization. Example "call 555-1212" or "email helpdesk@company.com"
SUPPORT_CONTACT_DETAILS="\(keys.settingsDict["SUPPORT_CONTACT_DETAILS"]!)"
# Paragraph text that will display under the main heading. For a new line, use \\n
# If this variable is left blank, the generic message will appear. Leave single
# quotes below as double quotes will break the new lines.
MAIN_TEXT='\(keys.settingsDict["MAIN_TEXT"]!)'
# Initial Start Status text that shows as things are firing up
INITAL_START_STATUS="\(keys.settingsDict["INITAL_START_STATUS"]!)"
# Text that will display in the progress bar
INSTALL_COMPLETE_TEXT="\(keys.settingsDict["INSTALL_COMPLETE_TEXT"]!)"
# Complete messaging to the end user can ether be a button at the bottom of the
# app with a modification to the main window text or a dropdown alert box. Default
# value set to false and will use buttons instead of dropdown messages.
COMPLETE_METHOD_DROPDOWN_ALERT=\(keys.settingsDict["COMPLETE_METHOD_DROPDOWN_ALERT"]!) # Set variable to true or false
# Script designed to automatically logout user to start FileVault process if
# deferred enablement is detected. Text displayed if deferred status is on.
# Option for dropdown alert box
FV_ALERT_TEXT="\(keys.settingsDict["FV_ALERT_TEXT"]!)"
# Options if not using dropdown alert box
FV_COMPLETE_MAIN_TEXT='\(keys.settingsDict["FV_COMPLETE_MAIN_TEXT"]!)'
FV_COMPLETE_BUTTON_TEXT="\(keys.settingsDict["FV_COMPLETE_BUTTON_TEXT"]!)"
# Text that will display inside the alert once policies have finished
# Option for dropdown alert box
COMPLETE_ALERT_TEXT="\(keys.settingsDict["COMPLETE_ALERT_TEXT"]!)"
# Options if not using dropdown alert box
COMPLETE_MAIN_TEXT='\(keys.settingsDict["COMPLETE_MAIN_TEXT"]!)'
COMPLETE_BUTTON_TEXT="\(keys.settingsDict["COMPLETE_BUTTON_TEXT"]!)"
#########################################################################################
# Plist Configuration
#########################################################################################
# The menu.depnotify.plist contains more and more things that configure the DEPNotify app
# You may want to save the file for purposes like verifying EULA acceptance or validating
# other options.
# Plist Save Location
# This wrapper allows variables that are created later to be used but also allow for
# configuration of where the plist is stored
INFO_PLIST_WRAPPER (){
DEP_NOTIFY_USER_INPUT_PLIST="\(keys.settingsDict["DEP_NOTIFY_USER_INPUT_PLIST"]!)"
}
# Status Text Alignment
# The status text under the progress bar can be configured to be left, right, or center
STATUS_TEXT_ALIGN="\(keys.settingsDict["STATUS_TEXT_ALIGN"]!)"
# Help Button Configuration
# The help button was changed to a popup. Button will appear if title is populated.
HELP_BUBBLE_TITLE="\(keys.settingsDict["HELP_BUBBLE_TITLE"]!)"
HELP_BUBBLE_BODY="\(keys.settingsDict["HELP_BUBBLE_BODY"]!)"
#########################################################################################
# Error Screen Text
#########################################################################################
# If testing mode is false and configuration files are present, this text will appear to
# the end user and asking them to contact IT. Limited window options here as the
# assumption is that they need to call IT. No continue or exit buttons will show for
# DEP Notify window and it will not show in fullscreen. IT staff will need to use Terminal
# or Activity Monitor to kill DEP Notify.
# Main heading that will be displayed under the image
ERROR_BANNER_TITLE="\(keys.settingsDict["ERROR_BANNER_TITLE"]!)"
# Paragraph text that will display under the main heading. For a new line, use \\n
# If this variable is left blank, the generic message will appear. Leave single
# quotes below as double quotes will break the new lines.
ERROR_MAIN_TEXT='\(keys.settingsDict["ERROR_MAIN_TEXT"]!)'
# Error status message that is displayed under the progress bar
ERROR_STATUS="\(keys.settingsDict["ERROR_STATUS"]!)"
#########################################################################################
# Trigger to be used to call the policy -> not needed, uses policy id
#########################################################################################
# Policies can be called be either a custom trigger or by policy id.
# Select either event, to call the policy by the custom trigger,
# or id to call the policy by id.
#########################################################################################
# Policy Variable to Modify
#########################################################################################
# The policy array must be formatted "Progress Bar text,id". These will be
# run in order as they appear below.
POLICY_ARRAY=(
\(String(describing: keys.settingsDict["POLICY_ARRAY"]!))
)
#########################################################################################
# Caffeinate / No Sleep Configuration
#########################################################################################
# Flag script to keep the computer from sleeping. BE VERY CAREFUL WITH THIS FLAG!
# This flag could expose your data to risk by leaving an unlocked computer wide open.
# Only recommended if you are using fullscreen mode and have a logout taking place at
# the end of configuration (like for FileVault). Some folks may use this in workflows
# where IT staff are the primary people setting up the device. The device will be
# allowed to sleep again once the DEPNotify app is quit as caffeinate is looking
# at DEPNotify's process ID.
NO_SLEEP=\(keys.settingsDict["NO_SLEEP"]!)
#########################################################################################
# Customized Self Service Branding
#########################################################################################
# Flag for using the custom branding icon from Self Service and Jamf Pro
# This will override the banner image specified above. If you have changed the
# name of Self Service, make sure to modify the Self Service name below.
# Please note, custom branding is downloaded from Jamf Pro after Self Service has opened
# at least one time. The script is designed to wait until the files have been downloaded.
# This could take a few minutes depending on server and network resources.
SELF_SERVICE_CUSTOM_BRANDING=\(keys.settingsDict["SELF_SERVICE_CUSTOM_BRANDING"]!) # Set variable to true or false
# If using a name other than Self Service with Custom branding. Change the
# name with the SELF_SERVICE_APP_NAME variable below. Keep .app on the end
SELF_SERVICE_APP_NAME="\(keys.settingsDict["SELF_SERVICE_APP_NAME"]!)"
# Number of seconds to wait (seconds) for the Self Service custon icon
SELF_SERVICE_CUSTOM_WAIT=\(keys.settingsDict["SELF_SERVICE_CUSTOM_WAIT"]!)
#########################################################################################
# EULA Variables to Modify
#########################################################################################
# EULA configuration
EULA_ENABLED=\(keys.settingsDict["EULA_ENABLED"]!) # Set variable to true or false
# EULA status bar text
EULA_STATUS="\(keys.settingsDict["EULA_STATUS"]!)"
# EULA button text on the main screen
EULA_BUTTON="\(keys.settingsDict["EULA_BUTTON"]!)"
# EULA Screen Title
EULA_MAIN_TITLE="\(keys.settingsDict["EULA_MAIN_TITLE"]!)"
# EULA Subtitle
EULA_SUBTITLE="\(keys.settingsDict["EULA_SUBTITLE"]!)"
# Path to the EULA file you would like the user to read and agree to. It is
# best to package this up with Composer or another tool and deliver it to a
# shared area like /Users/Shared/
EULA_FILE_PATH="\(keys.settingsDict["EULA_FILE_PATH"]!)"
#########################################################################################
# Registration Variables to Modify
#########################################################################################
# Registration window configuration
REGISTRATION_ENABLED=\(keys.settingsDict["REGISTRATION_ENABLED"]!) # Set variable to true or false
# Registration window title
REGISTRATION_TITLE="\(keys.settingsDict["REGISTRATION_TITLE"]!)"
# Registration status bar text
REGISTRATION_STATUS="\(keys.settingsDict["REGISTRATION_STATUS"]!)"
# Registration window submit or finish button text
REGISTRATION_BUTTON="\(keys.settingsDict["REGISTRATION_BUTTON"]!)"
# The text and pick list sections below will write the following lines out for
# end users. Use the variables below to configure what the sentence says
# Ex: Setting Computer Name to macBook0132
REGISTRATION_BEGIN_WORD="\(keys.settingsDict["REGISTRATION_BEGIN_WORD"]!)"
REGISTRATION_MIDDLE_WORD="\(keys.settingsDict["REGISTRATION_MIDDLE_WORD"]!)"
# Registration window can have up to two text fields. Leaving the text display
# variable empty will hide the input box. Display text is to the side of the
# input and placeholder text is the gray text inside the input box.
# Registration window can have up to four dropdown / pick list inputs. Leaving
# the pick display variable empty will hide the dropdown / pick list.
# First Text Field
#######################################################################################
# Text Field Label
REG_TEXT_LABEL_1="\(keys.settingsDict["REG_TEXT_LABEL_1"]!)"
# Place Holder Text
REG_TEXT_LABEL_1_PLACEHOLDER="\(keys.settingsDict["REG_TEXT_LABEL_1_PLACEHOLDER"]!)"
# Optional flag for making the field an optional input for end user
REG_TEXT_LABEL_1_OPTIONAL="\(keys.settingsDict["REG_TEXT_LABEL_1_OPTIONAL"]!.lowercased())" # Set variable to true or false
# Help Bubble for Input. If title left blank, this will not appear
REG_TEXT_LABEL_1_HELP_TITLE="\(keys.settingsDict["REG_TEXT_LABEL_1_HELP_TITLE"]!)"
REG_TEXT_LABEL_1_HELP_TEXT="\(keys.settingsDict["REG_TEXT_LABEL_1_HELP_TEXT"]!)"
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_TEXT_LABEL_1_LOGIC (){
REG_TEXT_LABEL_1_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_TEXT_LABEL_1")
if [ "$REG_TEXT_LABEL_1_OPTIONAL" = true ] && [ "$REG_TEXT_LABEL_1_VALUE" = "" ]; then
echo "Status: $REG_TEXT_LABEL_1 was left empty. Skipping..." >> "$DEP_NOTIFY_LOG"
echo "$(date "+%a %h %d %H:%M:%S"): $REG_TEXT_LABEL_1 was set to optional and was left empty. Skipping..." >> "$DEP_NOTIFY_DEBUG"
sleep 5
else
echo "Status: $REGISTRATION_BEGIN_WORD $REG_TEXT_LABEL_1 $REGISTRATION_MIDDLE_WORD $REG_TEXT_LABEL_1_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
"$JAMF_BINARY" setComputerName -name "$REG_TEXT_LABEL_1_VALUE"
sleep 5
fi
fi
}
# Second Text Field
#######################################################################################
# Text Field Label
REG_TEXT_LABEL_2="\(keys.settingsDict["REG_TEXT_LABEL_2"]!)"
# Place Holder Text
REG_TEXT_LABEL_2_PLACEHOLDER="\(keys.settingsDict["REG_TEXT_LABEL_2_PLACEHOLDER"]!)"
# Optional flag for making the field an optional input for end user
REG_TEXT_LABEL_2_OPTIONAL="\(keys.settingsDict["REG_TEXT_LABEL_2_OPTIONAL"]!)" # Set variable to true or false
# Help Bubble for Input. If title left blank, this will not appear
REG_TEXT_LABEL_2_HELP_TITLE="\(keys.settingsDict["REG_TEXT_LABEL_2_HELP_TITLE"]!)"
REG_TEXT_LABEL_2_HELP_TEXT="\(keys.settingsDict["REG_TEXT_LABEL_2_HELP_TEXT"]!)"
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_TEXT_LABEL_2_LOGIC (){
REG_TEXT_LABEL_2_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_TEXT_LABEL_2")
if [ "$REG_TEXT_LABEL_2_OPTIONAL" = true ] && [ "$REG_TEXT_LABEL_2_VALUE" = "" ]; then
echo "Status: $REG_TEXT_LABEL_2 was left empty. Skipping..." >> "$DEP_NOTIFY_LOG"
echo "$(date "+%a %h %d %H:%M:%S"): $REG_TEXT_LABEL_2 was set to optional and was left empty. Skipping..." >> "$DEP_NOTIFY_DEBUG"
sleep 5
else
echo "Status: $REGISTRATION_BEGIN_WORD $REG_TEXT_LABEL_2 $REGISTRATION_MIDDLE_WORD $REG_TEXT_LABEL_2_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
"$JAMF_BINARY" recon -assetTag "$REG_TEXT_LABEL_2_VALUE"
fi
fi
}
# Popup 1
#######################################################################################
# Label for the popup
REG_POPUP_LABEL_1="\(keys.settingsDict["REG_POPUP_LABEL_1"]!)"
# Array of options for the user to select
REG_POPUP_LABEL_1_OPTIONS=(
\(keys.settingsDict["REG_POPUP_LABEL_1_OPTIONS"]!)
)
# Help Bubble for Input. If title left blank, this will not appear
REG_POPUP_LABEL_1_HELP_TITLE="Building Dropdown Field"
REG_POPUP_LABEL_1_HELP_TEXT="Please choose the appropriate building for where you normally work. This is important for inventory purposes."
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_POPUP_LABEL_1_LOGIC (){
REG_POPUP_LABEL_1_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_POPUP_LABEL_1")
echo "Status: $REGISTRATION_BEGIN_WORD $REG_POPUP_LABEL_1 $REGISTRATION_MIDDLE_WORD $REG_POPUP_LABEL_1_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
"$JAMF_BINARY" recon -building "$REG_POPUP_LABEL_1_VALUE"
fi
}
# Popup 2
#######################################################################################
# Label for the popup
REG_POPUP_LABEL_2="\(keys.settingsDict["REG_POPUP_LABEL_2"]!)"
# Array of options for the user to select
REG_POPUP_LABEL_2_OPTIONS=(
\(keys.settingsDict["REG_POPUP_LABEL_2_OPTIONS"]!)
)
# Help Bubble for Input. If title left blank, this will not appear
REG_POPUP_LABEL_2_HELP_TITLE="Department Dropdown Field"
REG_POPUP_LABEL_2_HELP_TEXT="Please choose the appropriate department for where you normally work. This is important for inventory purposes."
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_POPUP_LABEL_2_LOGIC (){
REG_POPUP_LABEL_2_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_POPUP_LABEL_2")
echo "Status: $REGISTRATION_BEGIN_WORD $REG_POPUP_LABEL_2 $REGISTRATION_MIDDLE_WORD $REG_POPUP_LABEL_2_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
"$JAMF_BINARY" recon -department "$REG_POPUP_LABEL_2_VALUE"
fi
}
# Popup 3 - Code is here but currently unused
#######################################################################################
# Label for the popup
REG_POPUP_LABEL_3="\(keys.settingsDict["REG_POPUP_LABEL_3"]!)"
# Array of options for the user to select
REG_POPUP_LABEL_3_OPTIONS=(
\(keys.settingsDict["REG_POPUP_LABEL_3_OPTIONS"]!)
)
# Help Bubble for Input. If title left blank, this will not appear
REG_POPUP_LABEL_3_HELP_TITLE="Dropdown 3 Field"
REG_POPUP_LABEL_3_HELP_TEXT="This dropdown is currently not in use. All code is here ready for you to use. It can also be hidden by removing the contents of the REG_POPUP_LABEL_3 variable."
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_POPUP_LABEL_3_LOGIC (){
REG_POPUP_LABEL_3_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_POPUP_LABEL_3")
echo "Status: $REGISTRATION_BEGIN_WORD $REG_POPUP_LABEL_3 $REGISTRATION_MIDDLE_WORD $REG_POPUP_LABEL_3_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
sleep 10
fi
}
# Popup 4 - Code is here but currently unused
#######################################################################################
# Label for the popup
REG_POPUP_LABEL_4="\(keys.settingsDict["REG_POPUP_LABEL_4"]!)"
# Array of options for the user to select
REG_POPUP_LABEL_4_OPTIONS=(
\(keys.settingsDict["REG_POPUP_LABEL_4_OPTIONS"]!)
)
# Help Bubble for Input. If title left blank, this will not appear
REG_POPUP_LABEL_4_HELP_TITLE="Dropdown 4 Field"
REG_POPUP_LABEL_4_HELP_TEXT="This dropdown is currently not in use. All code is here ready for you to use. It can also be hidden by removing the contents of the REG_POPUP_LABEL_4 variable."
# Logic below was put in this section rather than in core code as folks may
# want to change what the field does. This is a function that gets called
# when needed later on. BE VERY CAREFUL IN CHANGING THE FUNCTION!
REG_POPUP_LABEL_4_LOGIC (){
REG_POPUP_LABEL_4_VALUE=$(/usr/bin/defaults read "$DEP_NOTIFY_USER_INPUT_PLIST" "$REG_POPUP_LABEL_4")
echo "Status: $REGISTRATION_BEGIN_WORD $REG_POPUP_LABEL_4 $REGISTRATION_MIDDLE_WORD $REG_POPUP_LABEL_4_VALUE" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
else
sleep 10
fi
}
#########################################################################################
#########################################################################################
# Core Script Logic - Don't Change Without Major Testing
#########################################################################################
#########################################################################################
# Variables for File Paths
JAMF_BINARY="/usr/local/bin/jamf"
FDE_SETUP_BINARY="/usr/bin/fdesetup"
DEP_NOTIFY_APP="/Applications/Utilities/DEPNotify.app"
DEP_NOTIFY_LOG="/var/tmp/depnotify.log"
DEP_NOTIFY_DEBUG="/var/tmp/depnotifyDebug.log"
DEP_NOTIFY_DONE="/var/tmp/com.depnotify.provisioning.done"
# Pulling from Policy parameters to allow true/false flags to be set. More info
# can be found on https://www.jamf.com/jamf-nation/articles/146/script-parameters
# These will override what is specified in the script above.
# Testing Mode
if [ "$4" != "" ]; then TESTING_MODE="$4"; fi
# Fullscreen Mode
if [ "$5" != "" ]; then FULLSCREEN="$5"; fi
# No Sleep / Caffeinate Mode
if [ "$6" != "" ]; then NO_SLEEP="$6"; fi
# Self Service Custom Branding
if [ "$7" != "" ]; then SELF_SERVICE_CUSTOM_BRANDING="$7"; fi
# Complete method dropdown or main screen
if [ "$8" != "" ]; then COMPLETE_METHOD_DROPDOWN_ALERT="$8"; fi
# EULA Mode
if [ "$9" != "" ]; then EULA_ENABLED="$9"; fi
# Registration Mode
if [ "${10}" != "" ]; then REGISTRATION_ENABLED="${10}"; fi
# Standard Testing Mode Enhancements
if [ "$TESTING_MODE" = true ]; then
# Removing old config file if present (Testing Mode Only)
if [ -f "$DEP_NOTIFY_LOG" ]; then rm "$DEP_NOTIFY_LOG"; fi
if [ -f "$DEP_NOTIFY_DONE" ]; then rm "$DEP_NOTIFY_DONE"; fi
if [ -f "$DEP_NOTIFY_DEBUG" ]; then rm "$DEP_NOTIFY_DEBUG"; fi
# Setting Quit Key set to command + control + x (Testing Mode Only)
echo "Command: QuitKey: x" >> "$DEP_NOTIFY_LOG"
fi
# Validating true/false flags
if [ "$TESTING_MODE" != true ] && [ "$TESTING_MODE" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Testing configuration not set properly. Currently set to $TESTING_MODE. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$FULLSCREEN" != true ] && [ "$FULLSCREEN" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Fullscreen configuration not set properly. Currently set to $FULLSCREEN. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$NO_SLEEP" != true ] && [ "$NO_SLEEP" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Sleep configuration not set properly. Currently set to $NO_SLEEP. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$SELF_SERVICE_CUSTOM_BRANDING" != true ] && [ "$SELF_SERVICE_CUSTOM_BRANDING" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Self Service Custom Branding configuration not set properly. Currently set to $SELF_SERVICE_CUSTOM_BRANDING. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$COMPLETE_METHOD_DROPDOWN_ALERT" != true ] && [ "$COMPLETE_METHOD_DROPDOWN_ALERT" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Completion alert method not set properly. Currently set to $COMPLETE_METHOD_DROPDOWN_ALERT. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$EULA_ENABLED" != true ] && [ "$EULA_ENABLED" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): EULA configuration not set properly. Currently set to $EULA_ENABLED. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
if [ "$REGISTRATION_ENABLED" != true ] && [ "$REGISTRATION_ENABLED" != false ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Registration configuration not set properly. Currently set to $REGISTRATION_ENABLED. Please update to true or false." >> "$DEP_NOTIFY_DEBUG"
exit 1
fi
# Run DEP Notify will run after Apple Setup Assistant
SETUP_ASSISTANT_PROCESS=$(pgrep -l "Setup Assistant")
until [ "$SETUP_ASSISTANT_PROCESS" = "" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Setup Assistant Still Running. PID $SETUP_ASSISTANT_PROCESS." >> "$DEP_NOTIFY_DEBUG"
sleep 1
SETUP_ASSISTANT_PROCESS=$(pgrep -l "Setup Assistant")
done
# Checking to see if the Finder is running now before continuing. This can help
# in scenarios where an end user is not configuring the device.
FINDER_PROCESS=$(pgrep -l "Finder")
until [ "$FINDER_PROCESS" != "" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Finder process not found. Assuming device is at login screen." >> "$DEP_NOTIFY_DEBUG"
sleep 1
FINDER_PROCESS=$(pgrep -l "Finder")
done
# After the Apple Setup completed. Now safe to grab the current user.
CURRENT_USER=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\\n");')
CURRENT_USER_ID=$(id -u $CURRENT_USER)
echo "$(date "+%a %h %d %H:%M:%S"): Current user set to $CURRENT_USER (id: $CURRENT_USER_ID)." >> "$DEP_NOTIFY_DEBUG"
# Stop DEPNotify if there was already a DEPNotify window running (from a PreStage package postinstall script).
PREVIOUS_DEP_NOTIFY_PROCESS=$(pgrep -l "DEPNotify" | cut -d " " -f1)
until [ "$PREVIOUS_DEP_NOTIFY_PROCESS" = "" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Stopping the previously-opened instance of DEPNotify." >> "$DEP_NOTIFY_DEBUG"
kill $PREVIOUS_DEP_NOTIFY_PROCESS
PREVIOUS_DEP_NOTIFY_PROCESS=$(pgrep -l "DEPNotify" | cut -d " " -f1)
done
# Stop BigHonkingText if it's running (from a PreStage package postinstall script).
BIG_HONKING_TEXT_PROCESS=$(pgrep -l "BigHonkingText" | cut -d " " -f1)
until [ "$BIG_HONKING_TEXT_PROCESS" = "" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Stopping the previously-opened instance of BigHonkingText." >> "$DEP_NOTIFY_DEBUG"
kill $BIG_HONKING_TEXT_PROCESS
BIG_HONKING_TEXT_PROCESS=$(pgrep -l "BigHonkingText" | cut -d " " -f1)
done
# Adding Check and Warning if Testing Mode is off and BOM files exist
if [[ ( -f "$DEP_NOTIFY_LOG" || -f "$DEP_NOTIFY_DONE" ) && "$TESTING_MODE" = false ]]; then
echo "$(date "+%a %h %d %H:%M:%S"): TESTING_MODE set to false but config files were found in /var/tmp. Letting user know and exiting." >> "$DEP_NOTIFY_DEBUG"
mv "$DEP_NOTIFY_LOG" "/var/tmp/depnotify_old.log"
echo "Command: MainTitle: $ERROR_BANNER_TITLE" >> "$DEP_NOTIFY_LOG"
echo "Command: MainText: $ERROR_MAIN_TEXT" >> "$DEP_NOTIFY_LOG"
echo "Status: $ERROR_STATUS" >> "$DEP_NOTIFY_LOG"
launchctl asuser $CURRENT_USER_ID open -a "$DEP_NOTIFY_APP" --args -path "$DEP_NOTIFY_LOG"
sleep 5
exit 1
fi
# If SELF_SERVICE_CUSTOM_BRANDING is set to true. Loading the updated icon
if [ "$SELF_SERVICE_CUSTOM_BRANDING" = true ]; then
open -a "/Applications/$SELF_SERVICE_APP_NAME" --hide
# Loop waiting on the branding image to properly show in the users library - wait up to 20 seconds
SELF_SERVICE_COUNTER=0
CUSTOM_BRANDING_PNG="/Users/$CURRENT_USER/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png"
until [ -f "$CUSTOM_BRANDING_PNG" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Waiting for branding image from Jamf Pro." >> "$DEP_NOTIFY_DEBUG"
sleep 1
(( SELF_SERVICE_COUNTER++ ))
if [ $SELF_SERVICE_COUNTER -gt $SELF_SERVICE_CUSTOM_WAIT ];then
CUSTOM_BRANDING_PNG="/Applications/Self Service.app/Contents/Resources/AppIcon.icns"
break
fi
done
# Setting Banner Image for DEP Notify to Self Service Custom Branding
BANNER_IMAGE_PATH="$CUSTOM_BRANDING_PNG"
# Closing Self Service
SELF_SERVICE_PID=$(pgrep -l "Self Service" | cut -d' ' -f1)
echo "$(date "+%a %h %d %H:%M:%S"): Self Service custom branding icon has been loaded. Killing Self Service PID $SELF_SERVICE_PID." >> "$DEP_NOTIFY_DEBUG"
kill "$SELF_SERVICE_PID"
elif [ -f "$BANNER_IMAGE_PATH" ];then
BANNER_IMAGE_PATH="/Applications/Self Service.app/Contents/Resources/AppIcon.icns"
fi
# Setting custom image if specified
if [ "$BANNER_IMAGE_PATH" != "" ]; then echo "Command: Image: $BANNER_IMAGE_PATH" >> "$DEP_NOTIFY_LOG"; fi
# Setting custom title if specified
if [ "$BANNER_TITLE" != "" ]; then echo "Command: MainTitle: $BANNER_TITLE" >> "$DEP_NOTIFY_LOG"; fi
# Setting custom main text if specified
if [ "$MAIN_TEXT" != "" ]; then echo "Command: MainText: $MAIN_TEXT" >> "$DEP_NOTIFY_LOG"; fi
# General Plist Configuration
# Calling function to set the INFO_PLIST_PATH
INFO_PLIST_WRAPPER
# The plist information below
DEP_NOTIFY_CONFIG_PLIST="/Users/$CURRENT_USER/Library/Preferences/menu.nomad.DEPNotify.plist"
# If testing mode is on, this will remove some old configuration files
if [ "$TESTING_MODE" = true ] && [ -f "$DEP_NOTIFY_CONFIG_PLIST" ]; then rm "$DEP_NOTIFY_CONFIG_PLIST"; fi
if [ "$TESTING_MODE" = true ] && [ -f "$DEP_NOTIFY_USER_INPUT_PLIST" ]; then rm "$DEP_NOTIFY_USER_INPUT_PLIST"; fi
# Setting default path to the plist which stores all the user completed info
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" pathToPlistFile "$DEP_NOTIFY_USER_INPUT_PLIST"
# Setting status text alignment
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" statusTextAlignment "$STATUS_TEXT_ALIGN"
# Setting help button
if [ "$HELP_BUBBLE_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" helpBubble -array-add "$HELP_BUBBLE_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" helpBubble -array-add "$HELP_BUBBLE_BODY"
fi
# EULA Configuration
if [ "$EULA_ENABLED" = true ]; then
DEP_NOTIFY_EULA_DONE="/var/tmp/com.depnotify.agreement.done"
# If testing mode is on, this will remove EULA specific configuration files
if [ "$TESTING_MODE" = true ] && [ -f "$DEP_NOTIFY_EULA_DONE" ]; then rm "$DEP_NOTIFY_EULA_DONE"; fi
# Writing title, subtitle, and EULA txt location to plist
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" EULAMainTitle "$EULA_MAIN_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" EULASubTitle "$EULA_SUBTITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" pathToEULA "$EULA_FILE_PATH"
# Setting ownership of EULA file
chown "$CURRENT_USER:staff" "$EULA_FILE_PATH"
chmod 444 "$EULA_FILE_PATH"
fi
# Registration Plist Configuration
if [ "$REGISTRATION_ENABLED" = true ]; then
DEP_NOTIFY_REGISTER_DONE="/var/tmp/com.depnotify.registration.done"
# If testing mode is on, this will remove registration specific configuration files
if [ "$TESTING_MODE" = true ] && [ -f "$DEP_NOTIFY_REGISTER_DONE" ]; then rm "$DEP_NOTIFY_REGISTER_DONE"; fi
# Main Window Text Configuration
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" registrationMainTitle "$REGISTRATION_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" registrationButtonLabel "$REGISTRATION_BUTTON"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" registrationPicturePath "$BANNER_IMAGE_PATH"
# First Text Box Configuration
if [ "$REG_TEXT_LABEL_1" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField1Label "$REG_TEXT_LABEL_1"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField1Placeholder "$REG_TEXT_LABEL_1_PLACEHOLDER"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField1IsOptional "$REG_TEXT_LABEL_1_OPTIONAL"
# Code for showing the help box if configured
if [ "$REG_TEXT_LABEL_1_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField1Bubble -array-add "$REG_TEXT_LABEL_1_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField1Bubble -array-add "$REG_TEXT_LABEL_1_HELP_TEXT"
fi
fi
# Second Text Box Configuration
if [ "$REG_TEXT_LABEL_2" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField2Label "$REG_TEXT_LABEL_2"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField2Placeholder "$REG_TEXT_LABEL_2_PLACEHOLDER"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField2IsOptional "$REG_TEXT_LABEL_2_OPTIONAL"
# Code for showing the help box if configured
if [ "$REG_TEXT_LABEL_2_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField2Bubble -array-add "$REG_TEXT_LABEL_2_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" textField2Bubble -array-add "$REG_TEXT_LABEL_2_HELP_TEXT"
fi
fi
# Popup 1
if [ "$REG_POPUP_LABEL_1" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton1Label "$REG_POPUP_LABEL_1"
# Code for showing the help box if configured
if [ "$REG_POPUP_LABEL_1_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu1Bubble -array-add "$REG_POPUP_LABEL_1_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu1Bubble -array-add "$REG_POPUP_LABEL_1_HELP_TEXT"
fi
# Code for adding the items from the array above into the plist
for REG_POPUP_LABEL_1_OPTION in "${REG_POPUP_LABEL_1_OPTIONS[@]}"; do
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton1Content -array-add "$REG_POPUP_LABEL_1_OPTION"
done
fi
# Popup 2
if [ "$REG_POPUP_LABEL_2" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton2Label "$REG_POPUP_LABEL_2"
# Code for showing the help box if configured
if [ "$REG_POPUP_LABEL_2_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu2Bubble -array-add "$REG_POPUP_LABEL_2_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu2Bubble -array-add "$REG_POPUP_LABEL_2_HELP_TEXT"
fi
# Code for adding the items from the array above into the plist
for REG_POPUP_LABEL_2_OPTION in "${REG_POPUP_LABEL_2_OPTIONS[@]}"; do
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton2Content -array-add "$REG_POPUP_LABEL_2_OPTION"
done
fi
# Popup 3
if [ "$REG_POPUP_LABEL_3" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton3Label "$REG_POPUP_LABEL_3"
# Code for showing the help box if configured
if [ "$REG_POPUP_LABEL_3_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu3Bubble -array-add "$REG_POPUP_LABEL_3_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu3Bubble -array-add "$REG_POPUP_LABEL_3_HELP_TEXT"
fi
# Code for adding the items from the array above into the plist
for REG_POPUP_LABEL_3_OPTION in "${REG_POPUP_LABEL_3_OPTIONS[@]}"; do
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton3Content -array-add "$REG_POPUP_LABEL_3_OPTION"
done
fi
# Popup 4
if [ "$REG_POPUP_LABEL_4" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton4Label "$REG_POPUP_LABEL_4"
# Code for showing the help box if configured
if [ "$REG_POPUP_LABEL_4_HELP_TITLE" != "" ]; then
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu4Bubble -array-add "$REG_POPUP_LABEL_4_HELP_TITLE"
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupMenu4Bubble -array-add "$REG_POPUP_LABEL_4_HELP_TEXT"
fi
# Code for adding the items from the array above into the plist
for REG_POPUP_LABEL_4_OPTION in "${REG_POPUP_LABEL_4_OPTIONS[@]}"; do
/usr/bin/defaults write "$DEP_NOTIFY_CONFIG_PLIST" popupButton4Content -array-add "$REG_POPUP_LABEL_4_OPTION"
done
fi
fi
# Changing Ownership of the plist file
chown "$CURRENT_USER":staff "$DEP_NOTIFY_CONFIG_PLIST"
chmod 600 "$DEP_NOTIFY_CONFIG_PLIST"
# Opening the app after initial configuration
if [ "$FULLSCREEN" = true ]; then
launchctl asuser $CURRENT_USER_ID open -a "$DEP_NOTIFY_APP" --args -path "$DEP_NOTIFY_LOG" -fullScreen
elif [ "$FULLSCREEN" = false ]; then
launchctl asuser $CURRENT_USER_ID open -a "$DEP_NOTIFY_APP" --args -path "$DEP_NOTIFY_LOG"
fi
# Grabbing the DEP Notify Process ID for use later
DEP_NOTIFY_PROCESS=$(pgrep -l "DEPNotify" | cut -d " " -f1)
until [ "$DEP_NOTIFY_PROCESS" != "" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Waiting for DEPNotify to start to gather the process ID." >> "$DEP_NOTIFY_DEBUG"
sleep 1
DEP_NOTIFY_PROCESS=$(pgrep -l "DEPNotify" | cut -d " " -f1)
done
# Using Caffeinate binary to keep the computer awake if enabled
if [ "$NO_SLEEP" = true ]; then
echo "$(date "+%a %h %d %H:%M:%S"): Caffeinating DEP Notify process. Process ID: $DEP_NOTIFY_PROCESS" >> "$DEP_NOTIFY_DEBUG"
caffeinate -disu -w "$DEP_NOTIFY_PROCESS"&
fi
# Adding an alert prompt to let admins know that the script is in testing mode
if [ "$TESTING_MODE" = true ]; then
echo "Command: Alert: DEP Notify is in TESTING_MODE. Script will not run Policies or other commands that make change to this computer." >> "$DEP_NOTIFY_LOG"
fi
# Adding nice text and a brief pause for prettiness
echo "Status: $INITAL_START_STATUS" >> "$DEP_NOTIFY_LOG"
sleep 5
# Setting the status bar
# Counter is for making the determinate look nice. Starts at one and adds
# more based on EULA, register, or other options.
ADDITIONAL_OPTIONS_COUNTER=1
if [ "$EULA_ENABLED" = true ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REGISTRATION_ENABLED" = true ]; then ((ADDITIONAL_OPTIONS_COUNTER++))
if [ "$REG_TEXT_LABEL_1" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REG_TEXT_LABEL_2" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REG_POPUP_LABEL_1" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REG_POPUP_LABEL_2" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REG_POPUP_LABEL_3" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
if [ "$REG_POPUP_LABEL_4" != "" ]; then ((ADDITIONAL_OPTIONS_COUNTER++)); fi
fi
# Checking policy array and adding the count from the additional options above.
ARRAY_LENGTH="$((${#POLICY_ARRAY[@]}+ADDITIONAL_OPTIONS_COUNTER))"
echo "Command: Determinate: $ARRAY_LENGTH" >> "$DEP_NOTIFY_LOG"
# EULA Window Display Logic
if [ "$EULA_ENABLED" = true ]; then
echo "Status: $EULA_STATUS" >> "$DEP_NOTIFY_LOG"
echo "Command: ContinueButtonEULA: $EULA_BUTTON" >> "$DEP_NOTIFY_LOG"
while [ ! -f "$DEP_NOTIFY_EULA_DONE" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Waiting for user to accept EULA." >> "$DEP_NOTIFY_DEBUG"
sleep 1
done
fi
# Registration Window Display Logic
if [ "$REGISTRATION_ENABLED" = true ]; then
echo "Status: $REGISTRATION_STATUS" >> "$DEP_NOTIFY_LOG"
echo "Command: ContinueButtonRegister: $REGISTRATION_BUTTON" >> "$DEP_NOTIFY_LOG"
while [ ! -f "$DEP_NOTIFY_REGISTER_DONE" ]; do
echo "$(date "+%a %h %d %H:%M:%S"): Waiting for user to complete registration." >> "$DEP_NOTIFY_DEBUG"
sleep 1
done
# Running Logic For Each Registration Box
if [ "$REG_TEXT_LABEL_1" != "" ]; then REG_TEXT_LABEL_1_LOGIC; fi
if [ "$REG_TEXT_LABEL_2" != "" ]; then REG_TEXT_LABEL_2_LOGIC; fi
if [ "$REG_POPUP_LABEL_1" != "" ]; then REG_POPUP_LABEL_1_LOGIC; fi
if [ "$REG_POPUP_LABEL_2" != "" ]; then REG_POPUP_LABEL_2_LOGIC; fi
if [ "$REG_POPUP_LABEL_3" != "" ]; then REG_POPUP_LABEL_3_LOGIC; fi
if [ "$REG_POPUP_LABEL_4" != "" ]; then REG_POPUP_LABEL_4_LOGIC; fi
fi
# Loop to run policies
for POLICY in "${POLICY_ARRAY[@]}"; do
echo "Status: $(echo "$POLICY" | cut -d ',' -f1)" >> "$DEP_NOTIFY_LOG"
if [ "$TESTING_MODE" = true ]; then
sleep 10
elif [ "$TESTING_MODE" = false ]; then
"$JAMF_BINARY" policy -id "$(echo "$POLICY" | cut -d ',' -f2)"
fi
done
# Nice completion text
echo "Status: $INSTALL_COMPLETE_TEXT" >> "$DEP_NOTIFY_LOG"
# Check to see if FileVault Deferred enablement is active
FV_DEFERRED_STATUS=$($FDE_SETUP_BINARY status | grep "Deferred" | cut -d ' ' -f6)
# Logic to log user out if FileVault is detected. Otherwise, app will close.
if [ "$FV_DEFERRED_STATUS" = "active" ] && [ "$TESTING_MODE" = true ]; then
if [ "$COMPLETE_METHOD_DROPDOWN_ALERT" = true ]; then
echo "Command: Quit: This is typically where your FV_LOGOUT_TEXT would be displayed. However, TESTING_MODE is set to true and FileVault deferred status is on." >> "$DEP_NOTIFY_LOG"
else
echo "Command: MainText: TESTING_MODE is set to true and FileVault deferred status is on. Button effect is quit instead of logout. \\n \\n $FV_COMPLETE_MAIN_TEXT" >> "$DEP_NOTIFY_LOG"
echo "Command: ContinueButton: Test $FV_COMPLETE_BUTTON_TEXT" >> "$DEP_NOTIFY_LOG"
fi
elif [ "$FV_DEFERRED_STATUS" = "active" ] && [ "$TESTING_MODE" = false ]; then
if [ "$COMPLETE_METHOD_DROPDOWN_ALERT" = true ]; then
echo "Command: Logout: $FV_ALERT_TEXT" >> "$DEP_NOTIFY_LOG"
else
echo "Command: MainText: $FV_COMPLETE_MAIN_TEXT" >> "$DEP_NOTIFY_LOG"
echo "Command: ContinueButtonLogout: $FV_COMPLETE_BUTTON_TEXT" >> "$DEP_NOTIFY_LOG"
fi
else
if [ "$COMPLETE_METHOD_DROPDOWN_ALERT" = true ]; then
echo "Command: Quit: $COMPLETE_ALERT_TEXT" >> "$DEP_NOTIFY_LOG"
else
echo "Command: MainText: $COMPLETE_MAIN_TEXT" >> "$DEP_NOTIFY_LOG"
echo "Command: ContinueButton: $COMPLETE_BUTTON_TEXT" >> "$DEP_NOTIFY_LOG"
fi
fi
exit 0
"""
if let _ = (sender as? NSButton)?.title {
let saveDialog = NSSavePanel()
saveDialog.canCreateDirectories = true
saveDialog.nameFieldStringValue = scriptName
saveDialog.beginSheetModal(for: self.view.window!){ result in
if result == .OK {
scriptName = saveDialog.nameFieldStringValue
exportURL = saveDialog.url!
// print("fileName", scriptName)
do {
try currentScript.write(to: exportURL, atomically: true, encoding: .utf8)
} catch {
print("failed to write to \(scriptName).")
}
}
}
} else {
currentScript = currentScript.replacingOccurrences(of: "TESTING_MODE=false # Set variable to true or false", with: "TESTING_MODE=true # Set variable to true or false")
currentScript = currentScript.replacingOccurrences(of: "DEP_NOTIFY_APP=\"/Applications/Utilities/DEPNotify.app\"", with: "DEP_NOTIFY_APP=\"\(DEPNotifyPath!.absoluteString.pathToString)\"")
// currentScript = currentScript.replacingOccurrences(of: "DEP_NOTIFY_LOG=\"/var/tmp/depnotify.log\"", with: "DEP_NOTIFY_LOG=\"/var/tmp/depnotifyPreview.log\"")
do {
let downloadsDirectory = fileManager.urls(for: .downloadsDirectory, in: .userDomainMask)[0]
let previewPath = downloadsDirectory.appendingPathComponent("DEPNotifyPreview.sh")
try currentScript.write(to: previewPath, atomically: true, encoding: .utf8)
// clean up old files if present
do {
let directoryContent = try fileManager.contentsOfDirectory(at: URL(string: "/private/tmp")!, includingPropertiesForKeys: [], options: [.skipsSubdirectoryDescendants, .skipsHiddenFiles])
for url in directoryContent {
if url.absoluteString.contains("depnotify") {
try fileManager.removeItem(at: url)
}
}
}
catch {
Alert().display(header: "Attention", message: "Unable to remove depnotify files from /private/tmp, remove manually.")
preview_Button.isEnabled = true
return
}
do {
let homePath = NSHomeDirectory().pathToString
let directoryContent = try fileManager.contentsOfDirectory(at: URL(string: "\(homePath)/Library/Preferences/")!, includingPropertiesForKeys: [], options: [.skipsSubdirectoryDescendants, .skipsHiddenFiles])
for url in directoryContent {
if url.absoluteString.contains("menu.nomad.DEPNotify") {
try fileManager.removeItem(at: url)
}
}
}
catch {
Alert().display(header: "Attention", message: "Unable to remove menu.nomad.DEPNotify* files from ~/Library/Preferences, remove manually.")
preview_Button.isEnabled = true
return
}
_ = myExitCode(cmd: "/usr/bin/killall", args: "cfprefsd")
// run the script
if myExitCode(cmd: "/bin/bash", args: previewPath.absoluteString.pathToString) == 0 {
_ = myExitCode(cmd: DEPNotifyBinary, args: "")
} else {
// script failed to run
}
} catch {
print("failed to write to \(scriptName).")
}
preview_Button.isEnabled = true
}
} // @IBAction func generateScript_Action
@IBAction func preview_Button(_ sender: Any) {
preview_Button.isEnabled = false
if !fileManager.fileExists(atPath: "/Applications/Utilities/DEPNotify.app") {
// Locate DEPNotify
DispatchQueue.main.async {
let openPanel = NSOpenPanel()
openPanel.canChooseDirectories = false
openPanel.canChooseFiles = true
openPanel.allowedFileTypes = ["app"]
openPanel.begin { [self] (result) in
if result.rawValue == NSApplication.ModalResponse.OK.rawValue {
DEPNotifyPath = openPanel.url
DEPNotifyBinary = (DEPNotifyPath?.absoluteString.pathToString)!+"/Contents/MacOS/DEPNotify"
if !fileManager.fileExists(atPath: self.DEPNotifyBinary) {
print("This does not seem to be the DEPNotify app")
Alert().display(header: "Attention", message: "This does not appear to be the DEPNotify app.")
userDefaults.set("/Applications/Utilities/DEPNotify.app", forKey: "DEPNotifyPath")
} else {
userDefaults.set("\(String(describing: self.DEPNotifyPath))", forKey: "DEPNotifyPath")
generateScript_Action(self)
}
userDefaults.synchronize()
}
} // openPanel.begin - end
// if importFiles_button.state - end
}
} else {
print("found DEPNotify")
generateScript_Action(self)
}
}
func controlTextDidEndEditing(_ obj: Notification) {
if let textField = obj.object as? NSTextField {
switch textField.tag {
case 0:
userDefaults.set(jamfServer_TextField.stringValue, forKey: "jamfServer")
case 1:
userDefaults.set(jamfUser_TextField.stringValue, forKey: "jamfUser")
case 100:
print("edited setting")
default:
break
}
}
}
@IBAction func endValueEdit_Action(_ sender: Any) {
var rectArray = [String]()
let rav = settings_TableView.visibleRect
var recttemp = "\(rav)".dropFirst()
recttemp = "\(recttemp)".dropLast()
rectArray = "\(recttemp)".components(separatedBy: ", ")
rectArray[1] = "\(Float(rectArray[1])! + 25)"
let scrollPos = NSRectFromString("{{\(rectArray[0]), \(rectArray[1])}, {\(rectArray[2]), \(rectArray[3])}}")
let currentlySelectedRow = settings_TableView.selectedRow
if currentlySelectedRow >= 0 {
let rawKeyName = friendlyToRawName(friendlyName: settingsArray[settings_TableView.selectedRow].keyName)
// print("rawKeyNameArray: \(rawKeyNameArray)")
if rawKeyName != "" {
// print("[endValueEdit_Action] userDefaults.set(\(settingsArray[settings_TableView.selectedRow].keyValue), forKey: \(settingsArray[settings_TableView.selectedRow].keyName))")
// print("all keys: \((keys.namesDictionary as NSDictionary).allKeys(for: settingsArray[settings_TableView.selectedRow].keyName))")
// print("all keys: \(rawKeyName)")
if validInput(key: rawKeyName, value: "\(settingsArray[currentlySelectedRow].keyValue)") {
userDefaults.set("\(settingsArray[currentlySelectedRow].keyValue)", forKey: "\(rawKeyName)")
userDefaults.synchronize()
// print("[endValueEdit_Action] userDefaults.set(\(settingsArray[settings_TableView.selectedRow].keyValue), forKey: \(rawKeyName))")
if rawKeyName == "ORG_NAME" {
userDefaults.synchronize()
refreshKeysTable()
settings_TableView.selectRowIndexes(.init(integer: currentlySelectedRow), byExtendingSelection: false)
settings_TableView.scrollToVisible(scrollPos)
}
} else {
refreshKeysTable()
settings_TableView.selectRowIndexes(.init(integer: currentlySelectedRow), byExtendingSelection: false)
settings_TableView.scrollToVisible(scrollPos)
}
} else {
print("Command Failed: userDefaults.set(\(settingsArray[settings_TableView.selectedRow].keyValue), forKey: \(settingsArray[settings_TableView.selectedRow].keyName))")
}
userDefaults.synchronize()
}
}
@objc func tableViewDoubleClick(_ sender:AnyObject) {
guard settings_TableView.selectedRow >= 0 else {
return
}
settings_TableView.editColumn(1, row: settings_TableView.selectedRow, with: nil, select: true)
}
func validInput(key: String, value: String) -> Bool {
var inputIsValid = true
// print("[validInput] key: \(key) value: \(String(describing: keys.settingsDict["\(key)"]!))")
switch key {
case "TESTING_MODE","FULLSCREEN","COMPLETE_METHOD_DROPDOWN_ALERT","NO_SLEEP","SELF_SERVICE_CUSTOM_BRANDING","EULA_ENABLED","REGISTRATION_ENABLED","REG_TEXT_LABEL_1_OPTIONAL","REG_TEXT_LABEL_2_OPTIONAL":
if value.lowercased() != "true" && value.lowercased() != "false" {
Alert().display(header: "Attention:", message: "Value must be set to either true or false.")
inputIsValid = false
}
case "STATUS_TEXT_ALIGN":
if value.lowercased() != "left" && value.lowercased() != "center" && value.lowercased() != "right" {
Alert().display(header: "Attention:", message: "Value must be set to either left, center, or right.")
inputIsValid = false
}
default:
break
}
return inputIsValid
}
func friendlyToRawName(friendlyName: String) -> String {
var rawName = ""
let rawKeyNameArray = (keys.namesDictionary as NSDictionary).allKeys(for: friendlyName)
if rawKeyNameArray.count == 1 {
rawName = "\(rawKeyNameArray[0])"
}
return rawName
}
// function to return exit code of bash command - start
func myExitCode(cmd: String, args: String...) -> Int8 {
//var pipe_pkg = Pipe()
let task_pkg = Process()
task_pkg.launchPath = cmd
task_pkg.arguments = args
//task_pkg.standardOutput = pipe_pkg
//var test = task_pkg.standardOutput
task_pkg.launch()
task_pkg.waitUntilExit()
let result = task_pkg.terminationStatus
return(Int8(result))
}
// function to return exit code of bash command - end
func refreshKeysTable() {
var firstKey = true
let sortedNameArray = keys.nameArray.sorted()
// Testing Mode
keys.settingsDict["TESTING_MODE"] = userDefaults.string(forKey: "TESTING_MODE") ?? "true"
// General Appearance - start
keys.settingsDict["FULLSCREEN"] = userDefaults.string(forKey: "FULLSCREEN") ?? "false"
keys.settingsDict["BANNER_IMAGE_PATH"] = userDefaults.string(forKey: "BANNER_IMAGE_PATH") ?? "/Applications/Self Service.app/Contents/Resources/AppIcon.icns"
keys.settingsDict["ORG_NAME"] = userDefaults.string(forKey: "ORG_NAME") ?? "Organization"
keys.settingsDict["BANNER_TITLE"] = userDefaults.string(forKey: "BANNER_TITLE") ?? "Welcome to \(String(describing: keys.settingsDict["ORG_NAME"]!))"
keys.settingsDict["SUPPORT_CONTACT_DETAILS"] = userDefaults.string(forKey: "SUPPORT_CONTACT_DETAILS") ?? "email support@organization.com"
keys.settingsDict["MAIN_TEXT"] = userDefaults.string(forKey: "MAIN_TEXT") ?? "Thanks for choosing a Mac at \(String(describing: keys.settingsDict["ORG_NAME"]!))! We want you to have a few applications and settings configured before you get started with your new Mac. This process should take 10 to 20 minutes to complete. \n \n If you need additional software or help, please visit the Self Service app in your Applications folder or on your Dock."
keys.settingsDict["INITAL_START_STATUS"] = userDefaults.string(forKey: "INITAL_START_STATUS") ?? "Initial Configuration Starting..."
keys.settingsDict["INSTALL_COMPLETE_TEXT"] = userDefaults.string(forKey: "INSTALL_COMPLETE_TEXT") ?? "Configuration Complete!"
keys.settingsDict["COMPLETE_METHOD_DROPDOWN_ALERT"] = userDefaults.string(forKey: "COMPLETE_METHOD_DROPDOWN_ALERT") ?? "false"
keys.settingsDict["FV_ALERT_TEXT"] = userDefaults.string(forKey: "FV_ALERT_TEXT") ?? "Your Mac must logout to start the encryption process. You will be asked to enter your password and click OK or Continue a few times. Your Mac will be usable while encryption takes place."
keys.settingsDict["FV_COMPLETE_MAIN_TEXT"] = userDefaults.string(forKey: "COMPLETE_METHOD_DROPDOWN_ALERT") ?? "Your Mac must logout to start the encryption process. You will be asked to enter your password and click OK or Continue a few times. Your Mac will be usable while encryption takes place."
keys.settingsDict["FV_COMPLETE_BUTTON_TEXT"] = userDefaults.string(forKey: "FV_COMPLETE_BUTTON_TEXT") ?? "Logout"
keys.settingsDict["COMPLETE_ALERT_TEXT"] = userDefaults.string(forKey: "COMPLETE_ALERT_TEXT") ?? "Your Mac is now finished with initial setup and configuration. Press Quit to get started!"
keys.settingsDict["COMPLETE_MAIN_TEXT"] = userDefaults.string(forKey: "COMPLETE_MAIN_TEXT") ?? "Your Mac is now finished with initial setup and configuration."
keys.settingsDict["COMPLETE_BUTTON_TEXT"] = userDefaults.string(forKey: "COMPLETE_BUTTON_TEXT") ?? "Get Started!"
// General Appearance - end
// Plist Configuration - start
keys.settingsDict["DEP_NOTIFY_USER_INPUT_PLIST"] = userDefaults.string(forKey: "DEP_NOTIFY_USER_INPUT_PLIST") ?? "/Users/$CURRENT_USER/Library/Preferences/menu.nomad.DEPNotifyUserInput.plist"
// Plist Configuration - end
keys.settingsDict["STATUS_TEXT_ALIGN"] = userDefaults.string(forKey: "STATUS_TEXT_ALIGN") ?? "center"
keys.settingsDict["HELP_BUBBLE_TITLE"] = userDefaults.string(forKey: "HELP_BUBBLE_TITLE") ?? "Need Help?"
keys.settingsDict["HELP_BUBBLE_BODY"] = userDefaults.string(forKey: "HELP_BUBBLE_BODY") ?? "This tool at \(String(describing: keys.settingsDict["ORG_NAME"]!)) is designed to help with new employee onboarding. If you have issues, please \(String(describing: keys.settingsDict["SUPPORT_CONTACT_DETAILS"]!))"
// Error Screen Text - start
keys.settingsDict["ERROR_BANNER_TITLE"] = userDefaults.string(forKey: "ERROR_BANNER_TITLE") ?? "Uh oh, Something Needs Fixing!"
keys.settingsDict["ERROR_MAIN_TEXT"] = userDefaults.string(forKey: "ERROR_MAIN_TEXT") ?? "We are sorry that you are experiencing this inconvenience with your new Mac. However, we have the nerds to get you back up and running in no time! \n \n Please contact IT right away and we will take a look at your computer ASAP. \n \n \(String(describing: keys.settingsDict["SUPPORT_CONTACT_DETAILS"]!))"
keys.settingsDict["ERROR_STATUS"] = userDefaults.string(forKey: "ERROR_STATUS") ?? "Setup Failed"
// Error Screen Text - end
// How the policies are called, event or id -> don't see a need for this
// keys.settingsDict["TRIGGER"] = userDefaults.string(forKey: "TRIGGER") ?? "id"
// Policy Variable to Modify - defined through policies_TableView selection(s)
// Caffeinate / No Sleep Configuration
keys.settingsDict["NO_SLEEP"] = userDefaults.string(forKey: "NO_SLEEP") ?? "false"
// Self Service
keys.settingsDict["SELF_SERVICE_CUSTOM_BRANDING"] = userDefaults.string(forKey: "SELF_SERVICE_CUSTOM_BRANDING") ?? "false"
keys.settingsDict["SELF_SERVICE_APP_NAME"] = userDefaults.string(forKey: "SELF_SERVICE_APP_NAME") ?? "Self Service.app"
keys.settingsDict["SELF_SERVICE_CUSTOM_WAIT"] = userDefaults.string(forKey: "SELF_SERVICE_CUSTOM_WAIT") ?? "20"
// EULA Variables to Modify - start
keys.settingsDict["EULA_ENABLED"] = userDefaults.string(forKey: "EULA_ENABLED") ?? "false"
keys.settingsDict["EULA_STATUS"] = userDefaults.string(forKey: "EULA_STATUS") ?? "Waiting on completion of EULA acceptance"
keys.settingsDict["EULA_BUTTON"] = userDefaults.string(forKey: "EULA_BUTTON") ?? "Read and Agree to EULA"
keys.settingsDict["EULA_MAIN_TITLE"] = userDefaults.string(forKey: "EULA_MAIN_TITLE") ?? "Organization End User License Agreement"
keys.settingsDict["EULA_SUBTITLE"] = userDefaults.string(forKey: "EULA_SUBTITLE") ?? "Please agree to the following terms and conditions to start configuration of this Mac"
keys.settingsDict["EULA_FILE_PATH"] = userDefaults.string(forKey: "EULA_FILE_PATH") ?? "/Users/Shared/eula.txt"
// EULA Variables to Modify - end
// Registration Variables to Modify - start
keys.settingsDict["REGISTRATION_ENABLED"] = userDefaults.string(forKey: "REGISTRATION_ENABLED") ?? "false"
keys.settingsDict["REGISTRATION_TITLE"] = userDefaults.string(forKey: "REGISTRATION_TITLE") ?? "Register Mac at \(String(describing: keys.settingsDict["ORG_NAME"]!))"
keys.settingsDict["REGISTRATION_STATUS"] = userDefaults.string(forKey: "REGISTRATION_STATUS") ?? "Waiting on completion of computer registration"
keys.settingsDict["REGISTRATION_BUTTON"] = userDefaults.string(forKey: "REGISTRATION_BUTTON") ?? "Register Your Mac"
keys.settingsDict["REGISTRATION_BEGIN_WORD"] = userDefaults.string(forKey: "REGISTRATION_BEGIN_WORD") ?? "Setting"
keys.settingsDict["REGISTRATION_MIDDLE_WORD"] = userDefaults.string(forKey: "REGISTRATION_MIDDLE_WORD") ?? "to"
// Registration Variables to Modify - end
// First Text Field - start
keys.settingsDict["REG_TEXT_LABEL_1"] = userDefaults.string(forKey: "REG_TEXT_LABEL_1") ?? "Computer Name"
keys.settingsDict["REG_TEXT_LABEL_1_PLACEHOLDER"] = userDefaults.string(forKey: "REG_TEXT_LABEL_1_PLACEHOLDER") ?? "macBook0123"
keys.settingsDict["REG_TEXT_LABEL_1_OPTIONAL"] = userDefaults.string(forKey: "REG_TEXT_LABEL_1_OPTIONAL") ?? "false"
keys.settingsDict["REG_TEXT_LABEL_1_HELP_TITLE"] = userDefaults.string(forKey: "REG_TEXT_LABEL_1_HELP_TITLE") ?? "Computer Name Field"
keys.settingsDict["REG_TEXT_LABEL_1_HELP_TEXT"] = userDefaults.string(forKey: "REG_TEXT_LABEL_1_HELP_TEXT") ?? "This field is sets the name of your new Mac to what is in the Computer Name box. This is important for inventory purposes."
// First Text Field - end
// Second Text Field - start
keys.settingsDict["REG_TEXT_LABEL_2"] = userDefaults.string(forKey: "REG_TEXT_LABEL_2") ?? "Asset Tag"
keys.settingsDict["REG_TEXT_LABEL_2_PLACEHOLDER"] = userDefaults.string(forKey: "REG_TEXT_LABEL_2_PLACEHOLDER") ?? "BR-549"
keys.settingsDict["REG_TEXT_LABEL_2_OPTIONAL"] = userDefaults.string(forKey: "REG_TEXT_LABEL_2_OPTIONAL") ?? "true"
keys.settingsDict["REG_TEXT_LABEL_2_HELP_TITLE"] = userDefaults.string(forKey: "REG_TEXT_LABEL_2_HELP_TITLE") ?? "Asset Tag Field"
keys.settingsDict["REG_TEXT_LABEL_2_HELP_TEXT"] = userDefaults.string(forKey: "REG_TEXT_LABEL_2_HELP_TEXT") ?? "This field is used to give an updated asset tag to our asset management system. If you do not know your asset tag number, please skip this field."
// Second Text Field - end
// Popup 1 - start
keys.settingsDict["REG_POPUP_LABEL_1"] = userDefaults.string(forKey: "REG_POPUP_LABEL_1") ?? "Building"
keys.settingsDict["REG_POPUP_LABEL_1_OPTIONS"] = userDefaults.string(forKey: "REG_POPUP_LABEL_1_OPTIONS") ?? "Amsterdam, Eau Claire, Minneapolis"
keys.settingsDict["REG_POPUP_LABEL_1_HELP_TITLE"] = userDefaults.string(forKey: "REG_POPUP_LABEL_1_HELP_TITLE") ?? "Building Dropdown Field"
keys.settingsDict["REG_POPUP_LABEL_1_HELP_TEXT"] = userDefaults.string(forKey: "REG_POPUP_LABEL_1_HELP_TEXT") ?? "Please choose the appropriate building for where you normally work. This is important for inventory purposes."
// Popup 1 - end
// Popup 2 - start
keys.settingsDict["REG_POPUP_LABEL_2"] = userDefaults.string(forKey: "REG_POPUP_LABEL_2") ?? "Department"
keys.settingsDict["REG_POPUP_LABEL_2_OPTIONS"] = userDefaults.string(forKey: "REG_POPUP_LABEL_2_OPTIONS") ?? "Customer Onboarding, Professional Services, Sales Engineering"
keys.settingsDict["REG_POPUP_LABEL_2_HELP_TITLE"] = userDefaults.string(forKey: "REG_POPUP_LABEL_2_HELP_TITLE") ?? "Department Dropdown Field"
keys.settingsDict["REG_POPUP_LABEL_2_HELP_TEXT"] = userDefaults.string(forKey: "REG_POPUP_LABEL_2_HELP_TEXT") ?? "Please choose the appropriate department for where you normally work. This is important for inventory purposes."
// Popup 2 - end
// Popup 3 - start
keys.settingsDict["REG_POPUP_LABEL_3"] = userDefaults.string(forKey: "REG_POPUP_LABEL_3") ?? "Some Label"
keys.settingsDict["REG_POPUP_LABEL_3_OPTIONS"] = userDefaults.string(forKey: "REG_POPUP_LABEL_3_OPTIONS") ?? "Option 1, Option 2, Option 3"
keys.settingsDict["REG_POPUP_LABEL_3_HELP_TITLE"] = userDefaults.string(forKey: "REG_POPUP_LABEL_3_HELP_TITLE") ?? "Dropdown 3 Field"
keys.settingsDict["REG_POPUP_LABEL_3_HELP_TEXT"] = userDefaults.string(forKey: "REG_POPUP_LABEL_3_HELP_TEXT") ?? "This dropdown is currently not in use. All code is here ready for you to use. It can also be hidden by removing the contents of the REG_POPUP_LABEL_3 variable."
// Popup 3 - end
// Popup 4 - start
keys.settingsDict["REG_POPUP_LABEL_4"] = userDefaults.string(forKey: "REG_POPUP_LABEL_4") ?? "Some Label"
keys.settingsDict["REG_POPUP_LABEL_4_OPTIONS"] = userDefaults.string(forKey: "REG_POPUP_LABEL_4_OPTIONS") ?? "Option 1, Option 2, Option 3"
keys.settingsDict["REG_POPUP_LABEL_4_HELP_TITLE"] = userDefaults.string(forKey: "REG_POPUP_LABEL_4_HELP_TITLE") ?? "Dropdown 4 Field"
keys.settingsDict["REG_POPUP_LABEL_4_HELP_TEXT"] = userDefaults.string(forKey: "REG_POPUP_LABEL_4_HELP_TEXT") ?? "This dropdown is currently not in use. All code is here ready for you to use. It can also be hidden by removing the contents of the REG_POPUP_LABEL_4 variable."
// Popup 4 - end
for keyName in sortedNameArray {
if let _ = keys.settingsDict[keyName] {
let value = keys.settingsDict[keyName]
if !firstKey {
settingsArray.append(Setting(keyName: keys.namesDictionary[keyName]!, keyValue: value!))
} else {
// settingsArray = [Setting(keyName: keyName, keyValue: value!)]
settingsArray = [Setting(keyName: keys.namesDictionary[keyName]!, keyValue: value!)]
firstKey = false
}
}
}
}
func savePasswordSetting() {
switch savePassword_Button.state.rawValue {
case 1:
userDefaults.set(1, forKey: "savePassword")
default:
// don't save/remove password
userDefaults.set(0, forKey: "savePassword")
let regexKey = try! NSRegularExpression(pattern: "http(.*?)://", options:.caseInsensitive)
let credKey = regexKey.stringByReplacingMatches(in: self.jamfServer_TextField.stringValue, options: [], range: NSRange(0..<self.jamfServer_TextField.stringValue.utf16.count), withTemplate: "")
let result = Credentials2().remove(service: "DEPNotifyHelper - "+credKey)
print("result of password removal: \(result)")
}
userDefaults.synchronize()
}
override func viewDidLoad() {
super.viewDidLoad()
// watch for changes between light and dark mode
DistributedNotificationCenter.default.addObserver(self, selector: #selector(interfaceModeChanged(sender:)), name: NSNotification.Name(rawValue: "AppleInterfaceThemeChangedNotification"), object: nil)
jamfServer_TextField.stringValue = userDefaults.string(forKey: "jamfServer") ?? "https://<server>.jamfcloud.com"
jamfUser_TextField.stringValue = userDefaults.string(forKey: "jamfUser") ?? ""
if (jamfServer_TextField.stringValue != "") && (jamfUser_TextField.stringValue != "") {
let regexKey = try! NSRegularExpression(pattern: "http(.*?)://", options:.caseInsensitive)
let credKey = regexKey.stringByReplacingMatches(in: jamfServer_TextField.stringValue, options: [], range: NSRange(0..<jamfServer_TextField.stringValue.utf16.count), withTemplate: "")
let credentailArray = Credentials2().retrieve(service: "DEPNotifyHelper - "+credKey)
if credentailArray.count == 2 {
jamfUserPwd_TextField.stringValue = credentailArray[1]
}
}
let savePasswordSetting = userDefaults.integer(forKey: "savePassword")
savePassword_Button.state = NSControl.StateValue(rawValue: savePasswordSetting)
// configure TextField so that we can monitor when editing is done
self.jamfServer_TextField.delegate = self
self.jamfUser_TextField.delegate = self
// Do any additional setup after loading the view.
settings_TableView.target = self
settings_TableView.doubleAction = #selector(tableViewDoubleClick(_:))
policies_TableView.delegate = self
policies_TableView.dataSource = self
refreshKeysTable()
// bring app to foreground
NSApplication.shared.activate(ignoringOtherApps: true)
}
override func viewDidAppear() {
DispatchQueue.main.async {
if self.isDarkMode {
print("darkmode")
self.view.layer?.backgroundColor = CGColor(red: 0x24/255.0, green: 0x24/255.0, blue: 0x24/255.0, alpha: 1.0)
} else {
print("lightmode")
self.view.layer?.backgroundColor = CGColor(red: 0xE9/255.0, green: 0xE9/255.0, blue: 0xE9/255.0, alpha: 1.0)
}
}
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}
extension ViewController: NSTableViewDataSource {
func numberOfRows(in theTable: NSTableView) -> Int {
let rowCount = policiesTableArray?.count ?? 0
return rowCount
}
}
extension ViewController: NSTableViewDelegate {
fileprivate enum CellIdentifiers {
static let SettingNameCell = "SettingNameCellId"
static let SettingValueCell = "SettingValueCellId"
static let PolicyNameCell = "PolicyNameCellId"
}
func tableView(_ object_TableView: NSTableView, shouldEdit tableColumn: NSTableColumn?, row: Int) -> Bool {
return true
}
func tableView(_ object_TableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
// print("tableView: \(object_TableView)")
// print("entered [NSTableViewDelegate] tableView")
// print("NSTableColumn: \(NSTableColumn.attributeKeys())")
// print("row: \(row)")
var text: String = ""
var cellIdentifier: String = ""
guard let item = policiesTableArray?[row] else {
return nil
}
// print("\n[NSTableViewDelegate] tableView tableView.tableColumns: \(object_TableView.tableColumns)")
// print("key: \(key) - value: \(value)")
if tableColumn == object_TableView.tableColumns[0] {
text = "\(item)"
cellIdentifier = CellIdentifiers.PolicyNameCell
}
if let cell = object_TableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier), owner: nil) as? NSTableCellView {
cell.textField?.stringValue = text
return cell
}
return nil
}
// Help Window
@IBAction func showHelpWindow(_ sender: AnyObject) {
let storyboard = NSStoryboard(name: "Main", bundle: nil)
let helpWindowController = storyboard.instantiateController(withIdentifier: "Help View Controller") as! NSWindowController
// if !windowIsVisible(windowName: "Help") {
helpWindowController.window?.hidesOnDeactivate = false
helpWindowController.showWindow(self)
// }
// if let helpWindow = helpWindowController.window {
//// let helpViewController = helpWindow.contentViewController as! HelpViewController
//
// let application = NSApplication.shared
// application.runModal(for: helpWindow)
//
// helpWindow.close()
// }
}
}
extension String {
var fqdnFromUrl: String {
get {
var fqdn = ""
let nameArray = self.components(separatedBy: "://")
if nameArray.count > 1 {
fqdn = nameArray[1]
} else {
fqdn = self
}
if fqdn.contains(":") {
let fqdnArray = fqdn.components(separatedBy: ":")
fqdn = fqdnArray[0]
}
return fqdn
}
}
var pathToString: String {
get {
var newPath = ""
newPath = self.replacingOccurrences(of: "file://", with: "")
newPath = newPath.replacingOccurrences(of: "%20", with: " ")
return newPath
}
}
}
| 57.294118
| 456
| 0.605704
|
315fd93329d1f2988352935877d65c5b2359b101
| 5,335
|
asm
|
Assembly
|
basic/src/commands/graphics.asm
|
paulscottrobson/eris
|
cf102530334ed86360deb20f0e41af1e10f5d584
|
[
"MIT"
] | 13
|
2020-03-31T08:21:22.000Z
|
2021-07-28T20:03:29.000Z
|
basic/src/commands/graphics.asm
|
paulscottrobson/eris
|
cf102530334ed86360deb20f0e41af1e10f5d584
|
[
"MIT"
] | 37
|
2020-03-31T06:35:37.000Z
|
2020-09-17T08:56:48.000Z
|
basic/src/commands/graphics.asm
|
paulscottrobson/eris
|
cf102530334ed86360deb20f0e41af1e10f5d584
|
[
"MIT"
] | 5
|
2020-05-10T10:23:06.000Z
|
2022-01-14T02:21:02.000Z
|
; *****************************************************************************
; *****************************************************************************
;
; Name: graphics.asm
; Purpose: Simple Graphics keywords
; Created: 18th March 2020
; Reviewed: TODO
; Author: Paul Robson (paul@robsons.org.uk)
;
; *****************************************************************************
; *****************************************************************************
; *****************************************************************************
;
; CLS INK and PAPER
;
; *****************************************************************************
.Command_Cls ;; [cls]
push link
mov r0,#$FF00 ; erase the whole graphics memory
jsr #OSIFillScreen
mov r0,#12 ; text cls
jsr #OSPrintCharacter
jsr #OSSpriteReset ; reset sprites
pop link
ret
.Command_Ink ;; [ink]
push link
jsr #EvaluateInteger ; get colour, must be 0-15
mov r1,r0,#0
and r1,#$FFF0
skz r1
jmp #BadNumberError
add r0,#$10 ; make control
jsr #OSPrintCharacter
pop link
ret
.Command_Paper ;; [paper]
push link
mov r0,#15 ; swap fgr/bgr
jsr #OSPrintCharacter
jsr #Command_Ink ; set the ink colour
mov r0,#15 ; swap fgr/bgr
jsr #OSPrintCharacter
pop link
ret
; *****************************************************************************
;
; SCREEN Mode setting
;
; *****************************************************************************
.Command_Screen ;; [screen]
push link
jsr #EvaluateInteger ; background planes
mov r1,r0,#0
and r0,#$FFF8
skz r0
jmp #BadNumberError
;
jsr #CheckComma
;
jsr #EvaluateInteger ; sprite planes
mov r2,r0,#0
and r0,#$FFF8
skz r0
jmp #BadNumberError
;
ror r2,#8 ; sprite plane count in upper byte
mov r0,r1,#0
add r0,r2,#0 ; background in lower byte
jsr #OSSetPlanes ; set plane sizes
pop link
ret
; *****************************************************************************
;
; BLIT command
;
; *****************************************************************************
.Command_Blit ;; [blit]
push link
jsr #OSWaitBlitter ; check it's not busy.
jsr #EvaluateInteger ; x
stm r0,#blitterX
jsr #CheckComma
jsr #EvaluateInteger ; y
stm r0,#blitterY
jsr #CheckComma
jsr #EvaluateInteger ; data or index
jsr #BlitIndexAddressProcess
stm r0,#blitterData
jsr #CheckComma
jsr #EvaluateInteger
stm r0,#blitterCMask
jsr #CheckComma
jsr #EvaluateInteger ; cmd
stm r0,#blitterCmd
pop link
ret
; *****************************************************************************
;
; Convert index or address R0 to image address in R0
;
; *****************************************************************************
.BlitIndexAddressProcess
push r1,r2
mov r1,r0,#0
and r1,#$FF00 ; is it 0-255 if so use sprite image.
skz r1
jmp #_BIAData
mov r1,r0,#0 ; check legitimate value.
ldm r2,#spriteImageCount
sub r1,r2,#0
sklt
jmp #BadNumberError
ror r0,#12 ; multiply by 16
ldm r1,#spriteImageMemory ; and sprite image memory address
add r0,r1,#0
._BIAData
pop r1,r2
ret
; *****************************************************************************
;
; Palette <colour>,<plane>,<rgb>
;
; *****************************************************************************
.Command_Palette ;; [palette]
push link
jsr #EvaluateInteger ; colour -> R2
mov r2,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; target -> R3
mov r3,r0,#0
and r0,#$FFFE ; check target is 0 or 1
skz r0
jmp #BadNumberError
jsr #CheckComma
jsr #EvaluateInteger ; palette -> R1
mov r1,r0,#0
and r1,#7
;
mov r0,r2,#0 ; colour in R2, RGB value in R3
sknz r3 ; if target = 0 do back plane
jsr #OSXSetBackPlanePalette
skz r3 ; if target = 1 do front plane
jsr #OSXSetFrontPlanePalette
pop link
ret
; *****************************************************************************
;
; Set drawing plane
;
; *****************************************************************************
.Command_Draw ;; [draw]
push link
ldm r0,r11,#0 ; check ON
xor r0,#TOK_ON
sknz r0
jmp #_CDrawOn
;
jsr #OSSetInkColourMask ; set ink & colour
jsr #GetCoordinatePair ; draw target in R0,R1
stm r0,#blitterX
stm r1,#blitterY
jsr #CheckComma ; comma
jsr #EvaluateInteger ; data
jsr #BlitIndexAddressProcess ; make address
stm r0,#blitterData
clr r2
ldm r0,r11,#0 ; check for DIMx
xor r0,#TOK_DIM
skz r0
jmp #_CDrawNoDim
inc r11
jsr #EvaluateInteger ; get DIM
dec r0 ; make 0 or 1
mov r2,r0,#0 ; put in R2
and r2,#1 ; mask out bit 0
ror r2,#4 ; shift to bit 12
and r0,#$FFFE ; validate 0 or 1
skz r0
jmp #BadNumberError
._CDrawNoDim
add r2,#16 ; write a row out.
stm r2,#blitterCmd
pop link
ret
._CDrawOn
inc r11
jsr #EvaluateInteger
jsr #OSSetActivePlane
and r0,#$FFFE
skz r0
jmp #BadNumberError
pop link
ret
| 25.046948
| 79
| 0.464855
|
20dcd2810b2b5e99322acbb5905844e020c55fec
| 865
|
py
|
Python
|
final_project/machinetranslation/tests/tests.py
|
bluesydan/xzceb-flask_eng_fr
|
e026b3b13402de94d7e75958f359e9c0cf4017aa
|
[
"Apache-2.0"
] | null | null | null |
final_project/machinetranslation/tests/tests.py
|
bluesydan/xzceb-flask_eng_fr
|
e026b3b13402de94d7e75958f359e9c0cf4017aa
|
[
"Apache-2.0"
] | null | null | null |
final_project/machinetranslation/tests/tests.py
|
bluesydan/xzceb-flask_eng_fr
|
e026b3b13402de94d7e75958f359e9c0cf4017aa
|
[
"Apache-2.0"
] | null | null | null |
import unittest
from translator import english_to_french, french_to_english
class TestenglishToFrench(unittest.TestCase):
def test1(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertEqual(english_to_french("Farewell"), "Adieu")
self.assertEqual(english_to_french("What time is it?"), "Quelle heure est-il?")
def test1none(self):
self.assertRaises(ValueError, english_to_french, None)
class TestfrenchToEnglish(unittest.TestCase):
def test2(self):
self.assertEqual(french_to_english("Bonjour"), "Hello")
self.assertEqual(french_to_english("Adieu"), "Goodbye")
self.assertEqual(french_to_english("Il est tard."), "It's late.")
def test2none(self):
self.assertRaises(ValueError, french_to_english, None)
if __name__ == "__main__":
unittest.main()
| 30.892857
| 87
| 0.708671
|
753ba6a65c8b2b3189c675f633073fa38f74f674
| 118
|
css
|
CSS
|
style.css
|
hebah-aldawalib/bus-mall
|
80f7a842460ccf09abc1484a61b5d27997cac093
|
[
"MIT"
] | null | null | null |
style.css
|
hebah-aldawalib/bus-mall
|
80f7a842460ccf09abc1484a61b5d27997cac093
|
[
"MIT"
] | null | null | null |
style.css
|
hebah-aldawalib/bus-mall
|
80f7a842460ccf09abc1484a61b5d27997cac093
|
[
"MIT"
] | null | null | null |
img{
width: 400px;
height: 400px;
}
img{
margin-left: 20px;
}
div{
padding-left: 150px;
}
| 9.833333
| 23
| 0.508475
|
c9646bb16ba2d15d6e2503c869a3afb386e9dd18
| 3,509
|
dart
|
Dart
|
lib/ui/views/home/home_view.dart
|
SleeplessCreative/fleoscan
|
cffc4fc7328430bf726fea8635cb7dbd9ce19ea5
|
[
"MIT"
] | null | null | null |
lib/ui/views/home/home_view.dart
|
SleeplessCreative/fleoscan
|
cffc4fc7328430bf726fea8635cb7dbd9ce19ea5
|
[
"MIT"
] | null | null | null |
lib/ui/views/home/home_view.dart
|
SleeplessCreative/fleoscan
|
cffc4fc7328430bf726fea8635cb7dbd9ce19ea5
|
[
"MIT"
] | null | null | null |
import 'package:fleoscan/items/fleocolor.dart';
import 'package:fleoscan/ui/widgets/appbar/appbar_view.dart';
import 'package:fleoscan/ui/widgets/end_drawer/end_drawer_view.dart';
import 'package:fleoscan/ui/widgets/navigation_bar/navigation_bar_view.dart';
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'home_viewmodel.dart';
class HomeView extends StatelessWidget {
const HomeView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ViewModelBuilder<HomeViewModel>.nonReactive(
onModelReady: (model) => model.initialise(),
builder: (context, model, child) {
return Scaffold(
extendBody: true,
appBar: AppbarView(
height: 100,
burgerButton: true,
),
bottomNavigationBar: NavigationBarView(
height: 110,
),
endDrawer: EndDrawerView(),
body: Container(
width: double.infinity,
decoration: new BoxDecoration(
color: FleoColor.c100(),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
boxShadow: [defaultShadow],
),
child: Column(
children: <Widget>[
Expanded(
flex: 10,
child: Container(
child: model.logoFleoscan,
),
),
Expanded(
flex: 6,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
boxShadow: [defaultShadow],
),
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.only(
top: 0,
left: 30,
right: 30,
bottom: 60,
),
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: model.hint[0],
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 16,
color: FleoColor.c400(),
),
children: <TextSpan>[
TextSpan(
text: model.hint[1],
style: TextStyle(
color: FleoColor.c100(),
),
),
TextSpan(
text: model.hint[2],
),
],
),
),
),
),
),
],
),
),
);
},
viewModelBuilder: () => HomeViewModel());
}
}
| 36.175258
| 77
| 0.394699
|
79b2143dcea754c8f6386beed76aee2482487e6d
| 9,583
|
php
|
PHP
|
resources/views/admin/add_manufacture.blade.php
|
Muhdmarwan07/Paddy88
|
76eb0a42c37a3dc140b90cd92c1e5a71277ef7b9
|
[
"MIT"
] | null | null | null |
resources/views/admin/add_manufacture.blade.php
|
Muhdmarwan07/Paddy88
|
76eb0a42c37a3dc140b90cd92c1e5a71277ef7b9
|
[
"MIT"
] | null | null | null |
resources/views/admin/add_manufacture.blade.php
|
Muhdmarwan07/Paddy88
|
76eb0a42c37a3dc140b90cd92c1e5a71277ef7b9
|
[
"MIT"
] | 3
|
2019-09-16T17:13:37.000Z
|
2020-10-07T06:32:09.000Z
|
@extends('admin_layout')
@section('admin_content')
<div class="breadcome-area">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="breadcome-list">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="breadcomb-wp">
<div class="breadcomb-icon">
<i class="icon nalika-home"></i>
</div>
<div class="breadcomb-ctn">
<h2>Add Manufacture</h2>
<p>Welcome to The Paddy88 <span class="bread-ntd"></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="single-pro-review-area">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="review-tab-pro-inner">
<ul id="myTab3" class="tab-review-design">
<li class="active"><a href="#description"><i class="icon nalika-edit" aria-hidden="true"></i> Add Manufacture</a></li>
</ul>
<div id="myTabContent" class="tab-content custom-product-edit" >
<p class="alert-success">
<?php
$message=Session::get('message');
if ($message)
{
echo $message;
Session::put('message',NULL);
}
?>
</p>
<div class="product-tab-list tab-pane fade active in" id="description">
<form action="{{ url('/save-manufacture') }}" method="post">
{{csrf_field()}}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="review-content-section">
<div class="input-group mg-b-pro-edt">
<span class="input-group-addon"><i class="icon nalika-user" aria-hidden="true"></i></span>
<input type="text" class="form-control"name="manufacture_name" placeholder="Manufacture Name" required="">
</div>
<div class="input-group mg-b-pro-edt">
<span class="input-group-addon"><i class="icon nalika-edit" aria-hidden="true"></i></span>
<input type="textarea" class="form-control" name="manufacture_description" placeholder="Manufacture Description" required="">
</div>
<div class>
<input type="checkbox" name="publication_status" value="1" required=""><font color="white">Publication Status</font>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="text-center custom-pro-edt-ds">
<button type="submit" class="btn btn-ctl-bt waves-effect waves-light m-r-10">Save
</button>
<!-- <button type="" class="btn btn-ctl-bt waves-effect waves-light">Discard
</button> -->
</div>
</div>
</div>
</div>
</form>
<div class="product-tab-list tab-pane fade" id="INFORMATION">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="review-content-section">
<div class="card-block">
<div class="text-muted f-w-400">
<p>No reviews yet.</p>
</div>
<div class="m-t-10">
<div class="txt-primary f-18 f-w-600">
<p>Your Rating</p>
</div>
<div class="stars stars-example-css detail-stars">
<div class="review-rating">
<fieldset class="rating">
<input type="radio" id="star5" name="rating" value="5">
<label class="full" for="star5"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half">
<label class="half" for="star4half"></label>
<input type="radio" id="star4" name="rating" value="4">
<label class="full" for="star4"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half">
<label class="half" for="star3half"></label>
<input type="radio" id="star3" name="rating" value="3">
<label class="full" for="star3"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half">
<label class="half" for="star2half"></label>
<input type="radio" id="star2" name="rating" value="2">
<label class="full" for="star2"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half">
<label class="half" for="star1half"></label>
<input type="radio" id="star1" name="rating" value="1">
<label class="full" for="star1"></label>
<input type="radio" id="starhalf" name="rating" value="half">
<label class="half" for="starhalf"></label>
</fieldset>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
| 70.985185
| 181
| 0.282584
|
1b141ba413795c50c7a473fcad06b71252adf6f3
| 503
|
rb
|
Ruby
|
spec/features/indexes/new_spec.rb
|
l1n/glowfic
|
26e5460d8c5cc97d82b796608fe436eadea8e2e5
|
[
"MIT"
] | 14
|
2017-02-05T22:43:40.000Z
|
2021-11-17T21:30:39.000Z
|
spec/features/indexes/new_spec.rb
|
l1n/glowfic
|
26e5460d8c5cc97d82b796608fe436eadea8e2e5
|
[
"MIT"
] | 799
|
2017-02-04T20:50:07.000Z
|
2022-03-28T05:45:23.000Z
|
spec/features/indexes/new_spec.rb
|
l1n/glowfic
|
26e5460d8c5cc97d82b796608fe436eadea8e2e5
|
[
"MIT"
] | 6
|
2017-02-14T04:45:24.000Z
|
2020-11-07T01:25:21.000Z
|
RSpec.feature "Creating a new index", :type => :feature do
scenario "Create a simple index" do
login
visit new_index_path
expect(page).to have_no_selector('.flash.error')
within('.form-table') do
fill_in 'Index Name', with: 'Example index'
click_button 'Save'
end
expect(page).to have_no_selector('.flash.error')
expect(page).to have_selector('.flash.success')
within('.flash.success') do
expect(page).to have_text('Index created!')
end
end
end
| 29.588235
| 58
| 0.66998
|
73a0adfec73eb53a7401890c1cfaf496c916f538
| 11,353
|
sql
|
SQL
|
recusos/contablesdb.sql
|
ar17092/ContablesWebApp
|
28194669fbb40b775336dfce7ce253e4a0836913
|
[
"Apache-2.0"
] | null | null | null |
recusos/contablesdb.sql
|
ar17092/ContablesWebApp
|
28194669fbb40b775336dfce7ce253e4a0836913
|
[
"Apache-2.0"
] | null | null | null |
recusos/contablesdb.sql
|
ar17092/ContablesWebApp
|
28194669fbb40b775336dfce7ce253e4a0836913
|
[
"Apache-2.0"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 09-01-2021 a las 00:30:27
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.2.34
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `contablesdb`
--
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `cuenta`
--
CREATE TABLE `cuenta` (
`id_cuenta` int(11) NOT NULL,
`nombre` varchar(100) NOT NULL,
`descripcion` varchar(200) DEFAULT NULL,
`id_tipocuenta` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `cuenta`
--
INSERT INTO `cuenta` (`id_cuenta`, `nombre`, `descripcion`, `id_tipocuenta`) VALUES
(1, 'Efectivos y equivalentes', 'Efectivos', 1),
(4, 'IVA debito fiscal', 'impuesta iva', 8),
(7, 'Cuenta nueva', 'Nueva', 10);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empresa`
--
CREATE TABLE `empresa` (
`id_empresa` int(11) NOT NULL,
`nombre` varchar(100) NOT NULL,
`id_rubro` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `empresa`
--
INSERT INTO `empresa` (`id_empresa`, `nombre`, `id_rubro`) VALUES
(1, 'ABC', 1),
(5, 'Empresa Klaus', 10),
(6, 'OVNICO S.A DE C.V', 11),
(7, 'Mike company', 12),
(8, 'Diego company', 13);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `libro__diario`
--
CREATE TABLE `libro__diario` (
`id_libro_diario` int(11) NOT NULL,
`nombre` varchar(200) NOT NULL,
`descripcion` varchar(200) DEFAULT NULL,
`id_user` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `libro__diario`
--
INSERT INTO `libro__diario` (`id_libro_diario`, `nombre`, `descripcion`, `id_user`) VALUES
(1, 'Primer libro diario', 'Soy aragon598 este es mi primer ldiario', 2),
(2, 'LDiario de diego', 'Este es de la empresa de Diego', 3),
(8, 'Daisy Ldiario', 'Mi primer libro diario', 6);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partida`
--
CREATE TABLE `partida` (
`id_partida` int(11) NOT NULL,
`nombre` varchar(200) NOT NULL,
`valor_debe` float DEFAULT NULL,
`valor_haber` float DEFAULT NULL,
`id_ldiario` int(11) DEFAULT NULL,
`fecha` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `partida`
--
INSERT INTO `partida` (`id_partida`, `nombre`, `valor_debe`, `valor_haber`, `id_ldiario`, `fecha`) VALUES
(1, 'aragon-partida-1', 65.61, 55.21, 1, '2019-11-04'),
(2, 'diego-partida-1', 0, 0, 2, '2018-01-04'),
(3, 'aragon-partida-2', 146, 146, 1, '2019-11-11'),
(4, 'daysi-primera-partida', 12, 12, 8, '2018-11-13'),
(5, 'tercera-partida', 0, 0, 1, '2018-11-20');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `partida_concepto`
--
CREATE TABLE `partida_concepto` (
`id_pconcepto` int(11) NOT NULL,
`valor_parcial` float DEFAULT NULL,
`id_cuenta` int(11) DEFAULT NULL,
`id_partida` int(11) DEFAULT NULL,
`cargo_abono` tinyint(1) DEFAULT NULL
) ;
--
-- Volcado de datos para la tabla `partida_concepto`
--
INSERT INTO `partida_concepto` (`id_pconcepto`, `valor_parcial`, `id_cuenta`, `id_partida`, `cargo_abono`) VALUES
(2, 10.4, 1, 1, 1),
(3, 50.21, 4, 1, 1),
(6, 5, 7, 1, 1),
(8, 105, 1, 3, 1),
(9, 64, 4, 3, 0),
(10, 41, 7, 3, 1),
(11, 65.61, 7, 1, 0),
(13, 12, 1, 4, 1),
(14, 12, 4, 4, 0),
(15, 82, 7, 3, 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rubro`
--
CREATE TABLE `rubro` (
`id_rubro` int(11) NOT NULL,
`rubro` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `rubro`
--
INSERT INTO `rubro` (`id_rubro`, `rubro`) VALUES
(1, 'Construccion'),
(2, 'comercio'),
(5, 'Ventas'),
(8, 'Cualquiera'),
(9, 'Rubro diego'),
(10, 'Klaus rubro'),
(11, 'Comunicaciones'),
(12, 'mike rubro'),
(13, 'Diego rubro');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `subcuenta`
--
CREATE TABLE `subcuenta` (
`id_subcuenta` int(11) NOT NULL,
`nombre` varchar(100) NOT NULL,
`descripcion` varchar(200) DEFAULT NULL,
`id_cuenta` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `subcuenta`
--
INSERT INTO `subcuenta` (`id_subcuenta`, `nombre`, `descripcion`, `id_cuenta`) VALUES
(1, 'Caja general', 'xd', 1),
(4, 'IVA debito fiscal local', 'impuesto iva local', 4),
(5, 'IVA debito fiscal externo', 'Pasivo', 4);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipo_cuenta`
--
CREATE TABLE `tipo_cuenta` (
`id_tipo_cuenta` int(11) NOT NULL,
`nombre` varchar(25) NOT NULL,
`saldo` tinyint(1) DEFAULT NULL,
`descripcion` varchar(200) DEFAULT NULL
) ;
--
-- Volcado de datos para la tabla `tipo_cuenta`
--
INSERT INTO `tipo_cuenta` (`id_tipo_cuenta`, `nombre`, `saldo`, `descripcion`) VALUES
(1, 'Activo', 1, 'De tipo acreedor'),
(7, 'Patrimonio', 1, NULL),
(8, 'Pasivo', 0, NULL),
(10, 'Cuenta deudoras', 0, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`nombre` varchar(100) NOT NULL,
`username` varchar(25) NOT NULL,
`password` varchar(128) NOT NULL,
`empresa_id` int(11) DEFAULT NULL,
`is_admin` tinyint(1) DEFAULT NULL
) ;
--
-- Volcado de datos para la tabla `user`
--
INSERT INTO `user` (`id`, `nombre`, `username`, `password`, `empresa_id`, `is_admin`) VALUES
(1, 'ADMIN', 'admin', 'pbkdf2:sha256:150000$5oClIM0i$c155be080802a2299bf20f891ea9e542c8fb11ea4a5927d390c36d2d91252a60', NULL, 1),
(2, 'Alejandro Aragon', 'aragon598', 'pbkdf2:sha256:150000$5oClIM0i$c155be080802a2299bf20f891ea9e542c8fb11ea4a5927d390c36d2d91252a60', 1, 0),
(3, 'Diego Rugamas', 'rugamas08', 'pbkdf2:sha256:150000$beAlUki6$0ebf2d83ec98b673ffa5311135ea8a87cdf710cb6ba107eaba9cdde0efdab299', 8, 0),
(5, 'Klaus Montano', 'montano', 'pbkdf2:sha256:150000$7TTu3ezr$596b30ee0894aaa4aa9fd786581fc3ce944725fa6ca5717c2fc6270dbd6dfe40', 5, 0),
(6, 'Daysi Rugamas', 'daysi65', 'pbkdf2:sha256:150000$8FU5AJtF$6153b6bc738cb2432d5fb5d50b3ab9fdeb03038375c16957ee776439ad8eebfb', 6, 0),
(7, 'Mike Aragón', 'mike64', 'pbkdf2:sha256:150000$d3paWwIK$c2a33c9213ce59854a28b081026a9f707dd344aec46deede4f27570a62504eac', 7, 0);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `cuenta`
--
ALTER TABLE `cuenta`
ADD PRIMARY KEY (`id_cuenta`),
ADD UNIQUE KEY `nombre` (`nombre`),
ADD KEY `id_tipocuenta` (`id_tipocuenta`);
--
-- Indices de la tabla `empresa`
--
ALTER TABLE `empresa`
ADD PRIMARY KEY (`id_empresa`),
ADD KEY `id_rubro` (`id_rubro`);
--
-- Indices de la tabla `libro__diario`
--
ALTER TABLE `libro__diario`
ADD PRIMARY KEY (`id_libro_diario`),
ADD UNIQUE KEY `nombre` (`nombre`),
ADD KEY `id_user` (`id_user`);
--
-- Indices de la tabla `partida`
--
ALTER TABLE `partida`
ADD PRIMARY KEY (`id_partida`),
ADD KEY `id_ldiario` (`id_ldiario`);
--
-- Indices de la tabla `partida_concepto`
--
ALTER TABLE `partida_concepto`
ADD PRIMARY KEY (`id_pconcepto`),
ADD KEY `id_cuenta` (`id_cuenta`),
ADD KEY `id_partida` (`id_partida`);
--
-- Indices de la tabla `rubro`
--
ALTER TABLE `rubro`
ADD PRIMARY KEY (`id_rubro`);
--
-- Indices de la tabla `subcuenta`
--
ALTER TABLE `subcuenta`
ADD PRIMARY KEY (`id_subcuenta`),
ADD UNIQUE KEY `nombre` (`nombre`),
ADD KEY `id_cuenta` (`id_cuenta`);
--
-- Indices de la tabla `tipo_cuenta`
--
ALTER TABLE `tipo_cuenta`
ADD PRIMARY KEY (`id_tipo_cuenta`),
ADD UNIQUE KEY `nombre` (`nombre`);
--
-- Indices de la tabla `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD KEY `empresa_id` (`empresa_id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `cuenta`
--
ALTER TABLE `cuenta`
MODIFY `id_cuenta` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de la tabla `empresa`
--
ALTER TABLE `empresa`
MODIFY `id_empresa` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `libro__diario`
--
ALTER TABLE `libro__diario`
MODIFY `id_libro_diario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `partida`
--
ALTER TABLE `partida`
MODIFY `id_partida` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `partida_concepto`
--
ALTER TABLE `partida_concepto`
MODIFY `id_pconcepto` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `rubro`
--
ALTER TABLE `rubro`
MODIFY `id_rubro` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT de la tabla `subcuenta`
--
ALTER TABLE `subcuenta`
MODIFY `id_subcuenta` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `tipo_cuenta`
--
ALTER TABLE `tipo_cuenta`
MODIFY `id_tipo_cuenta` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `cuenta`
--
ALTER TABLE `cuenta`
ADD CONSTRAINT `cuenta_ibfk_1` FOREIGN KEY (`id_tipocuenta`) REFERENCES `tipo_cuenta` (`id_tipo_cuenta`) ON DELETE SET NULL;
--
-- Filtros para la tabla `empresa`
--
ALTER TABLE `empresa`
ADD CONSTRAINT `empresa_ibfk_1` FOREIGN KEY (`id_rubro`) REFERENCES `rubro` (`id_rubro`) ON DELETE SET NULL;
--
-- Filtros para la tabla `libro__diario`
--
ALTER TABLE `libro__diario`
ADD CONSTRAINT `libro__diario_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`) ON DELETE SET NULL;
--
-- Filtros para la tabla `partida`
--
ALTER TABLE `partida`
ADD CONSTRAINT `partida_ibfk_1` FOREIGN KEY (`id_ldiario`) REFERENCES `libro__diario` (`id_libro_diario`) ON DELETE CASCADE;
--
-- Filtros para la tabla `partida_concepto`
--
ALTER TABLE `partida_concepto`
ADD CONSTRAINT `partida_concepto_ibfk_1` FOREIGN KEY (`id_cuenta`) REFERENCES `cuenta` (`id_cuenta`) ON DELETE SET NULL,
ADD CONSTRAINT `partida_concepto_ibfk_2` FOREIGN KEY (`id_partida`) REFERENCES `partida` (`id_partida`) ON DELETE SET NULL;
--
-- Filtros para la tabla `subcuenta`
--
ALTER TABLE `subcuenta`
ADD CONSTRAINT `subcuenta_ibfk_1` FOREIGN KEY (`id_cuenta`) REFERENCES `cuenta` (`id_cuenta`) ON DELETE SET NULL;
--
-- Filtros para la tabla `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id_empresa`) ON DELETE SET NULL;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 26.463869
| 141
| 0.659385
|
db82c7af8c805add1d7737fafd12749bb297d5cd
| 1,802
|
php
|
PHP
|
metadata/Google/Ads/GoogleAds/V0/Enums/DisplayAdFormatSetting.php
|
charlesastwood/google-ads-php
|
c0a76d4b3ae074cef9c72f687b5e37222f7571ce
|
[
"Apache-2.0"
] | null | null | null |
metadata/Google/Ads/GoogleAds/V0/Enums/DisplayAdFormatSetting.php
|
charlesastwood/google-ads-php
|
c0a76d4b3ae074cef9c72f687b5e37222f7571ce
|
[
"Apache-2.0"
] | null | null | null |
metadata/Google/Ads/GoogleAds/V0/Enums/DisplayAdFormatSetting.php
|
charlesastwood/google-ads-php
|
c0a76d4b3ae074cef9c72f687b5e37222f7571ce
|
[
"Apache-2.0"
] | null | null | null |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v0/enums/display_ad_format_setting.proto
namespace GPBMetadata\Google\Ads\GoogleAds\V0\Enums;
class DisplayAdFormatSetting
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0add030a3d676f6f676c652f6164732f676f6f676c656164732f76302f65" .
"6e756d732f646973706c61795f61645f666f726d61745f73657474696e67" .
"2e70726f746f121d676f6f676c652e6164732e676f6f676c656164732e76" .
"302e656e756d732281010a1a446973706c61794164466f726d6174536574" .
"74696e67456e756d22630a16446973706c61794164466f726d6174536574" .
"74696e67120f0a0b554e5350454349464945441000120b0a07554e4b4e4f" .
"574e1001120f0a0b414c4c5f464f524d4154531002120e0a0a4e4f4e5f4e" .
"41544956451003120a0a064e4154495645100442f0010a21636f6d2e676f" .
"6f676c652e6164732e676f6f676c656164732e76302e656e756d73421b44" .
"6973706c61794164466f726d617453657474696e6750726f746f50015a42" .
"676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" .
"676c65617069732f6164732f676f6f676c656164732f76302f656e756d73" .
"3b656e756d73a20203474141aa021d476f6f676c652e4164732e476f6f67" .
"6c654164732e56302e456e756d73ca021d476f6f676c655c4164735c476f" .
"6f676c654164735c56305c456e756d73ea0221476f6f676c653a3a416473" .
"3a3a476f6f676c654164733a3a56303a3a456e756d73620670726f746f33"
));
static::$is_initialized = true;
}
}
| 45.05
| 77
| 0.747503
|
b78101efddb2a7e59f09add1befc45375ecff834
| 994
|
cs
|
C#
|
Jacdac/Constants/CapacitivebuttonConstants.g.cs
|
microsoft/jacdac-csharp
|
e8cd9a303fabbd9480582a57be1ce3f08598dea9
|
[
"MIT"
] | 6
|
2021-07-29T09:09:38.000Z
|
2022-01-31T21:04:37.000Z
|
Jacdac/Constants/CapacitivebuttonConstants.g.cs
|
microsoft/jacdac-csharp
|
e8cd9a303fabbd9480582a57be1ce3f08598dea9
|
[
"MIT"
] | 7
|
2021-07-29T11:52:50.000Z
|
2022-01-21T17:25:09.000Z
|
Jacdac/Constants/CapacitivebuttonConstants.g.cs
|
microsoft/jacdac-csharp
|
e8cd9a303fabbd9480582a57be1ce3f08598dea9
|
[
"MIT"
] | 4
|
2021-12-13T19:36:12.000Z
|
2022-01-20T17:26:53.000Z
|
namespace Jacdac {
public static partial class ServiceClasses
{
public const uint CapacitiveButton = 0x2865adc9;
}
public enum CapacitiveButtonReg : ushort {
/// <summary>
/// Read-write ratio u0.16 (uint16_t). Indicates the threshold for ``up`` events.
///
/// ```
/// const [threshold] = jdunpack<[number]>(buf, "u0.16")
/// ```
/// </summary>
Threshold = 0x6,
}
public static class CapacitiveButtonRegPack {
/// <summary>
/// Pack format for 'threshold' register data.
/// </summary>
public const string Threshold = "u0.16";
}
public enum CapacitiveButtonCmd : ushort {
/// <summary>
/// No args. Request to calibrate the capactive. When calibration is requested, the device expects that no object is touching the button.
/// The report indicates the calibration is done.
/// </summary>
Calibrate = 0x2,
}
}
| 30.121212
| 145
| 0.577465
|
cd9bb00ef3d0cb38e7931f4bf7aeb98bff0c6d0a
| 1,129
|
cs
|
C#
|
src/ReactiveMarbles.ObservableEvents.Example/MyForm.cs
|
ScriptBox99/ObservableEvents
|
4bde8e3cd92f10a6e5b1f0df57c51eeee4b0928c
|
[
"MIT"
] | 44
|
2021-05-31T07:54:36.000Z
|
2022-03-19T13:16:32.000Z
|
src/ReactiveMarbles.ObservableEvents.Example/MyForm.cs
|
ScriptBox99/ObservableEvents
|
4bde8e3cd92f10a6e5b1f0df57c51eeee4b0928c
|
[
"MIT"
] | 98
|
2021-06-14T01:00:21.000Z
|
2022-03-30T00:16:12.000Z
|
src/ReactiveMarbles.ObservableEvents.Example/MyForm.cs
|
ScriptBox99/ObservableEvents
|
4bde8e3cd92f10a6e5b1f0df57c51eeee4b0928c
|
[
"MIT"
] | 5
|
2021-05-31T07:50:18.000Z
|
2021-08-22T23:02:01.000Z
|
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Reactive;
using System.Text;
using ReactiveMarbles.ObservableEvents;
using Xamarin.Forms;
[assembly: GenerateStaticEventObservables(typeof(StaticTest))]
#pragma warning disable
namespace ReactiveMarbles.ObservableEvents
{
/// <summary>
/// Code behind for the same page.
/// </summary>
public partial class MyForm : Page
{
/// <summary>
/// Test command.
/// </summary>
public void Test()
{
this.Events().PropertyChanged.Subscribe();
////RxStaticTestEvents.TestChanged.Subscribe();
}
}
public class MyNoEventsClass
{
public MyNoEventsClass()
{
this.Events();
}
}
public static class StaticTest
{
public static event EventHandler? TestChanged;
}
}
| 23.520833
| 87
| 0.655447
|
a12c73e78cf378ea711a38379e83c04094577236
| 1,631
|
ts
|
TypeScript
|
strongly-signalk/src/loader/ExpeditionFormatConversion.test.ts
|
tkurki/charted-sails
|
661e02510459b8746d5c00a470083a3ebccbe615
|
[
"Apache-2.0"
] | 1
|
2020-07-21T20:08:03.000Z
|
2020-07-21T20:08:03.000Z
|
strongly-signalk/src/loader/ExpeditionFormatConversion.test.ts
|
tkurki/charted-sails
|
661e02510459b8746d5c00a470083a3ebccbe615
|
[
"Apache-2.0"
] | null | null | null |
strongly-signalk/src/loader/ExpeditionFormatConversion.test.ts
|
tkurki/charted-sails
|
661e02510459b8746d5c00a470083a3ebccbe615
|
[
"Apache-2.0"
] | null | null | null |
import { ExpeditionFormatConversion } from './ExpeditionFormatConversion'
import * as utils from '@signalk/nmea0183-utilities'
import { columnConvertersForLine } from './CSVConversion';
import {toBeDeepCloseTo,toMatchCloseTo} from 'jest-matcher-deep-close-to';
import { SKValue } from '../model';
// This little dance is needed to avoid Typescript errors when adding new matchers.
// Thanks to: https://github.com/kentcdodds/react-testing-library/issues/36
interface ExtendedMatchers extends jest.Matchers<void> {
toBeDeepCloseTo: (o: object) => object
}
expect.extend({toBeDeepCloseTo, toMatchCloseTo});
let myExpect = (x:any) => (expect(x) as ExtendedMatchers)
let expeditionConverter : ExpeditionFormatConversion
beforeAll(() => {
expeditionConverter = new ExpeditionFormatConversion()
})
it('can convert expedition times', () => {
expect(expeditionConverter.timeConverter({'Utc': 38249.70139}))
.toEqual(new Date('2004-09-21T16:50:00.096Z'))
})
let convertHelper = (csvLine: any):SKValue|null => {
let availableConversions = columnConvertersForLine(csvLine, expeditionConverter)
expect(availableConversions).toHaveLength(1)
if (availableConversions.length == 1) {
return availableConversions[0].convert(csvLine)
}
return null
}
it('converts BSP column', () => {
myExpect(convertHelper({'Bsp': 6.2}))
.toBeDeepCloseTo({'path': 'navigation.speedThroughWater', value: utils.transform(6.2, 'knots', 'ms')})
})
it('converts HDG column', () => {
myExpect(convertHelper({'Hdg': 243.2}))
.toBeDeepCloseTo({'path': 'navigation.headingTrue', value: utils.transform(243.2, 'deg', 'rad')})
})
| 34.702128
| 106
| 0.732066
|