text
stringlengths 2
1.05M
|
|---|
define([
"dojo/_base/kernel",
"dojo/_base/lang",
"dojo/_base/declare",
"dojo/_base/array",
"dojo/_base/connect",
"dojo/_base/event",
"dojo/_base/sniff",
"dojo/_base/html",
"dojo/keys",
"dijit/a11y",
"dijit/focus",
"../_FocusManager"
], function(dojo, lang, declare, array, connect, event, has, html, keys, dijitA11y, dijitFocus, _FocusManager){
var _FocusArea = declare("dojox.grid.enhanced._FocusArea", null, {
// summary:
// This is a friend class of _FocusManager
/*=====
// name: string
// Name of this area.
name: "",
onFocus: function(event, step){
// summary:
// Called when this area logically gets focus.
// event: Event object
// May be unavailable, should check before use.
// step: Integer
// The distance in the tab sequence from last focused area to this area.
// returns:
// whether this area is successfully focused. If not, the next area will get focus.
return true;
},
onBlur: function(event, step){
// summary:
// Called when this area logically loses focus.
// event: Event object
// May be unavailable, should check before use.
// step: Integer
// The distance in the tab sequence from this area to the area to focus.
// returns:
// If Boolean, means whether this area has successfully blurred. If not, the next area to focus is still this one.
// If String, means the next area to focus is given by this returned name.
return true;
},
onMove: function(rowStep, colStep, event){
// summary:
// Called when focus is moving around within this area.
// rowStep: Integer
// colStep: Integer
// event: Event object
// May be unavailable, should check before use.
},
onKey: function(event, isBubble){
// summary:
// Called when some key is pressed when focus is logically in this area.
// event: Event object
// isBubble: Boolean
// Whether is in bubble stage (true) or catch stage (false).
// returns:
// If you do NOT want the event to propagate any further along the area stack, return exactly false.
// So if you return nothing (undefined), this event is still propagating.
return true;
},
getRegions: function(){
// summary:
// Define the small regions (dom nodes) in this area.
// returns:
// Array of dom nodes.
},
onRegionFocus: function(event){
// summary:
// Connected to the onfocus event of the defined regions (if any)
},
onRegionBlur: function(event){
// summary:
// Connected to the onblur event of the defined regions (if any)
},
=====*/
constructor: function(area, focusManager){
this._fm = focusManager;
this._evtStack = [area.name];
var dummy = function(){return true;};
area.onFocus = area.onFocus || dummy;
area.onBlur = area.onBlur || dummy;
area.onMove = area.onMove || dummy;
area.onKeyUp = area.onKeyUp || dummy;
area.onKeyDown = area.onKeyDown || dummy;
lang.mixin(this, area);
},
move: function(rowStep, colStep, evt){
if(this.name){
var i, len = this._evtStack.length;
for(i = len - 1; i >= 0; --i){
if(this._fm._areas[this._evtStack[i]].onMove(rowStep, colStep, evt) === false){
return false;
}
}
}
return true;
},
_onKeyEvent: function(evt, funcName){
if(this.name){
var i, len = this._evtStack.length;
for(i = len - 1; i >= 0; --i){
if(this._fm._areas[this._evtStack[i]][funcName](evt, false) === false){
return false;
}
}
for(i = 0; i < len; ++i){
if(this._fm._areas[this._evtStack[i]][funcName](evt, true) === false){
return false;
}
}
}
return true;
},
keydown: function(evt){
return this._onKeyEvent(evt, "onKeyDown");
},
keyup: function(evt){
return this._onKeyEvent(evt, "onKeyUp");
},
contentMouseEventPlanner: function(){
return 0;
},
headerMouseEventPlanner: function(){
return 0;
}
});
return declare("dojox.grid.enhanced._FocusManager", _FocusManager, {
_stopEvent: function(evt){
try{
if(evt && evt.preventDefault){
event.stop(evt);
}
}catch(e){}
},
constructor: function(grid){
this.grid = grid;
this._areas = {};
this._areaQueue = [];
this._contentMouseEventHandlers = [];
this._headerMouseEventHandlers = [];
this._currentAreaIdx = -1;
this._gridBlured = true;
this._connects.push(connect.connect(grid, "onBlur", this, "_doBlur"));
this._connects.push(connect.connect(grid.scroller, "renderPage", this, "_delayedCellFocus"));
this.addArea({
name: "header",
onFocus: lang.hitch(this, this.focusHeader),
onBlur: lang.hitch(this, this._blurHeader),
onMove: lang.hitch(this, this._navHeader),
getRegions: lang.hitch(this, this._findHeaderCells),
onRegionFocus: lang.hitch(this, this.doColHeaderFocus),
onRegionBlur: lang.hitch(this, this.doColHeaderBlur),
onKeyDown: lang.hitch(this, this._onHeaderKeyDown)
});
this.addArea({
name: "content",
onFocus: lang.hitch(this, this._focusContent),
onBlur: lang.hitch(this, this._blurContent),
onMove: lang.hitch(this, this._navContent),
onKeyDown: lang.hitch(this, this._onContentKeyDown)
});
this.addArea({
name: "editableCell",
onFocus: lang.hitch(this, this._focusEditableCell),
onBlur: lang.hitch(this, this._blurEditableCell),
onKeyDown: lang.hitch(this, this._onEditableCellKeyDown),
onContentMouseEvent: lang.hitch(this, this._onEditableCellMouseEvent),
contentMouseEventPlanner: function(evt, areas){ return -1; }
});
this.placeArea("header");
this.placeArea("content");
this.placeArea("editableCell");
this.placeArea("editableCell","above","content");
},
destroy: function(){
for(var name in this._areas){
var area = this._areas[name];
array.forEach(area._connects, connect.disconnect);
area._connects = null;
if(area.uninitialize){
area.uninitialize();
}
}
this.inherited(arguments);
},
addArea: function(area){
if(area.name && lang.isString(area.name)){
if(this._areas[area.name]){
//Just replace the original area, instead of remove it, so the position does not change.
array.forEach(area._connects, connect.disconnect);
}
this._areas[area.name] = new _FocusArea(area, this);
if(area.onHeaderMouseEvent){
this._headerMouseEventHandlers.push(area.name);
}
if(area.onContentMouseEvent){
this._contentMouseEventHandlers.push(area.name);
}
}
},
getArea: function(areaName){
return this._areas[areaName];
},
_bindAreaEvents: function(){
var area, hdl, areas = this._areas;
array.forEach(this._areaQueue, function(name){
area = areas[name];
if(!area._initialized && lang.isFunction(area.initialize)){
area.initialize();
area._initialized = true;
}
if(area.getRegions){
area._regions = area.getRegions() || [];
array.forEach(area._connects || [], connect.disconnect);
area._connects = [];
array.forEach(area._regions, function(r){
if(area.onRegionFocus){
hdl = connect.connect(r, "onfocus", area.onRegionFocus);
area._connects.push(hdl);
}
if(area.onRegionBlur){
hdl = connect.connect(r, "onblur", area.onRegionBlur);
area._connects.push(hdl);
}
});
}
});
},
removeArea: function(areaName){
var area = this._areas[areaName];
if(area){
this.ignoreArea(areaName);
var i = array.indexOf(this._contentMouseEventHandlers, areaName);
if(i >= 0){
this._contentMouseEventHandlers.splice(i, 1);
}
i = array.indexOf(this._headerMouseEventHandlers, areaName);
if(i >= 0){
this._headerMouseEventHandlers.splice(i, 1);
}
array.forEach(area._connects, connect.disconnect);
if(area.uninitialize){
area.uninitialize();
}
delete this._areas[areaName];
}
},
currentArea: function(areaName, toBlurOld){
// summary:
// Set current area to the one areaName refers.
// areaName: String
var idx, cai = this._currentAreaIdx;
if(lang.isString(areaName) && (idx = array.indexOf(this._areaQueue, areaName)) >= 0){
if(cai != idx){
this.tabbingOut = false;
if(toBlurOld && cai >= 0 && cai < this._areaQueue.length){
this._areas[this._areaQueue[cai]].onBlur();
}
this._currentAreaIdx = idx;
}
}else{
return (cai < 0 || cai >= this._areaQueue.length) ?
new _FocusArea({}, this) :
this._areas[this._areaQueue[this._currentAreaIdx]];
}
return null;
},
placeArea: function(name, pos, otherAreaName){
// summary:
// Place the area referred by *name* at some logical position relative to an existing area.
// example:
// placeArea("myarea","before"|"after",...)
// placeArea("myarea","below"|"above",...)
if(!this._areas[name]){ return; }
var idx = array.indexOf(this._areaQueue,otherAreaName);
switch(pos){
case "after":
if(idx >= 0){ ++idx; }
//intentional drop through
case "before":
if(idx >= 0){
this._areaQueue.splice(idx,0,name);
break;
}
//intentional drop through
default:
this._areaQueue.push(name);
break;
case "above":
var isAbove = true;
//intentional drop through
case "below":
var otherArea = this._areas[otherAreaName];
if(otherArea){
if(isAbove){
otherArea._evtStack.push(name);
}else{
otherArea._evtStack.splice(0,0,name);
}
}
}
},
ignoreArea: function(name){
this._areaQueue = array.filter(this._areaQueue,function(areaName){
return areaName != name;
});
},
focusArea: function(/* int|string|areaObj */areaId,evt){
var idx;
if(typeof areaId == "number"){
idx = areaId < 0 ? this._areaQueue.length + areaId : areaId;
}else{
idx = array.indexOf(this._areaQueue,
lang.isString(areaId) ? areaId : (areaId && areaId.name));
}
if(idx < 0){ idx = 0; }
var step = idx - this._currentAreaIdx;
this._gridBlured = false;
if(step){
this.tab(step, evt);
}else{
this.currentArea().onFocus(evt, step);
}
},
tab: function(step,evt){
//console.log("===========tab",step,"curArea",this._currentAreaIdx,"areaCnt",this._areaQueue.length);
this._gridBlured = false;
this.tabbingOut = false;
if(step === 0){
return;
}
var cai = this._currentAreaIdx;
var dir = step > 0 ? 1:-1;
if(cai < 0 || cai >= this._areaQueue.length){
cai = (this._currentAreaIdx += step);
}else{
var nextArea = this._areas[this._areaQueue[cai]].onBlur(evt,step);
if(nextArea === true){
cai = (this._currentAreaIdx += step);
}else if(lang.isString(nextArea) && this._areas[nextArea]){
cai = this._currentAreaIdx = array.indexOf(this._areaQueue,nextArea);
}
}
//console.log("target area:",cai);
for(; cai >= 0 && cai < this._areaQueue.length; cai += dir){
this._currentAreaIdx = cai;
if(this._areaQueue[cai] && this._areas[this._areaQueue[cai]].onFocus(evt,step)){
//console.log("final target area:",this._currentAreaIdx);
return;
}
}
//console.log("tab out");
this.tabbingOut = true;
if(step < 0){
this._currentAreaIdx = -1;
dijitFocus.focus(this.grid.domNode);
}else{
this._currentAreaIdx = this._areaQueue.length;
dijitFocus.focus(this.grid.lastFocusNode);
}
},
_onMouseEvent: function(type, evt){
var lowercase = type.toLowerCase(),
handlers = this["_" + lowercase + "MouseEventHandlers"],
res = array.map(handlers, function(areaName){
return {
"area": areaName,
"idx": this._areas[areaName][lowercase + "MouseEventPlanner"](evt, handlers)
};
}, this).sort(function(a, b){
return b.idx - a.idx;
}),
resHandlers = array.map(res, function(handler){
return res.area;
}),
i = res.length;
while(--i >= 0){
if(this._areas[res[i].area]["on" + type + "MouseEvent"](evt, resHandlers) === false){
return;
}
}
},
contentMouseEvent: function(evt){
this._onMouseEvent("Content", evt);
},
headerMouseEvent: function(evt){
this._onMouseEvent("Header", evt);
},
initFocusView: function(){
// summary:
// Overwritten
this.focusView = this.grid.views.getFirstScrollingView() || this.focusView || this.grid.views.views[0];
this._bindAreaEvents();
},
isNavHeader: function(){
// summary:
// Overwritten
// Check whether currently navigating among column headers.
// returns:
// true - focus is on a certain column header | false otherwise
return this._areaQueue[this._currentAreaIdx] == "header";
},
previousKey: function(e){
// summary:
// Overwritten
this.tab(-1,e);
},
nextKey: function(e){
// summary:
// Overwritten
this.tab(1,e);
},
setFocusCell: function(/* Object */inCell, /* Integer */inRowIndex){
// summary:
// Overwritten - focuses the given grid cell
if(inCell){
this.currentArea(this.grid.edit.isEditing() ? "editableCell" : "content", true);
//This is very slow when selecting cells!
//this.focusGridView();
this._focusifyCellNode(false);
this.cell = inCell;
this.rowIndex = inRowIndex;
this._focusifyCellNode(true);
}
this.grid.onCellFocus(this.cell, this.rowIndex);
},
doFocus: function(e){
// summary:
// Overwritten
// trap focus only for grid dom node
// do not focus for scrolling if grid is about to blur
if(e && e.target == e.currentTarget && !this.tabbingOut){
if(this._gridBlured){
this._gridBlured = false;
if(this._currentAreaIdx < 0 || this._currentAreaIdx >= this._areaQueue.length){
this.focusArea(0, e);
}else{
this.focusArea(this._currentAreaIdx, e);
}
}
}else{
this.tabbingOut = false;
}
event.stop(e);
},
_doBlur: function(){
this._gridBlured = true;
},
doLastNodeFocus: function(e){
// summary:
// Overwritten
if(this.tabbingOut){
this.tabbingOut = false;
}else{
this.focusArea(-1, e);
}
},
_delayedHeaderFocus: function(){
// summary:
// Overwritten
if(this.isNavHeader() && !has('ie')){
this.focusHeader();
}
},
_delayedCellFocus: function(){
// summary:
// Overwritten
//If focus header here, the page will scroll to grid when the grid is created.
//this.focusArea("header");
},
_changeMenuBindNode: function(oldBindNode, newBindNode){
var hm = this.grid.headerMenu;
if(hm && this._contextMenuBindNode == oldBindNode){
hm.unBindDomNode(oldBindNode);
hm.bindDomNode(newBindNode);
this._contextMenuBindNode = newBindNode;
}
},
//---------------Header Area------------------------------------------
focusHeader: function(evt, step){ //need a further look why these changes to parent's
// summary:
// Overwritten
var didFocus = false;
this.inherited(arguments);
if(this._colHeadNode && html.style(this._colHeadNode, 'display') != "none"){
dijitFocus.focus(this._colHeadNode);
this._stopEvent(evt);
didFocus = true;
}
return didFocus;
},
_blurHeader: function(evt,step){
// summary:
// Overwritten
if(this._colHeadNode){
html.removeClass(this._colHeadNode, this.focusClass);
}
html.removeAttr(this.grid.domNode,"aria-activedescendant");
// reset contextMenu onto viewsHeaderNode so right mouse on header will invoke (see focusHeader)
this._changeMenuBindNode(this.grid.domNode,this.grid.viewsHeaderNode);
//moved here from nextKey
this._colHeadNode = this._colHeadFocusIdx = null;
return true;
},
_navHeader: function(rowStep, colStep, evt){
var colDir = colStep < 0 ? -1 : 1,
savedIdx = array.indexOf(this._findHeaderCells(), this._colHeadNode);
if(savedIdx >= 0 && (evt.shiftKey && evt.ctrlKey)){
this.colSizeAdjust(evt, savedIdx, colDir * 5);
return;
}
this.move(rowStep, colStep);
},
_onHeaderKeyDown: function(e, isBubble){
if(isBubble){
var dk = keys;
switch(e.keyCode){
case dk.ENTER:
case dk.SPACE:
var colIdx = this.getHeaderIndex();
if(colIdx >= 0 && !this.grid.pluginMgr.isFixedCell(e.cell)/*TODO*/){
this.grid.setSortIndex(colIdx, null, e);
event.stop(e);
}
break;
}
}
return true;
},
_setActiveColHeader: function(){
// summary:
// Overwritten
this.inherited(arguments);
//EDG now will decorate event on header key events, if no focus, the cell will be wrong
dijitFocus.focus(this._colHeadNode);
},
//---------------Content Area------------------------------------------
findAndFocusGridCell: function(){
// summary:
// Overwritten
this._focusContent();
},
_focusContent: function(evt,step){
var didFocus = true;
var isEmpty = (this.grid.rowCount === 0); // If grid is empty this.grid.rowCount == 0
if(this.isNoFocusCell() && !isEmpty){
//skip all the hidden cells
for(var i = 0, cell = this.grid.getCell(0); cell && cell.hidden; cell = this.grid.getCell(++i)){}
this.setFocusIndex(0, cell ? i : 0);
}else if(this.cell && !isEmpty){
if(this.focusView && !this.focusView.rowNodes[this.rowIndex]){
// if rowNode for current index is undefined (likely as a result of a sort and because of #7304)
// scroll to that row
this.grid.scrollToRow(this.rowIndex);
this.focusGrid();
}else{
this.setFocusIndex(this.rowIndex, this.cell.index);
}
}else{
didFocus = false;
}
if(didFocus){ this._stopEvent(evt); }
return didFocus;
},
_blurContent: function(evt,step){
this._focusifyCellNode(false);
return true;
},
_navContent: function(rowStep, colStep, evt){
if((this.rowIndex === 0 && rowStep < 0) || (this.rowIndex === this.grid.rowCount - 1 && rowStep > 0)){
return;
}
this._colHeadNode = null;
this.move(rowStep, colStep, evt);
if(evt){
event.stop(evt);
}
},
_onContentKeyDown: function(e, isBubble){
if(isBubble){
var dk = keys, s = this.grid.scroller;
switch(e.keyCode){
case dk.ENTER:
case dk.SPACE:
var g = this.grid;
if(g.indirectSelection){ break; }
g.selection.clickSelect(this.rowIndex, connect.isCopyKey(e), e.shiftKey);
g.onRowClick(e);
event.stop(e);
break;
case dk.PAGE_UP:
if(this.rowIndex !== 0){
if(this.rowIndex != s.firstVisibleRow + 1){
this._navContent(s.firstVisibleRow - this.rowIndex, 0);
}else{
this.grid.setScrollTop(s.findScrollTop(this.rowIndex - 1));
this._navContent(s.firstVisibleRow - s.lastVisibleRow + 1, 0);
}
event.stop(e);
}
break;
case dk.PAGE_DOWN:
if(this.rowIndex + 1 != this.grid.rowCount){
event.stop(e);
if(this.rowIndex != s.lastVisibleRow - 1){
this._navContent(s.lastVisibleRow - this.rowIndex - 1, 0);
}else{
this.grid.setScrollTop(s.findScrollTop(this.rowIndex + 1));
this._navContent(s.lastVisibleRow - s.firstVisibleRow - 1, 0);
}
event.stop(e);
}
break;
}
}
return true;
},
//------------------editable content area-------------------------
_blurFromEditableCell: false,
_isNavigating: false,
_navElems: null,
_focusEditableCell: function(evt,step){
var didFocus = false;
if(this._isNavigating){
didFocus = true;
}else if(this.grid.edit.isEditing() && this.cell){
if(this._blurFromEditableCell || !this._blurEditableCell(evt, step)){
this.setFocusIndex(this.rowIndex,this.cell.index);
didFocus = true;
}
this._stopEvent(evt);
}
return didFocus;
},
_applyEditableCell: function(){
try{
this.grid.edit.apply();
}catch(e){
console.warn("_FocusManager._applyEditableCell() error:", e);
}
},
_blurEditableCell: function(evt,step){
this._blurFromEditableCell = false;
if(this._isNavigating){
var toBlur = true;
if(evt){
var elems = this._navElems;
var firstElem = elems.lowest || elems.first;
var lastElem = elems.last || elems.highest || firstElem;
var target = has('ie') ? evt.srcElement : evt.target;
toBlur = target == (step > 0 ? lastElem : firstElem);
}
if(toBlur){
this._isNavigating = false;
html.setSelectable(this.cell.getNode(this.rowIndex), false);
return "content";
}
return false;
}else if(this.grid.edit.isEditing() && this.cell){
if(!step || typeof step != "number"){ return false; }
var dir = step > 0 ? 1 : -1;
var cc = this.grid.layout.cellCount;
for(var cell, col = this.cell.index + dir; col >= 0 && col < cc; col += dir){
cell = this.grid.getCell(col);
if(cell.editable){
this.cell = cell;
this._blurFromEditableCell = true;
return false;
}
}
if((this.rowIndex > 0 || dir == 1) && (this.rowIndex < this.grid.rowCount || dir == -1)){
this.rowIndex += dir;
//this.cell = this.grid.getCell(0); //There must be an editable cell, so this is not necessary.
for(col = dir > 0 ? 0 : cc - 1; col >= 0 && col < cc; col += dir){
cell = this.grid.getCell(col);
if(cell.editable){
this.cell = cell;
break;
}
}
this._applyEditableCell();
return "content";
}
}
return true;
},
_initNavigatableElems: function(){
this._navElems = dijitA11y._getTabNavigable(this.cell.getNode(this.rowIndex));
},
_onEditableCellKeyDown: function(e, isBubble){
var dk = keys,
g = this.grid,
edit = g.edit,
editApplied = false,
toPropagate = true;
switch(e.keyCode){
case dk.ENTER:
if(isBubble && edit.isEditing()){
this._applyEditableCell();
editApplied = true;
event.stop(e);
}
//intentional drop through
case dk.SPACE:
if(!isBubble && this._isNavigating){
toPropagate = false;
break;
}
if(isBubble){
if(!this.cell.editable && this.cell.navigatable){
this._initNavigatableElems();
var toFocus = this._navElems.lowest || this._navElems.first;
if(toFocus){
this._isNavigating = true;
html.setSelectable(this.cell.getNode(this.rowIndex), true);
dijitFocus.focus(toFocus);
event.stop(e);
this.currentArea("editableCell", true);
break;
}
}
if(!editApplied && !edit.isEditing() && !g.pluginMgr.isFixedCell(this.cell)){
edit.setEditCell(this.cell, this.rowIndex);
}
if(editApplied){
this.currentArea("content", true);
}else if(this.cell.editable && g.canEdit()){
this.currentArea("editableCell", true);
}
}
break;
case dk.PAGE_UP:
case dk.PAGE_DOWN:
if(!isBubble && edit.isEditing()){
//prevent propagating to content area
toPropagate = false;
}
break;
case dk.ESCAPE:
if(!isBubble){
edit.cancel();
this.currentArea("content", true);
}
}
return toPropagate;
},
_onEditableCellMouseEvent: function(evt){
if(evt.type == "click"){
var cell = this.cell || evt.cell;
if(cell && !cell.editable && cell.navigatable){
this._initNavigatableElems();
if(this._navElems.lowest || this._navElems.first){
var target = has('ie') ? evt.srcElement : evt.target;
if(target != cell.getNode(evt.rowIndex)){
this._isNavigating = true;
this.focusArea("editableCell", evt);
html.setSelectable(cell.getNode(evt.rowIndex), true);
dijitFocus.focus(target);
return false;
}
}
}else if(this.grid.singleClickEdit){
this.currentArea("editableCell");
return false;
}
}
return true;
}
});
});
|
module.exports = {
extends: ['@commitlint/config-angular'],
rules: {
'type-enum': [
2,
'always', [
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test'
]
]
}
};
|
var callbackArguments = [];
var argument1 = function callback(){callbackArguments.push(arguments)};
var argument2 = "";
var argument3 = null;
var argument4 = function callback(){callbackArguments.push(arguments)};
var argument5 = ["WM-{-","7"];
var argument6 = "";
var argument7 = function callback(){callbackArguments.push(arguments)};
var argument8 = function callback(){callbackArguments.push(arguments)};
var base_0 = [":k","N"]
var r_0= undefined
try {
r_0 = base_0.map(argument1,argument2,argument3)
}
catch(e) {
r_0= "Error"
}
var base_1 = r_0
var r_1= undefined
try {
r_1 = base_1.map(argument4,argument5,argument6)
}
catch(e) {
r_1= "Error"
}
var base_2 = r_0
var r_2= undefined
try {
r_2 = base_2.map(argument7)
}
catch(e) {
r_2= "Error"
}
var base_3 = r_2
var r_3= undefined
try {
r_3 = base_3.map(argument8)
}
catch(e) {
r_3= "Error"
}
function serialize(array){
return array.map(function(a){
if (a === null || a == undefined) return a;
var name = a.constructor.name;
if (name==='Object' || name=='Boolean'|| name=='Array'||name=='Number'||name=='String')
return JSON.stringify(a);
return name;
});
}
setTimeout(function(){
require("fs").writeFileSync("./experiments/map/mapEmpty/test870.json",JSON.stringify({"baseObjects":serialize([base_0,base_1,base_2,base_3]),"returnObjects":serialize([r_0,r_1,r_2,r_3]),"callbackArgs":callbackArguments}))
},300)
|
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const tsc = require('typescript');
module.exports = {
process(src, path) {
if (path.endsWith('.ts') || path.endsWith('.tsx')) {
return tsc.transpile(
src,
{
jsx: tsc.JsxEmit.React,
module: tsc.ModuleKind.CommonJS,
},
path,
[]
);
}
return src;
},
};
|
/**
* 全局工具类导出
* */
const { regeneratorRuntime } = global;
import { promisify, complete } from 'promisify';
import $http from './x-http'; // 二次封装 wx.request
import $filters from './x-filters'; // 过滤器
/*
* 静默授权登录,获取用户信息
* app.$login().then(res=>{})
* */
const $login = async() => {
// 获取本地存储的用户信息
let userInfo = wx.getStorageSync('user_info');
if (!userInfo) {
try {
// 解密微信用户信息,根据openid查询是否已有用户信息
const { code: jsCode } = await promisify(wx.login)();
const { data } = await $http({
url: '/wx/openid',
errType: 'none',
data: { jsCode }
});
userInfo = typeof data === 'string' ? { openid: data } : data;
// 存储到本地缓存
wx.setStorageSync('user_info', userInfo);
} catch (e) {
console.log('[$login failed] ', e);
}
}
return userInfo;
};
/*
* 检验是否授权
* 处理部门权限未授权的情况
* */
const $authorize = async (scope) => {
//scope列表
const scopeList = {
'scope.userLocation': '地理位置',
'scope.address': '通讯地址',
'scope.record': '录音功能',
'scope.writePhotosAlbum': '保存到相册',
};
await complete(wx.authorize)({scope: scope});
let {authSetting} = await promisify(wx.getSetting)();
console.info('wx.getSetting => ', authSetting);
if (!authSetting[scope]) {
wx.showModal({
title: '授权提示',
content: `检测到您未打开${scopeList[scope]}权限,请在设置中打开`,
async success (res) {
if (res.confirm) {
let {authSetting} = await promisify(wx.openSetting)();
return authSetting[scope] || Promise.reject();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
return true;
};
export default {
$http,
$filters,
$login,
$authorize
};
|
var searchData=
[
['headertype_2135',['HeaderType',['../structHeaderType.html',1,'']]],
['hpdir_5ft_2136',['hpdir_t',['../structhpdir__t.html',1,'']]]
];
|
/**
* Component watchers
*/
const mixin = {
watch: {
// Watch window width change
widthWindow (newValue, oldValue) {
if (oldValue) {
this.prepareCarousel()
this.toggleFade()
}
},
// Watch current slide change
currentSlide () {
this.prepareSlidesClasses()
// Set start time of slide
this.autoplayStart = (this.settings.autoplay) ? +new Date() : null
this.$emit('afterChange', { currentSlide: this.currentSlide })
},
// Recalculate settings
currentBreakpoint () {
this.prepareSettings()
this.$emit('breakpoint', { breakpoint: this.currentBreakpoint })
},
// Watch drag distance change
dragDistance () {
if (this.mouseDown) {
if (this.dragDistance > this.swipeDistance && this.canGoToPrev) {
this.goToPrev()
this.handleMouseUp()
}
if (this.dragDistance < -1 * this.swipeDistance && this.canGoToNext) {
this.goToNext()
this.handleMouseUp()
}
}
},
'settings.fade' () {
this.toggleFade()
},
'settings.autoplay' () {
this.toggleAutoPlay()
},
pauseAutoPlay (nevValue) {
if (nevValue) {
// Store current slide remaining time and disable auto play mode
this.remaining = this.settings.autoplaySpeed - (+new Date() - this.autoplayStart)
this.disableAutoPlay()
this.clearAutoPlayPause()
} else {
// Go to next after remaining time and rerun auto play mode
this.autoplayTimeout = setTimeout(() => {
this.clearAutoPlayPause()
this.goToNext()
this.toggleAutoPlay()
}, this.remaining)
}
}
}
}
export default mixin
|
const Locations = require('../lib/repositories/locations');
const { ErrorHandler } = require('../lib/utils');
const { PARENT_LOC_NOT_FOUND } = require('../constants');
async function checkParentId(ctx, next) {
try {
const { parentLocation } = ctx.request.body;
const { db } = ctx;
if (parentLocation) {
const parent = await Locations.get(db, parentLocation);
if (!parent) {
return ErrorHandler.ResourceNotFoundError(PARENT_LOC_NOT_FOUND);
}
}
await next();
} catch (error) {
return ErrorHandler.ServerError();
}
}
module.exports = checkParentId;
|
"use strict";
// end-snippet
// begin-snippet: adt-boolean-functions
function and(left, right) {
return left.tag === "true" ? right : { tag: "false" };
}
function or(left, right) {
return left.tag === "true" ? { tag: "true" } : right;
}
// end-snippet
// begin-snippet: adt-boolean-encode-decode
function adtEncodeBoolean(bool) {
return bool ? { tag: "true" } : { tag: "false" };
}
function adtDecodeBoolean(bool) {
return bool.tag === "true" ? true : false;
}
function churchEncodeBoolean(bool) {
return bool.tag === "true" ? ({ tru, fals }) => tru
: ({ tru, fals }) => fals;
}
// end-snippet
// begin-snippet: church-boolean-functions
const tru = ({ tru, fals }) => tru;
const fals = ({ tru, fals }) => fals;
function churchAnd(left, right) {
return left({
tru: right,
fals
});
}
function churchOr(left, right) {
return left({
tru,
fals: right
});
}
// Contrived example of how these might be used
const oneIsOdd = tru;
const twoIsOdd = fals;
// Using a Church boolean to create a string
const message = churchAnd(oneIsOdd, twoIsOdd)({
tru: "both 1 and 2 are odd numbers",
fals: "at least one of 1 or 2 are not an odd number"
});
// We can return other types from a Church Boolean as well
const undefinedIfOneIsOdd = oneIsOdd({
tru: undefined,
fals: 1
});
// Show that we can turn our Church boolean back into an ADT
// without losing information, which establishes that they are
// equivalent.
function churchDecodeBoolean(bool) {
return bool({
tru: { tag: "true" },
fals: { tag: "false" }
});
}
// end-snippet
// begin-snippet: adt-tuple-instantiation
const pair = {
tag: 'tuple',
first: 1,
second: 'hello world'
};
function churchEncodeTuple(tuple) {
return fn => fn(tuple.first, tuple.second);
}
// end-snippet
// begin-snippet: church-tuple-usage
// Convenience functions, for readability
function adtTuple(first, second) {
return {
tag: 'tuple',
first,
second
};
}
function churchTuple(a, b) {
return function (fn) {
return fn(a, b);
};
}
const fourFiveAdt = adtTuple(4, 5);
const fourFiveChurch = churchTuple(4, 5);
const twenty = fourFiveAdt.first * fourFiveAdt.second;
const twentyAgain = fourFiveChurch((first, second) => first * second);
const fortyFive = `${fourFiveAdt.first}{fourFiveAdt.second}`;
const fortyFiveAgain = fourFiveChurch((first, second) => `${first}${second}`);
// end-snippet
// begin-snippet: church-tuple-decode
function decodeChurchTuple(tuple) {
return tuple((first, second) => ({
tag: 'tuple',
first,
second
}));
}
// end-snippet
// begin-snippet: church-request-state-encode-decode
function churchEncodeRequestState(requestState) {
return function (choices) {
if (requestState.tag === "NotYetSent") {
return choices.notYetSent;
}
if (requestState.tag === "InProgress") {
return choices.inProgress;
}
if (requestState.tag === "Succeeded") {
return choices.succeeded(requestState.result);
}
return choices.failed(requestState.errorCode, requestState.errorMessage);
};
}
function churchDecodeRequestState(churchRequestState) {
return churchRequestState({
notYetSent: { tag: "NotYetSent" },
inProgress: { tag: "InProgress" },
succeeded: result => ({
tag: "Succeeded",
result
}),
failed: (errorCode, errorMessage) => ({
tag: "Failed",
errorCode,
errorMessage
})
});
}
// end-snippet
const adtRequestState = undefined;
const churchRequestState = undefined;
// begin-snippet: request-state-usage
// Using an ADT
let uiContents;
if (adtRequestState.tag === "NotYetSent") {
uiContents = "request pending...";
}
else if (adtRequestState.tag === "InProgress") {
uiContents = "loading...";
}
else if (adtRequestState.tag === "Succeeded") {
uiContents = adtRequestState.result;
}
else {
const { errorCode, errorMessage } = adtRequestState;
uiContents = `Received error ${errorCode}: ${errorMessage}`;
}
// Using a Church encoding
const uiContents2 = churchRequestState({
notYetSent: "request pending...",
inProgress: "loading...",
succeeded: result => result,
failed: (code, msg) => `Recieved error ${code}: ${msg}`
});
// end-snippet
|
module.exports = {
nodeuse : '',
component : {
file : '',
module : '',
path : ''
},
isDebug : false,
isIsolation : false
};
|
/*
* Copyright (C) IBM Corp. 2009 All rights reserved.
*
* 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.
* * Neither the name of IBM Corp. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @implements {UI.ActionDelegate}
* @implements {UI.ToolbarItem.ItemsProvider}
* @implements {UI.ContextMenu.Provider}
* @unrestricted
*/
Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget {
constructor() {
super(true);
this.registerRequiredCSS('object_ui/objectValue.css');
this.registerRequiredCSS('sources/watchExpressionsSidebarPane.css');
/** @type {!Array.<!Sources.WatchExpression>} */
this._watchExpressions = [];
this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExpressions', []);
this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'largeicon-add');
this._addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addButtonClicked.bind(this));
this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'largeicon-refresh');
this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this.update, this);
this.contentElement.classList.add('watch-expressions');
this.contentElement.addEventListener('contextmenu', this._contextMenu.bind(this), false);
this._expandController = new ObjectUI.ObjectPropertiesSectionExpandController();
UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this);
UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update, this);
this._linkifier = new Components.Linkifier();
this.update();
}
/**
* @override
* @return {!Array<!UI.ToolbarItem>}
*/
toolbarItems() {
return [this._addButton, this._refreshButton];
}
/**
* @return {boolean}
*/
hasExpressions() {
return !!this._watchExpressionsSetting.get().length;
}
_saveExpressions() {
const toSave = [];
for (let i = 0; i < this._watchExpressions.length; i++) {
if (this._watchExpressions[i].expression())
toSave.push(this._watchExpressions[i].expression());
}
this._watchExpressionsSetting.set(toSave);
}
async _addButtonClicked() {
await UI.viewManager.showView('sources.watch');
this._createWatchExpression(null).startEditing();
}
/**
* @override
* @return {!Promise.<?>}
*/
doUpdate() {
this._linkifier.reset();
this.contentElement.removeChildren();
this._watchExpressions = [];
this._emptyElement = this.contentElement.createChild('div', 'gray-info-message');
this._emptyElement.textContent = Common.UIString('No watch expressions');
const watchExpressionStrings = this._watchExpressionsSetting.get();
for (let i = 0; i < watchExpressionStrings.length; ++i) {
const expression = watchExpressionStrings[i];
if (!expression)
continue;
this._createWatchExpression(expression);
}
return Promise.resolve();
}
/**
* @param {?string} expression
* @return {!Sources.WatchExpression}
*/
_createWatchExpression(expression) {
this._emptyElement.classList.add('hidden');
const watchExpression = new Sources.WatchExpression(expression, this._expandController, this._linkifier);
watchExpression.addEventListener(
Sources.WatchExpression.Events.ExpressionUpdated, this._watchExpressionUpdated, this);
this.contentElement.appendChild(watchExpression.element());
this._watchExpressions.push(watchExpression);
return watchExpression;
}
/**
* @param {!Common.Event} event
*/
_watchExpressionUpdated(event) {
const watchExpression = /** @type {!Sources.WatchExpression} */ (event.data);
if (!watchExpression.expression()) {
this._watchExpressions.remove(watchExpression);
this.contentElement.removeChild(watchExpression.element());
this._emptyElement.classList.toggle('hidden', !!this._watchExpressions.length);
}
this._saveExpressions();
}
/**
* @param {!Event} event
*/
_contextMenu(event) {
const contextMenu = new UI.ContextMenu(event);
this._populateContextMenu(contextMenu, event);
contextMenu.show();
}
/**
* @param {!UI.ContextMenu} contextMenu
* @param {!Event} event
*/
_populateContextMenu(contextMenu, event) {
let isEditing = false;
for (const watchExpression of this._watchExpressions)
isEditing |= watchExpression.isEditing();
if (!isEditing)
contextMenu.debugSection().appendItem(Common.UIString('Add watch expression'), this._addButtonClicked.bind(this));
if (this._watchExpressions.length > 1) {
contextMenu.debugSection().appendItem(
Common.UIString('Delete all watch expressions'), this._deleteAllButtonClicked.bind(this));
}
const target = event.deepElementFromPoint();
if (!target)
return;
for (const watchExpression of this._watchExpressions) {
if (watchExpression.element().isSelfOrAncestor(target))
watchExpression._populateContextMenu(contextMenu, event);
}
}
_deleteAllButtonClicked() {
this._watchExpressions = [];
this._saveExpressions();
this.update();
}
/**
* @param {string} expression
*/
_focusAndAddExpressionToWatch(expression) {
UI.viewManager.showView('sources.watch');
this.doUpdate();
this._addExpressionToWatch(expression);
}
/**
* @param {string} expression
*/
_addExpressionToWatch(expression) {
this._createWatchExpression(expression);
this._saveExpressions();
}
/**
* @override
* @param {!UI.Context} context
* @param {string} actionId
* @return {boolean}
*/
handleAction(context, actionId) {
const frame = UI.context.flavor(Sources.UISourceCodeFrame);
if (!frame)
return false;
const text = frame.textEditor.text(frame.textEditor.selection());
this._focusAndAddExpressionToWatch(text);
return true;
}
/**
* @param {!ObjectUI.ObjectPropertyTreeElement} target
*/
_addPropertyPathToWatch(target) {
this._addExpressionToWatch(target.path());
}
/**
* @override
* @param {!Event} event
* @param {!UI.ContextMenu} contextMenu
* @param {!Object} target
*/
appendApplicableItems(event, contextMenu, target) {
if (target instanceof ObjectUI.ObjectPropertyTreeElement && !target.property.synthetic) {
contextMenu.debugSection().appendItem(
ls`Add property path to watch`, this._addPropertyPathToWatch.bind(this, target));
}
const frame = UI.context.flavor(Sources.UISourceCodeFrame);
if (!frame || frame.textEditor.selection().isEmpty())
return;
contextMenu.debugSection().appendAction('sources.add-to-watch');
}
};
/**
* @unrestricted
*/
Sources.WatchExpression = class extends Common.Object {
/**
* @param {?string} expression
* @param {!ObjectUI.ObjectPropertiesSectionExpandController} expandController
* @param {!Components.Linkifier} linkifier
*/
constructor(expression, expandController, linkifier) {
super();
this._expression = expression;
this._expandController = expandController;
this._element = createElementWithClass('div', 'watch-expression monospace');
this._editing = false;
this._linkifier = linkifier;
this._createWatchExpression();
this.update();
}
/**
* @return {!Element}
*/
element() {
return this._element;
}
/**
* @return {?string}
*/
expression() {
return this._expression;
}
update() {
const currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
if (currentExecutionContext && this._expression) {
currentExecutionContext
.evaluate(
{
expression: this._expression,
objectGroup: Sources.WatchExpression._watchObjectGroupId,
includeCommandLineAPI: false,
silent: true,
returnByValue: false,
generatePreview: false
},
/* userGesture */ false,
/* awaitPromise */ false)
.then(result => this._createWatchExpression(result.object, result.exceptionDetails));
}
}
startEditing() {
this._editing = true;
this._element.removeChild(this._objectPresentationElement);
const newDiv = this._element.createChild('div');
newDiv.textContent = this._nameElement.textContent;
this._textPrompt = new ObjectUI.ObjectPropertyPrompt();
this._textPrompt.renderAsBlock();
const proxyElement = this._textPrompt.attachAndStartEditing(newDiv, this._finishEditing.bind(this));
proxyElement.classList.add('watch-expression-text-prompt-proxy');
proxyElement.addEventListener('keydown', this._promptKeyDown.bind(this), false);
this._element.getComponentSelection().selectAllChildren(newDiv);
}
/**
* @return {boolean}
*/
isEditing() {
return !!this._editing;
}
/**
* @param {!Event} event
* @param {boolean=} canceled
*/
_finishEditing(event, canceled) {
if (event)
event.consume(canceled);
this._editing = false;
this._textPrompt.detach();
const newExpression = canceled ? this._expression : this._textPrompt.text();
delete this._textPrompt;
this._element.removeChildren();
this._element.appendChild(this._objectPresentationElement);
this._updateExpression(newExpression);
}
/**
* @param {!Event} event
*/
_dblClickOnWatchExpression(event) {
event.consume();
if (!this.isEditing())
this.startEditing();
}
/**
* @param {?string} newExpression
*/
_updateExpression(newExpression) {
if (this._expression)
this._expandController.stopWatchSectionsWithId(this._expression);
this._expression = newExpression;
this.update();
this.dispatchEventToListeners(Sources.WatchExpression.Events.ExpressionUpdated, this);
}
/**
* @param {!Event} event
*/
_deleteWatchExpression(event) {
event.consume(true);
this._updateExpression(null);
}
/**
* @param {!SDK.RemoteObject=} result
* @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails
*/
_createWatchExpression(result, exceptionDetails) {
this._result = result || null;
const headerElement = createElementWithClass('div', 'watch-expression-header');
const deleteButton = UI.Icon.create('smallicon-cross', 'watch-expression-delete-button');
deleteButton.title = ls`Delete watch expression`;
deleteButton.addEventListener('click', this._deleteWatchExpression.bind(this), false);
headerElement.appendChild(deleteButton);
const titleElement = headerElement.createChild('div', 'watch-expression-title');
this._nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this._expression);
if (!!exceptionDetails || !result) {
this._valueElement = createElementWithClass('span', 'watch-expression-error value');
titleElement.classList.add('dimmed');
this._valueElement.textContent = Common.UIString('<not available>');
} else {
this._valueElement = ObjectUI.ObjectPropertiesSection.createValueElementWithCustomSupport(
result, !!exceptionDetails, false /* showPreview */, titleElement, this._linkifier);
}
const separatorElement = createElementWithClass('span', 'watch-expressions-separator');
separatorElement.textContent = ': ';
titleElement.appendChildren(this._nameElement, separatorElement, this._valueElement);
this._element.removeChildren();
this._objectPropertiesSection = null;
if (!exceptionDetails && result && result.hasChildren && !result.customPreview()) {
headerElement.classList.add('watch-expression-object-header');
this._objectPropertiesSection = new ObjectUI.ObjectPropertiesSection(result, headerElement, this._linkifier);
this._objectPresentationElement = this._objectPropertiesSection.element;
this._objectPresentationElement.classList.add('watch-expression-object');
this._expandController.watchSection(/** @type {string} */ (this._expression), this._objectPropertiesSection);
const objectTreeElement = this._objectPropertiesSection.objectTreeElement();
objectTreeElement.toggleOnClick = false;
objectTreeElement.listItemElement.addEventListener('click', this._onSectionClick.bind(this), false);
objectTreeElement.listItemElement.addEventListener('dblclick', this._dblClickOnWatchExpression.bind(this));
} else {
this._objectPresentationElement = headerElement;
this._objectPresentationElement.addEventListener('dblclick', this._dblClickOnWatchExpression.bind(this));
}
this._element.appendChild(this._objectPresentationElement);
}
/**
* @param {!Event} event
*/
_onSectionClick(event) {
event.consume(true);
if (event.detail === 1) {
this._preventClickTimeout = setTimeout(handleClick.bind(this), 333);
} else {
clearTimeout(this._preventClickTimeout);
delete this._preventClickTimeout;
}
/**
* @this {Sources.WatchExpression}
*/
function handleClick() {
if (!this._objectPropertiesSection)
return;
const objectTreeElement = this._objectPropertiesSection.objectTreeElement();
if (objectTreeElement.expanded)
objectTreeElement.collapse();
else
objectTreeElement.expand();
}
}
/**
* @param {!Event} event
*/
_promptKeyDown(event) {
if (isEnterKey(event) || isEscKey(event))
this._finishEditing(event, isEscKey(event));
}
/**
* @param {!UI.ContextMenu} contextMenu
* @param {!Event} event
*/
_populateContextMenu(contextMenu, event) {
if (!this.isEditing()) {
contextMenu.editSection().appendItem(
Common.UIString('Delete watch expression'), this._updateExpression.bind(this, null));
}
if (!this.isEditing() && this._result && (this._result.type === 'number' || this._result.type === 'string'))
contextMenu.clipboardSection().appendItem(Common.UIString('Copy value'), this._copyValueButtonClicked.bind(this));
const target = event.deepElementFromPoint();
if (target && this._valueElement.isSelfOrAncestor(target))
contextMenu.appendApplicableItems(this._result);
}
_copyValueButtonClicked() {
InspectorFrontendHost.copyText(this._valueElement.textContent);
}
};
Sources.WatchExpression._watchObjectGroupId = 'watch-group';
/** @enum {symbol} */
Sources.WatchExpression.Events = {
ExpressionUpdated: Symbol('ExpressionUpdated')
};
|
module.exports = {
tabWidth: 2,
semi: true,
singleQuote: true,
trailingComma: 'es5',
};
|
$(function(){
var pick = '#videoupload',
uploadUrl = $(pick).attr('data-url'),
beforeUrl = $(pick).attr('data-base'),
successUrl = $(pick).attr('data-success'),
GUID = WebUploader.Base.guid()
id = $(pick).attr("data-id");
/** 实现webupload hook,触发上传前,中,后的调用关键 **/
WebUploader.Uploader.register({
"before-send-file": "beforeSendFile", // 整个文件上传前
"before-send": "beforeSend", // 每个分片上传前
"after-send-file": "afterSendFile", // 分片上传完毕
}, {
beforeSendFile: function (file) {
var task = new $.Deferred();
$.ajax({
type: "POST",
url: beforeUrl, // 后台url地址
data: {
id: id,
guid:GUID,
size:file.size,
name:file.name
},
cache: false,
async: false, // 同步
timeout: 1000, //todo 超时的话,只能认为该文件不曾上传过
dataType: "json",
beforeSend: function(){
$("#progress").css({top:0,bottom:0});
$("#progress").show();
$("#videoupload").addClass("disabled").text("正在上传中");
}
}).then(function (data, textStatus, jqXHR) {
if (data.code == 1) { //若存在,这返回失败给WebUploader,表明该文件不需要上传
alreadyChunks = data.chunkList;
fileId = data.fileId;
filePath = data.filePath;
task.resolve();
// // 业务逻辑...
} else {
task.reject();
}
}, function (jqXHR, textStatus, errorThrown) { //任何形式的验证失败,都触发重新上传
task.reject();
});
return $.when(task);
}
, beforeSend: function (block) {
//分片验证是否已传过,用于断点续传
var task = new $.Deferred();
if($.inArray(block.chunk,alreadyChunks) >= 0){
task.reject();
}else{
task.resolve();
}
return $.when(task);
}
, afterSendFile: function (file) {
//合并请求
var task = new $.Deferred();
$.ajax({
type: "POST",
url: successUrl,
data: {
fileId: fileId,
filePath: filePath,
},
cache: false,
async: false, // 同步
dataType: "json"
}).then(function (data, textStatus, jqXHR) {
// 业务逻辑...
if(data.code == 1){
task.resolve();
}else{
task.reject();
}
}, function (jqXHR, textStatus, errorThrown) {
task.reject();
});
return $.when(task);
}
});
var uploader = new WebUploader.Uploader({
auto: true,
swf:'/webuploader/Uploader.swf',
// 文件接收服务端。
server: uploadUrl,
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: pick,
accept:{
extensions:'mp4',
},
chunked: true,//开启分片上传
chunkSize : 2*1024*1024,
threads: 1,//上传并发数
fileNumLimit:1,
fileSizeLimit:2*1024*1024*1024,
//由于Http的无状态特征,在往服务器发送数据过程传递一个进入当前页面是生成的GUID作为标示
formData: {guid:GUID,oid:id}
});
// 文件上传过程中创建进度条实时显示。
uploader.on('uploadProgress', function (file, percentage) {
var rate = percentage * 100 .toFixed(1);
$('#progress .bar').css('width', rate + '%');
});
// 文件上传成功处理。
uploader.on('uploadSuccess', function (file, response) {
$('#alert').html(alertSuccess("上传成功"));
});
// 文件上传失败处理。
uploader.on('uploadError', function (file) {
$('#alert').html(alertDanger('上传失败'));
});
// 长传完毕,不管成功失败都会调用该事件,主要用于关闭进度条
uploader.on('uploadComplete', function (file) {
$("#progress").hide();
$('#progress .bar').css('width', '0%');
setTimeout(function() {
$('.close').click();
window.location.reload();
},2000);
});
uploader.on('error',function(type){
if(type == 'Q_TYPE_DENIED'){
$('#alert').html(alertDanger('请上传mp4格式的视频'));
}else if(type == 'Q_EXCEED_SIZE_LIMIT'){
$('#alert').html(alertDanger('一次只能上传一个视频'));
}else if(type == 'Q_EXCEED_SIZE_LIMIT'){
$('#alert').html(alertDanger('视频大小不能超过2G'));
}
setTimeout(function() {
$('.close').click();
},3000);
})
});
|
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var __chunk_1 = require('../chunk-49d9503c.js');
var React = _interopDefault(require('react'));
require('@carbon/icon-helpers');
require('prop-types');
var Api32 =
/*#__PURE__*/
React.forwardRef(function Api32(props, ref) {
return React.createElement(__chunk_1.Icon, __chunk_1._extends({
width: 32,
height: 32,
viewBox: "0 0 32 32",
ref: ref
}, props), React.createElement("path", {
d: "M26 22a3.86 3.86 0 0 0-2 .57l-3.09-3.1a6 6 0 0 0 0-6.94L24 9.43a3.86 3.86 0 0 0 2 .57 4 4 0 1 0-4-4 3.86 3.86 0 0 0 .57 2l-3.1 3.09a6 6 0 0 0-6.94 0L9.43 8A3.86 3.86 0 0 0 10 6a4 4 0 1 0-4 4 3.86 3.86 0 0 0 2-.57l3.09 3.1a6 6 0 0 0 0 6.94L8 22.57A3.86 3.86 0 0 0 6 22a4 4 0 1 0 4 4 3.86 3.86 0 0 0-.57-2l3.1-3.09a6 6 0 0 0 6.94 0l3.1 3.09a3.86 3.86 0 0 0-.57 2 4 4 0 1 0 4-4zm0-18a2 2 0 1 1-2 2 2 2 0 0 1 2-2zM4 6a2 2 0 1 1 2 2 2 2 0 0 1-2-2zm2 22a2 2 0 1 1 2-2 2 2 0 0 1-2 2zm10-8a4 4 0 1 1 4-4 4 4 0 0 1-4 4zm10 8a2 2 0 1 1 2-2 2 2 0 0 1-2 2z"
}), props.children);
});
module.exports = Api32;
|
// Size of canvas. These get updated to fill the whole browser.
let width = 150;
let height = 150;
var count = 0;
const numBoids = 100;
const visualRange = 75;
var boids = [];
var terrain = [];
var active = false;
var currentX;
var currentY;
var initialX;
var initialY;
var xOffset = 0;
var yOffset = 0;
var headerOffset = 100;
function dragStart(e) {
if (e.type === "touchstart") {
initialX = e.touches[0].clientX;
initialY = e.touches[0].clientY;
addBoid('blue');
} else {
//addBoid('green');
initialX = e.clientX;
initialY = e.clientY;
addBoid('white');
}
document.getElementById('output').innerHTML = initialX;
document.getElementById('output2').innerHTML = initialY;
for(let rect of terrain){
if(initialX < rect.x + rect.width && initialX > rect.x && initialY < rect.y + rect.height && initialY > rect.y){
addBoid('orange');
}
}
active = true;
}
function dragEnd(e) {
initialX = currentX;
initialY = currentY;
addBoid('black');
active = false;
}
function drag(e){
// if(e.clientX < rect.x + rect.width && e.clientX > rect.x && e.clientY < rect.y + rect.height && e.clientY > rect.y){
// addBoid('white');
// }
// //addBoid('green');
if (active){
e.preventDefault();
//addBoid('green');
if(e.type === "touchmove"){
// something soon
deltaX = e.clientX[0] - initialX;
deltaY = e.clientY[0] - initialY;
hldX = e.clientX[0];
hldY = e.clientY[0];
addBoid('grey');
} else {
deltaX = e.clientX - initialX;
deltaY = e.clientY - initialY;
hldX = e.clientX;
hldY = e.clientY;
}
//something
for(let rect of terrain){
addBoid('green');
//addBoid('green');
if(hldX < rect.x + rect.width && hldX > rect.x && hldY - headerOffset < rect.y + rect.height && hldY - headerOffset > rect.y){
//addBoid('green');
rect.x += deltaX;
rect.y += deltaY;
//document.getElementById('output').innerHTML = e.clientX;
addBoid("purple");
}
}
initialX = hldX;
initialY = hldY;
yOffset = currentX;
yOffset = currentY;
}
}
function addRectangle(xPos,yPos,wid,heig,col){
terrain.push({
x : xPos,
y : yPos,
width : wid,
height : heig,
color : col,
});
}
function addBoid(col){
boids.push({
x: Math.random() * 10 + 500,
y: Math.random() * 10 + 700,
dx: Math.random() * 10 - 5,
dy: Math.random() * 10 - 5,
history: [],
color: col,
});
}
function addBoid2(e){
addBoid('red');
}
function boidTeam(num,col){
for(var i = 0; i < num; i +=1){
addBoid(col);
}
}
function initBoids(color) {
for (var i = 0; i < numBoids; i += 1) {
boids[boids.length] = {
x: Math.random() * width,
y: Math.random() * height,
dx: Math.random() * 10 - 5,
dy: Math.random() * 10 - 5,
history: [],
color: color,
};
}
}
function distance(boid1, boid2) {
return Math.sqrt(
(boid1.x - boid2.x) * (boid1.x - boid2.x) +
(boid1.y - boid2.y) * (boid1.y - boid2.y),
);
}
// TODO: This is naive and inefficient.
function nClosestBoids(boid, n) {
// Make a copy
const sorted = boids.slice();
// Sort the copy by distance from `boid`
sorted.sort((a, b) => distance(boid, a) - distance(boid, b));
// Return the `n` closest
return sorted.slice(1, n + 1);
}
// Called initially and whenever the window resizes to update the canvas
// size and width/height variables.
function sizeCanvas() {
const canvas = document.getElementById("boids");
//document.write(canvas)
width = window.innerWidth;
height = window.innerHeight;
canvas.width = width;
canvas.height = height;
}
function collisionDect(boid){
for(let rect of terrain){
if(boid.x < rect.x + rect.width &&
boid.x > rect.x &&
boid.y < rect.y + rect.height &&
boid.y > rect.y){
boid.color = 'green';
//addBoid('orange');
//rect.x += 100;
const index = boids.indexOf(boid);
if(index > -1){
boids.splice(index,1);
}
}
}
}
// Constrain a boid to within the window. If it gets too close to an edge,
// nudge it back in and reverse its direction.
function keepWithinBounds(boid) {
const margin = 200;
const turnFactor = 1;
if (boid.x < margin) {
boid.dx += turnFactor;
}
if (boid.x > width - margin) {
boid.dx -= turnFactor;
}
if (boid.y < margin) {
boid.dy += turnFactor;
}
if (boid.y > height - margin) {
boid.dy -= turnFactor;
}
}
// Find the center of mass of the other boids and adjust velocity slightly to
// point towards the center of mass.
function flyTowardsCenter(boid) {
const centeringFactor = 0.005; // adjust velocity by this %
let centerX = 0;
let centerY = 0;
let numNeighbors = 0;
for (let otherBoid of boids) {
if(otherBoid.color == boid.color){
if (distance(boid, otherBoid) < visualRange) {
centerX += otherBoid.x;
centerY += otherBoid.y;
numNeighbors += 1;
}
}
}
if (numNeighbors) {
centerX = centerX / numNeighbors;
centerY = centerY / numNeighbors;
boid.dx += (centerX - boid.x) * centeringFactor;
boid.dy += (centerY - boid.y) * centeringFactor;
}
}
// Move away from other boids that are too close to avoid colliding
function avoidOthers(boid) {
const minDistance = 20; // The distance to stay away from other boids
const avoidFactor = 0.05; // Adjust velocity by this %
let moveX = 0;
let moveY = 0;
for (let otherBoid of boids) {
if(otherBoid.color == boid.color){
if (otherBoid !== boid) {
if (distance(boid, otherBoid) < minDistance) {
moveX += boid.x - otherBoid.x;
moveY += boid.y - otherBoid.y;
}
}
}
}
boid.dx += moveX * avoidFactor;
boid.dy += moveY * avoidFactor;
}
// Find the average velocity (speed and direction) of the other boids and
// adjust velocity slightly to match.
function matchVelocity(boid) {
const matchingFactor = 0.05; // Adjust by this % of average velocity
let avgDX = 0;
let avgDY = 0;
let numNeighbors = 0;
for (let otherBoid of boids) {
if(otherBoid.color == boid.color){
if (distance(boid, otherBoid) < visualRange) {
avgDX += otherBoid.dx;
avgDY += otherBoid.dy;
numNeighbors += 1;
}
}
}
if (numNeighbors) {
avgDX = avgDX / numNeighbors;
avgDY = avgDY / numNeighbors;
boid.dx += (avgDX - boid.dx) * matchingFactor;
boid.dy += (avgDY - boid.dy) * matchingFactor;
}
}
// Speed will naturally vary in flocking behavior, but real animals can't go
// arbitrarily fast.
function limitSpeed(boid) {
const speedLimit = 15;
const speed = Math.sqrt(boid.dx * boid.dx + boid.dy * boid.dy);
if (speed > speedLimit) {
boid.dx = (boid.dx / speed) * speedLimit;
boid.dy = (boid.dy / speed) * speedLimit;
}
}
const DRAW_TRAIL = false;
function drawBoid(ctx, boid) {
const angle = Math.atan2(boid.dy, boid.dx);
ctx.translate(boid.x, boid.y);
ctx.rotate(angle);
ctx.translate(-boid.x, -boid.y);
//ctx.fillStyle = "#558cf4";
ctx.fillStyle = boid.color;
ctx.beginPath();
ctx.moveTo(boid.x, boid.y);
ctx.lineTo(boid.x - 15, boid.y + 5);
ctx.lineTo(boid.x - 15, boid.y - 5);
ctx.lineTo(boid.x, boid.y);
ctx.fill();
ctx.setTransform(1, 0, 0, 1, 0, 0);
if (DRAW_TRAIL) {
ctx.strokeStyle = "#558cf466";
ctx.beginPath();
ctx.moveTo(boid.history[0][0], boid.history[0][1]);
for (const point of boid.history) {
ctx.lineTo(point[0], point[1]);
}
ctx.stroke();
}
}
function drawRectangle(ctx,rect){
ctx.beginPath();
//ctx.fillStyle('green');
//ctx.rect(rect.x, rect.y, rect.width, rect.height);
ctx.fillStyle = rect.color;
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
//ctx.fillRect(20, 20, 150, 100);
//ctx.fill(rect.color)
ctx.stroke();
}
// Main animation loop
function animationLoop() {
//document.getElementById("clicker").innerHTML = width.toString();
//count += 1;
// Update each boid
for (let boid of boids) {
// Update the velocities according to each rule
flyTowardsCenter(boid);
avoidOthers(boid);
matchVelocity(boid);
limitSpeed(boid);
keepWithinBounds(boid);
collisionDect(boid);
// Update the position based on the current velocity
boid.x += boid.dx;
boid.y += boid.dy;
boid.history.push([boid.x, boid.y])
boid.history = boid.history.slice(-50);
}
// Clear the canvas and redraw all the boids in their current positions
const ctx = document.getElementById("boids").getContext("2d");
ctx.clearRect(0, 0, width, height);
for (let boid of boids) {
drawBoid(ctx, boid);
}
for (let rect of terrain){
drawRectangle(ctx,rect);
}
// Schedule the next frame
window.requestAnimationFrame(animationLoop);
}
//New stuffs
function myFunction() {
//document.getElementById("demo").innerHTML = "YOU CLICKED ME!";
}
function clickerAdd(){
count += 1;
//document.getElementById("clicker").innerHTML = count.toString();
}
//End
window.onload = () => {
//document.getElementById("demo").onclick = function() {addBoid('green')};
document.getElementById("dump").onclick = function() {boidTeam(20,'blue')};
//document.getElementById("clicker").onclick = function() {clickerAdd()};
//document.getElementById("clicker").innerHTML = 'test';
document.getElementById('output').innerHTML = 'ending';
//document.addEventListener("mousedown",addBoid2, false);
document.addEventListener("touchstart", dragStart, false);
document.addEventListener("touchend", dragEnd, false);
document.addEventListener("touchmove", drag, false);
document.addEventListener("mousedown", dragStart, false);
document.addEventListener("mouseup", dragEnd, false);
document.addEventListener("mousemove", drag, false);
//count += 1;
// Make sure the canvas always fills the whole window
window.addEventListener("resize", sizeCanvas, false);
sizeCanvas();
// Randomly distribute the boids to start
initBoids("red");
addRectangle(700,50,150,300,"blue")
addRectangle(100,0,150,300,"blue")
// Schedule the main animation loop
window.requestAnimationFrame(animationLoop);
};
|
"use strict";
/** @type {import('@adonisjs/framework/src/Hash')} */
const Hash = use("Hash");
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use("Model");
class User extends Model {
static boot() {
super.boot();
/**
* A hook to hash the user password before saving
* it to the database.
*/
this.addHook("beforeSave", async (userInstance) => {
if (userInstance.dirty.password) {
userInstance.password = await Hash.make(userInstance.password);
}
});
}
/**
* A relationship on tokens is required for auth to
* work. Since features like `refreshTokens` or
* `rememberToken` will be saved inside the
* tokens table.
*
* @method tokens
*
* @return {Object}
*/
tokens() {
return this.hasMany("App/Models/Token");
}
contacts() {
return this.hasMany("App/Models/Contact");
}
}
module.exports = User;
|
describe('loader-map for combo', function () {
var S = KISSY;
it('use map to modify single url', function () {
var url = '';
KISSY.config({
packages: {
a: {
base: window['PACKAGE_LOADER_MAP_COMBO_A_PATH'] || '../specs/loader-map'
}
},
map: [
[/(.+)a\/a.js(.+)$/, function (m, m1, m2) {
url = m;
return m1 + 'a/1.0/a.js' + m2;
}]
]
});
var ret = 0;
S.use('a/a,a/b', function (S, a, b) {
expect(a).toBe(1);
expect(b).toBe(2);
ret = 1;
});
waitsFor(function () {
return ret;
});
runs(function () {
expect(url.indexOf('src/seed/tests/specs/loader-map/a/a.js?t=') != -1)
.toBeTruthy();
});
});
});
|
import React, { useState, useEffect } from 'react'
import { Table } from 'reactstrap';
import axiosWithAuth from '../utils/axiosWithAuth';
import NewComments from './NewComments'
import { Link } from 'react-router-dom'
import { Button } from 'reactstrap'
import {connect} from "react-redux";
import {getAllTickets} from "../actions";
const TicketList = (props) => {
const [tickets, setTickets] = useState([])
console.log('TICKES: ', tickets)
const getTickets = () => {
axiosWithAuth()
.get('/tickets')
.then(response => {
setTickets(response.data)
console.log('RESPONSE FOR TICKETS: ', response)
})
.catch(error => {
console.log('ERROR: ', error)
})
}
useEffect(getTickets, [])
return(
<Table>
<thead>
<tr>
<th>Ticket ID</th>
<th>Category</th>
<th>Title</th>
<th>Description</th>
<th>Steps Taken</th>
<th>Creator</th>
<th>Status</th>
<th>Comments</th>
</tr>
</thead>
{tickets.map(ticket => {
return(
<tbody>
<tr>
<th scope="row">{ticket.id}</th>
<td>{ticket.category}</td>
<td>{ticket.title}</td>
<td>{ticket.description}</td>
<td>{ticket.steps_taken}</td>
<td>{ticket.creator_id}</td>
<td>{ticket.status}</td>
<td>
<Button tag={Link} to={`/new_comments/${ticket.id}/${ticket.creator_id}`}>New</Button>
<Button tag={Link} to={`/view_comments/${ticket.id}/${ticket.creator_id}`}>View</Button>
</td>
</tr>
</tbody>
)
})}
</Table>
)
}
const mapStateToProps = (state) => {
return{
tickets: state.tickets
}
}
export default connect(
mapStateToProps,
{getAllTickets}
) (TicketList)
|
'use strict'; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
const chalk = require('chalk'); // eslint-disable-next-line import/default
const stringLength = require('string-length');
const scroll = require('./lib/scrollList');var _require =
require('./lib/terminalUtils');const getTerminalWidth = _require.getTerminalWidth;
const highlight = require('./lib/highlight');var _require2 =
require('./reporters/utils');const trimAndFormatPath = _require2.trimAndFormatPath;
const Prompt = require('./lib/Prompt');var _require3 =
require('./lib/patternModeHelpers');const formatTypeaheadSelection = _require3.formatTypeaheadSelection,printMore = _require3.printMore,printPatternCaret = _require3.printPatternCaret,printPatternMatches = _require3.printPatternMatches,printRestoredPatternCaret = _require3.printRestoredPatternCaret,printStartTyping = _require3.printStartTyping,printTypeaheadItem = _require3.printTypeaheadItem;
const PatternPrompt = require('./PatternPrompt');
module.exports = class TestPathPatternPrompt extends PatternPrompt {
constructor(pipe, prompt) {
super(pipe, prompt);
this._entityName = 'filenames';
}
_onChange(pattern, options) {
super._onChange(pattern, options);
this._printTypeahead(pattern, options);
}
_printTypeahead(pattern, options) {
const matchedTests = this._getMatchedTests(pattern);
const total = matchedTests.length;
const pipe = this._pipe;
const prompt = this._prompt;
printPatternCaret(pattern, pipe);
if (pattern) {
printPatternMatches(total, 'file', pipe);
const prefix = ` ${chalk.dim('\u203A')} `;
const padding = stringLength(prefix) + 2;
const width = getTerminalWidth();var _scroll =
scroll(total, options);const start = _scroll.start,end = _scroll.end,index = _scroll.index;
prompt.setTypeaheadLength(total);
matchedTests.
slice(start, end).
map((_ref) => {let path = _ref.path,context = _ref.context;
const filePath = trimAndFormatPath(
padding,
context.config,
path,
width);
return highlight(path, filePath, pattern, context.config.rootDir);
}).
map((item, i) => formatTypeaheadSelection(item, i, index, prompt)).
forEach(item => printTypeaheadItem(item, pipe));
if (total > end) {
printMore('file', pipe, total - end);
}
} else {
printStartTyping('filename', pipe);
}
printRestoredPatternCaret(pattern, this._currentUsageRows, pipe);
}
_getMatchedTests(pattern) {
let regex;
try {
regex = new RegExp(pattern, 'i');
} catch (e) {}
let tests = [];
if (regex) {
this._searchSources.forEach((_ref2) => {let searchSource = _ref2.searchSource,context = _ref2.context;
tests = tests.concat(searchSource.findMatchingTests(pattern).tests);
});
}
return tests;
}
updateSearchSources(searchSources) {
this._searchSources = searchSources;
}};
|
/**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.1.0
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2013-12-27
*/
!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/I18n",l="moxie/core/utils/Mime",d="moxie/core/utils/Env",f="moxie/core/utils/Dom",p="moxie/core/Exceptions",h="moxie/core/EventTarget",m="moxie/core/utils/Encode",g="moxie/runtime/Runtime",v="moxie/runtime/RuntimeClient",y="moxie/file/Blob",w="moxie/file/File",E="moxie/file/FileInput",_="moxie/file/FileDrop",x="moxie/runtime/RuntimeTarget",R="moxie/file/FileReader",b="moxie/core/utils/Url",T="moxie/file/FileReaderSync",S="moxie/xhr/FormData",A="moxie/xhr/XMLHttpRequest",O="moxie/runtime/Transporter",I="moxie/image/Image",D="moxie/runtime/html5/Runtime",N="moxie/runtime/html5/file/Blob",L="moxie/core/utils/Events",M="moxie/runtime/html5/file/FileInput",C="moxie/runtime/html5/file/FileDrop",F="moxie/runtime/html5/file/FileReader",H="moxie/runtime/html5/xhr/XMLHttpRequest",P="moxie/runtime/html5/utils/BinaryReader",k="moxie/runtime/html5/image/JPEGHeaders",U="moxie/runtime/html5/image/ExifParser",B="moxie/runtime/html5/image/JPEG",z="moxie/runtime/html5/image/PNG",G="moxie/runtime/html5/image/ImageInfo",q="moxie/runtime/html5/image/MegaPixel",X="moxie/runtime/html5/image/Image",j="moxie/runtime/flash/Runtime",V="moxie/runtime/flash/file/Blob",W="moxie/runtime/flash/file/FileInput",Y="moxie/runtime/flash/file/FileReader",$="moxie/runtime/flash/file/FileReaderSync",J="moxie/runtime/flash/xhr/XMLHttpRequest",Z="moxie/runtime/flash/runtime/Transporter",K="moxie/runtime/flash/image/Image",Q="moxie/runtime/silverlight/Runtime",et="moxie/runtime/silverlight/file/Blob",tt="moxie/runtime/silverlight/file/FileInput",nt="moxie/runtime/silverlight/file/FileDrop",it="moxie/runtime/silverlight/file/FileReader",rt="moxie/runtime/silverlight/file/FileReaderSync",ot="moxie/runtime/silverlight/xhr/XMLHttpRequest",at="moxie/runtime/silverlight/runtime/Transporter",st="moxie/runtime/silverlight/image/Image",ut="moxie/runtime/html4/Runtime",ct="moxie/runtime/html4/file/FileInput",lt="moxie/runtime/html4/file/FileReader",dt="moxie/runtime/html4/xhr/XMLHttpRequest",ft="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(a,s){s>0&&n(a,function(n,a){n!==r&&(e(i[a])===e(n)&&~o(e(n),["array","object"])?t(i[a],n):i[a]=n)})}),i},n=function(e,t){var n,i,r,o;if(e){try{n=e.length}catch(a){n=o}if(n===o){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;n>r;r++)if(t(e[r],r)===!1)return}},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},a=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===o(t[r],n)&&i.push(t[r]);return i.length?i:!1},s=function(e,t){var i=[];return n(e,function(e){-1!==o(e,t)&&i.push(e)}),i.length?i:null},u=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},c=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),l=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},d=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),e};return{guid:c,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inArray:o,arrayDiff:a,arrayIntersect:s,toArray:u,trim:l,parseSizeStr:d}}),i(c,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(e){var t=[].slice.call(arguments,1);return e.replace(/%[a-z]/g,function(){return t.shift()||""})}}}),i(l,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]])-1===e.inArray(s,u)&&u.push(s);else{if(!n||!/^\w+$/.test(r[a]))return[];u.push("."+r[a])}}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(d,[u],function(e){function t(e,t,n){var i=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),i=0;r>i;i++)if(e[i]!=t[i]){if(e[i]=u(e[i]),t[i]=u(t[i]),e[i]<t[i]){o=-1;break}if(e[i]>t[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",f="architecture",p="console",h="mobile",m="tablet",g={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},v={rgx:function(){for(var t,n=0,a,s,u,c,l,d,f=arguments;n<f.length;n+=2){var p=f[n],h=f[n+1];if(typeof t===r){t={};for(u in h)c=h[u],typeof c===o?t[c[0]]=e:t[c]=e}for(a=s=0;a<p.length;a++)if(l=p[a].exec(this.getUA())){for(u=0;u<h.length;u++)d=l[++s],c=h[u],typeof c===o&&c.length>0?2==c.length?t[c[0]]=typeof c[1]==i?c[1].call(this,d):c[1]:3==c.length?t[c[0]]=typeof c[1]!==i||c[1].exec&&c[1].test?d?d.replace(c[1],c[2]):e:d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a<i[r].length;a++)if(g.has(i[r][a],t))return r===n?e:r}else if(g.has(i[r],t))return r===n?e:r;return t}},y={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},w={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],[u,d,a],[/\s(opr)\/((\d+)?[\w\.]+)/i],[[u,"Opera"],d,a],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],[u,d,a],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[[u,"IE"],d,a],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[u,"Yandex"],d,a],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[[u,/_/g," "],d,a],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[u,d,a],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[u,"Dolphin"],d,a],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[u,"Chrome"],d,a],[/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i],[[u,"Android Browser"],d,a],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[d,a,[u,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[d,a,u],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[u,[a,v.str,y.browser.oldsafari.major],[d,v.str,y.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],[u,d,a],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[u,"Netscape"],d,a],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[u,d,a]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]+).*(gecko)/i],[d,u]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[d,v.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[d,v.str,y.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],d],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[u,d],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[u,"Symbian"],d],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],d],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[u,d],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(sunos)\s?([\w\.]+\d)*/i],[[u,"Solaris"],d],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[u,d],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[u,"iOS"],[d,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[u,[d,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],[u,d]]},E=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return v.rgx.apply(this,w.browser)},this.getEngine=function(){return v.rgx.apply(this,w.engine)},this.getOS=function(){return v.rgx.apply(this,w.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this.setUA(n)};return(new E).getResult()}(),i=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==r.browser||r.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r={can:i,browser:n.browser.name,version:parseFloat(n.browser.major),os:n.os.name,osVersion:n.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return r.OS=r.os,r}),i(f,[d],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(p,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(h,[p,u],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){this.uid||(this.uid=t.guid("uid_"))},addEventListener:function(e,i,r,o){var a=this,s;return e=t.trim(e),/\s/.test(e)?(t.each(e.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}),void 0):(e=e.toLowerCase(),r=parseInt(r,10)||0,s=n[this.uid]&&n[this.uid][e]||[],s.push({fn:i,priority:r,scope:o||this}),n[this.uid]||(n[this.uid]={}),n[this.uid][e]=s,void 0)},hasEventListener:function(e){return e?!(!n[this.uid]||!n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,i){e=e.toLowerCase();var r=n[this.uid]&&n[this.uid][e],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete n[this.uid][e],t.isEmptyObj(n[this.uid])&&delete n[this.uid])}},removeAllEventListeners:function(){n[this.uid]&&delete n[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={},c=!0,l;if("string"!==t.typeOf(i)){if(s=i,"string"!==t.typeOf(s.type))throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=n[r]&&n[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var d=[];t.each(o,function(e){a[0].target=e.scope,u.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&t.inSeries(d,function(e){c=!e})}return c},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;"array"!==t.typeOf(e)&&(e=[e]);for(var i=0;i<e.length;i++)n="on"+e[i],"function"===t.typeOf(this[n])?this.addEventListener(e[i],this[n]):"undefined"===t.typeOf(this[n])&&(this[n]=null)}})}return n.instance=new n,n}),i(m,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(f++)),u=i.indexOf(e.charAt(f++)),c=i.indexOf(e.charAt(f++)),l=i.indexOf(e.charAt(f++)),d=s<<18|u<<12|c<<6|l,r=255&d>>16,o=255&d>>8,a=255&d,m[p++]=64==c?String.fromCharCode(r):64==l?String.fromCharCode(r,o):String.fromCharCode(r,o,a);while(f<e.length);return h=m.join(""),n?t(h):h},i=function(t,n){if(n&&e(t),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!t)return t;do r=t.charCodeAt(f++),o=t.charCodeAt(f++),a=t.charCodeAt(f++),d=r<<16|o<<8|a,s=63&d>>18,u=63&d>>12,c=63&d>>6,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(f<t.length);h=m.join("");var g=t.length%3;return(g?h.slice(0,g-3):h)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(g,[u,f,h],function(e,t,n){function i(n,r,a,s,u){var c=this,l,d=e.guid(r+"_"),f=u||"browser";n=n||{},o[d]=this,a=e.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},a),n.preferred_caps&&(f=i.getMode(s,n.preferred_caps,f)),l=function(){var t={};return{exec:function(e,n,i,r){return l[n]&&(t[e]||(t[e]={context:this,instance:new l[n]}),t[e].instance[i])?t[e].instance[i].apply(this,r):void 0},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,i){"function"===e.typeOf(t.instance.destroy)&&t.instance.destroy.call(t.context),n.removeInstance(i)})}}}(),e.extend(this,{initialized:!1,uid:d,type:r,mode:i.getMode(s,n.required_caps,f),shimid:d+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||a;if("string"===e.typeOf(t)&&"undefined"===e.typeOf(n)&&(t=i.parseCaps(t)),"object"===e.typeOf(t)){for(var o in t)if(!this.can(o,t[o],r))return!1;return!0}return"function"===e.typeOf(r[t])?r[t].call(this,n):n===r[t]},getShimContainer:function(){var n,i=t.get(this.shimid);return i||(n=this.options.container?t.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,e.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),n.appendChild(i),n=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=t.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete o[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&n.required_caps&&!this.can(n.required_caps)&&(this.mode=!1)}var r={},o={};return i.order="html5,flash,silverlight,html4",i.getRuntime=function(e){return o[e]?o[e]:!1},i.addConstructor=function(e,t){t.prototype=n.instance,r[e]=t},i.getConstructor=function(e){return r[e]||null},i.getInfo=function(e){var t=i.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},i.parseCaps=function(t){var n={};return"string"!==e.typeOf(t)?t||{}:(e.each(t.split(","),function(e){n[e]=!0}),n)},i.can=function(e,t){var n,r=i.getConstructor(e),o;return r?(n=new r({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},i.thatCan=function(e,t){var n=(t||i.order).split(/\s*,\s*/);for(var r in n)if(i.can(n[r],e))return n[r];return null},i.getMode=function(t,n,i){var r=null;if("undefined"===e.typeOf(i)&&(i="browser"),n&&!e.isEmptyObj(t)){if(e.each(n,function(n,i){if(t.hasOwnProperty(i)){var o=t[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=e.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==e.inArray(i,r)?i:r[0];if(r===!1)return!1}return i},i.capTrue=function(){return!0},i.capFalse=function(){return!1},i.capTest=function(e){return function(){return!!e}},i}),i(v,[p,u,g],function(e,t,n){return function i(){var i;t.extend(this,{connectRuntime:function(r){function o(t){var s,u;return t.length?(s=t.shift(),(u=n.getConstructor(s))?(i=new u(r),i.bind("Init",function(){i.initialized=!0,setTimeout(function(){i.clients++,a.trigger("RuntimeInit",i)},1)}),i.bind("Error",function(){i.destroy(),o(t)}),i.mode?(i.init(),void 0):(i.trigger("Error"),void 0)):(o(t),void 0)):(a.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)),i=null,void 0)}var a=this,s;if("string"===t.typeOf(r)?s=r:"string"===t.typeOf(r.ruid)&&(s=r.ruid),s){if(i=n.getRuntime(s))return i.clients++,i;throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){return i&&i.uid?i:(i=null,null)},disconnectRuntime:function(){i&&--i.clients<=0&&(i.destroy(),i=null)}})}}),i(y,[u,m,v],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy",r[this.uid]),this.disconnectRuntime(),this.ruid=null),e=e||"";var n=e.match(/^data:([^;]*);base64,/);n&&(this.type=n[1],e=t.atob(e.substring(e.indexOf("base64,")+7))),this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(w,[u,l,y],function(e,t,n){function i(i,r){var o,a;if(r||(r={}),a=r.type&&""!==r.type?r.type:t.getFileMime(r.name),r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else{var s=a.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[a]&&(o+="."+t.extensions[a][0])}n.apply(this,arguments),e.extend(this,{type:a||"",name:o||e.guid("file_"),lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(E,[u,l,f,p,h,c,w,g,v],function(e,t,n,i,r,o,a,s,u){function c(r){var c=this,d,f,p;if(-1!==e.inArray(e.typeOf(r),["string","node"])&&(r={browse_button:r}),f=n.get(r.browse_button),!f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);p={accept:[{title:o.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:f.parentNode||document.body},r=e.extend({},p,r),"string"==typeof r.required_caps&&(r.required_caps=s.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=t.mimes2extList(r.accept)),d=n.get(r.container),d||(d=document.body),"static"===n.getStyle(d,"position")&&(d.style.position="relative"),d=f=null,u.call(c),e.extend(c,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){c.convertEventPropsToHandlers(l),c.bind("RuntimeInit",function(t,i){c.ruid=i.uid,c.shimid=i.shimid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Change",function(){var t=i.exec.call(c,"FileInput","getFiles");c.files=[],e.each(t,function(e){return 0===e.size?!0:(c.files.push(new a(c.ruid,e)),void 0)})},999),c.bind("Refresh",function(){var t,o,a,s;a=n.get(r.browse_button),s=n.get(i.shimid),a&&(t=n.getPos(a,n.get(r.container)),o=n.getSize(a),s&&e.extend(s.style,{top:t.y+"px",left:t.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),i.exec.call(c,"FileInput","init",r)}),c.connectRuntime(e.extend({},r,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){c.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null}})}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=r.instance,c}),i(_,[c,f,p,u,w,v,h,l],function(e,t,n,i,r,o,a,s){function u(n){var a=this,u;"string"==typeof n&&(n={drop_zone:n}),u={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},u,n):u,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=s.mimes2extList(n.accept)),o.call(a),i.extend(a,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){a.convertEventPropsToHandlers(c),a.bind("RuntimeInit",function(e,t){a.ruid=t.uid,a.bind("Drop",function(){var e=t.exec.call(a,"FileDrop","getFiles");a.files=[],i.each(e,function(e){a.files.push(new r(a.ruid,e))})},999),t.exec.call(a,"FileDrop","init",n),a.dispatchEvent("ready")}),a.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null}})}var c=["ready","dragenter","dragleave","drop","error"];return u.prototype=a.instance,u}),i(x,[u,v,h],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(R,[u,m,p,h,y,w,x],function(e,t,n,i,r,o,a){function s(){function i(e,i){function l(e){o.readyState=s.DONE,o.error=e,o.trigger("error"),d()}function d(){c.destroy(),c=null,o.trigger("loadend")}function f(t){c.bind("Error",function(e,t){l(t)}),c.bind("Progress",function(e){o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e)}),c.bind("Load",function(e){o.readyState=s.DONE,o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e),d()}),t.exec.call(c,"FileReader","read",e,i)}if(c=new a,this.convertEventPropsToHandlers(u),this.readyState===s.LOADING)return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR));if(this.readyState=s.LOADING,this.trigger("loadstart"),i instanceof r)if(i.isDetached()){var p=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(p)}this.readyState=s.DONE,this.trigger("load"),d()}else f(c.connectRuntime(i.ruid));else l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}var o=this,c;e.extend(this,{uid:e.guid("uid_"),readyState:s.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[s.EMPTY,s.DONE])&&(this.readyState===s.LOADING&&(this.readyState=s.DONE),c&&c.getRuntime().exec.call(this,"FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))
},destroy:function(){this.abort(),c&&(c.getRuntime().exec.call(this,"FileReader","destroy"),c.disconnectRuntime()),o=c=null}})}var u=["loadstart","progress","load","abort","error","loadend"];return s.EMPTY=0,s.LOADING=1,s.DONE=2,s.prototype=i.instance,s}),i(b,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,/(\/|\/[^\.]+)$/.test(c)?c+="/":c=c.replace(/\/[^\/]+$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i=e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(T,[u,v,m],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(S,[p,u,y],function(e,t,n){function i(){var e,i=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):i.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(i,function(e){n(e.value,e.name)}),e&&n(e.value,e.name)},destroy:function(){e=null,i=[]}})}return i}),i(A,[u,p,h,m,b,g,x,y,T,S,d,l],function(e,t,n,i,r,o,a,s,u,c,l,d){function f(){this.uid=e.guid("uid_")}function p(){function n(e,t){return y.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?y[e]:v[e]:(l.can("define_property")?y[e]=t:v[e]=t,void 0):void 0}function u(t){function i(){k.destroy(),k=null,s.dispatchEvent("loadend"),s=null}function r(r){k.bind("LoadStart",function(e){n("readyState",p.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),I&&s.upload.dispatchEvent(e)}),k.bind("Progress",function(e){n("readyState")!==p.LOADING&&(n("readyState",p.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),k.bind("UploadProgress",function(e){I&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),k.bind("Load",function(t){n("readyState",p.DONE),n("status",Number(r.exec.call(k,"XMLHttpRequest","getStatus")||0)),n("statusText",h[n("status")]||""),n("response",r.exec.call(k,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),U=r.exec.call(k,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(I&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),k.bind("Abort",function(e){s.dispatchEvent(e),i()}),k.bind("Error",function(e){N=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(k,"XMLHttpRequest","send",{url:E,method:_,async:w,user:R,password:b,headers:x,mimeType:S,encoding:T,responseType:s.responseType,withCredentials:s.withCredentials,options:P},t)}var s=this;M=(new Date).getTime(),k=new a,"string"==typeof P.required_caps&&(P.required_caps=o.parseCaps(P.required_caps)),P.required_caps=e.extend({},P.required_caps,{return_response_type:s.responseType}),t instanceof c&&(P.required_caps.send_multipart=!0),L||(P.required_caps.do_cors=!0),P.ruid?r(k.connectRuntime(P)):(k.bind("RuntimeInit",function(e,t){r(t)}),k.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),k.connectRuntime(P))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),M=C=null}var v=this,y={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},w=!0,E,_,x={},R,b,T=null,S=null,A=!1,O=!1,I=!1,D=!1,N=!1,L=!1,M,C,F=null,H=null,P={},k,U="",B;e.extend(this,y,{uid:e.guid("uid_"),upload:new f,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(_=o.toUpperCase()),~e.inArray(_,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),L=r.hasSameOrigin(l),E=r.resolveUrl(a),(u||c)&&!L)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(R=u||l.user,b=c||l.pass,w=s||!0,w===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);A=!w,O=!1,x={},g.call(this),n("readyState",p.OPENED),this.convertEventPropsToHandlers(["readystatechange"]),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(x[r]?x[r]+=", "+o:x[r]=o,!0)},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(B||(B={},e.each(U.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),B[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),B.hasOwnProperty(t))?B[t].header+": "+B[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,H=o},send:function(n,r){if(P="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.convertEventPropsToHandlers(m),this.upload.convertEventPropsToHandlers(m),this.readyState!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)P.ruid=n.ruid,S=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();P.ruid=o.ruid,S=o.type||"application/octet-stream"}}else"string"==typeof n&&(T="UTF-8",S="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=P.required_caps&&P.required_caps.send_browser_cookies&&!L),I=!A&&this.upload.hasEventListener(),N=!1,D=!n,A||(O=!0),u.call(this,n)},abort:function(){if(N=!0,A=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),O=!1,!k)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);k.getRuntime().exec.call(k,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){k&&("function"===e.typeOf(k.destroy)&&k.destroy(),k=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}})}var h={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};f.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(O,[u,m,v,h],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;f>i&&(f=i),n=t.btoa(c.substr(d,f)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,f;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),f=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(I,[u,f,p,T,A,g,v,O,d,h,y,w,m],function(e,t,n,i,r,o,a,s,u,c,l,d,f){function p(){function i(e){e||(e=this.getRuntime().exec.call(this,"Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)/^data:[^;]*;base64,/.test(t)?c.call(this,new l(null,{data:t}),arguments[1]):v.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function v(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){i.call(this)},999),this.convertEventPropsToHandlers(h),c.apply(this,arguments)},downsize:function(t,i,r,o){try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);(!t&&!i||"undefined"===e.typeOf(r))&&(r=!1),t=t||this.width,i=i||this.height,o="undefined"===e.typeOf(o)?!0:!!o,this.getRuntime().exec.call(this,"Image","downsize",t,i,r,o)}catch(a){this.trigger("error",a)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return e||(e="image/jpeg"),"image/jpeg"!==e||t||(t=90),this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return f.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i){function r(){if(u.can("create_canvas")){var t=a.getAsCanvas();if(t)return i.appendChild(t),t=null,a.destroy(),o.trigger("embedded"),void 0}var r=a.getAsDataURL(c,l);if(!r)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",r.length))i.innerHTML='<img src="'+r+'" width="'+a.width+'" height="'+a.height+'" />',a.destroy(),o.trigger("embedded");else{var d=new s;d.bind("TransportingComplete",function(){v=o.connectRuntime(this.result.ruid),o.bind("Embedded",function(){e.extend(v.getShimContainer().style,{top:"0px",left:"0px",width:a.width+"px",height:a.height+"px"}),v=null},999),v.exec.call(o,"ImageView","display",this.result.uid,m,g),a.destroy()}),d.transport(f.atob(r.substring(r.indexOf("base64,")+7)),c,e.extend({},h,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i}))}}var o=this,a,c,l,d,h=arguments[1]||{},m=this.width,g=this.height,v;try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(c=h.type||this.type||"image/jpeg",l=h.quality||90,d="undefined"!==e.typeOf(h.crop)?h.crop:!1,h.width)m=h.width,g=h.height||m;else{var y=t.getSize(i);y.w&&y.h&&(m=y.w,g=y.h)}return a=new p,a.bind("Resize",function(){r.call(o)}),a.bind("Load",function(){a.downsize(m,g,d,!1)}),a.clone(this,!1),a}catch(w){this.trigger("error",w)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}})}var h=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=6500,p.MAX_RESIZE_HEIGHT=6500,p.prototype=c.instance,p}),i(D,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.version>9)}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),return_response_headers:u,return_response_type:function(e){return"json"===e&&window.JSON?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.version>=21},select_multiple:function(){return!(!r.can("select_file")||"Safari"===i.browser&&"Windows"===i.os||"iOS"===i.os&&i.verComp(i.osVersion,"7.0.4","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[D,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(L,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(M,[D,u,f,L,l,d],function(e,t,n,i,r,o){function a(){var e=[],a;t.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,f,p,h,m;a=s,e=[],f=a.accept.mimes||r.extList2mimes(a.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" capture="camera" style="font-size:999px;opacity:0;"'+(a.multiple&&c.can("select_multiple")?"multiple":"")+(a.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(f?' accept="'+f.join(",")+'"':"")+" />",l=n.get(c.uid),t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=n.get(a.browse_button),c.can("summon_file_dialog")&&("static"===n.getStyle(p,"position")&&(p.style.position="relative"),h=parseInt(n.getStyle(p,"z-index"),10)||1,p.style.zIndex=h,d.style.zIndex=h-1,i.addEvent(p,"click",function(e){var t=n.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?p:d,i.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),i.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),i.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),i.addEvent(n.get(a.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(){if(e=[],a.directory?t.each(this.files,function(t){"."!==t.name&&e.push(t)}):e=[].slice.call(this.files),"IE"!==o.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=g}u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),i;(i=n.get(t.uid))&&(i.disabled=!!e)},destroy:function(){var t=this.getRuntime(),r=t.getShim(),o=t.getShimContainer();i.removeAllEvents(o,this.uid),i.removeAllEvents(a&&n.get(a.container),this.uid),i.removeAllEvents(a&&n.get(a.browse_button),this.uid),o&&(o.innerHTML=""),r.removeInstance(this.uid),e=a=o=r=null}})}return e.FileInput=a}),i(C,[D,u,f,L,l],function(e,t,n,i,r){function o(){function e(e){for(var n=[],i=0;i<e.length;i++)[].push.apply(n,e[i].extensions.split(/\s*,\s*/));return-1===t.inArray("*",n)?n:[]}function o(e){var n=r.getFileExtension(e.name);return!n||!l.length||-1!==t.inArray(n,l)}function a(e,n){var i=[];t.each(e,function(e){i.push(function(t){s(e,t)})}),t.inSeries(i,function(){n()})}function s(e,t){e.isFile?e.file(function(e){o(e)&&c.push(e),t()},function(){t()}):e.isDirectory?u(e,t):t()}function u(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){a(i,t)})}var c=[],l=[],d;t.extend(this,{init:function(n){var r=this,s;d=n,l=e(d.accept),s=d.container,i.addEvent(s,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(s,"drop",function(e){if(e.preventDefault(),e.stopPropagation(),c=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry){var n=[];t.each(e.dataTransfer.items,function(e){n.push(e.webkitGetAsEntry())}),a(n,function(){r.trigger("drop")})}else t.each(e.dataTransfer.files,function(e){o(e)&&c.push(e)}),r.trigger("drop")},r.uid),i.addEvent(s,"dragenter",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragenter")},r.uid),i.addEvent(s,"dragleave",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragleave")},r.uid)},getFiles:function(){return c},destroy:function(){i.removeAllEvents(d&&n.get(d.container),this.uid),c=l=d=null}})}return e.FileDrop=o}),i(F,[D,m,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(e,t){var o=this;i=new window.FileReader,i.addEventListener("progress",function(e){o.trigger(e)}),i.addEventListener("load",function(e){o.trigger(e)}),i.addEventListener("error",function(e){o.trigger(e,i.error)}),i.addEventListener("loadend",function(){i=null}),"function"===n.typeOf(i[e])?(r=!1,i[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,i.readAsDataURL(t.getSource()))},getResult:function(){return i&&i.result?r?e(i.result):i.result:null},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(H,[D,u,l,b,w,y,S,p,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),f.send.call(n,e,t)},r.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.version<8?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return p.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+e.type+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var f=this,p,h;t.extend(this,{send:function(n,r){var s=this,l="Mozilla"===u.browser&&u.version>=4&&u.version<7,f="Android Browser"===u.browser,m=!1;if(h=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=c(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,n,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function v(){switch(p.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=p.getResponseHeader("Content-Length")||0),p.responseText&&(t=p.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&(p.responseType="json"!==n.responseType||u.can("return_response_type","json")?n.responseType:"text"),m?p.sendAsBinary?p.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);p.send(e.buffer)}():p.send(r),s.trigger("loadstart")},getStatus:function(){try{if(p)return p.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,p.response),o=p.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return i.name=h,i.type||(i.type=n.getFileMime(h)),i;case"json":return u.can("return_response_type","json")?p.response:200===p.status&&window.JSON?JSON.parse(p.responseText):null;case"document":return l(p);default:return""!==p.responseText?p.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return p.getAllResponseHeaders()}catch(e){}return""},abort:function(){p&&p.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),i(P,[],function(){return function(){function e(e,t){var n=r?0:-8*(t-1),i=0,a;for(a=0;t>a;a++)i|=o.charCodeAt(e+a)<<Math.abs(n+8*a);return i}function n(e,t,n){n=3===arguments.length?n:o.length-t-1,o=o.substr(0,t)+e+o.substr(n+t)}function i(e,t,i){var o="",a=r?0:-8*(i-1),s;for(s=0;i>s;s++)o+=String.fromCharCode(255&t>>Math.abs(a+8*s));n(o,e,i)}var r=!1,o;return{II:function(e){return e===t?r:(r=e,void 0)},init:function(e){r=!1,o=e},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return o.substr(e,o.length-e-1);case 2:return o.substr(e,t);case 3:n(i,e,t);break;default:return o}},BYTE:function(t){return e(t,1)},SHORT:function(t){return e(t,2)},LONG:function(n,r){return r===t?e(n,4):(i(n,r,4),void 0)},SLONG:function(t){var n=e(t,4);return n>2147483647?n-4294967296:n},STRING:function(t,n){var i="";for(n+=t;n>t;t++)i+=String.fromCharCode(e(t,1));return i}}}}),i(k,[P],function(e){return function t(n){var i=[],r,o,a,s=0;if(r=new e,r.init(n),65496===r.SHORT(0)){for(o=2;o<=n.length;)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;s=r.SHORT(o+2)+2,a>=65505&&65519>=a&&i.push({hex:a,name:"APP"+(15&a),start:o,length:s,segment:r.SEGMENT(o,s)}),o+=s}return r.init(null),{headers:i,restore:function(e){var t,n;for(r.init(e),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,t=i.length;t>n;n++)r.SEGMENT(o,0,i[n].segment),o+=i[n].length;return e=r.SEGMENT(),r.init(null),e},strip:function(e){var n,i,o;for(i=new t(e),n=i.headers,i.purge(),r.init(e),o=n.length;o--;)r.SEGMENT(n[o].start,n[o].length,"");return e=r.SEGMENT(),r.init(null),e},get:function(e){for(var t=[],n=0,r=i.length;r>n;n++)i[n].name===e.toUpperCase()&&t.push(i[n].segment);return t},set:function(e,t){var n=[],r,o,a;for("string"==typeof t?n.push(t):n=t,r=o=0,a=i.length;a>r&&(i[r].name===e.toUpperCase()&&(i[r].segment=n[o],i[r].length=n[o].length,o++),!(o>=n.length));r++);},purge:function(){i=[],r.init(null),r=null}}}}}),i(U,[u,P],function(e,n){return function i(){function i(e,n){var i=a.SHORT(e),r,o,s,u,d,f,p,h,m=[],g={};for(r=0;i>r;r++)if(p=f=e+12*r+2,s=n[a.SHORT(p)],s!==t){switch(u=a.SHORT(p+=2),d=a.LONG(p+=2),p+=4,m=[],u){case 1:case 7:for(d>4&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.BYTE(p+o);break;case 2:d>4&&(p=a.LONG(p)+c.tiffHeader),g[s]=a.STRING(p,d-1);continue;case 3:for(d>2&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.SHORT(p+2*o);break;case 4:for(d>1&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.LONG(p+4*o);break;case 5:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.LONG(p+4*o)/a.LONG(p+4*o+4);break;case 9:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o);break;case 10:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o)/a.SLONG(p+4*o+4);break;default:continue}h=1==d?m[0]:m,g[s]=l.hasOwnProperty(s)&&"object"!=typeof h?l[s][h]:h}return g}function r(){var e=c.tiffHeader;return a.II(18761==a.SHORT(e)),42!==a.SHORT(e+=2)?!1:(c.IFD0=c.tiffHeader+a.LONG(e+=2),u=i(c.IFD0,s.tiff),"ExifIFDPointer"in u&&(c.exifIFD=c.tiffHeader+u.ExifIFDPointer,delete u.ExifIFDPointer),"GPSInfoIFDPointer"in u&&(c.gpsIFD=c.tiffHeader+u.GPSInfoIFDPointer,delete u.GPSInfoIFDPointer),!0)}function o(e,t,n){var i,r,o,u=0;if("string"==typeof t){var l=s[e.toLowerCase()];for(var d in l)if(l[d]===t){t=d;break}}i=c[e.toLowerCase()+"IFD"],r=a.SHORT(i);for(var f=0;r>f;f++)if(o=i+12*f+2,a.SHORT(o)==t){u=o+8;break}return u?(a.LONG(u,n),!0):!1}var a,s,u,c={},l;return a=new n,s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},{init:function(e){return c={tiffHeader:10},e!==t&&e.length?(a.init(e),65505===a.SHORT(0)&&"EXIF\0"===a.STRING(4,5).toUpperCase()?r():!1):!1
},TIFF:function(){return u},EXIF:function(){var t;if(t=i(c.exifIFD,s.exif),t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}return t},GPS:function(){var t;return t=i(c.gpsIFD,s.gps),t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join(".")),t},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:o("exif",e,t)},getBinary:function(){return a.SEGMENT()},purge:function(){a.init(null),a=u=null,c={}}}}}),i(B,[u,p,k,P,U],function(e,t,n,i,r){function o(o){function a(){for(var e=0,t,n;e<=u.length;){if(t=c.SHORT(e+=2),t>=65472&&65475>=t)return e+=5,{height:c.SHORT(e),width:c.SHORT(e+=2)};n=c.SHORT(e+=2),e+=n-2}return null}function s(){d&&l&&c&&(d.purge(),l.purge(),c.init(null),u=f=l=d=c=null)}var u,c,l,d,f,p;if(u=o,c=new i,c.init(u),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o),d=new r,p=!!d.init(l.get("app1")[0]),f=a.call(this),e.extend(this,{type:"image/jpeg",size:u.length,width:f&&f.width||0,height:f&&f.height||0,setExif:function(t,n){return p?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),l.set("app1",d.getBinary()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):u=l.restore(u)},stripHeaders:function(e){return l.strip(e)},purge:function(){s.call(this)}}),p&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS()})}return o}),i(z,[p,u,P],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function o(){u&&(u.init(null),s=d=c=l=u=null)}function a(e){var t,n,i,r;return t=u.LONG(e),n=u.STRING(e+=4,4),i=e+=4,r=u.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l,d;s=i,u=new n,u.init(s),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=u.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),d=r.call(this),t.extend(this,{type:"image/png",size:s.length,width:d.width,height:d.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(G,[u,p,B,z],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(q,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var f=1024,p=document.createElement("canvas");p.width=p.height=f;for(var h=p.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+f>a?a-g:f,y=0;o>y;){var w=y+f>o?o-y:f;h.clearRect(0,0,f,f),h.drawImage(e,-y,-g);var E=y*s/o+c<<0,_=Math.ceil(w*s/o),x=g*u/a/m+l<<0,R=Math.ceil(v*u/a/m);d.drawImage(p,0,0,w,v,E,x,_,R),y+=f}g+=f}p=h=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(X,[D,u,p,m,w,G,q,l,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(){if(!E&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return E||y}function c(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function l(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function d(e){var t=this;y=new Image,y.onerror=function(){g.call(this),t.trigger("error",new n.ImageError(n.ImageError.WRONG_FORMAT))},y.onload=function(){t.trigger("load")},y.src=/^data:[^;]*;base64,/.test(e)?e:l(e,x.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",new n.FileException(n.FileException.NOT_READABLE_ERR))},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c=0,l=0,d,f,p,g;if(b=o,g=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(g,[5,6,7,8])){var v=n;n=i,i=v}return d=e(),u=r?Math.max:Math.min,s=u(n/d.width,i/d.height),s>1&&(!r||o)?(this.trigger("Resize"),void 0):(E||(E=document.createElement("canvas")),f=Math.round(d.width*s),p=Math.round(d.height*s),r?(E.width=n,E.height=i,f>n&&(c=Math.round((f-n)/2)),p>i&&(l=Math.round((p-i)/2))):(E.width=f,E.height=p),b||m(E.width,E.height,g),h.call(this,d,E,-c,-l,f,p),this.width=E.width,this.height=E.height,R=!0,a.trigger("Resize"),void 0)}function h(e,t,n,i,r,o){if("iOS"===u.OS)a.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var s=t.getContext("2d");s.drawImage(e,n,i,r,o)}}function m(e,t,n){switch(n){case 5:case 6:case 7:case 8:E.width=t,E.height=e;break;default:E.width=e,E.height=t}var i=E.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function g(){w&&(w.purge(),w=null),_=y=E=x=null,R=!1}var v=this,y,w,E,_,x,R=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return x=e,e.isDetached()?(_=e.getSource(),d.call(this,_),void 0):(f.call(this,e.getSource(),function(e){r&&(_=c(e)),d.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,x=new r(null,{name:e.name,size:e.size,type:e.type}),d.call(this,t?_=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!w&&_&&t.can("access_image_binary")&&(w=new o(_)),n={width:e().width||0,height:e().height||0,type:x.type||s.getFileMime(x.name),size:_&&_.length||x.size||0,name:x.name||"",meta:w&&w.meta||this.meta||{}}},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return E&&(E.id=this.uid+"_canvas"),E},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new r(null,{name:x.name||"",type:e,data:v.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!R)return y.src;if("image/jpeg"!==e)return E.toDataURL("image/png");try{return E.toDataURL("image/jpeg",t/100)}catch(n){return E.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!R)return _||(_=c(v.getAsDataURL(e,t))),_;if("image/jpeg"!==e)_=c(v.getAsDataURL(e,t));else{var n;t||(t=90);try{n=E.toDataURL("image/jpeg",t/100)}catch(i){n=E.toDataURL("image/jpeg")}_=c(n),w&&(_=w.stripHeaders(_),b&&(w.meta&&w.meta.exif&&w.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),_=w.writeHeaders(_)),w.purge(),w=null)}return R=!1,_},destroy:function(){v=null,g.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),i(j,[u,d,f,p,g],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(a){var c=this,l;a=e.extend({swf_url:t.swf_url},a),r.call(this,a,s,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===c.mode},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="flash",u={};return r.addConstructor(s,a),u}),i(V,[j,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(W,[j],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=t}),i(Y,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i="",r={read:function(e,t){var r=this,o=r.getRuntime();return"readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,r){r&&(i+=n(r,e))}),o.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return i},destroy:function(){i=null}};return e.FileReader=r}),i($,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(J,[j,u,y,w,T,S,O],function(e,t,n,i,r,o,a){var s={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var f=i.getBlob();f.isDetached()?u(f,function(e){f.destroy(),s(d,e)}):s(d,f)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=s}),i(Z,[j,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(K,[j,u,O,y,T],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(Q,[u,d,f,p,g],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(et,[Q,u,V],function(e,t,n){return e.Blob=t.extend({},n)}),i(tt,[Q],function(e){var t={init:function(e){function t(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=t}),i(nt,[Q,f,L],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(it,[Q,u,Y],function(e,t,n){return e.FileReader=t.extend({},n)}),i(rt,[Q,u,$],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(ot,[Q,u,J],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(at,[Q,u,Z],function(e,t,n){return e.Transporter=t.extend({},n)}),i(st,[Q,u,K],function(e,t,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps"],i={meta:{}},r=e.shimExec.call(this,"Image","getInfo");return r.meta&&t.each(n,function(e){var t=r.meta[e],n,o,a,s;if(t&&t.keys)for(i.meta[e]={},o=0,a=t.keys.length;a>o;o++)n=t.keys[o],s=t[n],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),i.meta[e][n]=s)}),i.width=parseInt(r.width,10),i.height=parseInt(r.height,10),i.size=parseInt(r.size,10),i.type=r.type,i.name=r.name,i}})}),i(ut,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(ct,[ut,u,f,L,l,d],function(e,t,n,i,r,o){function a(){function e(){var r=this,l=r.getRuntime(),d,f,p,h,m,g;g=t.guid("uid_"),d=l.getShimContainer(),a&&(p=n.get(a+"_form"),p&&t.extend(p.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",g+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),t.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name",c.name||"Filedata"),m.setAttribute("accept",u.join(",")),t.extend(m.style,{fontSize:"999px",opacity:0}),h.appendChild(m),d.appendChild(h),t.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===o.browser&&o.version<10&&t.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var t;this.value&&(t=this.files?this.files[0]:{name:this.value},s=[t],this.onchange=function(){},e.call(r),r.bind("change",function i(){var e=n.get(g),t=n.get(g+"_form"),o;r.unbind("change",i),r.files.length&&e&&t&&(o=r.files[0],e.setAttribute("id",o.uid),t.setAttribute("id",o.uid+"_form"),t.setAttribute("target",o.uid+"_iframe")),e=t=null},998),m=h=null,r.trigger("change"))},l.can("summon_file_dialog")&&(f=n.get(c.browse_button),i.removeEvent(f,"click",r.uid),i.addEvent(f,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},r.uid)),a=g,d=p=f=null}var a,s=[],u=[],c;t.extend(this,{init:function(t){var o=this,a=o.getRuntime(),s;c=t,u=t.accept.mimes||r.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,r,u;e=n.get(t.browse_button),a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),r=parseInt(n.getStyle(e,"z-index"),10)||1,e.style.zIndex=r,s.style.zIndex=r-1),u=a.can("summon_file_dialog")?e:s,i.addEvent(u,"mouseover",function(){o.trigger("mouseenter")},o.uid),i.addEvent(u,"mouseout",function(){o.trigger("mouseleave")},o.uid),i.addEvent(u,"mousedown",function(){o.trigger("mousedown")},o.uid),i.addEvent(n.get(t.container),"mouseup",function(){o.trigger("mouseup")},o.uid),e=null}(),e.call(this),s=null,o.trigger({type:"ready",async:!0})},getFiles:function(){return s},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),r=e.getShimContainer();i.removeAllEvents(r,this.uid),i.removeAllEvents(c&&n.get(c.container),this.uid),i.removeAllEvents(c&&n.get(c.browse_button),this.uid),r&&(r.innerHTML=""),t.removeInstance(this.uid),a=s=u=c=r=t=null}})}return e.FileInput=a}),i(lt,[ut,F],function(e,t){return e.FileReader=t}),i(dt,[ut,u,f,b,p,L,y,S],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,f){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:""" style="display:none"></iframe>',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),h.trigger({type:"progress",loaded:c.length,total:c.length}),w&&h.trigger({type:"uploadprogress",loaded:w.size||1025,total:w.size||1025}))}catch(r){if(!i.hasSameOrigin(d.url))return e.call(h,function(){h.trigger("error")}),void 0;u=404}e.call(h,function(){h.trigger("load")})},h.uid)}var h=this,m=h.getRuntime(),g,v,y,w;if(u=c=null,f instanceof s&&f.hasBlob()){if(w=f.getBlob(),g=w.uid,y=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",d.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),v.setAttribute("target",g+"_iframe"),m.getShimContainer().appendChild(v);f instanceof s&&f.each(function(e,n){if(e instanceof a)y&&y.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),y?v.insertBefore(i,y):v.appendChild(i)}}),v.setAttribute("action",d.url),p(),v.submit(),h.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(ft,[ut,X],function(e,t){return e.Image=t}),a([u,c,l,d,f,p,h,m,g,v,y,w,E,_,x,R,b,T,S,A,O,I,L])}(this);;(function(){"use strict";var e={},t=moxie.core.utils.Basic.inArray;return function n(r){var i,s;for(i in r)s=typeof r[i],s==="object"&&!~t(i,["Exceptions","Env","Mime"])?n(r[i]):s==="function"&&(e[i]=r[i])}(window.moxie),e.Env=window.moxie.core.utils.Env,e.Mime=window.moxie.core.utils.Mime,e.Exceptions=window.moxie.core.Exceptions,window.mOxie=e,window.o||(window.o=e),e})();
/**
* Plupload - multi-runtime File Uploader
* v2.1.0
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2013-12-27
*/
;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",max_file_size:"access_binary",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),e.resize.enabled&&(n.send_binary_string=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.1.0",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<f.length;n++)!e&&f[n].status==o.QUEUED?(e=f[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==f.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",f))}}function y(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e<f.length;e++)t=f[e],t.size!==n?(d.size+=t.origSize,d.loaded+=t.loaded*t.origSize/t.size):d.size=n,t.status==o.DONE?d.uploaded++:t.status==o.FAILED?d.failed++:d.queued++;d.size===n?d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded",C),this.bind("CancelUpload",M),this.bind("BeforeUpload",k),this.bind("UploadFile",L),this.bind("UploadProgress",A),this.bind("StateChanged",O),this.bind("QueueChanged",b),this.bind("Error",D),this.bind("FileUploaded",_),this.bind("Destroy",P)}function x(e,n){var r=this,i=0,s=[],u={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t;break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){[].push.apply(f,t),e.trigger("QueueChanged"),e.refresh()}function k(e,t){if(a.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function L(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g,y;if(n.status==o.DONE||n.status==o.FAILED||e.state==o.STOPPED)return;g={name:n.target_name||n.name},s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y<c.size?(d.destroy(),f+=y,n.loaded=Math.min(f,c.size),e.trigger("ChunkUploaded",n,{offset:n.loaded,total:c.size,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&e.trigger("UploadProgress",n)):n.loaded=n.size,d=v=null,!f||f>=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(g.name=n.target_name||n.name,m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s*Math.floor(n.loaded/s)),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function A(e,t){y(t)}function O(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function M(){m&&m.abort()}function _(e){b(),r(function(){g.call(e)},1)}function D(e,t){t.file&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function P(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,a=p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)});if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}S.call(this),x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function l(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function c(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!f)return!1;e.ruid=f,e.connectRuntime(f)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){l(e,function(n){n||(a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?c(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):i==="array"&&(n=null,t.each(e,c))}var s=this,u=[],a=[],f;f=w(),c(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(i=!0,this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),this.trigger("QueueChanged"),this.refresh(),i&&this.start(),r},bind:function(e,t,n){var r=this;o.Uploader.prototype.bind.call(this,e,function(){var e=[].slice.call(arguments);return e.splice(0,1,r),t.apply(this,e)},0,n)},destroy:function(){this.trigger("Destroy"),d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
|
//// [contextualTypingOfObjectLiterals2.ts]
interface Foo {
foo: (t: string) => string;
}
function f2(args: Foo) { }
f2({ foo: s => s.hmm }) // 's' should be 'string', so this should be an error
//// [contextualTypingOfObjectLiterals2.js]
function f2(args) {
}
f2({
foo: function (s) {
return s.hmm;
}
}); // 's' should be 'string', so this should be an error
|
import ol_ext_inherits from '../ext'
import ol_ext_element from '../element';
import ol_ext_input_Base from './Base'
/** Base class for input popup
* @constructor
* @extends {ol_ext_input_Base}
* @fires change:color
* @fires color
* @param {*} options
* @param {string} [options.className]
* @param {ol.colorLike} [options.color] default color
* @param {Element} [options.input] input element, if non create one
* @param {Element} [options.parent] parent element, if create an input
* @param {string} [options.position='popup'] fixed | static | popup | inline (no popup)
* @param {boolean} [options.autoClose=true] close when click on color
* @param {boolean} [options.hidden=false] display the input
*/
var ol_ext_input_PopupBase = function(options) {
options = options || {};
options.hidden = options.hidden!==false;
ol_ext_input_Base.call(this, options);
this.set('autoClose', options.autoClose !== false);
this.element = ol_ext_element.create('DIV', {
className: ('ol-ext-popup-input ' + (options.className || '')).trim(),
});
switch (options.position) {
case 'inline': break;
case 'static':
case 'fixed': {
this.element.classList.add('ol-popup');
this.element.classList.add('ol-popup-fixed');
this._fixed = (options.position === 'fixed');
break;
}
default: {
this.element.classList.add('ol-popup');
break;
}
}
var input = this.input;
if (input.parentNode) input.parentNode.insertBefore(this.element, input);
// Show on element click
this.element.addEventListener('click', function() {
if (this.isCollapsed()) setTimeout( function() { this.collapse(false); }.bind(this) );
}.bind(this));
// Hide on click outside
document.addEventListener('click', function() {
if (!this.moving) this.collapse(true);
}.bind(this));
// Hide on window resize
window.addEventListener('resize', function() {
this.collapse(true);
}.bind(this));
this._elt = {};
// Popup container
this._elt.popup = ol_ext_element.create('DIV', { className: 'ol-popup', parent: this.element });
this._elt.popup.addEventListener('click', function(e) { e.stopPropagation(); });
};
ol_ext_inherits(ol_ext_input_PopupBase, ol_ext_input_Base);
/** show/hide color picker
* @param {boolean} [b=false]
*/
ol_ext_input_PopupBase.prototype.collapse = function(b) {
if (b != this.isCollapsed()) {
this.dispatchEvent({
type: 'change:visible',
visible: !this.isCollapsed()
});
}
this.dispatchEvent({
type: 'collapse',
visible: !b
});
if (b) {
this._elt.popup.classList.remove('ol-visible');
} else {
this._elt.popup.classList.add('ol-visible');
if (this._fixed) {
// Get fixed position
var pos = this.element.getBoundingClientRect();
var offset = ol_ext_element.getFixedOffset(this.element);
pos = {
bottom: pos.bottom - offset.top,
left: pos.left - offset.left
}
// Test window overflow + recenter
var dh = pos.bottom + this._elt.popup.offsetHeight + offset.top;
if (dh > document.documentElement.clientHeight) {
this._elt.popup.style.top = Math.max(document.documentElement.clientHeight - this._elt.popup.offsetHeight - offset.top, 0) + 'px';
} else {
this._elt.popup.style.top = pos.bottom + 'px';
}
var dw = pos.left + this._elt.popup.offsetWidth + offset.left;
if (dw > document.documentElement.clientWidth) {
this._elt.popup.style.left = Math.max(document.documentElement.clientWidth - this._elt.popup.offsetWidth - offset.left, 0) + 'px';
} else {
this._elt.popup.style.left = pos.left + 'px';
}
}
}
};
/** Is the popup collapsed ?
* @returns {boolean}
*/
ol_ext_input_PopupBase.prototype.isCollapsed = function() {
return !this._elt.popup.classList.contains('ol-visible');
};
/** Toggle the popup
*/
ol_ext_input_PopupBase.prototype.toggle = function() {
this.collapse(!this.isCollapsed());
};
export default ol_ext_input_PopupBase
|
import assert from "assert"
import createNamespace from "../../create-namespace.js"
import defaultArray, * as nsArray from "../../fixture/cjs/export/array.js"
import defaultClass, * as nsClass from "../../fixture/cjs/export/class.js"
import defaultDefault, * as nsDefault from "../../fixture/cjs/export/default.js"
import defaultEmpty, * as nsEmpty from "../../fixture/cjs/export/empty.js"
import defaultFunction, { a as aOfFunction } from "../../fixture/cjs/export/function.js"
import defaultNull, * as nsNull from "../../fixture/cjs/export/null.js"
import defaultNumber, * as nsNumber from "../../fixture/cjs/export/number.js"
import defaultObject, { a as aOfObject } from "../../fixture/cjs/export/object.js"
import defaultPseudo, { a as aOfPseudo } from "../../fixture/cjs/export/pseudo.js"
import defaultReExport from "../../fixture/cjs/export/re-export.js"
import defaultUndefined, * as nsUndefined from "../../fixture/cjs/export/undefined.js"
import * as nsFunction from "../../fixture/cjs/export/function.js"
import * as nsGetSet from "../../fixture/cjs/export/get-set.js"
import * as nsPseudo from "../../fixture/cjs/export/pseudo.js"
import * as nsPseudoEmpty from "../../fixture/cjs/export/pseudo-empty.js"
import * as nsStarMixed from "../../fixture/cjs/export/star-mixed"
export default () => {
let ns = createNamespace({ 0: "a", default: defaultArray })
assert.deepStrictEqual(defaultArray, ["a"])
assert.deepStrictEqual(nsArray, ns)
ns = createNamespace({ a: "a", default: defaultClass })
assert.strictEqual(typeof defaultClass, "function")
assert.deepStrictEqual(nsClass, ns)
ns = createNamespace({ default: defaultDefault })
assert.deepStrictEqual(defaultDefault, { default: "default" })
assert.deepStrictEqual(nsDefault, ns)
ns = createNamespace({ a: "a", default: defaultFunction })
assert.strictEqual(aOfFunction, "a")
assert.strictEqual(defaultFunction(), "ok")
assert.deepStrictEqual(nsFunction, ns)
ns = createNamespace({ default: defaultNull })
assert.strictEqual(defaultNull, null)
assert.deepStrictEqual(nsNull, ns)
ns = createNamespace({ default: defaultNumber })
assert.strictEqual(defaultNumber, 1)
assert.deepStrictEqual(nsNumber, ns)
ns = createNamespace({ a: "a", default: "default" })
assert.strictEqual(aOfPseudo, "a")
assert.strictEqual(defaultPseudo, "default")
assert.deepStrictEqual(nsPseudo, ns)
ns = createNamespace({ default: defaultUndefined })
assert.strictEqual(defaultUndefined, void 0)
assert.deepStrictEqual(nsUndefined, ns)
ns = createNamespace({ default: {} })
assert.deepStrictEqual(nsEmpty, ns)
ns = createNamespace({})
assert.deepStrictEqual(nsPseudoEmpty, ns)
ns = createNamespace({ a: "a", b: "b", c: "c", d: "d", e: "e" })
assert.deepStrictEqual(nsStarMixed, ns)
assert.strictEqual(nsGetSet.safe, "safe get")
assert.strictEqual(Reflect.getPrototypeOf(defaultEmpty), Object.prototype)
assert.deepStrictEqual(defaultObject, { a: "a" })
assert.strictEqual(aOfObject, "a")
assert.deepStrictEqual(defaultReExport, {})
}
|
(function(){
module("kendo attr", {
teardown: function(){
kendo.ns = "";
}
});
test("default ns is empty", function() {
equal(kendo.ns, "");
});
test("attr returns a data attribute", function() {
kendo.ns = "kendo-";
equal(kendo.attr("role"), "data-kendo-role");
});
test("attr handles empty ns", function() {
kendo.ns = "";
equal(kendo.attr("role"), "data-role");
});
}());
|
config.$inject = [ '$stateProvider' ];
function config ($stateProvider) {
$stateProvider
.state('main.import-students', {
url: '/alumnos/importar-alumnos',
templateUrl: 'templates/components/main/import-students/import-students.html',
controller: "ImportStudentsController as vm",
onEnter: onStateEnter
});
}
const onStateEnter = [ '$rootScope',
rootScope => {
rootScope.viewTitle = "Importar Alumnos";
rootScope.viewStyles = "main import-students";
}
];
module.exports = config;
|
import { h } from 'vue'
export default {
name: "CommentOutline",
vendor: "Mdi",
type: "",
tags: ["comment","outline"],
render() {
return h(
"svg",
{"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-comment-outline","innerHTML":"<path d='M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10Z' />"},
)
}
}
|
angular.module('portainer.app')
.factory('EndpointService', ['$q', 'Endpoints', 'FileUploadService',
function EndpointServiceFactory($q, Endpoints, FileUploadService) {
'use strict';
var service = {};
service.endpoint = function(endpointID) {
return Endpoints.get({id: endpointID}).$promise;
};
service.endpoints = function() {
return Endpoints.query({}).$promise;
};
service.snapshotEndpoints = function() {
return Endpoints.snapshots({}, {}).$promise;
};
service.snapshotEndpoint = function(endpointID) {
return Endpoints.snapshot({ id: endpointID }, {}).$promise;
};
service.endpointsByGroup = function(groupId) {
var deferred = $q.defer();
Endpoints.query({}).$promise
.then(function success(data) {
var endpoints = data.filter(function (endpoint) {
return endpoint.GroupId === groupId;
});
deferred.resolve(endpoints);
})
.catch(function error(err) {
deferred.reject({msg: 'Unable to retrieve endpoints', err: err});
});
return deferred.promise;
};
service.updateAccess = function(id, authorizedUserIDs, authorizedTeamIDs) {
return Endpoints.updateAccess({id: id}, {authorizedUsers: authorizedUserIDs, authorizedTeams: authorizedTeamIDs}).$promise;
};
service.updateEndpoint = function(id, payload) {
var deferred = $q.defer();
FileUploadService.uploadTLSFilesForEndpoint(id, payload.TLSCACert, payload.TLSCert, payload.TLSKey)
.then(function success() {
deferred.notify({upload: false});
return Endpoints.update({id: id}, payload).$promise;
})
.then(function success(data) {
deferred.resolve(data);
})
.catch(function error(err) {
deferred.notify({upload: false});
deferred.reject({msg: 'Unable to update endpoint', err: err});
});
return deferred.promise;
};
service.deleteEndpoint = function(endpointID) {
return Endpoints.remove({id: endpointID}).$promise;
};
service.createLocalEndpoint = function() {
var deferred = $q.defer();
FileUploadService.createEndpoint('local', 1, '', '', 1, [], false)
.then(function success(response) {
deferred.resolve(response.data);
})
.catch(function error(err) {
deferred.reject({msg: 'Unable to create endpoint', err: err});
});
return deferred.promise;
};
service.createRemoteEndpoint = function(name, type, URL, PublicURL, groupID, tags, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) {
var deferred = $q.defer();
FileUploadService.createEndpoint(name, type, 'tcp://' + URL, PublicURL, groupID, tags, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile)
.then(function success(response) {
deferred.resolve(response.data);
})
.catch(function error(err) {
deferred.reject({msg: 'Unable to create endpoint', err: err});
});
return deferred.promise;
};
service.createAzureEndpoint = function(name, applicationId, tenantId, authenticationKey, groupId, tags) {
var deferred = $q.defer();
FileUploadService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tags)
.then(function success(response) {
deferred.resolve(response.data);
})
.catch(function error(err) {
deferred.reject({msg: 'Unable to connect to Azure', err: err});
});
return deferred.promise;
};
service.executeJobFromFileUpload = function (image, jobFile, endpointId, nodeName) {
return FileUploadService.executeEndpointJob(image, jobFile, endpointId, nodeName);
};
service.executeJobFromFileContent = function (image, jobFileContent, endpointId, nodeName) {
var payload = {
Image: image,
FileContent: jobFileContent
};
return Endpoints.executeJob({ id: endpointId, method: 'string', nodeName: nodeName }, payload).$promise;
};
return service;
}]);
|
import { settings } from '../../../settings';
import { getUserPreference, getURL } from '../../../utils';
import { API } from '../api';
const getInfoFromUserObject = (user) => {
const {
_id,
name,
emails,
status,
statusConnection,
username,
utcOffset,
active,
language,
roles,
settings,
customFields,
} = user;
return {
_id,
name,
emails,
status,
statusConnection,
username,
utcOffset,
active,
language,
roles,
settings,
customFields,
};
};
API.helperMethods.set('getUserInfo', function _getUserInfo(user) {
const me = getInfoFromUserObject(user);
const isVerifiedEmail = () => {
if (me && me.emails && Array.isArray(me.emails)) {
return me.emails.find((email) => email.verified);
}
return false;
};
const getUserPreferences = () => {
const defaultUserSettingPrefix = 'Accounts_Default_User_Preferences_';
const allDefaultUserSettings = settings.get(new RegExp(`^${ defaultUserSettingPrefix }.*$`));
return allDefaultUserSettings.reduce((accumulator, setting) => {
const settingWithoutPrefix = setting.key.replace(defaultUserSettingPrefix, ' ').trim();
accumulator[settingWithoutPrefix] = getUserPreference(user, settingWithoutPrefix);
return accumulator;
}, {});
};
const verifiedEmail = isVerifiedEmail();
me.email = verifiedEmail ? verifiedEmail.address : undefined;
me.avatarUrl = getURL(`/avatar/${ me.username }`, { cdn: false, full: true });
me.settings = {
preferences: getUserPreferences(),
};
return me;
});
|
import React from 'react';
import PropTypes from 'prop-types';
// Mui Example:
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Avatar/Avatar.js#L38
// eslint-disable-next-line prefer-arrow-callback
const ArrowRightCircle = React.forwardRef(function ArrowRightCircle(
props,
ref
) {
const { color, size, ...otherProps } = props;
const variantSizes = {
xsmall: 12,
small: 14,
medium: 16,
large: 20,
xlarge: 28,
xxlarge: 36,
};
const newSize = !isNaN(parseInt(size, 10))
? size
: variantSizes[size] !== undefined
? variantSizes[size]
: variantSizes['medium'];
return (
<svg
width={newSize}
height={newSize}
viewBox="0 0 24 24"
{...otherProps}
fill={color}
ref={ref}
>
<path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1zm0 2.225a8.775 8.775 0 100 17.55 8.775 8.775 0 000-17.55zm.787 4.033l3.955 3.955.015.016.045.05-.06-.066a1.122 1.122 0 01.267.431 1.11 1.11 0 01-.267 1.143l-3.955 3.955a1.112 1.112 0 01-1.574-1.574l2.056-2.056H8.045a1.112 1.112 0 010-2.224l5.223-.001-2.055-2.055a1.112 1.112 0 011.574-1.574z" />
</svg>
);
});
ArrowRightCircle.propTypes = {
color: PropTypes.string,
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
ArrowRightCircle.defaultProps = {
color: 'currentColor',
size: '16',
};
// Hard coding component names and render names
ArrowRightCircle.name = ArrowRightCircle.render.name || 'ArrowRightCircle';
export default ArrowRightCircle;
|
/*Nav Start*/
var navFlag = false;
function showNav() {
if (navFlag === false) {
document.querySelector("#mainNav").style.width = "100%";
document.querySelector("#mNavBtn").style.transform="translateX(-100px)";
document.querySelector("#mNavBtn2").style.top="15px";
return navFlag = true;
}else if(navFlag === true)
{
document.querySelector("#mainNav").style.width = "0%";
document.querySelector("#mNavBtn").style.transform="translateX(15px)";
document.querySelector("#mNavBtn2").style.top="-100px";
return navFlag = false;
}
}
/*Nav End*/
//drone
var $p1 = $("#l-prop1");
var $p2 = $("#l-prop2");
var $p3 = $("#r-prop1");
var $p4 = $("#r-prop2");
var $drone = $("#drone-container");
var blade;
var speed = .01;
var $delay = 1;
//Left Blades
rotateBladeLeft($p1, speed)
rotateBladeRight($p2, speed)
//Right Blades
rotateBladeLeft($p4, speed)
rotateBladeRight($p3, speed)
function rotateBladeLeft(blade, speed) {
var spin = "230px";
TweenMax.to(blade, speed, {x:spin, scaleX:".1", ease:Power2.easeNone, repeat:-1, yoyo:true});
}
function rotateBladeRight(blade, speed) {
var spin = "-35px";
TweenMax.to(blade, speed, {x:spin, scaleX:".1", ease:Power2.easeNone, repeat:-1, yoyo:true});
}
/*preloader js*/
function loadingComplete(){
$(".preloader").css({"-webkit-animation":"slit-out-horizontal 1s ease-in both","animation":"slit-out-horizontal 1s ease-in both"});
}
|
/*
*
* debounce(fn, interval[, self]); // returns a debounced function
* fn - function
* interval - time in ms
* self - (optional) explicit `this` for the eventually called function
*
* Usage: document.addEventListener(
* "mousemove"
* , limiter.debounce(function (e) { console.log(this, e); }, 500, document.body)
* , false
* );
*
* The resulting function will be called when the event has occurred,
* and not occurred again within`interval` ms
*
*/
import isPositiveInteger from "./is-positive-integer";
const _slice = [].slice,
glob = "undefined" == typeof global ? window : global,
copyEvent = e => {
const copy = {};
for (let prop in e) { copy[prop] = e[prop]; }
return copy;
};
const isIEEvent = e => "returnValue" in e;
const debounce = (fn, interval, self) => {
if ("function" != typeof fn) throw new Error(`First argument must be a function, was ${ fn }`);
if (!isPositiveInteger(interval)) throw new Error(`Second argument must be a positive integer, was ${ interval }`);
let timer, ts, args;
arguments.length == 3 || (self = glob);
return () => {
ts = new Date;
if (isIEEvent(arguments[0])) { // hoops for old IE event.
args = [copyEvent(arguments[0]), arguments[1]];
}
else {
args = _slice.call(arguments);
}
const tmp = () => {
const prev = new Date - ts;
if (prev < interval) { return timer = setTimeout(tmp, interval-prev); }
timer = null;
fn.apply(self, args);
};
timer || (timer = setTimeout(tmp, interval));
};
};
export default debounce;
|
webpackHotUpdate(0,{
/***/ "./src/Views/Posters.js":
/*!******************************!*\
!*** ./src/Views/Posters.js ***!
\******************************/
/*! exports provided: default */
/*! exports used: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_router_dom__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_axios__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_axios__);
var _jsxFileName = 'C:\\StarterProject\\MoviePosterArena\\StarterProject\\MovieArtArena.Web\\app\\public\\src\\Views\\Posters.js';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Posters = function (_React$Component) {
_inherits(Posters, _React$Component);
function Posters(props) {
_classCallCheck(this, Posters);
var _this = _possibleConstructorReturn(this, (Posters.__proto__ || Object.getPrototypeOf(Posters)).call(this, props));
_this.componentWillMount = function () {
_this.getMovies();
};
_this.getMovies = function () {
__WEBPACK_IMPORTED_MODULE_2_axios___default.a.get("http://localhost:65332/api/poster/getall").then(function (resp) {
var movies = resp.data.items;
_this.setState({ movies: movies });
console.log(resp);
console.log(movies);
});
};
_this.state = {
movies: []
};
return _this;
}
_createClass(Posters, [{
key: 'render',
value: function render() {
var _this2 = this;
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{ className: 'container', __source: {
fileName: _jsxFileName,
lineNumber: 33
},
__self: this
},
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{ className: 'container', __source: {
fileName: _jsxFileName,
lineNumber: 34
},
__self: this
},
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'h2',
{ className: 'movietitlefont', __source: {
fileName: _jsxFileName,
lineNumber: 35
},
__self: this
},
'MoviePosters'
)
),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{ className: 'row', __source: {
fileName: _jsxFileName,
lineNumber: 37
},
__self: this
},
this.state.movies.map(function (movie) {
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{ key: movie.id, __source: {
fileName: _jsxFileName,
lineNumber: 39
},
__self: _this2
},
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{ className: 'row col', __source: {
fileName: _jsxFileName,
lineNumber: 41
},
__self: _this2
},
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('img', { className: 'row ibox md-3 movies', src: movie.imageUrl, href: '', __source: {
fileName: _jsxFileName,
lineNumber: 42
},
__self: _this2
}),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{
__source: {
fileName: _jsxFileName,
lineNumber: 43
},
__self: _this2
},
movie.title
),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{
__source: {
fileName: _jsxFileName,
lineNumber: 44
},
__self: _this2
},
movie.description
),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{
__source: {
fileName: _jsxFileName,
lineNumber: 45
},
__self: _this2
},
movie.type
),
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
'div',
{
__source: {
fileName: _jsxFileName,
lineNumber: 46
},
__self: _this2
},
movie.price
)
)
);
})
)
);
}
}]);
return Posters;
}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component);
/* harmony default export */ __webpack_exports__["a"] = (Posters);
/***/ })
})
//# sourceMappingURL=0.35d867ee0a4bc3c0087d.hot-update.js.map
|
import { Server, Model, belongsTo } from "miragejs";
/*
A model with a belongsTo association can be in six states
with respect to its association. This helper class
returns a child (and its association) in these various states.
The return value is an array of the form
[ child, parent ]
where the parent may be undefined.
*/
export default class BelongsToHelper {
constructor() {
this.server = new Server({
environment: "test",
models: {
user: Model.extend({
profile: belongsTo()
}),
profile: Model.extend({
user: belongsTo()
})
}
});
this.db = this.server.db;
this.schema = this.server.schema;
}
shutdown() {
this.server.shutdown();
}
savedChildNoParent() {
let insertedUser = this.db.users.insert({ name: "Link" });
return [this.schema.users.find(insertedUser.id), undefined];
}
savedChildNewParent() {
let user = this.schema.users.create({ name: "Link" });
let profile = this.schema.profiles.new({ age: 300 });
user.profile = profile;
return [user, profile];
}
savedChildSavedParent() {
let insertedProfile = this.db.profiles.insert({ age: 300 });
let insertedUser = this.db.users.insert({
name: "Link",
profileId: insertedProfile.id
});
this.db.profiles.update(insertedProfile.id, { userId: insertedUser.id });
let user = this.schema.users.find(insertedUser.id);
let profile = this.schema.profiles.find(insertedProfile.id);
return [user, profile];
}
newChildNoParent() {
return [this.schema.users.new({ name: "Link" }), undefined];
}
newChildNewParent() {
let profile = this.schema.profiles.new({ age: 300 });
let user = this.schema.users.new({ name: "Link" });
user.profile = profile;
return [user, profile];
}
newChildSavedParent() {
let insertedProfile = this.db.profiles.insert({ age: 300 });
let user = this.schema.users.new({ name: "Link" });
let savedProfile = this.schema.profiles.find(insertedProfile.id);
user.profile = savedProfile;
return [user, savedProfile];
}
// Just a saved unassociated parent.
savedParent() {
let insertedProfile = this.db.profiles.insert({ age: 300 });
return this.schema.profiles.find(insertedProfile.id);
}
newParent() {
return this.schema.profiles.new({ age: 300 });
}
}
export const states = [
"savedChildNoParent",
"savedChildNewParent",
"savedChildSavedParent",
"newChildNoParent",
"newChildNewParent",
"newChildSavedParent"
];
|
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const vscode = require("vscode");
const fs = require("fs");
const os = require("os");
const path_1 = require("path");
function rndName() {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
}
function createRandomFile(contents = '', fileExtension = 'txt') {
return new Promise((resolve, reject) => {
const tmpFile = path_1.join(os.tmpdir(), rndName() + '.' + fileExtension);
fs.writeFile(tmpFile, contents, (error) => {
if (error) {
return reject(error);
}
resolve(vscode.Uri.file(tmpFile));
});
});
}
exports.createRandomFile = createRandomFile;
function pathEquals(path1, path2) {
if (process.platform !== 'linux') {
path1 = path1.toLowerCase();
path2 = path2.toLowerCase();
}
return path1 === path2;
}
exports.pathEquals = pathEquals;
function deleteFile(file) {
return new Promise((resolve, reject) => {
fs.unlink(file.fsPath, (err) => {
if (err) {
reject(err);
}
else {
resolve(true);
}
});
});
}
exports.deleteFile = deleteFile;
function closeAllEditors() {
return vscode.commands.executeCommand('workbench.action.closeAllEditors');
}
exports.closeAllEditors = closeAllEditors;
function withRandomFileEditor(initialContents, fileExtension = 'txt', run) {
return createRandomFile(initialContents, fileExtension).then(file => {
return vscode.workspace.openTextDocument(file).then(doc => {
return vscode.window.showTextDocument(doc).then((editor) => {
return run(editor, doc).then(_ => {
if (doc.isDirty) {
return doc.save().then(() => {
return deleteFile(file);
});
}
else {
return deleteFile(file);
}
});
});
});
});
}
exports.withRandomFileEditor = withRandomFileEditor;
//# sourceMappingURL=testUtils.js.map
|
/*! lozad.js - v1.10.0 - 2019-09-18
* https://github.com/ApoorvSaxena/lozad.js
* Copyright (c) 2019 Apoorv Saxena; Licensed MIT */
/**
* Detect IE browser
* @const {boolean}
* @private
*/
const isIE = typeof document !== 'undefined' && document.documentMode;
const defaultConfig = {
rootMargin: '0px',
threshold: 0,
load(element) {
if (element.nodeName.toLowerCase() === 'picture') {
const img = document.createElement('img');
if (isIE && element.getAttribute('data-iesrc')) {
img.src = element.getAttribute('data-iesrc');
}
if (element.getAttribute('data-alt')) {
img.alt = element.getAttribute('data-alt');
}
element.append(img);
}
if (element.nodeName.toLowerCase() === 'video' && !element.getAttribute('data-src')) {
if (element.children) {
const childs = element.children;
let childSrc;
for (let i = 0; i <= childs.length - 1; i++) {
childSrc = childs[i].getAttribute('data-src');
if (childSrc) {
childs[i].src = childSrc;
}
}
element.load();
}
}
if (element.getAttribute('data-src')) {
element.src = element.getAttribute('data-src');
}
if (element.getAttribute('data-srcset')) {
element.setAttribute('srcset', element.getAttribute('data-srcset'));
}
if (element.getAttribute('data-background-image')) {
element.style.backgroundImage = `url('${element.getAttribute('data-background-image')}')`;
}
if (element.getAttribute('data-toggle-class')) {
element.classList.toggle(element.getAttribute('data-toggle-class'));
}
},
loaded() {}
};
function markAsLoaded(element) {
element.setAttribute('data-loaded', true);
}
const isLoaded = element => element.getAttribute('data-loaded') === 'true';
const onIntersection = (load, loaded) => (entries, observer) => {
entries.forEach(entry => {
if (entry.intersectionRatio > 0 || entry.isIntersecting) {
observer.unobserve(entry.target);
if (!isLoaded(entry.target)) {
load(entry.target);
markAsLoaded(entry.target);
loaded(entry.target);
}
}
});
};
const getElements = (selector, root = document) => {
if (selector instanceof Element) {
return [selector]
}
if (selector instanceof NodeList) {
return selector
}
return root.querySelectorAll(selector)
};
function lozad (selector = '.lozad', options = {}) {
const {root, rootMargin, threshold, load, loaded} = Object.assign({}, defaultConfig, options);
let observer;
if (typeof window !== 'undefined' && window.IntersectionObserver) {
observer = new IntersectionObserver(onIntersection(load, loaded), {
root,
rootMargin,
threshold
});
}
return {
observe() {
const elements = getElements(selector, root);
for (let i = 0; i < elements.length; i++) {
if (isLoaded(elements[i])) {
continue
}
if (observer) {
observer.observe(elements[i]);
continue
}
load(elements[i]);
markAsLoaded(elements[i]);
loaded(elements[i]);
}
},
triggerLoad(element) {
if (isLoaded(element)) {
return
}
load(element);
markAsLoaded(element);
loaded(element);
},
observer
}
}
export default lozad;
|
define([
'kb_widget/bases/dataWidget',
'kb_service/client/workspace',
'kb_service/utils',
'kb_common/html'
], function(DataWidget, Workspace, serviceUtil, html) {
'use strict';
function factory(config) {
/**
* Utility function to build a table based on the given object.
*
* @param {type} expressionSeriesObject
* @returns {unresolved}
*/
function buildOverviewTable(expressionSeriesObject) {
var columns = ['Name', 'Workspace', 'KBID', 'Source', 'Genome', 'Type', 'Errors', 'Owner', 'Creation date'],
genome = Object.keys(expressionSeriesObject.data.genome_expression_sample_ids_map)[0],
rows = [
[
expressionSeriesObject.workspaceInfo.name,
expressionSeriesObject.workspaceInfo.ws,
expressionSeriesObject.data.regulome_id,
genome,
expressionSeriesObject.data.type,
expressionSeriesObject.data.importErrors,
expressionSeriesObject.creator,
expressionSeriesObject.created
]
],
content = html.makeTableRotated({
columns: columns,
rows: rows,
class: 'table table-striped table-bordered'
});
return content;
}
/**
* Utility function to build a table based on the given set of sample ids.
*
* @param {type} data
* @returns {unresolved}
*/
function buildExpressionSeriesTable(data) {
var columns = ['Gene Expression Samples'],
// Reformat to be reflect tabular structure.
rows = data.map(function(datum) {
return [datum];
}),
content = html.makeTable({
columns: columns,
rows: rows,
class: 'table table-striped table-bordered'
});
return content;
}
/**
*
* Build a bootstrap tabset, with content derived from the utility
* functions above.
* Note that
*
* @param {type} widget
* @returns {unresolved}
*/
function buildTabset(widget) {
var tabs = [{
id: html.genId(),
label: 'Overview',
content: buildOverviewTable(widget.get('data'))
},
{
id: html.genId(),
label: 'Expression Series',
content: buildExpressionSeriesTable(widget.get('sampleData'))
}
];
return html.makeTabs({
tabs: tabs
});
}
function doFetch(widget) {
var workspace = new Workspace(widget.runtime.getConfig('services.workspace.url'), {
token: widget.runtime.service('session').getAuthToken()
}),
params = widget.get('params'),
// ref = '78/38/1'
ref = params.workspaceId + '/' + params.objectId + '/' + params.objectVersion;
return workspace.get_objects([{ ref: ref }])
.then(function(data) {
if (data.length === 1) {
var workspaceObject = data[0];
workspaceObject.workspaceInfo = serviceUtil.object_info_to_object(workspaceObject.info);
widget.set('data', workspaceObject);
return workspaceObject;
}
if (data.length === 0) {
throw new Error('Sorry, no object found');
}
if (data.length > 1) {
throw new Error('Too many data objects found: ' + data.length);
}
})
.then(function(workspaceObject) {
var genome = Object.keys(workspaceObject.data.genome_expression_sample_ids_map)[0],
series = workspaceObject.data.genome_expression_sample_ids_map[genome],
sampleRefs = series.map(function(sampleRef) {
return { ref: sampleRef };
});
return workspace.get_objects(sampleRefs);
})
.then(function(sampleData) {
// Munge the returned objects into a list of lists
var data = sampleData.map(function(dataObject) {
return dataObject.data.id;
});
widget.set('sampleData', data);
})
.then(function() {
widget.set('ready', true);
});
}
return DataWidget.make({
runtime: config.runtime,
title: 'Expression Series Widget',
on: {
initialContent: function() {
return html.loading('Loading...');
},
fetch: function() {
return doFetch(this);
},
render: function() {
if (this.get('ready')) {
return buildTabset(this);
}
}
}
});
}
return {
make: function(config) {
return factory(config);
}
};
});
|
const hedValidator = require('hed-validator')
const utils = require('../../utils')
const Issue = utils.issues.Issue
module.exports = function checkHedStrings(events, headers, jsonContents) {
const issues = []
// get all headers associated with task data
const taskHeaders = headers.filter(header => {
const file = header[0]
return file.relativePath.includes('_task-')
})
// loop through headers with files that are tasks
taskHeaders.forEach(taskHeader => {
const file = taskHeader[0]
// get the json sidecar dictionary associated with that nifti scan
const potentialSidecars = utils.files.potentialLocations(
file.relativePath.replace('.gz', '').replace('.nii', '.json'),
)
const mergedDictionary = utils.files.generateMergedSidecarDict(
potentialSidecars,
jsonContents,
)
const sidecarHedTags = {}
for (let sidecarKey in mergedDictionary) {
const sidecarValue = mergedDictionary[sidecarKey]
if (sidecarValue.HED !== undefined) {
sidecarHedTags[sidecarKey] = sidecarValue.HED
}
}
// get the _events.tsv associated with this task scan
const potentialEvents = utils.files.potentialLocations(
file.relativePath.replace('.gz', '').replace('bold.nii', 'events.tsv'),
)
const associatedEvents = events.filter(
event => potentialEvents.indexOf(event.path) > -1,
)
// loop through all events associated with this task scan
for (let event of associatedEvents) {
// get all non-empty rows
const rows = event.contents
.split('\n')
.filter(row => !(!row || /^\s*$/.test(row)))
const columnHeaders = rows[0].trim().split('\t')
const hedColumnIndex = columnHeaders.indexOf('HED')
const sidecarHedColumnIndices = {}
for (let sidecarHedColumn in sidecarHedTags) {
const sidecarHedColumnHeader = columnHeaders.indexOf(sidecarHedColumn)
if (sidecarHedColumnHeader > -1) {
sidecarHedColumnIndices[sidecarHedColumn] = sidecarHedColumnHeader
}
}
if (hedColumnIndex === -1 && sidecarHedColumnIndices.length === 0) {
continue
}
for (let row of rows.slice(1)) {
// get the 'HED' field
const rowCells = row.trim().split('\t')
const hedStringParts = []
if (rowCells[hedColumnIndex]) {
hedStringParts.push(rowCells[hedColumnIndex])
}
for (let sidecarHedColumn in sidecarHedColumnIndices) {
const sidecarHedIndex = sidecarHedColumnIndices[sidecarHedColumn]
const sidecarHedKey = rowCells[sidecarHedIndex]
if (sidecarHedKey) {
const sidecarHedString =
sidecarHedTags[sidecarHedColumn][sidecarHedKey]
if (sidecarHedString !== undefined) {
hedStringParts.push(sidecarHedString)
} else {
issues.push(
new Issue({
code: 112,
file: file,
evidence: sidecarHedKey,
}),
)
}
}
}
if (hedStringParts.length === 0) {
continue
}
const hedString = hedStringParts.join(',')
const hedIssues = []
const isHedStringValid = hedValidator.HED.validateHedString(
hedString,
hedIssues,
true,
)
if (!isHedStringValid) {
const convertedIssues = convertHedIssuesToBidsIssues(hedIssues, file)
for (let convertedIssue of convertedIssues) {
issues.push(convertedIssue)
}
}
}
}
})
return issues
}
function convertHedIssuesToBidsIssues(hedIssues, file) {
const hedIssuesToBidsCodes = {
'ERROR: Invalid character': 106,
'ERROR: Comma missing after': 108,
'WARNING: First word not capitalized or camel case': 109,
'ERROR: Duplicate tag': 110,
'ERROR: Too many tildes': 111,
}
const convertedIssues = []
for (let hedIssue of hedIssues) {
if (
hedIssue.startsWith(
'ERROR: Number of opening and closing parentheses are unequal.',
)
) {
convertedIssues.push(
new Issue({
code: 107,
file: file,
}),
)
} else {
const issueParts = hedIssue.split(' - ')
const bidsIssueCode = hedIssuesToBidsCodes[issueParts[0]]
if (bidsIssueCode === undefined) {
if (hedIssue.startsWith('WARNING')) {
convertedIssues.push(
new Issue({
code: 105,
file: file,
evidence: issueParts[1],
}),
)
} else {
convertedIssues.push(
new Issue({
code: 104,
file: file,
evidence: issueParts[1],
}),
)
}
} else {
convertedIssues.push(
new Issue({
code: bidsIssueCode,
file: file,
evidence: issueParts[1],
}),
)
}
}
}
return convertedIssues
}
|
/*
* Copyright 2016 Austin Lehman
*
* 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.
*/
/**
* Page object is used with Binder to provided virtual page support
* in web app. Extend Page and implement show() to create a new page.
* @param PageId is a string with the page id. This is used in the URL
* as /<PageId>. (Unique)
* @param PageTitle is a string with a human readable title for the page.
*/
function Page (PageId, PageTitle) {
BaseObj.call(this);
this.id = '';
this.title = '';
// Manage scroll position.
this.scrollPos = 0;
if (isDef(PageId)) {
this.id = PageId;
this.title = PageTitle;
}
}
Page.prototype = new BaseObj;
/**
* Shows the content of the page. Override this method to implement
* the construction of the page.
* @param Bdr is the binder calling object.
*/
Page.prototype.show = function (Bdr) {
throw ("Page.show(): Not implemented. Implement this method to handle on-show event.");
};
/**
* This method is called by the Binder to update
* the page scroll position.
* @param Pos is an integer with the new scroll position.
* @return this
*/
Page.prototype.onScroll = function (Pos) {
this.scrollPos = Pos;
return this;
};
Page.prototype.constructor = Page;
/**
* Creates a new Binder object that manages virtual pages in
* an app.
* @param Selector is a jQuery selector to use as the page.
*/
function Binder (Selector) {
BaseObj.call(this);
// Selector
this.selector = Selector;
// Home page.
this.homePage = undefined;
// The current page name.
this.currentPage = undefined;
// Map to all pages. (PageId -> PageObj)
this.pages = {};
// Page data used for history pushState ...
this.pageData = {};
// History list. This is a list of objects with the following
// properties.
// id - The page id.
// data - The data the page was called with.
this.history = [];
// Clear page setting. If set to true then when gotoPage is called the
// current page html is replaced with a blank string until the new page
// inserts the new content.
this.clearPage = true;
}
Binder.prototype = new BaseObj;
/**
* Initializes the Binder object and set's the home page.
* @param HomePage is an instance of Page and is the home page.
* @return this
*/
Binder.prototype.init = function (HomePage) {
if (!isDef(HomePage)) { throw ("Binder.init(): Expecting parameter HomePage."); }
this.homePage = HomePage;
this.currentPage = HomePage;
this.pageData = { page: HomePage.id };
this.pages[HomePage.id] = HomePage;
this.setNavigationHandlers();
return this;
};
/**
* This method is called by init and sets up the window
* history back button handling.
* @return this
*/
Binder.prototype.setNavigationHandlers = function () {
var self = this;
history.pushState(this.pageData, this.homePage.title, "/");
window.onpopstate = function(event) {
history.pushState(self.pageData, self.homePage.title, "/");
return self.backOnePage();
};
return this;
};
/**
* This method moves the Binder back to the previous page. It is
* called by the back button handler when back is pressed but
* can be called as well.
* @return this
*/
Binder.prototype.backOnePage = function () {
if (this.history[this.history.length - 1].id === this.homePage.id) {
window.history.go(-2);
return 1;
} else {
this.history.pop(); // Remove current
var backPageObj = this.history.pop(); // Remove previous because it will be added back.
// Set the BackButton flag.
if (isDef(backPageObj.data)) {
backPageObj.data.BackButton = true;
} else {
backPageObj.data = { BackButton: true };
}
this.gotoPage(backPageObj.id, backPageObj.data);
}
return this;
};
/**
* Adds the provided Page object to the Binder.
* @param PageObj is an instance of Page object to add to the Binder.
* @return this
*/
Binder.prototype.addPage = function (PageObj) {
if (!isDef(PageObj)) { throw ("Binder.addPage(): Param PageObj is required."); }
this.pages[PageObj.id] = PageObj;
return this;
};
/**
* Sends the binder to a new page by the page ID provided. If the page
* navigation is triggered by the back button, then the current page (not
* next page) will retain it's position. If not triggered by the back button
* then the current page will have it's position set to 0. This is so when
* clicking the back button the binder will make an attempt along with the page
* calling updateScrollPosition() to return the user to the spot they were at
* in the previous page.
* @param PageId is a string with the page to navigate to.
* @param Data is a JS object with parameters to pass through to the show()
* function. It may also contain the BackButton boolean indicating it was called
* when a user clicked the browser back button.
* button caused the navigation and false if not.
* @return this
*/
Binder.prototype.gotoPage = function(PageId, Data) {
if (!isDef(PageId) || PageId.trim() === "") { throw ("Binder.gotoPage(): Parameter PageId is missing or blank."); }
if (!this.pages.contains(PageId)) { throw ("Binder.gotoPage(): Provided PageId '" + PageId + "' not found in binder."); }
if (isDef(this.pages[PageId].show) && typeof this.pages[PageId].show === "function") {
// If clearPage is set to true, first clear the current content.
if (this.clearPage === true) {
this.replace("");
}
// Set browser location to default.
history.replaceState(this.pageData, this.homePage.title, "/");
// Set page info.
if (PageId === this.homePage.id) {
this.history = [];
}
this.history.push( { id: PageId, data: Data } );
// Remove current scroll handler.
$(document).off('scroll');
// Set current page.
this.currentPage = this.pages[PageId];
// If this was triggered by back button, then remove the back button flag.
// Else reset scrollPos of page.
if (isDef(Data) && isDef(Data.BackButton) && Data.BackButton === true) {
Data.BackButton = false;
} else {
this.currentPage.scrollPos = 0;
}
// Show the page.
this.currentPage.show(this, Data);
} else {
throw ("Binder.gotoPage(): Page '" + PageId + "' show() method not found.");
}
return this;
};
Binder.prototype.setQueryString = function (UrlQueryString) {
if (isDef(UrlQueryString)) {
history.replaceState(this.pageData, this.homePage.title, UrlQueryString);
}
};
/**
* Called by the page once it's show method has completed any
* writing to the page to update the scroll tracking and
* attach the scroll handler.
* @return this
*/
Binder.prototype.updateScrollPosition = function () {
var cpage = this.currentPage;
var imgLoaded = false;
var self = this;
// Create a new hidden div with generated ID to wait for the load.
var did = uuid.get();
// Wait for images.
$(this.selector).waitForImages(function () {
imgLoaded = true;
});
// Wait for images and div available.
var appint = setInterval(function(){
if ($('#' + did).length > 0 && imgLoaded) {
$('#' + did).remove();
clearInterval(appint);
$(document).scrollTop(cpage.scrollPos);
self.registerScrollHandler();
}
}, 100);
$(this.selector).append("<div id='" + did + "' style='display: none;'></div>");
return this;
};
/**
* Registers the document scroll handler to the current page. This method
* is called by updateScrollPosition() once the content in the page has loaded.
* @return this.
*/
Binder.prototype.registerScrollHandler = function () {
var cpage = this.currentPage;
$(document).scroll(function () {
var pos = $(document).scrollTop();
cpage.onScroll(pos);
});
return this;
};
/**
* Replaces the current page contents with the HTML content provided. This is
* generally meant to be called the the Page when shown in order to set it's
* page content.
* @param Content is a string with the HTML content to set.
* @return this
*/
Binder.prototype.replace = function (Content) {
$(this.selector).replaceWith("<div id='" + this.selector.replace('#', '') + "'>" + Content + "</div>");
return this;
};
Binder.prototype.constructor = Binder;
|
/**
* Admui-iframe v2.0.0 (http://www.admui.com/)
* Copyright 2015-2018 Admui Team
* Licensed under the Admui License 1.1 (http://www.admui.com/about/license)
*/
!function(e,t,n){"use strict";jQuery.components.register("selective",{mode:"default",defaults:{search:function(){return'<input class="'+this.namespace+'-search" type="text" placeholder="搜索…">'},triggerButton:function(){return'<div class="'+this.namespace+'-trigger-button">添加</div>'}}})}(window,document);
|
/*!
diff v2.0.2
Software License Agreement (BSD License)
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
All rights reserved.
Redistribution and use of this software 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.
* Neither the name of Kevin Decker nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@license
*/
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.JsDiff=b():a.JsDiff=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}b.__esModule=!0;var e=c(1),f=d(e),g=c(3),h=c(4),i=c(5),j=c(6),k=c(7),l=c(8),m=c(9),n=c(10),o=c(12),p=c(13);b.Diff=f["default"],b.diffChars=g.diffChars,b.diffWords=h.diffWords,b.diffWordsWithSpace=h.diffWordsWithSpace,b.diffLines=i.diffLines,b.diffTrimmedLines=i.diffTrimmedLines,b.diffSentences=j.diffSentences,b.diffCss=k.diffCss,b.diffJson=l.diffJson,b.structuredPatch=n.structuredPatch,b.createTwoFilesPatch=n.createTwoFilesPatch,b.createPatch=n.createPatch,b.applyPatch=m.applyPatch,b.convertChangesToDMP=o.convertChangesToDMP,b.convertChangesToXML=p.convertChangesToXML,b.canonicalize=l.canonicalize},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){this.ignoreWhitespace=a}function f(a,b,c,d){for(var e=0,f=a.length,g=0,h=0;f>e;e++){var j=a[e];if(j.removed){if(j.value=c.slice(h,h+j.count).join(""),h+=j.count,e&&a[e-1].added){var k=a[e-1];a[e-1]=a[e],a[e]=k}}else{if(!j.added&&d){var l=b.slice(g,g+j.count);l=i["default"](l,function(a,b){var d=c[h+b];return d.length>a.length?d:a}),j.value=l.join("")}else j.value=b.slice(g,g+j.count).join("");g+=j.count,j.added||(h+=j.count)}}return a}function g(a){return{newPos:a.newPos,components:a.components.slice(0)}}b.__esModule=!0,b["default"]=e;var h=c(2),i=d(h);e.prototype={diff:function(a,b,c){function d(a){return c?(setTimeout(function(){c(void 0,a)},0),!0):a}function e(){for(var c=-1*k;k>=c;c+=2){var e=void 0,l=m[c-1],n=m[c+1],o=(n?n.newPos:0)-c;l&&(m[c-1]=void 0);var p=l&&l.newPos+1<i,q=n&&o>=0&&j>o;if(p||q){if(!p||q&&l.newPos<n.newPos?(e=g(n),h.pushComponent(e.components,void 0,!0)):(e=l,e.newPos++,h.pushComponent(e.components,!0,void 0)),o=h.extractCommon(e,b,a,c),e.newPos+1>=i&&o+1>=j)return d(f(e.components,b,a,h.useLongestToken));m[c]=e}else m[c]=void 0}k++}var h=this;if(a=this.castInput(a),b=this.castInput(b),b===a)return d([{value:b}]);if(!b)return d([{value:a,removed:!0}]);if(!a)return d([{value:b,added:!0}]);b=this.removeEmpty(this.tokenize(b)),a=this.removeEmpty(this.tokenize(a));var i=b.length,j=a.length,k=1,l=i+j,m=[{newPos:-1,components:[]}],n=this.extractCommon(m[0],b,a,0);if(m[0].newPos+1>=i&&n+1>=j)return d([{value:b.join("")}]);if(c)!function p(){setTimeout(function(){return k>l?c():void(e()||p())},0)}();else for(;l>=k;){var o=e();if(o)return o}},pushComponent:function(a,b,c){var d=a[a.length-1];d&&d.added===b&&d.removed===c?a[a.length-1]={count:d.count+1,added:b,removed:c}:a.push({count:1,added:b,removed:c})},extractCommon:function(a,b,c,d){for(var e=b.length,f=c.length,g=a.newPos,h=g-d,i=0;e>g+1&&f>h+1&&this.equals(b[g+1],c[h+1]);)g++,h++,i++;return i&&a.components.push({count:i}),a.newPos=g,h},equals:function(a,b){var c=/\S/;return a===b||this.ignoreWhitespace&&!c.test(a)&&!c.test(b)},removeEmpty:function(a){for(var b=[],c=0;c<a.length;c++)a[c]&&b.push(a[c]);return b},castInput:function(a){return a},tokenize:function(a){return a.split("")}},a.exports=b["default"]},function(a,b){"use strict";function c(a,b,c){if(Array.prototype.map)return Array.prototype.map.call(a,b,c);for(var d=new Array(a.length),e=0,f=a.length;f>e;e++)d[e]=b.call(c,a[e],e,a);return d}b.__esModule=!0,b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.diffChars=e;var f=c(1),g=d(f),h=new g["default"];b.characterDiff=h},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return j.diff(a,b,c)}function f(a,b,c){return k.diff(a,b,c)}b.__esModule=!0,b.diffWords=e,b.diffWordsWithSpace=f;var g=c(1),h=d(g),i=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,j=new h["default"](!0);b.wordDiff=j;var k=new h["default"];b.wordWithSpaceDiff=k,j.tokenize=k.tokenize=function(a){for(var b=a.split(/(\s+|\b)/),c=0;c<b.length-1;c++)!b[c+1]&&b[c+2]&&i.test(b[c])&&i.test(b[c+2])&&(b[c]+=b[c+2],b.splice(c+1,2),c--);return b}},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return i.diff(a,b,c)}function f(a,b,c){return j.diff(a,b,c)}b.__esModule=!0,b.diffLines=e,b.diffTrimmedLines=f;var g=c(1),h=d(g),i=new h["default"];b.lineDiff=i;var j=new h["default"];b.trimmedLineDiff=j,j.ignoreTrim=!0,i.tokenize=j.tokenize=function(a){for(var b=[],c=a.split(/^/m),d=0;d<c.length;d++){var e=c[d],f=c[d-1],g=f&&f[f.length-1];"\n"===e&&"\r"===g?b[b.length-1]=b[b.length-1].slice(0,-1)+"\r\n":(this.ignoreTrim&&(e=e.trim(),d<c.length-1&&(e+="\n")),b.push(e))}return b}},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.diffSentences=e;var f=c(1),g=d(f),h=new g["default"];b.sentenceDiff=h,h.tokenize=function(a){return a.split(/(\S.+?[.!?])(?=\s+|$)/)}},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.diffCss=e;var f=c(1),g=d(f),h=new g["default"];b.cssDiff=h,h.tokenize=function(a){return a.split(/([{}:;,]|\s+)/)}},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return k.diff(a,b,c)}function f(a,b,c){b=b||[],c=c||[];var d=void 0;for(d=0;d<b.length;d+=1)if(b[d]===a)return c[d];var e=void 0;if("[object Array]"===j.call(a)){for(b.push(a),e=new Array(a.length),c.push(e),d=0;d<a.length;d+=1)e[d]=f(a[d],b,c);b.pop(),c.pop()}else if("object"==typeof a&&null!==a){b.push(a),e={},c.push(e);var g=[],h=void 0;for(h in a)a.hasOwnProperty(h)&&g.push(h);for(g.sort(),d=0;d<g.length;d+=1)h=g[d],e[h]=f(a[h],b,c);b.pop(),c.pop()}else e=a;return e}b.__esModule=!0,b.diffJson=e,b.canonicalize=f;var g=c(1),h=d(g),i=c(5),j=Object.prototype.toString,k=new h["default"];b.jsonDiff=k,k.useLongestToken=!0,k.tokenize=i.lineDiff.tokenize,k.castInput=function(a){return"string"==typeof a?a:JSON.stringify(f(a),void 0," ")},k.equals=function(a,b){return h["default"].prototype.equals(a.replace(/,([\r\n])/g,"$1"),b.replace(/,([\r\n])/g,"$1"))}},function(a,b){"use strict";function c(a,b){for(var c=b.split("\n"),d=[],e=0,f=!1,g=!1;e<c.length&&!/^@@/.test(c[e]);)e++;for(;e<c.length;e++)if("@"===c[e][0]){var h=c[e].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);d.unshift({start:h[3],oldlength:+h[2],removed:[],newlength:h[4],added:[]})}else"+"===c[e][0]?d[0].added.push(c[e].substr(1)):"-"===c[e][0]?d[0].removed.push(c[e].substr(1)):" "===c[e][0]?(d[0].added.push(c[e].substr(1)),d[0].removed.push(c[e].substr(1))):"\\"===c[e][0]&&("+"===c[e-1][0]?f=!0:"-"===c[e-1][0]&&(g=!0));var i=a.split("\n");for(e=d.length-1;e>=0;e--){for(var j=d[e],k=0;k<j.oldlength;k++)if(i[j.start-1+k]!==j.removed[k])return!1;Array.prototype.splice.apply(i,[j.start-1,j.oldlength].concat(j.added))}if(f)for(;!i[i.length-1];)i.pop();else g&&i.push("");return i.join("\n")}b.__esModule=!0,b.applyPatch=c},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c,d,e,f,g){function i(a){return j["default"](a,function(a){return" "+a})}g||(g={context:4});var k=h.patchDiff.diff(c,d);k.push({value:"",lines:[]});for(var l=[],m=0,n=0,o=[],p=1,q=1,r=function(a){var b=k[a],e=b.lines||b.value.replace(/\n$/,"").split("\n");if(b.lines=e,b.added||b.removed){if(!m){var f=k[a-1];m=p,n=q,f&&(o=g.context>0?i(f.lines.slice(-g.context)):[],m-=o.length,n-=o.length)}o.push.apply(o,j["default"](e,function(a){return(b.added?"+":"-")+a})),b.added?q+=e.length:p+=e.length}else{if(m)if(e.length<=2*g.context&&a<k.length-2)o.push.apply(o,i(e));else{var h=Math.min(e.length,g.context);o.push.apply(o,i(e.slice(0,h)));var r={oldStart:m,oldLines:p-m+h,newStart:n,newLines:q-n+h,lines:o};if(a>=k.length-2&&e.length<=g.context){var s=/\n$/.test(c),t=/\n$/.test(d);0!=e.length||s?s&&t||o.push("\\ No newline at end of file"):o.splice(r.oldLines,0,"\\ No newline at end of file")}l.push(r),m=0,n=0,o=[]}p+=e.length,q+=e.length}},s=0;s<k.length;s++)r(s);return{oldFileName:a,newFileName:b,oldHeader:e,newHeader:f,hunks:l}}function f(a,b,c,d,f,g,h){var i=e(a,b,c,d,f,g,h),j=[];a==b&&j.push("Index: "+a),j.push("==================================================================="),j.push("--- "+i.oldFileName+("undefined"==typeof i.oldHeader?"":" "+i.oldHeader)),j.push("+++ "+i.newFileName+("undefined"==typeof i.newHeader?"":" "+i.newHeader));for(var k=0;k<i.hunks.length;k++){var l=i.hunks[k];j.push("@@ -"+l.oldStart+","+l.oldLines+" +"+l.newStart+","+l.newLines+" @@"),j.push.apply(j,l.lines)}return j.join("\n")+"\n"}function g(a,b,c,d,e,g){return f(a,a,b,c,d,e,g)}b.__esModule=!0,b.structuredPatch=e,b.createTwoFilesPatch=f,b.createPatch=g;var h=c(11),i=c(2),j=d(i)},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}b.__esModule=!0;var e=c(1),f=d(e),g=new f["default"];b.patchDiff=g,g.tokenize=function(a){var b=[],c=a.split(/(\n|\r\n)/);c[c.length-1]||c.pop();for(var d=0;d<c.length;d++){var e=c[d];d%2?b[b.length-1]+=e:b.push(e)}return b}},function(a,b){"use strict";function c(a){for(var b=[],c=void 0,d=void 0,e=0;e<a.length;e++)c=a[e],d=c.added?1:c.removed?-1:0,b.push([d,c.value]);return b}b.__esModule=!0,b.convertChangesToDMP=c},function(a,b){"use strict";function c(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];e.added?b.push("<ins>"):e.removed&&b.push("<del>"),b.push(d(e.value)),e.added?b.push("</ins>"):e.removed&&b.push("</del>")}return b.join("")}function d(a){var b=a;return b=b.replace(/&/g,"&"),b=b.replace(/</g,"<"),b=b.replace(/>/g,">"),b=b.replace(/"/g,""")}b.__esModule=!0,b.convertChangesToXML=c}])});
|
/*global angular*/
(function () {
angular
.module('simplAdmin.cms')
.factory('htmlWidgetService', widgetService);
/* @ngInject */
function widgetService($http) {
var service = {
getWidgetZones: getWidgetZones,
getHtmlWidget: getHtmlWidget,
createHtmlWidget: createHtmlWidget,
editHtmlWidget: editHtmlWidget,
getNumberOfWidgets: getNumberOfWidgets
};
return service;
function getWidgetZones() {
return $http.get('api/widget-zones');
}
function getHtmlWidget(id) {
return $http.get('api/html-widgets/' + id);
}
function createHtmlWidget(widgetInstance) {
return $http.post('api/html-widgets', widgetInstance);
}
function editHtmlWidget(widgetInstance) {
return $http.put('api/html-widgets/' + widgetInstance.id, widgetInstance);
}
function getNumberOfWidgets() {
return $http.get('api/widget-instances/number-of-widgets');
}
}
})();
|
module.exports = {
testEnvironment: "node",
globals: {
DB_JSON: JSON.stringify({
client: "pg",
connection: {
host: "127.0.0.1",
"port": "5432",
"database": "spoke_test",
"password": "spoke_test",
"user": "spoke_test"
},
}),
JOBS_SYNC: true,
JOBS_SAME_PROCESS: true,
DEFAULT_SERVICE: 'fakeservice',
DST_REFERENCE_TIMEZONE: 'America/New_York',
DATABASE_SETUP_TEARDOWN_TIMEOUT: 20000,
},
moduleFileExtensions: [
"js",
"jsx"
],
transform: {
".*.js": "<rootDir>/node_modules/babel-jest"
},
moduleDirectories: [
"node_modules"
],
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
},
collectCoverageFrom : ["**/*.{js,jsx}", "!**/node_modules/**", "!**/__test__/**", "!**/deploy/**", "!**/coverage/**"],
setupTestFrameworkScriptFile: "<rootDir>/__test__/setup.js",
};
|
/* global it, describe */
import { expect } from 'chai';
import FlowTemplate from '../src/template/flow-template';
import card from './cards/card.json';
describe('Flow Template', () => {
describe('Constructor', () => {
it('Should construct an instance', () => {
let instance = new FlowTemplate({ localesPath: __dirname+'/locales' });
expect(instance).to.exist;
});
});
describe('Translate a phrase', () => {
it('Should translate using variables', () => {
let instance = new FlowTemplate({ localesPath: __dirname+'/locales' });
let view = {
user: {
name: 'Jesús'
}
};
let translated = instance.translatePhrase('Hello {{ user.name }}, how are you today?', 'es', view);
let expected = 'Hola Jesús, ¿cómo andas?';
expect(translated).to.equal(expected);
});
});
describe('Translate an object', () => {
it('Should translate an object using variables', () => {
let instance = new FlowTemplate({ localesPath: __dirname+'/locales' });
let view = {
user: {
name: 'Jesús'
}
};
let translated = instance.translate(card, 'es', view);
let expected = {
greet: 'Hola',
greetUser: 'Hola Jesús, ¿cómo andas?'
};
expect(translated).to.deep.equal(expected);
});
});
});
|
import React from 'react'
import {Link} from 'react-router-dom'
import './Nav.css'
const Nav = () => {
return (
<nav>
<h2>MERN</h2>
<ul>
<li>
<Link to="/">Home</Link>
<Link to="/register">Register</Link>
</li>
</ul>
</nav>
)
}
export default Nav
|
import {
TagLabel,
Tag,
Text,
Stack,
Divider,
Link,
Image,
Skeleton,
useColorMode,
ScaleFade
} from '@chakra-ui/react'
import { useMediaQuery } from 'react-responsive';
import {
FaGithub,
FaPython,
FaDocker,
FaDatabase,
FaJs,
FaReact,
FaCode,
FaWhmcs,
FaExternalLinkAlt,
FaEthernet,
FaWaveSquare
} from 'react-icons/fa'
import ReactGA from 'react-ga'
import React, { useState } from 'react'
import { bgColor, primaryTextColor, iconColor, borderColor, secondaryTextColor, shadowColor } from '../styles/darkMode'
export default function CanvasCard({
imageURL,
title,
desc,
githubLink,
deployLink,
tag
}) {
const { colorMode } = useColorMode()
const [opacity, setOpacity] = useState(0)
const getTag = (tag) => {
let values = []
if (tag == 'Online') {
values[0] = 'blue'
}
else if (tag == 'Sold') {
values[0] = 'red'
}
else if (tag == 'For Sale') {
values[0] = 'green'
}
else {
values[0] = 'gray'
}
return values
}
const isBigScreen = useMediaQuery({ minWidth: 600 });
const Tags = tag.map((item) => (
<Tag
key={item}
colorScheme={getTag(item)[0]}
size={isBigScreen ? 'md' : 'sm'}
>
<TagLabel>{item}</TagLabel>
</Tag>
))
const handleClick = (event) => {
ReactGA.event({
category: 'click',
action: event,
})
}
const [imageLoad, setImageLoad] = useState(false);
return (
<Link
href={deployLink}
title={title}
style={{ textDecoration: 'none' }}
>
<Stack
bg="secondary"
borderRadius="10px"
minH="320px"
maxH="500px"
maxW="350px"
border="1px"
borderColor={{ base: '#333', md: borderColor[colorMode] }}
transition="0.3s"
_hover={{
boxShadow: shadowColor[colorMode],
textDecoration: 'none'
}}
mt={4}
onMouseOver={() => setOpacity(1)}
onMouseLeave={() => setOpacity(0)}
>
<ScaleFade in={true} transition={{ duration: 1 }}>
<Skeleton isLoaded={imageLoad} m='1' borderRadius="10px 10px 0px 0px">
<Image
width={375}
height={375}
w="auto"
h="auto"
src={imageURL}
transition="0.3s"
borderRadius="10px 10px 0px 0px"
alt="project image"
onLoad={() => setImageLoad(true)}
></Image>
</Skeleton>
<Stack px={4} py={2}>
<Stack isInline justifyContent="space-between" alignItems="center">
<Text fontSize="2xl" color={primaryTextColor[colorMode]}>
<strong>{title}</strong>
</Text>
{Tags}
</Stack>
<Divider />
<Text color={secondaryTextColor[colorMode]} fontSize={['sm', 'sm']}>
{desc}
</Text>
</Stack>
</ScaleFade>
</Stack>
</Link>
)
}
|
// https://www.codewars.com/kata/5ce969ab07d4b7002dcaa7a1
const solve = s => {
const limit = ~~(s.length / 2);
for (let length = limit; length > 0; length--) {
const prefix = s.slice(0, length);
const suffix = s.slice(-length);
if (prefix === suffix) {
return length;
}
}
return 0;
}
|
// @flow
import {isEqual} from 'lodash-es'
import * as ChatTypes from '../../constants/types/chat2'
import * as Chat2Gen from '../../actions/chat2-gen'
import * as TeamsGen from '../../actions/teams-gen'
import {type ChannelMembershipState} from '../../constants/types/teams'
import ManageChannels from '.'
import {
connect,
compose,
lifecycle,
type TypedState,
withHandlers,
withStateHandlers,
withPropsOnChange,
} from '../../util/container'
import {navigateTo, navigateAppend} from '../../actions/route-tree'
import {anyWaiting} from '../../constants/waiting'
import {getChannelsWaitingKey, getCanPerform, getTeamChannelInfos, hasCanPerform} from '../../constants/teams'
const mapStateToProps = (state: TypedState, {routeProps, routeState}) => {
const teamname = routeProps.get('teamname')
const waitingKey = getChannelsWaitingKey(teamname)
const waitingForGet = anyWaiting(state, waitingKey)
const channelInfos = getTeamChannelInfos(state, teamname)
const you = state.config.username
const yourOperations = getCanPerform(state, teamname)
// We can get here without loading team operations
// if we manage channels on mobile without loading the conversation first
const _hasOperations = hasCanPerform(state, teamname)
const canEditChannels =
yourOperations.editChannelDescription || yourOperations.renameChannel || yourOperations.deleteChannel
const canCreateChannels = yourOperations.createChannel
const channels = channelInfos
.map((info, convID) => ({
description: info.description,
convID,
name: info.channelname,
selected: you && info.participants.has(you),
}))
.valueSeq()
.toArray()
.sort((a, b) => a.name.localeCompare(b.name))
return {
_hasOperations,
_you: you,
canCreateChannels,
canEditChannels,
channels,
teamname,
waitingForGet,
waitingKey,
}
}
const mapDispatchToProps = (dispatch, {navigateUp, routePath, routeProps}) => {
const teamname = routeProps.get('teamname')
return {
_loadOperations: () => dispatch(TeamsGen.createGetTeamOperations({teamname})),
_loadChannels: () => dispatch(TeamsGen.createGetChannels({teamname})),
onBack: () => dispatch(navigateUp()),
onClose: () => dispatch(navigateUp()),
onEdit: conversationIDKey =>
dispatch(navigateAppend([{selected: 'editChannel', props: {conversationIDKey, teamname}}])),
onCreate: () =>
dispatch(navigateTo([{selected: 'createChannel', props: {teamname}}], routePath.butLast())),
_saveSubscriptions: (
oldChannelState: ChannelMembershipState,
nextChannelState: ChannelMembershipState,
you: string
) => {
dispatch(
TeamsGen.createSaveChannelMembership({
teamname,
oldChannelState,
newChannelState: nextChannelState,
you,
})
)
dispatch(navigateUp())
},
_onView: (
oldChannelState: ChannelMembershipState,
nextChannelState: ChannelMembershipState,
you: string,
channelname: string
) => {
dispatch(
TeamsGen.createSaveChannelMembership({
teamname,
oldChannelState,
newChannelState: nextChannelState,
you,
})
)
dispatch(navigateUp())
dispatch(Chat2Gen.createPreviewConversation({teamname, channelname, reason: 'manageView'}))
},
}
}
export default compose(
connect(mapStateToProps, mapDispatchToProps, (s, d, o) => ({...o, ...s, ...d})),
withPropsOnChange(['channels'], props => ({
oldChannelState: props.channels.reduce((acc, c) => {
acc[c.convID] = c.selected
return acc
}, {}),
})),
withStateHandlers(
props => ({
nextChannelState: props.oldChannelState,
}),
{
setNextChannelState: () => nextChannelState => ({nextChannelState}),
}
),
withHandlers({
onToggle: props => (convID: ChatTypes.ConversationIDKey) =>
props.setNextChannelState({
...props.nextChannelState,
[convID]: !props.nextChannelState[convID],
}),
onSaveSubscriptions: props => () =>
props._saveSubscriptions(props.oldChannelState, props.nextChannelState, props._you),
onClickChannel: props => (channelname: string) => {
props._onView(props.oldChannelState, props.nextChannelState, props._you, channelname)
},
}),
lifecycle({
componentDidUpdate(prevProps) {
if (!isEqual(this.props.oldChannelState, prevProps.oldChannelState)) {
this.props.setNextChannelState(this.props.oldChannelState)
}
},
componentDidMount() {
this.props._loadChannels()
if (!this.props._hasOperations) {
this.props._loadOperations()
}
},
}),
withPropsOnChange(['oldChannelState', 'nextChannelState'], props => ({
unsavedSubscriptions: !isEqual(props.oldChannelState, props.nextChannelState),
}))
)(ManageChannels)
|
module.exports = [
require("./uri/ip"),
require("./uri/info"),
require("./google-news/google-news"),
require("./dict/countries"),
require("./elasticsearch/elasticsearch"),
// require("./nlp-uk/token"),
// require("./nlp-uk/ner")
]
.concat(require("./cypher"))
.concat(require("./mysql"))
.concat(require("./plantuml"))
.concat(require("./mongodb"))
.concat(require("./github"))
.concat(require("./jace-nlp"))
.concat(require("./dataverse"))
|
'use strict';
exports.__esModule = true;
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _componentOrElement = require('prop-types-extra/lib/componentOrElement');
var _componentOrElement2 = _interopRequireDefault(_componentOrElement);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _getContainer = require('./utils/getContainer');
var _getContainer2 = _interopRequireDefault(_getContainer);
var _ownerDocument = require('./utils/ownerDocument');
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
var _LegacyPortal = require('./LegacyPortal');
var _LegacyPortal2 = _interopRequireDefault(_LegacyPortal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* The `<Portal/>` component renders its children into a new "subtree" outside of current component hierarchy.
* You can think of it as a declarative `appendChild()`, or jQuery's `$.fn.appendTo()`.
* The children of `<Portal/>` component will be appended to the `container` specified.
*/
var Portal = function (_React$Component) {
_inherits(Portal, _React$Component);
function Portal() {
var _temp, _this, _ret;
_classCallCheck(this, Portal);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.setContainer = function () {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
_this._portalContainerNode = (0, _getContainer2.default)(props.container, (0, _ownerDocument2.default)(_this).body);
}, _this.getMountNode = function () {
return _this._portalContainerNode;
}, _this.getOverlayDOMNode = function () {
if (!_this._isMounted) {
throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
}
if (_this._overlayInstance) {
return _reactDom2.default.findDOMNode(_this._overlayInstance);
}
return null;
}, _temp), _possibleConstructorReturn(_this, _ret);
}
Portal.prototype.componentDidMount = function componentDidMount() {
this._isMounted = true;
this.setContainer();
this.forceUpdate(this.props.onRendered);
};
Portal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.container !== this.props.container) {
this.setContainer(nextProps);
}
};
Portal.prototype.componentWillUnmount = function componentWillUnmount() {
this._isMounted = false;
this._portalContainerNode = null;
};
Portal.prototype.render = function render() {
return this.props.children && this._portalContainerNode ? _reactDom2.default.createPortal(this.props.children, this._portalContainerNode) : null;
};
return Portal;
}(_react2.default.Component);
Portal.displayName = 'Portal';
Portal.propTypes = {
/**
* A Node, Component instance, or function that returns either. The `container` will have the Portal children
* appended to it.
*/
container: _propTypes2.default.oneOfType([_componentOrElement2.default, _propTypes2.default.func]),
onRendered: _propTypes2.default.func
};
exports.default = _reactDom2.default.createPortal ? Portal : _LegacyPortal2.default;
module.exports = exports['default'];
|
const actions = {
SET_CLASS_STATE: 'SET_CLASS_STATE',
GET_CLASS_DATA: 'GET_CLASS_DATA',
}
export default actions
|
// This file was procedurally generated from the following sources:
// - src/class-fields/computed-name-valueof-err.case
// - src/class-fields/class-evaluation-error/cls-expr.template
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, class, class-fields-public]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation
...
27. For each ClassElement e in order from elements
a. If IsStatic of me is false, then
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
b. Else,
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
c. If fields is an abrupt completion, then
i. Set the running execution context's LexicalEnvironment to lex.
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
iii. Return Completion(status).
...
Runtime Semantics: ClassElementEvaluation
ClassElement: FieldDefinition;
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
Runtime Semantics: ClassFieldDefinitionEvaluation
With parameters isStatic and homeObject.
1. Let fieldName be the result of evaluating ClassElementName.
2. ReturnIfAbrupt(fieldName).
...
Runtime Semantics: Evaluation
ComputedPropertyName: [ AssignmentExpression ]
1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be ? GetValue(exprValue).
3. Return ? ToPropertyKey(propName).
---*/
var obj = {
toString: undefined,
valueOf: function() {
throw new Test262Error();
}
};
function evaluate() {
var C = class {
[obj]
};
}
assert.throws(Test262Error, evaluate);
|
import * as tslib_1 from "tslib";
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { FooterComponent } from './footer/footer.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { TablesComponent } from './tables/tables.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatSortModule, MatTableModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatRippleModule, MatOptionModule, MatSelectModule, MatDialogModule, MatIconModule, MatExpansionModule, MatTabsModule, MatCheckboxModule, MatSidenavModule, MatToolbarModule, MatListModule, MatDatepickerModule, MatNativeDateModule, MatRadioModule } from '@angular/material';
import { DepartmentComponent } from './masterPages/department/department.component';
import { HttpClientModule } from '@angular/common/http';
import { CommonModule } from '@angular/common';
import { DesignationComponent } from './masterPages/designation/designation.component';
import { MasterPagesService } from './masterPages/shared/master-pages.service';
import { TeamComponent } from './masterPages/Team/team.component';
import { RoleComponent } from './masterPages/role/role.component';
import { AssetCategoryComponent } from './masterPages/assetCategory/assetCategory.component';
import { AssetSubCategoryComponent } from './masterPages/AssetSubCategory/assetSubCategory.component';
import { ProductComponent } from './masterPages/Product/product.component';
import { ProductTypeComponent } from './masterPages/ProductType/productType.component';
import { SoftwareTypeComponent } from './masterPages/SoftwareType/SoftwareType.component';
import { SoftwareCategoryComponent } from './masterPages/SoftwareCategory/SoftwareCategory.component';
import { TimezoneComponent } from './masterPages/TimeZone/TimeZone.component';
import { LocationGeneralComponent } from './commonViews/location-general/location-general.component';
import { CommonDepartmentComponent } from './commonViews/common-department/common-department.component';
import { CommonDesignationComponent } from './commonViews/common-designation/common-designation.component';
import { CommonTeamComponent } from './commonViews/common-team/common-team.component';
import { CommonAssetsComponent } from './commonViews/common-assets/common-assets.component';
import { CommonAssetHistoryComponent } from './commonViews/common-asset-history/common-asset-history.component';
import { CommonContactsComponent } from './commonViews/common-contacts/common-contacts.component';
import { CommonDocumentsComponent } from './commonViews/common-documents/common-documents.component';
import { CommonHistoryComponent } from './commonViews/common-history/common-history.component';
import { CommonTicketComponent } from './commonViews/common-ticket/common-ticket.component';
import { LocationViewComponent } from './view/locationView/locationView.component';
import { LocationListComponent } from './View/locationView/location-list/location-list.component';
import { ContactsViewComponent } from './view/contactsView/contactsView.component';
import { ContactsListComponent } from './view/contactsView/contacts-list/contacts-list.component';
import { AssetsViewComponent } from './view/assetsView/assetsView.component';
import { AssetsListComponent } from './view/assetsView/assets-list/assets-list.component';
import { TicketViewComponent } from './view/ticketView/ticketView.component';
import { TicketListComponent } from './view/ticketView/ticket-list/ticket-list.component';
import { DocumentViewComponent } from './view/documentView/documentView.component';
import { DocumentListComponent } from './view/documentView/document-list/document-list.component';
import { ContactsGeneralComponent } from './commonViews/contacts-general/contacts-general.component';
import { LocationGlobalComponent } from './commonViews/location-global/location-global.component';
import { ContactsGlobalComponent } from './commonViews/contacts-global/contacts-global.component';
import { AssetsGlobalComponent } from './commonViews/assets-global/assets-global.component';
import { AssetsGeneralComponent } from './commonViews/assets-general/assets-general.component';
import { DocumentsGlobalComponent } from './commonViews/documents-global/documents-global.component';
import { DocumentsGeneralComponent } from './commonViews/documents-general/documents-general.component';
import { TicketGeneralComponent } from './commonViews/ticket-general/ticket-general.component';
import { TicketGlobalComponent } from './commonViews/ticket-global/ticket-global.component';
import { TicketCategoryComponent } from './masterPages/ticketCategory/ticketCategory.component';
import { TicketSubCategoryComponent } from './masterPages/ticketSubCategory/ticketSubCategory.component';
import { A11yModule } from '@angular/cdk/a11y';
import { BidiModule } from '@angular/cdk/bidi';
import { ObserversModule } from '@angular/cdk/observers';
import { OverlayModule } from '@angular/cdk/overlay';
import { PlatformModule } from '@angular/cdk/platform';
import { PortalModule } from '@angular/cdk/portal';
import { ScrollDispatchModule } from '@angular/cdk/scrolling';
import { CdkStepperModule } from '@angular/cdk/stepper';
import { CdkTableModule } from '@angular/cdk/table';
import { DepartmentDialogBoxComponent } from './masterPages/department/department-dialog-box/department-dialog-box.component';
import { DesignationtDialogBoxComponent } from './masterPages/designation/designationt-dialog-box/designationt-dialog-box.component';
import { RoleDialogBoxComponent } from './masterPages/role/role-dialog-box/role-dialog-box.component';
import { AssetCategoryDialogBoxComponent } from './masterPages/assetCategory/asset-category-dialog-box/asset-category-dialog-box.component';
import { ProductDialogBoxComponent } from './masterPages/Product/product-dialog-box/product-dialog-box.component';
import { ProductTypeDialogBoxComponent } from './masterPages/ProductType/product-type-dialog-box/product-type-dialog-box.component';
import { SoftwareTypeDialogBoxComponent } from './masterPages/SoftwareType/software-type-dialog-box/software-type-dialog-box.component';
import { TeamDialogBoxComponent } from './masterPages/Team/team-dialog-box/team-dialog-box.component';
import { AssetSubCategoryDialogBoxComponent } from './masterPages/AssetSubCategory/asset-sub-category-dialog-box/asset-sub-category-dialog-box.component';
import { TicketSubCategoryDialogBoxComponent } from './masterPages/ticketSubCategory/ticket-sub-category-dialog-box/ticket-sub-category-dialog-box.component';
import { ToastrModule } from 'ngx-toastr';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TicketCategoryDialogBoxComponent } from './masterPages/ticketCategory/ticket-category-dialog-box/ticket-category-dialog-box.component';
let AppModule = class AppModule {
};
AppModule = tslib_1.__decorate([
NgModule({
declarations: [
AppComponent,
NavbarComponent,
SidebarComponent,
FooterComponent,
DashboardComponent,
TablesComponent,
DepartmentComponent,
DesignationComponent,
TeamComponent,
RoleComponent,
AssetCategoryComponent,
AssetSubCategoryComponent,
ProductComponent,
ProductTypeComponent,
SoftwareTypeComponent,
SoftwareCategoryComponent,
TimezoneComponent,
LocationGeneralComponent,
CommonDepartmentComponent,
CommonDesignationComponent,
CommonTeamComponent,
CommonAssetsComponent,
CommonAssetHistoryComponent,
CommonContactsComponent,
CommonDocumentsComponent,
CommonHistoryComponent,
CommonTicketComponent,
LocationViewComponent,
LocationListComponent,
ContactsViewComponent,
ContactsListComponent,
AssetsViewComponent,
AssetsListComponent,
TicketViewComponent,
TicketListComponent,
DocumentViewComponent,
DocumentListComponent,
ContactsGeneralComponent,
LocationGlobalComponent,
ContactsGlobalComponent,
AssetsGlobalComponent,
AssetsGeneralComponent,
DocumentsGlobalComponent,
DocumentsGeneralComponent,
TicketGeneralComponent,
TicketGlobalComponent,
TicketCategoryComponent,
TicketSubCategoryComponent,
DepartmentDialogBoxComponent,
DesignationtDialogBoxComponent,
RoleDialogBoxComponent,
AssetCategoryDialogBoxComponent,
ProductDialogBoxComponent,
ProductTypeDialogBoxComponent,
SoftwareTypeDialogBoxComponent,
TeamDialogBoxComponent,
AssetSubCategoryDialogBoxComponent,
TicketSubCategoryDialogBoxComponent,
TicketCategoryDialogBoxComponent
],
imports: [
BrowserAnimationsModule,
ToastrModule.forRoot(),
BrowserModule,
RouterModule,
AppRoutingModule,
CommonModule,
FormsModule,
NgbModule.forRoot(),
NoopAnimationsModule,
BrowserAnimationsModule,
ReactiveFormsModule,
HttpClientModule,
MatSortModule,
MatTableModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatRippleModule,
MatOptionModule,
MatSelectModule,
MatButtonModule,
MatDialogModule,
MatIconModule,
MatExpansionModule,
MatTabsModule,
MatCheckboxModule,
MatSidenavModule,
MatListModule,
MatToolbarModule,
MatDatepickerModule,
MatNativeDateModule,
MatRadioModule,
MatCheckboxModule,
A11yModule,
BidiModule,
ObserversModule,
OverlayModule,
PlatformModule,
PortalModule,
ScrollDispatchModule,
CdkStepperModule,
CdkTableModule,
],
entryComponents: [
DepartmentDialogBoxComponent,
DesignationtDialogBoxComponent,
RoleDialogBoxComponent,
AssetCategoryDialogBoxComponent,
ProductDialogBoxComponent,
ProductTypeDialogBoxComponent,
SoftwareTypeDialogBoxComponent,
TeamDialogBoxComponent,
AssetSubCategoryDialogBoxComponent,
TicketSubCategoryDialogBoxComponent,
LocationGlobalComponent,
ContactsGlobalComponent,
AssetsGlobalComponent,
TicketGlobalComponent,
DocumentsGlobalComponent,
TicketCategoryDialogBoxComponent
],
providers: [MasterPagesService],
bootstrap: [AppComponent]
})
], AppModule);
export { AppModule };
//# sourceMappingURL=app.module.js.map
|
export var $ = (s, d = document) => Array.from(d.querySelectorAll(s));
$.one = (s, d = document) => d.querySelector(s);
|
module.exports = {
siteMetadata: {
title: 'Full-Stack Bootcamp!',
author: 'Artur Karpiński'
},
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-source-contentful',
options: {
spaceId: process.env.CONTENTFUL_SPACE_ID,
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN
}
},
'gatsby-plugin-sass',
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'src',
path: `${__dirname}/src/`
}
},
'gatsby-plugin-sharp',
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-relative-images',
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 750,
linkImagesToOriginal: false
}
}
]
}
}
]
}
|
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom';
import App from './App';
it('renders without crashing', () => {
const storeFake = (state) => ({
default: () => { },
subscribe: () => { },
dispatch: () => { },
exchangeslist: () => { },
getState: () => ({ ...state })
});
const store = storeFake({});
const div = document.createElement('div');
ReactDOM.render(
<Provider store={store}>
<MemoryRouter>
<App />
</MemoryRouter>
</Provider>, div);
});
|
gdo.net.app["Maps"].drawEmptyMapTable = function (maxCol, maxRow) {
$("iframe").contents().find("#map_table").empty();
for (var i = 0; i < maxRow; i++) {
$("iframe").contents().find("#map_table").append("<tr id='map_table_row_" + i + "' row='" + i + "'></tr>");
for (var j = 0; j < maxCol; j++) {
$("iframe").contents().find("#map_table tr:last").append("<td id='map_table_row_" + i + "_col_" + j + "' col='" + j + "' row='" + i + "'></td>");
}
}
}
gdo.net.app["Maps"].drawMapTable = function (instanceId) {
gdo.net.app["Maps"].drawEmptyMapTable(2, 1);
$("iframe").contents().find("#map_table_row_0_col_0")
.empty()
.append("<div> <b>3D</b></div>")
.css("height", gdo.management.button_height / 1.4)
.css("width", "20%")
.css("border", "3px solid #444")
.css("background", "#222")
.css("color", "#DDD")
.css('padding', gdo.management.cell_padding)
.attr("align", "center")
.css({ fontSize: gdo.management.button_font_size })
.unbind()
.click(function () {
gdo.net.app["Maps"].server.set3DMode(instanceId, !gdo.net.instance[instanceId].mode);
gdo.net.app["Maps"].drawMapTable(instanceId);
});
if (gdo.net.instance[instanceId].mode) {
$("iframe").contents().find("#map_table_row_0_col_0").css("color", "lightgreen");
} else {
$("iframe").contents().find("#map_table_row_0_col_0").css("color", "lightcoral");
}
$("iframe").contents().find("#map_table_row_0_col_1")
.empty()
.append("<div> <b>Advanced</b></div>")
.css("height", gdo.management.button_height / 1.4)
.css("width", "20%")
.css("border", "3px solid #444")
.css("background", "#222")
.css("color", "#DDD")
.css('padding', gdo.management.cell_padding)
.attr("align", "center")
.css({ fontSize: gdo.management.button_font_size })
.unbind()
.click(function () {
window.open("\Advanced.cshtml?clientId=" + instanceId, '_blank');
});
}
|
let data = {
"body": "<path d=\"M31.93 19.2L17.33 4.6a2 2 0 0 0-1.41-.6H6a2 2 0 0 0-2 2v9.92a2 2 0 0 0 .59 1.41l14.6 14.6a2 2 0 0 0 2.83 0l9.9-9.9a2 2 0 0 0 .01-2.83zM9.65 11.31a1.66 1.66 0 1 1 1.66-1.66a1.66 1.66 0 0 1-1.66 1.66z\" class=\"clr-i-solid--badged clr-i-solid-path-1--badged\" fill=\"currentColor\"/><circle cx=\"30\" cy=\"6.33\" r=\"5\" class=\"clr-i-solid--badged clr-i-solid-path-2--badged clr-i-badge\" fill=\"currentColor\"/>",
"width": 36,
"height": 36
};
export default data;
|
const passport = require('passport');
const User = require('../models/user');
const LocalStrategy = require('passport-local').Strategy;
const FacebookStrategy = require('passport-facebook').Strategy;
//==============================================================================
// SESSION SERIALIZATION
//==============================================================================
passport.serializeUser((user, done) => {
done(null, user.id);
});
passport.deserializeUser((id, done) => {
User
.findById(id)
.then((user) => {
done(null, user);
})
.catch((err) => {
done(err);
});
});
/**
* Validates that a user is allowed to login.
* @param {User} user the user to be validated
* @param {Function} done the callback for the validation
*/
function ValidateUserLogin(user, done) {
if (!user) {
return done(new Error('user not found'));
}
if (user.disabled) {
return done(null, false, {message: 'Account disabled'});
}
return done(null, user);
}
//==============================================================================
// STRATEGIES
//==============================================================================
passport.use(new LocalStrategy({
usernameField: 'email',
passwordField: 'password'
}, (email, password, done) => {
User
.findLocalUser(email, password)
.then((user) => {
if (!user) {
return done(null, false, {message: 'Incorrect email/password combination'});
}
return ValidateUserLogin(user, done);
})
.catch((err) => {
done(err);
});
}));
if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET && process.env.TALK_ROOT_URL) {
passport.use(new FacebookStrategy({
clientID: process.env.TALK_FACEBOOK_APP_ID,
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
callbackURL: `${process.env.TALK_ROOT_URL}/api/v1/auth/facebook/callback`,
profileFields: ['id', 'displayName', 'picture.type(large)']
}, (accessToken, refreshToken, profile, done) => {
User
.findOrCreateExternalUser(profile)
.then((user) =>
ValidateUserLogin(user, done)
)
.catch((err) => {
done(err);
});
}));
} else {
console.error('Facebook cannot be enabled, missing one of TALK_FACEBOOK_APP_ID, TALK_FACEBOOK_APP_SECRET, TALK_ROOT_URL');
}
module.exports = passport;
|
var cobs = require('../');
function run(text, ws) {
var program = cobs.compileProgram(text, ws);
program.procedure = program.compileFunction();
var data = program.run(null);
if (data)
return data.working_storage;
else
return null;
};
exports['compile and run move'] = function (test) {
var ws = { a: null };
var newws = run('move 1 to a.', ws);
test.equal(newws.a, 1);
};
exports['compile and run two moves'] = function (test) {
var ws = { a: null, b: null };
var newws = run('move 1 to a. move 2 to b.', ws);
test.equal(newws.a, 1);
test.equal(newws.b, 2);
};
exports['compile and run two moves to nested items'] = function (test) {
var ws = {
group: {
items: {
a: null,
b: null
}
}
};
var newws = run('move 1 to a. move 2 to b.', ws);
test.equal(newws.group.items.a, 1);
test.equal(newws.group.items.b, 2);
};
exports['compile and run move to two variables'] = function (test) {
var ws = { a: null, b: null };
var newws = run('move 1 to a, b.', ws);
test.equal(newws.a, 1);
test.equal(newws.b, 1);
};
|
const ghpages = require('gh-pages');
const { copyFileSync } = require('fs');
const { copySync } = require('fs-extra');
const { join } = require('path');
const { execSync } = require('child_process');
const basePath = join(process.cwd(), 'dist/app');
const branch = process.env.TRAVIS_BRANCH || execSync(`git branch | sed -n '/\* /s///p'`).toString().trim();
const isStableVersion = branch === 'v5';
// build demo
execSync(
`rm -rf dist/app && ng build --prod --deploy-url=/ngx-adminify/${branch}/ --base-href=/ngx-adminify/${isStableVersion ? '': branch} --output-path=dist/app/${branch}`,
{stdio: 'inherit'}
);
copyFileSync(join(basePath, branch, 'index.html'), join(basePath, branch, '404.html'));
if (isStableVersion) {
copySync(join(basePath, branch, 'assets'), join(basePath, 'assets'));
copyFileSync(join(basePath, branch, 'favicon.ico'), join(basePath, 'favicon.ico'));
['404', 'index'].forEach(page => copyFileSync(join(basePath, branch, 'index.html'), join(basePath, `${page}.html`)));
}
ghpages.publish(
basePath,
{
only: branch,
repo: 'https://' + process.env.GH_TOKEN + '@github.com/Hatles/ngx-adminify.git',
}
);
|
var path = require('path');
var config = require('./config');
var loader = require('./loader');
var plugin = require('./plugin');
var { resolve } = require('./utils');
//基本配置
var webpackConfig = {
// entry: {},
cache: true,
// devtool: false,
// output: {},
resolve: {
modules: [
resolve('node_modules'),
path.join(__dirname, '../../node_modules')
],
extensions: ['.js'],
alias: {
'@': resolve('src')
}
},
resolveLoader: {
modules: [
path.join(__dirname, '../../node_modules'),
resolve('node_modules')
]
},
module: {
// noParse: [/\.min\.js$/],
rules: [
config.fle.eslint && loader.eslint(),
loader.css(),
loader.cssModules(),
config.vue && loader.vue(),
loader.babel(),
loader.text(),
loader.imagesOrigin(),
loader.imagesMin(),
loader.fonts(),
loader.medias()
].filter(r => r)
},
//配置插件
plugins: [
plugin.define(),
config.vue && plugin.vue()
].filter(p => p),
externals: {},
target: 'web'
};
module.exports = webpackConfig;
|
import React, {
useEffect,
useState,
useCallback,
useLayoutEffect,
useRef,
useMemo,
} from "react";
import PropTypes from "prop-types";
import {
StyledSelectList,
StyledSelectLoaderContainer,
StyledPopoverContainer,
StyledSelectListTable,
StyledSelectListTableHeader,
StyledSelectListTableBody,
} from "./select-list.style";
import Popover from "../../../__internal__/popover";
import OptionRow from "../option-row/option-row.component";
import updateListScrollTop from "./update-list-scroll";
import getNextChildByText from "../utils/get-next-child-by-text";
import getNextIndexByKey from "../utils/get-next-index-by-key";
import ListActionButton from "../list-action-button/list-action-button.component";
import StyledSelectListContainer from "./select-list-container.style";
import Loader from "../../loader";
import Option from "../option/option.component";
const popoverModifiers = [
{
name: "offset",
options: {
offset: [0, 3],
},
},
{
name: "preventOverflow",
options: {
mainAxis: false,
},
},
];
const SelectList = React.forwardRef(
(
{
listActionButton,
id,
labelId,
children,
onSelect,
onSelectListClose,
filterText,
anchorElement,
highlightedValue,
disablePortal,
onListAction,
isLoading,
onListScrollBottom,
multiColumn,
tableHeader,
...listProps
},
listContainerRef
) => {
const [currentOptionsListIndex, setCurrentOptionsListIndex] = useState(-1);
const [listHeight, setListHeight] = useState(0);
const [listWidth, setListWidth] = useState(null);
const [placement, setPlacement] = useState("bottom");
const lastFilter = useRef("");
const listRef = useRef();
const tableRef = useRef();
const listActionButtonRef = useRef();
const optionRefs = useRef(
React.Children.map(children, (child) => {
if (child?.type === Option || child?.type === OptionRow) {
return React.createRef();
}
return null;
}).filter((child) => child)
);
const setPlacementCallback = useCallback((popper) => {
setPlacement(popper.placement);
}, []);
const anchorRef = useMemo(
() => ({
current: anchorElement,
}),
[anchorElement]
);
const childrenList = useMemo(() => React.Children.toArray(children), [
children,
]);
const lastOptionIndex = useMemo(() => {
let lastIndex = 0;
childrenList.forEach((element, index) => {
if (element.type === Option || element.type === OptionRow) {
lastIndex = index;
}
});
return lastIndex;
}, [childrenList]);
const getNextHighlightableItemIndex = useCallback(
(key, indexOfHighlighted) => {
const lastIndex = lastOptionIndex;
let nextIndex = getNextIndexByKey(
key,
indexOfHighlighted,
lastIndex,
isLoading
);
const nextElement = childrenList[nextIndex];
if (
nextElement &&
nextElement.type !== Option &&
nextElement.type !== OptionRow
) {
nextIndex = getNextHighlightableItemIndex(key, nextIndex, lastIndex);
}
return nextIndex;
},
[childrenList, lastOptionIndex, isLoading]
);
const getIndexOfMatch = useCallback(
(valueToMatch) => {
return childrenList.findIndex(
(child) => child.props.value === valueToMatch
);
},
[childrenList]
);
const highlightNextItem = useCallback(
(key) => {
let currentIndex = currentOptionsListIndex;
if (highlightedValue) {
const indexOfHighlighted = getIndexOfMatch(highlightedValue);
currentIndex = indexOfHighlighted;
}
const nextIndex = getNextHighlightableItemIndex(key, currentIndex);
if (currentIndex === nextIndex) {
return;
}
const { text, value } = childrenList[nextIndex].props;
onSelect({ text, value, selectionType: "navigationKey" });
},
[
childrenList,
currentOptionsListIndex,
getIndexOfMatch,
getNextHighlightableItemIndex,
highlightedValue,
onSelect,
]
);
const handleActionButtonTab = useCallback(
(event, isActionButtonFocused) => {
if (isActionButtonFocused) {
onSelect({ selectionType: "tab" });
} else {
event.preventDefault();
listActionButtonRef.current.focus();
}
},
[onSelect]
);
const focusOnAnchor = useCallback(() => {
if (anchorElement) {
anchorElement.getElementsByTagName("input")[0].focus();
}
}, [anchorElement]);
const handleGlobalKeydown = useCallback(
(event) => {
const { key } = event;
const isActionButtonFocused =
document.activeElement === listActionButtonRef.current;
if (key === "Tab" && listActionButton) {
handleActionButtonTab(event, isActionButtonFocused);
} else if (key === "Tab" || key === "Escape") {
onSelectListClose();
} else if (key === "Enter" && !isActionButtonFocused) {
const currentOption = childrenList[currentOptionsListIndex];
if (!currentOption) {
onSelectListClose();
return;
}
const { text, value } = currentOption.props;
onSelect({ text, value, selectionType: "enterKey" });
} else if (isNavigationKey(key)) {
focusOnAnchor();
highlightNextItem(key);
}
},
[
childrenList,
listActionButton,
handleActionButtonTab,
onSelectListClose,
currentOptionsListIndex,
onSelect,
highlightNextItem,
focusOnAnchor,
]
);
const handleListScroll = useCallback(
(event) => {
const element = event.target;
if (
onListScrollBottom &&
element.scrollHeight - element.scrollTop === element.clientHeight
) {
onListScrollBottom();
}
},
[onListScrollBottom]
);
const handleSelect = useCallback(
(optionData) => {
onSelect({ ...optionData, selectionType: "click" });
},
[onSelect]
);
const childrenWithListProps = useMemo(
() =>
React.Children.map(children, (child, index) => {
if (!child || (child.type !== Option && child.type !== OptionRow)) {
return child;
}
const newProps = {
onSelect: handleSelect,
isHighlighted: currentOptionsListIndex === index,
hidden: isLoading && React.Children.count(children) === 1,
ref: optionRefs.current[index],
};
return React.cloneElement(child, newProps);
}),
[children, currentOptionsListIndex, handleSelect, isLoading]
);
const assignListWidth = useCallback(() => {
if (!disablePortal && anchorElement) {
const inputBoundingRect = anchorElement.getBoundingClientRect();
const width = `${inputBoundingRect.width}px`;
setListWidth(width);
}
}, [anchorElement, disablePortal]);
useLayoutEffect(() => {
assignListWidth();
window.addEventListener("resize", assignListWidth);
return () => {
window.removeEventListener("resize", assignListWidth);
};
}, [assignListWidth]);
useLayoutEffect(() => {
let newHeight;
newHeight = listRef.current.clientHeight;
if (listActionButtonRef.current) {
newHeight += listActionButtonRef.current.parentElement.clientHeight;
}
setListHeight(`${newHeight}px`);
}, [children]);
useEffect(() => {
const keyboardEvent = "keydown";
const listElement = listRef.current;
window.addEventListener(keyboardEvent, handleGlobalKeydown);
listElement.addEventListener("scroll", handleListScroll);
return function cleanup() {
window.removeEventListener(keyboardEvent, handleGlobalKeydown);
listElement.removeEventListener("scroll", handleListScroll);
};
}, [handleGlobalKeydown, handleListScroll]);
useEffect(() => {
if (!filterText || filterText === lastFilter.current) {
lastFilter.current = filterText;
return;
}
lastFilter.current = filterText;
setCurrentOptionsListIndex((previousIndex) => {
const match = getNextChildByText(
filterText,
childrenList,
previousIndex
);
if (!match) {
return previousIndex;
}
const indexOfMatch = getIndexOfMatch(match.props.value);
updateListScrollTop(
indexOfMatch,
multiColumn ? tableRef.current : listRef.current,
optionRefs.current
);
return indexOfMatch;
});
}, [childrenList, filterText, getIndexOfMatch, lastFilter, multiColumn]);
useEffect(() => {
if (!highlightedValue) {
return;
}
const indexOfMatch = getIndexOfMatch(highlightedValue);
setCurrentOptionsListIndex(indexOfMatch);
updateListScrollTop(
indexOfMatch,
multiColumn ? tableRef.current : listRef.current,
optionRefs.current
);
}, [childrenList, getIndexOfMatch, highlightedValue, multiColumn]);
useEffect(() => {
if (isLoading && currentOptionsListIndex === lastOptionIndex) {
listRef.current.scrollTop = listRef.current.scrollHeight;
}
}, [children, currentOptionsListIndex, isLoading, lastOptionIndex]);
function isNavigationKey(keyEvent) {
return (
keyEvent === "ArrowDown" ||
keyEvent === "ArrowUp" ||
keyEvent === "Home" ||
keyEvent === "End"
);
}
const loader = () => (
<StyledSelectLoaderContainer key="loader" as={multiColumn ? "div" : "li"}>
<Loader />
</StyledSelectLoaderContainer>
);
let selectListContent = childrenWithListProps;
if (multiColumn) {
selectListContent = (
<StyledSelectListTable>
<StyledSelectListTableHeader>
{tableHeader}
</StyledSelectListTableHeader>
<StyledSelectListTableBody ref={tableRef}>
{childrenWithListProps}
</StyledSelectListTableBody>
</StyledSelectListTable>
);
}
return (
<Popover
placement="bottom-start"
disablePortal={disablePortal}
reference={anchorRef}
onFirstUpdate={setPlacementCallback}
modifiers={popoverModifiers}
>
<StyledPopoverContainer
height={listHeight}
width={listWidth}
ref={listContainerRef}
>
<StyledSelectListContainer
data-element="select-list-wrapper"
height={listHeight}
placement={placement}
{...listProps}
>
<StyledSelectList
id={id}
as={multiColumn ? "div" : "ul"}
aria-labelledby={labelId}
data-element="select-list"
role="listbox"
ref={listRef}
tabIndex="0"
isLoading={isLoading}
multiColumn={multiColumn}
>
{selectListContent}
{isLoading && loader()}
</StyledSelectList>
{listActionButton && (
<ListActionButton
ref={listActionButtonRef}
listActionButton={listActionButton}
onListAction={onListAction}
/>
)}
</StyledSelectListContainer>
</StyledPopoverContainer>
</Popover>
);
}
);
SelectList.propTypes = {
/** The ID for the parent <div> */
id: PropTypes.string,
/** The Id of the label */
labelId: PropTypes.string,
/** Child components (such as <Option>) for the <ScrollableList> */
children: PropTypes.node,
/** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
disablePortal: PropTypes.bool,
/** DOM element to position the dropdown menu list relative to */
anchorElement: PropTypes.object,
/** A callback for when a child is selected */
onSelect: PropTypes.func.isRequired,
/** A callback for when the list should be closed */
onSelectListClose: PropTypes.func.isRequired,
/** Text value to highlight an option */
filterText: PropTypes.string,
/** Value of option to be highlighted on component render */
highlightedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
/** True for default text button or a Button Component to be rendered */
listActionButton: PropTypes.oneOfType([PropTypes.bool, PropTypes.element]),
/** A callback for when the Action Button is triggered */
onListAction: PropTypes.func,
/** If true the loader animation is displayed below the last option */
isLoading: PropTypes.bool,
/** A callback that is triggered when a user scrolls to the bottom of the list */
onListScrollBottom: PropTypes.func,
/** SelectList table header, should consist of multiple th elements. Works only in multiColumn mode */
tableHeader: PropTypes.node,
/** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
multiColumn: PropTypes.bool,
};
export default SelectList;
|
const express = require("express");
const Message = require('../model/messageModel');
const router = express.Router();
//mesaj ekleme kismi
router.post("/",async(req,res)=>{
const newMessage = new Message(req.body);
try {
const savedMessage = await newMessage.save();
res.status(200).json(savedMessage);
} catch (error) {
res.status(500).json(error);
}
})
router.get("/:conversationId", async(req,res)=>{
try {
const messages = await Message.find({
conversationId:req.params.conversationId,
});
res.status(200).json(messages);
} catch (error) {
res.status(500).json(error);
}
})
module.exports = router;
|
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("a11yhelp","cy",{title:"Canllawiau Hygyrchedd",contents:"Cynnwys Cymorth. I gau y deialog hwn, pwyswch ESC.",legend:[{name:"Cyffredinol",items:[{name:"Bar Offer y Golygydd",legend:"Pwyswch $ {toolbarFocus} i fynd at y bar offer. Symudwch i'r grŵp bar offer nesaf a blaenorol gyda TAB a SHIFT+TAB. Symudwch i'r botwm bar offer nesaf a blaenorol gyda SAETH DDE neu SAETH CHWITH. Pwyswch SPACE neu ENTER i wneud botwm y bar offer yn weithredol."},{name:"Deialog y Golygydd",legend:"Inside a dialog, press TAB to navigate to the next dialog element, press SHIFT+TAB to move to the previous dialog element, press ENTER to submit the dialog, press ESC to cancel the dialog. When a dialog has multiple tabs, the tab list can be reached either with ALT+F10 or with TAB as part of the dialog tabbing order. With tab list focused, move to the next and previous tab with RIGHT and LEFT ARROW, respectively."},
{name:"Dewislen Cyd-destun y Golygydd",legend:"Pwyswch $ {contextMenu} neu'r ALLWEDD 'APPLICATION' i agor y ddewislen cyd-destun. Yna symudwch i'r opsiwn ddewislen nesaf gyda'r TAB neu'r SAETH I LAWR. Symudwch i'r opsiwn blaenorol gyda SHIFT+TAB neu'r SAETH I FYNY. Pwyswch SPACE neu ENTER i ddewis yr opsiwn ddewislen. Agorwch is-dewislen yr opsiwn cyfredol gyda SPACE neu ENTER neu SAETH DDE. Ewch yn ôl i'r eitem ar y ddewislen uwch gydag ESC neu SAETH CHWITH. Ceuwch y ddewislen cyd-destun gydag ESC."},
{name:"Blwch Rhestr y Golygydd",legend:"Tu mewn y blwch rhestr, ewch i'r eitem rhestr nesaf gyda TAB neu'r SAETH I LAWR. Symudwch i restr eitem flaenorol gyda SHIFT+TAB neu SAETH I FYNY. Pwyswch SPACE neu ENTER i ddewis yr opsiwn o'r rhestr. Pwyswch ESC i gau'r rhestr."},{name:"Bar Llwybr Elfen y Golygydd",legend:"Pwyswch ${elementsPathFocus} i fynd i'r bar llwybr elfennau. Symudwch i fotwm yr elfen nesaf gyda TAB neu SAETH DDE. Symudwch i fotwm blaenorol gyda SHIFT+TAB neu SAETH CHWITH. Pwyswch SPACE neu ENTER i ddewis yr elfen yn y golygydd."}]},
{name:"Gorchmynion",items:[{name:"Gorchymyn dadwneud",legend:"Pwyswch ${undo}"},{name:"Gorchymyn ailadrodd",legend:"Pwyswch ${redo}"},{name:"Gorchymyn Bras",legend:"Pwyswch ${bold}"},{name:"Gorchymyn italig",legend:"Pwyswch ${italig}"},{name:"Gorchymyn tanlinellu",legend:"Pwyso ${underline}"},{name:"Gorchymyn dolen",legend:"Pwyswch ${link}"},{name:"Gorchymyn Cwympo'r Dewislen",legend:"Pwyswch ${toolbarCollapse}"},{name:"Myned i orchymyn bwlch ffocws blaenorol",legend:"Pwyswch ${accessPreviousSpace} i fyned i'r \"blwch ffocws sydd methu ei gyrraedd\" cyn y caret, er enghraifft: dwy elfen HR drws nesaf i'w gilydd. AIladroddwch y cyfuniad allwedd i gyrraedd bylchau ffocws pell."},
{name:"Ewch i'r gorchymyn blwch ffocws nesaf",legend:"Pwyswch ${accessNextSpace} i fyned i'r blwch ffocws agosaf nad oes modd ei gyrraedd ar ôl y caret, er enghraifft: dwy elfen HR drws nesaf i'w gilydd. Ailadroddwch y cyfuniad allwedd i gyrraedd blychau ffocws pell."},{name:"Cymorth Hygyrchedd",legend:"Pwyswch ${a11yHelp}"}]}],backspace:"Backspace",tab:"Tab",enter:"Enter",shift:"Shift",ctrl:"Ctrl",alt:"Alt",pause:"Pause",capslock:"Caps Lock",escape:"Escape",pageUp:"Page Up",pageDown:"Page Down",
end:"End",home:"Home",leftArrow:"Left Arrow",upArrow:"Up Arrow",rightArrow:"Right Arrow",downArrow:"Down Arrow",insert:"Insert","delete":"Delete",leftWindowKey:"Left Windows key",rightWindowKey:"Right Windows key",selectKey:"Select key",numpad0:"Numpad 0",numpad1:"Numpad 1",numpad2:"Numpad 2",numpad3:"Numpad 3",numpad4:"Numpad 4",numpad5:"Numpad 5",numpad6:"Numpad 6",numpad7:"Numpad 7",numpad8:"Numpad 8",numpad9:"Numpad 9",multiply:"Multiply",add:"Add",subtract:"Subtract",decimalPoint:"Decimal Point",
divide:"Divide",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",numLock:"Num Lock",scrollLock:"Scroll Lock",semiColon:"Semicolon",equalSign:"Equal Sign",comma:"Comma",dash:"Dash",period:"Period",forwardSlash:"Forward Slash",graveAccent:"Grave Accent",openBracket:"Open Bracket",backSlash:"Backslash",closeBracket:"Close Bracket",singleQuote:"Single Quote"});
|
export const GET_TYPPES = "GET_TYPPES"
export const CHANGE_TYPES = "CHANGE_TYPES"
import {api} from "./AY_API"
export function getTypes(){
return (dispatch)=>{
api("ebs.setting.getcheckset","",function(e){
dispatch({
type:GET_TYPPES,
types:e.types
});
});
}
}
export function changeTypes(item_i,ele_i){
return (dispatch,getState)=>{
let types = getState().CheckOrders.types;
types[item_i]["options"][ele_i].checked = types[item_i]["options"][ele_i].checked ? false:true;
let args = {
"types":JSON.stringify(types)
};
api("ebs.setting.saveset",args,function(e){
console.log(e);
});
}
}
|
define(
{
"toc":[
{
"heading":"Table of Contents",
"topics":[
{
"title":"List of Figures",
"href":"lof.html"
},
{
"title":"List of Tables",
"href":"lot.html"
},
{
"title":"Title and Copyright Information",
"href":"index.html"
},
{
"title":"Preface",
"href":"preface.html#GUID-840BDD16-D5B3-40D5-A4FD-56A219F62368",
"topics":[
{
"title":"Audience",
"href":"preface.html#GUID-023FA5F6-3458-40E0-99FC-32747886C531"
},
{
"title":"Documentation Accessibility",
"href":"preface.html#GUID-E409CC44-9A8F-4043-82C8-6B95CD939296"
},
{
"title":"Related Documents",
"href":"preface.html#GUID-1A3A3881-BA70-457D-8D6B-CEBEDC70F8CC"
},
{
"title":"Conventions",
"href":"preface.html#GUID-803F795F-5E10-44A2-9719-731C8D93D258"
}
]
},
{
"title":"<span class=\"secnum\">1 </span> Introduction to Oracle Database Gateway for APPC",
"href":"appc-gateway-introduction.html#GUID-624068CA-767C-4BA8-9C4E-3051ACF26257",
"topics":[
{
"title":"Overview of the Gateway",
"href":"appc-gateway-introduction.html#GUID-51421C36-0119-468B-9176-4DEA86791EC8"
},
{
"title":"Features of the Gateway",
"href":"appc-gateway-introduction.html#GUID-4757EF36-6039-4D76-A6D1-9FBD3659E8D8"
},
{
"title":"Terms",
"href":"appc-gateway-introduction.html#GUID-400C46E0-0637-4C48-A255-C2B796438793"
},
{
"title":"Architecture of the Gateway",
"href":"appc-gateway-introduction.html#GUID-3E12BDA4-0BD9-472D-A493-CB941CBADDC6"
},
{
"title":"Implementation of the Gateway",
"href":"appc-gateway-introduction.html#GUID-1545F917-23F3-4809-9E41-48365BEC9D9E"
},
{
"title":"Communication with the Gateway",
"href":"appc-gateway-introduction.html#GUID-B7302561-3830-4052-B397-6741162B0E69"
},
{
"title":"Remote Procedural Call Functions",
"href":"appc-gateway-introduction.html#GUID-8FD607A5-4E24-4D21-8511-CCD910540486",
"topics":[
{
"title":"Description of RPC Functions",
"href":"appc-gateway-introduction.html#GUID-96043CA3-D580-4579-BACE-4865BFAE9BDD",
"topics":[
{
"title":"Remote Transaction Initiation",
"href":"appc-gateway-introduction.html#GUID-B6180A6D-EAC2-44DC-A950-9D250670E7C2"
},
{
"title":"Data Exchange",
"href":"appc-gateway-introduction.html#GUID-71F30B22-247D-4CC4-BD6E-6534ACFB9EA1"
},
{
"title":"Remote Transaction Termination",
"href":"appc-gateway-introduction.html#GUID-6B7A2585-5F55-469C-83C0-177D121405F0"
}
]
}
]
},
{
"title":"Transaction Types for Gateway Using SNA",
"href":"appc-gateway-introduction.html#GUID-E967E94D-8143-42A0-9654-1214D8F81BD6"
},
{
"title":"Transaction Types for Gateway Using TCP/IP",
"href":"appc-gateway-introduction.html#GUID-AA7DD41D-6E8F-47A2-8940-42FD187D36D8"
}
]
},
{
"title":"<span class=\"secnum\">2 </span> Release Information",
"href":"appc-gateway-release-information.html#GUID-F586427F-484F-4B21-852E-7CECA56988B6",
"topics":[
{
"title":"Product Set",
"href":"appc-gateway-release-information.html#GUID-1AD4F10C-8FBE-4CEE-B59E-EFB470E32571"
},
{
"title":"Changes and Enhancements",
"href":"appc-gateway-release-information.html#GUID-89B83CDB-B8DF-4B9D-96FB-2D17849BB4AA",
"topics":[
{
"title":"Gateway Password Encryption Tool",
"href":"appc-gateway-release-information.html#GUID-A56338A1-9EA0-417C-85BD-81672EC787D6"
},
{
"title":"Partial IPv6 Support",
"href":"appc-gateway-release-information.html#GUID-3455ABBB-E573-4137-8CD5-DF520EE71FE6"
}
]
},
{
"title":"Known Restrictions",
"href":"appc-gateway-release-information.html#GUID-DC385AE7-3BC5-4EFC-950A-1F350A06381D",
"topics":[
{
"title":"Known Restrictions for the Gateway",
"href":"appc-gateway-release-information.html#GUID-C6EA18B1-0A40-4BFB-A23E-259567922859"
},
{
"title":"Known Restrictions for PGAU",
"href":"appc-gateway-release-information.html#GUID-3275CFB0-D805-424B-9D86-BE264424B633"
}
]
}
]
},
{
"title":"<span class=\"secnum\">3 </span> System Requirements",
"href":"appc-gateway-system-requirements.html#GUID-9CE31DCF-BE16-4338-8E1B-683D829E21C9",
"topics":[
{
"title":"Hardware Requirements",
"href":"appc-gateway-system-requirements.html#GUID-9C66BFF3-9BDF-44A3-A852-1C47B0E9424C",
"topics":[
{
"title":"Processor Requirements",
"href":"appc-gateway-system-requirements.html#GUID-59450A5F-8410-4EA9-8CA0-87A10521934A"
},
{
"title":"Memory Requirements",
"href":"appc-gateway-system-requirements.html#GUID-EE7491D6-BD00-487B-BBD9-C10A697B7C81"
},
{
"title":"Network Attachment Requirements",
"href":"appc-gateway-system-requirements.html#GUID-54E9DC59-C7E6-4B5F-9285-D80415C82C50"
},
{
"title":"Disk Space Requirements",
"href":"appc-gateway-system-requirements.html#GUID-EEF4E41B-4370-48DB-90B2-F6F60052A18B"
}
]
},
{
"title":"Software Requirements",
"href":"appc-gateway-system-requirements.html#GUID-20D5707D-E453-4EFA-91AE-6C73369FAC28",
"topics":[
{
"title":"Operating System Requirements",
"href":"appc-gateway-system-requirements.html#GUID-AC3B5A5D-14A0-4207-8DB5-A830DD8A2B8C"
},
{
"title":"Communication Protocol Requirements",
"href":"appc-gateway-system-requirements.html#GUID-8AF88E61-E8F4-4809-9E6A-82177C3EF483"
},
{
"title":"Oracle Database Requirements",
"href":"appc-gateway-system-requirements.html#GUID-51F252B8-75F2-43DA-AA20-4C8E2A8458EF"
},
{
"title":"Oracle Networking Product Requirements",
"href":"appc-gateway-system-requirements.html#GUID-061BB541-733E-4BBA-9E74-16287528BC36"
},
{
"title":"IBM Mainframe Requirements",
"href":"appc-gateway-system-requirements.html#GUID-1319318A-B93C-452A-9C92-2AE43BD939FB"
}
]
}
]
},
{
"title":"<span class=\"secnum\">4 </span> Installing the Gateway",
"href":"appc-gateway-installation.html#GUID-7EF0DEAA-52AF-415D-A0B0-F0564076BB4A",
"topics":[
{
"title":"Before You Begin",
"href":"appc-gateway-installation.html#GUID-F285491D-B7E3-4F47-BC42-CCC743DD197E"
},
{
"title":"Planning to Upgrade or Migrate the Gateway",
"href":"appc-gateway-installation.html#GUID-AADBE3F5-2412-4B09-AED2-1439A7B5BE1B",
"topics":[
{
"title":"Performing Pre-Upgrade Procedures",
"href":"appc-gateway-installation.html#GUID-A0174300-F393-4750-86DD-55FA09D2C504"
},
{
"title":"Upgrade and Migration Considerations",
"href":"appc-gateway-installation.html#GUID-178335E6-228B-440A-A8FB-DBE661665271"
},
{
"title":"Restoration",
"href":"appc-gateway-installation.html#GUID-6158CFD3-C203-4F97-8C7B-CAC51CC02EF4"
}
]
},
{
"title":"Performing Preinstallation Procedures",
"href":"appc-gateway-installation.html#GUID-6DF74585-E6F8-47DF-96F5-65016389A74A",
"topics":[
{
"title":"Gateway Installation Methods",
"href":"appc-gateway-installation.html#GUID-2DD46FEC-909E-4352-9461-82E1E0B8CE27"
}
]
},
{
"title":"Installing the Gateway Software",
"href":"appc-gateway-installation.html#GUID-413BA6FF-FD5D-4F4F-8E50-9D67BE70E5AE"
},
{
"title":"Using Windows User Account as Oracle Home User",
"href":"appc-gateway-installation.html#GUID-17A60E5D-B00B-4E1E-826B-86438B85EFF2"
},
{
"title":"Installation Steps",
"href":"appc-gateway-installation.html#GUID-B0C88AC3-3870-4BD9-8154-5E15AF2D78D6",
"topics":[
{
"title":"Step 1: Log On to Windows System",
"href":"appc-gateway-installation.html#GUID-1F02D2F9-286A-43AF-B852-5FC86C80CF60"
},
{
"title":"Step 2: Ensure Minimum Amount of Disk Space",
"href":"appc-gateway-installation.html#GUID-928BE048-16AD-483D-B2C9-35F76BE6B257"
},
{
"title":"Step 3: Stop All Oracle Services",
"href":"appc-gateway-installation.html#GUID-E1FC2669-ED7B-4DC4-89EE-5C907D8554DB"
},
{
"title":"Step 4: Insert the Gateway Product Installation Media",
"href":"appc-gateway-installation.html#GUID-07489F94-4F80-4F64-B1BE-AC2646F030C6"
},
{
"title":"Step 5: Start the Oracle Universal Installer",
"href":"appc-gateway-installation.html#GUID-9EFCEAE3-2B2F-4A22-9C1F-670245F0D251"
},
{
"title":"Step 6: Step Through the Oracle Universal Installer",
"href":"appc-gateway-installation.html#GUID-3D8D7CE8-64BF-4DC8-A77A-275ECDF61F84",
"topics":[
{
"title":"Oracle Universal Installer on Windows Platforms",
"href":"appc-gateway-installation.html#GUID-DC9C3CD8-AD72-459F-9E16-6DB4A66E8403"
}
]
}
]
},
{
"title":"Removing Your Oracle Database Gateway for APPC",
"href":"appc-gateway-installation.html#GUID-0D9BF0B7-456C-41EC-8A6A-CB238F73DD72",
"topics":[
{
"title":"About the Deinstallation Tool",
"href":"appc-gateway-installation.html#GUID-4E6C5CCC-D924-4746-98A8-D6DC825096E3"
},
{
"title":"Removing Oracle Software",
"href":"appc-gateway-installation.html#GUID-1BD5CECF-B172-4224-9171-7EBA5AF8556C"
}
]
}
]
},
{
"title":"<span class=\"secnum\">5 </span> Configuring Your Oracle Network",
"href":"appc-gateway-configure-oracle-network.html#GUID-2A3A2F2C-7FF5-45C4-AC94-561AD15DFCD4"
},
{
"title":"<span class=\"secnum\">6 </span> Configuring the SNA Communication Package on Windows",
"href":"appc-gateway-configure-sna.html#GUID-88C38A89-B41D-4070-A707-F89F648B3CAE",
"topics":[
{
"title":"Using SNA Security Validation",
"href":"appc-gateway-configure-sna.html#GUID-996B1CEB-86CD-4261-A48C-0C7ABB10A40F"
},
{
"title":"Processing Inbound Connections",
"href":"appc-gateway-configure-sna.html#GUID-7C139FD4-2B62-47F3-80F7-BFFA03583480"
},
{
"title":"Configuring Your Microsoft Host Integration Server",
"href":"appc-gateway-configure-sna.html#GUID-37376AC3-E491-480B-ACD1-035F6E603559",
"topics":[
{
"title":"Independent Versus Dependent LUs",
"href":"appc-gateway-configure-sna.html#GUID-2FF7DD09-75FC-4556-BC70-9B2B25B59882"
},
{
"title":"Location of Sample SNA Server Definitions",
"href":"appc-gateway-configure-sna.html#GUID-49DDABA1-E7BC-4558-9C25-01C554D43A54"
},
{
"title":"HIS Definition Types",
"href":"appc-gateway-configure-sna.html#GUID-E3EEB335-124B-4130-A7CF-7BC39E85DC2F"
},
{
"title":"Methods of Creating SNA Server Definitions for the Gateway",
"href":"appc-gateway-configure-sna.html#GUID-020CE353-C095-4B6C-9390-55C9EE5099B5"
}
]
},
{
"title":"Creating SNA Server Definitions on Microsoft Host Integration Server",
"href":"appc-gateway-configure-sna.html#GUID-2050119C-E715-4B4F-A483-A25B6C3A43AE",
"topics":[
{
"title":"Server Selection",
"href":"appc-gateway-configure-sna.html#GUID-0EB96A60-A93F-4527-AB36-9286BED5CABA"
},
{
"title":"Link Service Definition",
"href":"appc-gateway-configure-sna.html#GUID-A510A568-09D1-4005-80F6-F7339A261B86"
},
{
"title":"Connection Definition",
"href":"appc-gateway-configure-sna.html#GUID-9E9C6315-0846-4DC8-A0A3-58CC329F15AD"
},
{
"title":"Local LU Definition",
"href":"appc-gateway-configure-sna.html#GUID-B6997C13-4727-4CDC-8ACA-A7E7E236580B"
},
{
"title":"Mode Definition",
"href":"appc-gateway-configure-sna.html#GUID-046B6F4A-DFDF-43E5-B3F1-9E564A8B56E6"
},
{
"title":"Remote LU Definition",
"href":"appc-gateway-configure-sna.html#GUID-7525F7F0-886F-4604-8C2B-6C9F11AD522B"
},
{
"title":"CPI-C Symbolic Destination Name",
"href":"appc-gateway-configure-sna.html#GUID-96C22A3D-4240-4DAA-AA4B-E0F82E9DEE87"
}
]
},
{
"title":"Configuring an IBM Communications Server",
"href":"appc-gateway-configure-sna.html#GUID-6F690AC1-F53E-476E-827D-A9A05B846D70",
"topics":[
{
"title":"Independent And Dependent LUs",
"href":"appc-gateway-configure-sna.html#GUID-A041D839-8F02-4533-9C5E-0CB8D3996724"
},
{
"title":"Definition Types",
"href":"appc-gateway-configure-sna.html#GUID-93E11F9E-4AD4-468A-8964-7E8D24CA9573"
}
]
},
{
"title":"Creating IBM Communications Server Definitions for the Gateway",
"href":"appc-gateway-configure-sna.html#GUID-27C4A162-C9E3-4538-B085-45BCC0BC8121",
"topics":[
{
"title":"Creating the Configuration",
"href":"appc-gateway-configure-sna.html#GUID-5C9D0DDA-12B0-4F40-A195-A5E59DFFCFF5"
},
{
"title":"Creating the Node",
"href":"appc-gateway-configure-sna.html#GUID-CAF7B733-F240-419A-ACFD-F3FB3272E8B0"
},
{
"title":"Creating Devices",
"href":"appc-gateway-configure-sna.html#GUID-D3C70BE0-7066-4088-BAF4-332DC8163F63"
},
{
"title":"Choosing the Device Type",
"href":"appc-gateway-configure-sna.html#GUID-12824BBE-1C17-4A39-840E-6C1459D5EDD6"
},
{
"title":"Configuring a LAN Device",
"href":"appc-gateway-configure-sna.html#GUID-1DDC9541-3C1E-41AD-9705-21B07032C12C"
},
{
"title":"Creating Peer Connections",
"href":"appc-gateway-configure-sna.html#GUID-4455C8C8-F532-4083-9DD1-3552733739F8"
},
{
"title":"Defining the Link Station",
"href":"appc-gateway-configure-sna.html#GUID-2AC52A55-5865-4297-8657-7B72296716DE"
},
{
"title":"Defining the Adjacent Node",
"href":"appc-gateway-configure-sna.html#GUID-A978129C-3B26-4ED0-AA6E-3F394F07E572"
},
{
"title":"Creating Local LUs",
"href":"appc-gateway-configure-sna.html#GUID-5C6AED2F-1AE6-4FCC-88E0-6D802F6BF654"
},
{
"title":"Defining Local LUs",
"href":"appc-gateway-configure-sna.html#GUID-66F4DB74-713F-43F6-8D47-9D9905CF6B71"
},
{
"title":"Creating Partner LUs",
"href":"appc-gateway-configure-sna.html#GUID-02079A83-4FA7-41E3-A340-A036185D1D04"
},
{
"title":"Defining Partner LUs",
"href":"appc-gateway-configure-sna.html#GUID-2ECB5D88-56A0-4D61-8129-D2C6EEBC709B"
},
{
"title":"Creating the CPI-C Side Information Profile",
"href":"appc-gateway-configure-sna.html#GUID-B99E80E7-9736-4BE7-928C-69107200350B"
}
]
},
{
"title":"Testing the Connection",
"href":"appc-gateway-configure-sna.html#GUID-DB9D6EA8-44BC-421A-BBF8-3F3DCD2CB282"
},
{
"title":"Resume Configuration of the Gateway",
"href":"appc-gateway-configure-sna.html#GUID-9374497B-F2F8-487F-A334-0082AF2F9FEF"
}
]
},
{
"title":"<span class=\"secnum\">7 </span> Configuring the OLTP",
"href":"appc-gateway-configure-oltp.html#GUID-7B0371E7-BBF8-4057-BFC4-4B1FA1BB54BB",
"topics":[
{
"title":"Configuring the OLTP for Your SNA Environment",
"href":"appc-gateway-configure-oltp.html#GUID-0FD2FE94-3229-4D0E-83F2-7B35B6DEF7CC"
},
{
"title":"Configuring the OLTP for Your TCP/IP Environment",
"href":"appc-gateway-configure-oltp.html#GUID-2B76963A-BD65-4D5B-BDFE-86A50847553B"
}
]
},
{
"title":"<span class=\"secnum\">8 </span> Configuring the Gateway Using SNA Communication Protocol",
"href":"configure-appc-gateway-using-sna.html#GUID-D5DF29FD-80BA-4E55-831D-D9CBD826E413",
"topics":[
{
"title":"Before You Begin",
"href":"configure-appc-gateway-using-sna.html#GUID-F913CE5A-572C-4C9B-A4F0-2EB4AA3631F4"
},
{
"title":"Preparing to Configure a Gateway Installation/Upgrade",
"href":"configure-appc-gateway-using-sna.html#GUID-B9313098-CEE8-4D8B-837B-ED87E67F7D09"
},
{
"title":"Integrating Server Configuration: First-Time Gateway Installations",
"href":"configure-appc-gateway-using-sna.html#GUID-C6CBC625-C0FE-496C-9EEC-096A04004A7D"
},
{
"title":"Upgrading or Migrating the Oracle Database from Previous Gateways",
"href":"configure-appc-gateway-using-sna.html#GUID-4E439D8E-8B91-439A-B239-1AE0FBA43154",
"topics":[
{
"title":"If You Must Reinstall Package Specifications",
"href":"configure-appc-gateway-using-sna.html#GUID-6ED43492-2A39-4F74-B830-1D79F7A69B32"
},
{
"title":"Upgrading PGAU from Previous Gateway Releases",
"href":"configure-appc-gateway-using-sna.html#GUID-A95D962C-066C-4FA1-BBD6-1E7FFAFD819E"
}
]
},
{
"title":"Configuring the Oracle Database for Gateways to Coexist",
"href":"configure-appc-gateway-using-sna.html#GUID-40EEFA66-1FCB-47BB-9EFF-EE6B25B97D5F"
},
{
"title":"Optional Configuration Steps to Permit Multiple Users",
"href":"configure-appc-gateway-using-sna.html#GUID-C750A196-5039-4370-99ED-0EB71862A930"
},
{
"title":"Configuring the Gateway",
"href":"configure-appc-gateway-using-sna.html#GUID-383121C7-26B7-4869-9C28-D9E83EAB79EA"
},
{
"title":"Configuring Commit-Confirm",
"href":"configure-appc-gateway-using-sna.html#GUID-D2D24B90-BD74-455C-98B5-08B35261CF06",
"topics":[
{
"title":"Configuring the Oracle Database for Commit-Confirm",
"href":"configure-appc-gateway-using-sna.html#GUID-A9F0651B-9F3B-427D-A7E1-D12E01CC5374"
},
{
"title":"Configuring Gateway Initialization Parameters for Commit-Confirm",
"href":"configure-appc-gateway-using-sna.html#GUID-D0334257-DC09-45B3-8071-62EE8F0A43E2"
},
{
"title":"Configuring the OLTP for Commit-Confirm",
"href":"configure-appc-gateway-using-sna.html#GUID-4E9B411B-D554-4945-825A-B4316404F7C0"
}
]
},
{
"title":"Verifying the Gateway Installation and OLTP Configuration",
"href":"configure-appc-gateway-using-sna.html#GUID-04DFBC73-2DC5-437C-83F5-CB679F20C35C",
"topics":[
{
"title":"Verifying the Gateway Installation",
"href":"configure-appc-gateway-using-sna.html#GUID-4270B0C3-A67D-4A2D-A06D-9B74836ED48E"
},
{
"title":"Verifying the OLTP Configuration",
"href":"configure-appc-gateway-using-sna.html#GUID-273B8DEB-A60B-4B98-9122-8E03D0FFB216",
"topics":[
{
"title":"CICS Verification",
"href":"configure-appc-gateway-using-sna.html#GUID-BEFDE1DF-6102-48C2-86B5-315E7E9C485F"
},
{
"title":"IMS/TM Verification",
"href":"configure-appc-gateway-using-sna.html#GUID-0D83B68D-908B-427E-A1E7-DDEED4B95C5E"
},
{
"title":"APPC/MVS Verification",
"href":"configure-appc-gateway-using-sna.html#GUID-15353C3B-AC05-40C8-9CC7-F899E56239CD"
}
]
},
{
"title":"Verifying OLTP Configuration for Commit-Confirm",
"href":"configure-appc-gateway-using-sna.html#GUID-487E4EE1-6B30-4B46-A79D-F3A0389EC612"
}
]
},
{
"title":"Performing Postinstallation Procedures",
"href":"configure-appc-gateway-using-sna.html#GUID-04B54C37-0458-4E94-BA62-D00F2F823AFD",
"topics":[
{
"title":"Installing Sample Applications",
"href":"configure-appc-gateway-using-sna.html#GUID-129F07F3-C3DC-4BCC-9C4E-10A98AB35E98"
}
]
}
]
},
{
"title":"<span class=\"secnum\">9 </span> Configuring the Gateway Using TCP/IP Communication Protocol",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-2E8F3302-CA66-45F1-A0F0-241FDEC9EBCE",
"topics":[
{
"title":"Before You Begin",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-07D12664-17E3-4DC4-B3C8-3BD452A44675"
},
{
"title":"Preparing to Configure a Gateway Installation/Upgrade",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-FCAB1574-8D8E-4F0F-93DA-9D79FB9FAB1A"
},
{
"title":"Configuring the Oracle Database : First Time Installation",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-C1D6A15C-21DD-480A-A45D-EE4D3554B54C"
},
{
"title":"Upgrading or Migrating the Oracle Database from Previous Gateways",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-9883203F-7CBC-484D-BCC3-CA836A9946B1",
"topics":[
{
"title":"If You Must Reinstall Package Specifications",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-8ECDBDAF-284D-447F-A8D6-767D82C8420A"
},
{
"title":"Upgrading PGAU from Previous Gateway Releases",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-F632840A-F2C5-496A-83E4-CCABBF1F7F39"
}
]
},
{
"title":"Optional Configuration Steps to Permit Multiple Users",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-9F6E76E3-09C2-47EE-B212-A7B8153752C6"
},
{
"title":"Configuring TCP/IP for the Gateway",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-4401EF36-6A5E-4DF2-8FB8-57D8EEFEDB92"
},
{
"title":"Configuring the Gateway",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-A60824B1-6CFC-4CC5-BB8A-C977BFA8A189"
},
{
"title":"Loading the PGA_TCP_IMSC Table",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-7FBE512D-4608-482A-8F27-EFBFF6BAE583"
},
{
"title":"Verifying the Gateway Installation and OLTP Configuration",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-8D4B842E-0CF0-4072-8FF6-3AC0737A7D00",
"topics":[
{
"title":"Verifying the Gateway Installation",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-02491AB4-86E5-4F50-B968-BE0457542AE5"
},
{
"title":"Verifying the OLTP Configuration",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-C360B987-27C2-47CE-8F69-A808B63A8C20",
"topics":[
{
"title":"IMS/TM Verification",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-85147605-CE9E-4F69-8243-CC3FC50F1B65"
}
]
}
]
},
{
"title":"Performing Postinstallation Procedures",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-7FB56CC9-2004-4716-9DF5-4082EC028816",
"topics":[
{
"title":"Installing Sample Applications",
"href":"configure-appc-gateway-using-tcp-ip.html#GUID-CA7EA2DB-3417-4206-8852-211FDAA6786A"
}
]
}
]
},
{
"title":"<span class=\"secnum\">10 </span> Security Requirements",
"href":"appc-gateway-security-requirements.html#GUID-87EF21D2-821F-4552-AB91-E0EC5C8A81CB",
"topics":[
{
"title":"Overview of Security Requirements",
"href":"appc-gateway-security-requirements.html#GUID-D6052F75-75BE-4CD2-A66A-6BA298028845"
},
{
"title":"Authenticating Application Logons",
"href":"appc-gateway-security-requirements.html#GUID-89593F28-EE64-4B7F-B757-A4C5EB4D83F7"
},
{
"title":"Defining and Controlling Database Links",
"href":"appc-gateway-security-requirements.html#GUID-C589D41D-90BD-4E78-8AD3-D63BBB7755BF",
"topics":[
{
"title":"Link Accessibility",
"href":"appc-gateway-security-requirements.html#GUID-214E2E55-2123-4A57-B7B5-C407201A7D7B"
},
{
"title":"Links and CONNECT Clauses",
"href":"appc-gateway-security-requirements.html#GUID-FB28A9DE-C5E7-4F67-B649-86E3D19C8151"
}
]
},
{
"title":"Using SNA Security Validation",
"href":"appc-gateway-security-requirements.html#GUID-9A645D8B-8805-41A8-81FE-E9A4985C654F",
"topics":[
{
"title":"Specifying SNA Conversation Security",
"href":"appc-gateway-security-requirements.html#GUID-B54F7B7A-31A4-4348-8B86-8467EAD963B0",
"topics":[
{
"title":"SNA Security Option SECURITY=NONE",
"href":"appc-gateway-security-requirements.html#GUID-70AEBAE0-A900-4C6C-859A-6831D944472F"
},
{
"title":"SNA Security Option SECURITY=PROGRAM",
"href":"appc-gateway-security-requirements.html#GUID-137F2523-60FF-4AB1-9A82-07823A5A0875"
}
]
}
]
},
{
"title":"TCP/IP Security",
"href":"appc-gateway-security-requirements.html#GUID-5B363323-57C7-47D8-8DE1-5B883448005B",
"topics":[
{
"title":"Specifying TCP/IP Conversation Security",
"href":"appc-gateway-security-requirements.html#GUID-CC900504-284A-4348-B180-7166ED16CE69",
"topics":[
{
"title":"TCP/IP Security Option SECURITY=NONE",
"href":"appc-gateway-security-requirements.html#GUID-35A2BB70-87C0-49F8-9367-7FB3E628CE4B"
},
{
"title":"TCP/IP Security Option SECURITY=PROGRAM",
"href":"appc-gateway-security-requirements.html#GUID-F6FE5DC3-DAA3-4FE3-AA62-F073E40B4069"
}
]
}
]
},
{
"title":"Passwords in the Gateway Initialization File",
"href":"appc-gateway-security-requirements.html#GUID-5BE1BC54-C7E5-4FA0-B1F3-257C54237E1C"
}
]
},
{
"title":"<span class=\"secnum\">11 </span> Migrating from Existing Gateways",
"href":"appc-gateway-migration.html#GUID-8367CF57-12EC-4ED9-B609-2CAE2F9AE723",
"topics":[
{
"title":"Migrating an Existing Gateway Instance to New Release Using SNA Protocol",
"href":"appc-gateway-migration.html#GUID-5B666B0B-A175-4453-9EAF-4EC4C63B22A7",
"topics":[
{
"title":"Step 1: Install the New Release",
"href":"appc-gateway-migration.html#GUID-5A896CA4-BC9C-42BE-875A-3B7AC2934751"
},
{
"title":"Step 2: Transfer initsid.ora Gateway Initialization File Parameters",
"href":"appc-gateway-migration.html#GUID-AB45B0AC-F4E3-4132-8BC8-261F56C1968B"
},
{
"title":"Backout Considerations When Migrating to New Releases",
"href":"appc-gateway-migration.html#GUID-B7C5EC69-7F8C-4415-B38B-79DA6556C87E"
},
{
"title":"Oracle Net Considerations",
"href":"appc-gateway-migration.html#GUID-19897933-4A23-40F4-A360-4D5D44EA6D79"
},
{
"title":"Parameter Changes: Version 4 to 12c Release 2 (12.2) of the Gateway",
"href":"appc-gateway-migration.html#GUID-59034BAA-DFCF-49E4-8069-C16BCA35D982"
},
{
"title":"Parameter Changes: Version 8 or Earlier to Gateway 12c Release 2 (12.2)",
"href":"appc-gateway-migration.html#GUID-DB50E653-6F5D-49A4-9F44-3B437C4C402C"
},
{
"title":"Migrating from Gateway Release 9.0.1 or 9.2.0 to Gateway 12c Release 2 (12.2)",
"href":"appc-gateway-migration.html#GUID-E834764F-24C6-4C32-9315-F45F5F317806"
}
]
},
{
"title":"Migrating from an Existing Gateway Using SNA to TCP/IP",
"href":"appc-gateway-migration.html#GUID-A95CF937-367D-4849-B9E3-1FDC885535AA",
"topics":[
{
"title":"To Use Existing TIPs with Existing Side Profile Definitions",
"href":"appc-gateway-migration.html#GUID-60F74020-0D5C-4792-8E15-D9617DEA146A"
}
]
}
]
},
{
"title":"<span class=\"secnum\">A </span> Gateway Initialization Parameters for SNA Protocol",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-84F7EB01-3551-4335-A54A-918F7E637F5D",
"topics":[
{
"title":"PGA Parameters",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-FA92B3D4-6DB1-499A-A382-B243EFCFBC98"
},
{
"title":"PGA_CAPABILITY Parameter Considerations",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-AFCB48DA-EF85-42A3-A7C7-62E8DA1CD778"
},
{
"title":"PGA_CONFIRM Parameter Considerations",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-F52E3C91-38FE-4935-87B0-89E5B2AAA9FD"
},
{
"title":"Sample listener.ora File for a Gateway Using SNA",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-B7251BC4-D7B4-4B35-8560-66A602D3FF31"
},
{
"title":"Sample tnsnames.ora File for a Gateway Using SNA",
"href":"appc-gateway-initialization-parameters-sna.html#GUID-396255E1-6B6C-49AE-9D15-A03AA1C73CD5"
}
]
},
{
"title":"<span class=\"secnum\">B </span> Gateway Initialization Parameters for TCP/IP Communication Protocol",
"href":"appc-gateway-initialization-parameters-tcp-ip.html#GUID-67D9D370-DB10-430B-93B8-BD8844DE7E3E",
"topics":[
{
"title":"Gateway Initialization Parameter File Using TCP/IP",
"href":"appc-gateway-initialization-parameters-tcp-ip.html#GUID-4FBBCBDD-0B42-49D7-8104-63DEDD046DCE"
},
{
"title":"Output for the pg4tcpmap Tool",
"href":"appc-gateway-initialization-parameters-tcp-ip.html#GUID-C9B3713C-E8A0-4D7A-A6C9-504B83D64733",
"topics":[
{
"title":"Sample listener.ora File for a Gateway Using TCP/IP",
"href":"appc-gateway-initialization-parameters-tcp-ip.html#GUID-6482FDAA-0A19-4DA7-8D48-234DA865554A"
},
{
"title":"Sample tnsnames.ora File for a Gateway Using TCP/IP",
"href":"appc-gateway-initialization-parameters-tcp-ip.html#GUID-E852A6CF-7C38-4595-B1A2-8EC6AE432E53"
}
]
}
]
},
{
"title":"<span class=\"secnum\">C </span> Gateway Terminology",
"href":"appc-gateway-terminology.html#GUID-E053475C-BC9A-4116-A4AF-0E8449F33F4E"
},
{
"title":"<span class=\"secnum\">D </span> Configuration Worksheet",
"href":"appc-gateway-configuration-worksheet.html#GUID-96B6C85D-6B37-42C7-ADE0-5752F46AF88A"
},
{
"title":"Index",
"href":"book-index.html"
}
]
}
]
});
|
import { Component, Children } from 'react'
import { storeShape } from './PropTypes'
export default class Provider extends Component {
static propTypes = {
store: storeShape.isRequired
}
static childContextTypes = {
store: storeShape.isRequired
}
getChildContext () {
return {
store: this.props.store
}
}
render () {
return Children.only(this.props.children)
}
}
|
class Storage extends (require('../../BaseMethod').BaseMethod) {
constructor(props) {
super(props);
}
getByKey(request_key, callback) {
console.log(5, request_key[0]);
this.db.query("select * from storage where `request_key` = ? ORDER BY rand() limit 0,1",
[request_key[0].toLowerCase()], (q_error, q_response) => {
if (q_error) {
return callback({ status: false })
} else if (q_response.rows.length < 1) {
return callback({ status: false })
}
return callback({
status: true,
response: q_response.rows[0]
});
});
}
addByKey(request_key, response_value, author_info = '', client_id = 1, callback) {
this.hasBy(request_key, response_value, client_id, (has) => {
if (has) {
return callback({
status: true
});
}
this.query("INSERT INTO `storage` (`id`, `request_key`, `response_value`, `date_add`, `author_info`, `client_id`) VALUES (NULL, ?, ?, '"+(Math.round((+new Date())/1000))+"', ?, ?)",
[(request_key).toLowerCase(), (response_value).toLowerCase(), author_info, client_id], (q_error, q_response) => {
if (q_error) {
return callback({ status: false })
}
return callback({
status: true,
});
})
});
}
hasBy(request_key, response_value, client_id = 1, callback) {
this.db.query("select id from storage where `request_key` = ? && `response_value` = ? && `client_id` = ? limit 0,1",
[request_key.toLowerCase(), response_value.toLowerCase(), client_id], (q_error, q_response) => {
if (q_error) {
return callback(false)
} else if (q_response.rows.length < 1) {
return callback(false)
}
return callback(true);
});
}
removeByKey(request_key, response_value, client_id = 1, callback) {
this.query("DELETE FROM `storage` WHERE `request_key` = ? && `response_value` = ? && `client_id` = ?",
[request_key.toLowerCase(), response_value.toLowerCase(), client_id], (q_error, q_response) => {
if (q_error) {
return callback({ status: false })
}
return callback({
status: true,
});
})
}
execute() {
switch (this.method) {
case 'get':
return this.getByKey(this.$_GET('request_key'), (response) => {
if (!response.status) {
return this.response({
response: `Я еще не знаю, как ответить на это сообщение. Научи меня? Напиши мне: ${this.$_GET('request_key')}===а здесь как я должен был ответить на это`
})
}
return this.response({
response: response.response.response_value
})
});
case 'add':
return this.addByKey(this.$_GET('request_key'), this.$_GET('response_value'), '', 1, (response) => {
if (!response.status) {
return this.response({
response: `Что-то пошло не так, попробуй еще раз...`
})
}
return this.response({
response: 'Спасибо, я запомнил.'
})
});
case 'remove':
return this.removeByKey(this.$_GET('request_key'), this.$_GET('response_value'), 1, (response) => {
if (!response.status) {
return this.response({
response: `Что-то пошло не так, попробуй еще раз...`
})
}
return this.response({
response: 'Удалил.'
})
});
}
this.error('unknownError');
}
}
module.exports = {Storage};
|
/**
* Calculates a new result graph from the given source graph.
* @param {Object} config Configuration parameters.
* @constructor
*/
GraphView = function(config){
// Constructor with no arguments is used for subclasses.
if (arguments.length <= 0) return;
this['config'] = config == null ? {} : config;
this['constellation'] = null;
this['source'] = null;
this['result'] = null;
this.valid = true;
};
window["GraphView"] = GraphView;
GraphView.prototype.getConstellation = function(){
return this['constellation'];
};
GraphView.prototype["getConstellation"] = GraphView.prototype.getConstellation;
GraphView.prototype.setConstellation = function(constellation){
this['constellation'] = constellation;
this.invalidate();
};
GraphView.prototype["setConstellation"] = GraphView.prototype.setConstellation;
GraphView.prototype.getSource = function(){
return this['source'];
};
GraphView.prototype["getSource"] = GraphView.prototype.getSource;
GraphView.prototype.setSource = function(source){
this['source'] = source;
this.invalidate();
};
GraphView.prototype["setSource"] = GraphView.prototype.setSource;
/**
* Call this method when the contents of the source graph change.
* This method invalidates the view so it can be recalculated.
*/
GraphView.prototype.sourceChanged = function(){
this.invalidate();
};
GraphView.prototype["sourceChanged"] = GraphView.prototype.sourceChanged;
/**
* Fetches the output of this graph view.
*/
GraphView.prototype.getResult = function(){
return this['result'];
};
GraphView.prototype["getResult"] = GraphView.prototype.getResult;
/**
* Sets the output of this graph view.
*/
GraphView.prototype.setResult = function(result){
this['result'] = result;
this.invalidate();
};
GraphView.prototype["setResult"] = GraphView.prototype.setResult;
/**
* Invalidates the graph view, scheduling it for a refresh.
*/
GraphView.prototype.invalidate = function(){
if (!this.valid) return;
this.valid = false;
var self = this;
window.setTimeout(function(){
self.validateDispatcher();
}, 50);
};
GraphView.prototype["invalidate"] = GraphView.prototype.invalidate;
/**
* Called after the validation delay.
* @private
*/
GraphView.prototype.validateDispatcher = function(){
if (this['constellation'] && this['source'] && this['result']) {
var changed = this['validate']();
this.valid = true;
if (changed) {
jQuery(this).trigger('change');
}
}
};
/**
* Calculates the result graph based on the input source graph. The
* return value is true iff the view changed.
* This method should be overridden to do some actual calculation.
*/
GraphView.prototype.validate = function(){
return false;
};
GraphView.prototype["validate"] = GraphView.prototype.validate;
/**
* Graph view where the result is the same graph data structure as the source.
* @param {Object} config Configuration parameters.
* @constructor
*/
DirectGraphView = function(config){
// Constructor with no arguments is used for subclasses.
if (arguments.length <= 0) return;
GraphView.call(this, config);
};
window["DirectGraphView"] = DirectGraphView;
DirectGraphView.prototype = new GraphView();
DirectGraphView.prototype.constructor = DirectGraphView;
DirectGraphView.prototype.validate = function(){
var i;
var doomedNodeIds = this['result'].getNodeIds();
var doomedEdgeIds = this['result'].getEdgeIds();
var resultNodes = this['source'].getNodes();
var resultEdges = this['source'].getEdges();
// Undoomify nodes and edges that are in the result tree
// make sure their data properties are up-to-date.
for (i = 0; i < resultEdges.length; i++) {
index = doomedEdgeIds.indexOf(resultEdges[i]['id']);
if (index >= 0) {
edge = this['result'].getEdge(resultEdges[i]['id']);
edge['data'] = resultEdges[i]['data'];
edge.dataChanged();
doomedEdgeIds.splice(index, 1);
resultEdges.splice(i, 1);
i--;
}
}
for (i = 0; i < resultNodes.length; i++) {
index = doomedNodeIds.indexOf(resultNodes[i]['id']);
if (index >= 0) {
node = this['result'].getNode(resultNodes[i]['id']);
node['data'] = resultNodes[i]['data'];
node.dataChanged();
doomedNodeIds.splice(index, 1);
resultNodes.splice(i, 1);
i--;
}
}
// Remove remaining doomed nodes and edges.
for (i = 0; i < doomedEdgeIds.length; i++) {
this['result'].removeEdge(doomedEdgeIds[i]);
}
for (i = 0; i < doomedNodeIds.length; i++) {
this['result'].removeNode(doomedNodeIds[i]);
}
// Add remaining result nodes and edges.
for (i = 0; i < resultNodes.length; i++) {
var resultNode = resultNodes[i];
this['result'].addNode(
resultNode['id'],
resultNode['data']);
}
for (i = 0; i < resultEdges.length; i++) {
var resultEdge = resultEdges[i];
this['result'].addEdge(
resultEdge['id'],
resultEdge['tailNode']['id'],
resultEdge['headNode']['id'],
resultEdge['data']);
}
return true;
};
DirectGraphView.prototype["validate"] = DirectGraphView.prototype.validate;
/**
* Calculates a tree rooted at the currently selected node. The
* tree is revealed incrementally with a delay.
* @param {Object} config Configuration parameters.
* @constructor
*/
TreeGraphView = function(config){
// Constructor with no arguments is used for subclasses.
if (arguments.length <= 0) return;
GraphView.call(this, config);
this.selectedNodeId = null;
this.selectedNodeChanged = false;
this.currDepth = 1;
};
window["TreeGraphView"] = TreeGraphView;
TreeGraphView.prototype = new GraphView();
TreeGraphView.prototype.constructor = TreeGraphView;
TreeGraphView.prototype.setConstellation = function(constellation){
if (this['constellation']) {
jQuery(this['constellation']).unbind('nodeselect.TreeGraphView');
}
GraphView.prototype.setConstellation.call(this, constellation);
if (this['constellation']) {
var prevSelectedNodeId = this.selectedNodeId;
this.selectedNodeId = this['constellation'].getSelectedNodeId();
this.selectedNodeChanged = this.selectedNodeId != prevSelectedNodeId;
jQuery(this['constellation']).bind('nodeselect.TreeGraphView', {context: this}, function(event){
event.data.context.selectedNodeHandler();
});
}
};
TreeGraphView.prototype["setConstellation"] = TreeGraphView.prototype.setConstellation;
/**
* Called when Constellation's selected node changes.
* @private
*/
TreeGraphView.prototype.selectedNodeHandler = function() {
this.selectedNodeChanged = true;
this.prevSelectedNodeId = this.selectedNodeId;
this.selectedNodeId = this['constellation'].getSelectedNodeId();
this.invalidate();
};
TreeGraphView.prototype["selectedNodeHandler"] = TreeGraphView.prototype.selectedNodeHandler;
/**
* Override the default validate method to extract a tree.
* The tree is rooted at the selected node and the nodes in
* the result are given appropriate style classes.
*/
TreeGraphView.prototype.validate = function() {
var i, index;
var startDepth = this['config']['startDepth'] ? this['config']['startDepth'] : 2;
var depth = this['config']['depth'] ? this['config']['depth'] : 3;
var delay = this['config']['delay'] ? this['config']['delay'] : 1000;
if (this.selectedNodeChanged) {
this.currDepth = startDepth;
}
var selectedNode = this['source'].getNode(this.selectedNodeId);
if (!selectedNode) {
// Selected node hasn't been loaded yet. Wait until more source data
// comes in and then we'll try validating again.
return;
}
selectedNode['data']['depth'] = 0;
var doomedNodeIds = this['result'].getNodeIds();
var doomedEdgeIds = this['result'].getEdgeIds();
var resultNodes = [selectedNode];
var resultEdges = [];
var nodeMetadata = {};
var nodeQueue = [selectedNode];
nodeMetadata[this.selectedNodeId] = {
treeDepth: this.currDepth,
nodeDepth: 0
};
while (nodeQueue.length > 0) {
var currNode = nodeQueue.shift();
var currNodeMetadata = nodeMetadata[currNode['id']];
if (currNodeMetadata.treeDepth > 0) {
var edges = currNode['edges'];
for (i = 0; i < edges.length; i++) {
var edge = edges[i];
var neighborNode;
if (edge['tailNode']['id'] == currNode['id']) {
neighborNode = edge['headNode'];
}
else {
neighborNode = edge['tailNode'];
}
var neighborNodeMetadata = nodeMetadata[neighborNode['id']];
if ((!neighborNodeMetadata
|| neighborNodeMetadata.treeDepth < currNodeMetadata.treeDepth - 1)
&& currNodeMetadata.treeDepth > 1) {
// The neighbor node has not been added yet
var neighborTreeDepth = currNodeMetadata.treeDepth - 1;
neighborNode['data']['depth'] = currNodeMetadata.nodeDepth + 1;
resultNodes.push(neighborNode);
nodeQueue.push(neighborNode);
neighborNodeMetadata = {
treeDepth: neighborTreeDepth,
nodeDepth: currNodeMetadata.nodeDepth + 1
};
nodeMetadata[neighborNode['id']] = neighborNodeMetadata;
}
// Add edge if the neighbor exists.
if (jQuery.inArray(edge, resultEdges) < 0 && neighborNodeMetadata) {
edge['data']['depth'] = currNodeMetadata.nodeDepth;
resultEdges.push(edge);
}
}
}
}
// Undoomify nodes and edges that are in the result tree
// make sure their data properties are up-to-date.
for (i = 0; i < resultEdges.length; i++) {
index = doomedEdgeIds.indexOf(resultEdges[i]['id']);
if (index >= 0) {
edge = this['result'].getEdge(resultEdges[i]['id']);
edge['data'] = resultEdges[i]['data'];
edge.dataChanged();
doomedEdgeIds.splice(index, 1);
resultEdges.splice(i, 1);
i--;
}
}
for (i = 0; i < resultNodes.length; i++) {
index = doomedNodeIds.indexOf(resultNodes[i]['id']);
if (index >= 0) {
node = this['result'].getNode(resultNodes[i]['id']);
node['data'] = resultNodes[i]['data'];
node.dataChanged();
doomedNodeIds.splice(index, 1);
resultNodes.splice(i, 1);
i--;
}
}
// Remove remaining doomed nodes and edges.
for (i = 0; i < doomedEdgeIds.length; i++) {
var doomedEdgeId = doomedEdgeIds[i];
jQuery(this['source'].getNode(doomedEdgeId)).unbind('dataChange.TreeGraphView', this.edgeDataChangeHandler);
this['result'].removeEdge(doomedEdgeId);
}
for (i = 0; i < doomedNodeIds.length; i++) {
var doomedNodeId = doomedNodeIds[i];
jQuery(this['source'].getNode(doomedNodeId)).unbind('dataChange.TreeGraphView', this.nodeDataChangeHandler);
this['result'].removeNode(doomedNodeId);
}
// Add remaining result nodes and edges.
for (i = 0; i < resultNodes.length; i++) {
var resultNode = resultNodes[i];
var n = this['result'].addNode(
resultNode['id'],
// FIXME: Should the data be cloned and if so, shallow or deep copy?
jQuery.extend({}, resultNode['data']));
jQuery(resultNode).bind('dataChange.TreeGraphView', {context: this, result: n}, this.dataChangeHandler);
}
for (i = 0; i < resultEdges.length; i++) {
var resultEdge = resultEdges[i];
var e = this['result'].addEdge(
resultEdge['id'],
resultEdge['tailNode']['id'],
resultEdge['headNode']['id'],
// FIXME: Should the data be cloned and if so, shallow or deep copy?
jQuery.extend({}, resultEdge['data']));
jQuery(resultEdge).bind('dataChange.TreeGraphView', {context: this, result: e}, this.dataChangeHandler);
}
this.selectedNodeChanged = false;
if (this.currDepth < depth) {
// Need to increment the depth after a delay.
clearTimeout(this.incrementDepthTimeoutId);
var self = this;
this.incrementDepthTimeoutId = setTimeout(function() {
self.incrementDepth();
}, delay);
}
return true;
};
TreeGraphView.prototype["validate"] = TreeGraphView.prototype.validate;
TreeGraphView.prototype.dataChangeHandler = function(event) {
// Copy the data from the source node/edge (event target) to the result node/edge.
// FIXME: Should jQuery.extend be used here to protect existing properties?
event.data.result.data = event.target.data;
event.data.result.draw();
};
TreeGraphView.prototype.incrementDepth = function() {
this.currDepth++;
this.invalidate();
};
|
define([], function() {
return function(config, element) {
'use strict'
const activeItemClass = 'rating__rate-item--active',
errorVisibleClass = 'rating__error--visible',
reviewError = document.getElementById(config.reviewError),
ratingElements = [...element.querySelectorAll('.rating__rate-item')],
submitButton = document.getElementById(config.submitButton),
reviewForm = document.getElementById(config.reviewForm);
let optionChoosen = false;
ratingElements.forEach(oneRank => {
oneRank.addEventListener('click', () => {
deleteOtherRates();
oneRank.querySelector('.radio__field').checked = true;
oneRank.classList.add(activeItemClass);
optionChoosen = true;
if (reviewError.classList.contains(errorVisibleClass)) {
reviewError.classList.remove(errorVisibleClass);
}
for (let i = 0; i < ratingElements.length; i++) {
if (!ratingElements[i].classList.contains(activeItemClass)) {
ratingElements[i].classList.add(activeItemClass);
}
else {
return;
}
}
});
});
reviewForm.addEventListener('submit', (e) => {
if (!optionChoosen) {
reviewError.classList.add(errorVisibleClass);
submitButton.disabled = false;
e.preventDefault();
return false;
}
});
function deleteOtherRates() {
ratingElements.forEach(item => {
item.classList.remove(activeItemClass);
});
}
}
});
|
// Sepcific a new version, like 2.0.1 -> 2.0.2
const fs = require('fs')
const { spawnSync } = require('child_process')
const version = process.argv[2]
if (!version) {
throw Error('No version specified')
}
const files = ['package.json', 'chrome/manifest.json', 'octohint.safariextension/Info.plist']
files.slice(0, 2).forEach(file => {
fs.writeFileSync(file, fs.readFileSync(file, 'utf8').replace(/"version": "\d.\d.\d"/, `"version": "${version}"`))
})
fs.writeFileSync(
files[2],
fs.readFileSync(files[2], 'utf8').replace(/<string>\d.\d.\d<\/string>/, `<string>${version}</string>`),
)
spawnSync('git', ['add', ...files])
spawnSync('git', ['commit', '-m', version])
spawnSync('git', ['tag', 'v' + version])
|
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS PUB 180-1
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
*/
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
/*
* Calculate the SHA-1 of an array of big-endian words, and a bit length
*/
function core_sha1(x, len)
{
/* append padding */
x[len >> 5] |= 0x80 << (24 - len % 32);
x[((len + 64 >> 9) << 4) + 15] = len;
var w = Array(80);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var e = -1009589776;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
var olde = e;
for(var j = 0; j < 80; j++)
{
if(j < 16) w[j] = x[i + j];
else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
safe_add(safe_add(e, w[j]), sha1_kt(j)));
e = d;
d = c;
c = rol(b, 30);
b = a;
a = t;
}
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
e = safe_add(e, olde);
}
return Array(a, b, c, d, e);
}
/*
* Perform the appropriate triplet combination function for the current
* iteration
*/
function sha1_ft(t, b, c, d)
{
if(t < 20) return (b & c) | ((~b) & d);
if(t < 40) return b ^ c ^ d;
if(t < 60) return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
/*
* Determine the appropriate additive constant for the current iteration
*/
function sha1_kt(t)
{
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
(t < 60) ? -1894007588 : -899497514;
}
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* Convert an 8-bit or 16-bit string to an array of big-endian words
* In 8-bit function, characters >255 have their hi-byte silently ignored.
*/
function str2binb(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
return bin;
}
/*
* Convert an array of big-endian words to a hex string.
*/
function binb2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
}
return str;
}
/*
* Convert an array of big-endian words to a base-64 string
*/
function binb2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
function limitlength(val) {
var limit = document.f.lenlimit.value;
if(limit < 0) return val;
return val.slice(0,limit);
}
|
// Update with your config settings.
module.exports = {
development: {
client: 'sqlite3',
connection: {
filename: './data/database.db3'
},
useNullAsDefault:true,
migrations:{
directory:'./data/migrations'
},
seeds: {
directory: './data/seeds'
},
// add the following
pool: {
afterCreate: (conn, done) => {
// runs after a connection is made to the sqlite engine
conn.run('PRAGMA foreign_keys = ON', done); // turn on FK enforcement
},
},
},
production: {
client: 'pg',
connection: {
filename: './data/database.db3'
},
useNullAsDefault:true,
migrations:{
directory:'./data/migrations'
},
seeds: {
directory: './data/seeds'
},
// add the following
pool: {
afterCreate: (conn, done) => {
// runs after a connection is made to the sqlite engine
conn.run('PRAGMA foreign_keys = ON', done); // turn on FK enforcement
},
},
},
};
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var axios = _interopDefault(require('axios'));
var qs = _interopDefault(require('qs'));
(function (Stat) {
Stat["ok"] = "ok";
Stat["fail"] = "fail";
})(exports.Stat || (exports.Stat = {}));
(function (ErrorType) {
ErrorType["invalidParameter"] = "invalid_parameter";
ErrorType["missingParameter"] = "missing_parameter";
})(exports.ErrorType || (exports.ErrorType = {}));
(function (AlertContactType) {
AlertContactType[AlertContactType["sms"] = 1] = "sms";
AlertContactType[AlertContactType["email"] = 2] = "email";
AlertContactType[AlertContactType["twitter"] = 3] = "twitter";
AlertContactType[AlertContactType["boxcar"] = 4] = "boxcar";
AlertContactType[AlertContactType["webhook"] = 5] = "webhook";
AlertContactType[AlertContactType["pushbullet"] = 6] = "pushbullet";
AlertContactType[AlertContactType["zapier"] = 7] = "zapier";
AlertContactType[AlertContactType["pushover"] = 9] = "pushover";
AlertContactType[AlertContactType["hipchat"] = 10] = "hipchat";
AlertContactType[AlertContactType["slack"] = 11] = "slack";
})(exports.AlertContactType || (exports.AlertContactType = {}));
(function (AlertContactState) {
/** pending activation */
AlertContactState[AlertContactState["pending"] = 0] = "pending";
AlertContactState[AlertContactState["paused"] = 1] = "paused";
AlertContactState[AlertContactState["active"] = 2] = "active";
})(exports.AlertContactState || (exports.AlertContactState = {}));
(function (MonitorType) {
MonitorType[MonitorType["http"] = 1] = "http";
MonitorType[MonitorType["https"] = 1] = "https";
MonitorType[MonitorType["keyword"] = 2] = "keyword";
MonitorType[MonitorType["port"] = 4] = "port";
})(exports.MonitorType || (exports.MonitorType = {}));
(function (MonitorSubType) {
MonitorSubType[MonitorSubType["none"] = 0] = "none";
MonitorSubType[MonitorSubType["http"] = 1] = "http";
MonitorSubType[MonitorSubType["https"] = 2] = "https";
MonitorSubType[MonitorSubType["ftp"] = 3] = "ftp";
MonitorSubType[MonitorSubType["smtp"] = 4] = "smtp";
MonitorSubType[MonitorSubType["pop3"] = 5] = "pop3";
MonitorSubType[MonitorSubType["imap"] = 6] = "imap";
MonitorSubType[MonitorSubType["customPort"] = 99] = "customPort";
})(exports.MonitorSubType || (exports.MonitorSubType = {}));
(function (MonitorKeywordType) {
MonitorKeywordType[MonitorKeywordType["none"] = 0] = "none";
MonitorKeywordType[MonitorKeywordType["exists"] = 1] = "exists";
MonitorKeywordType[MonitorKeywordType["notExists"] = 2] = "notExists";
})(exports.MonitorKeywordType || (exports.MonitorKeywordType = {}));
(function (MonitorState) {
MonitorState[MonitorState["paused"] = 0] = "paused";
MonitorState[MonitorState["new"] = 1] = "new";
MonitorState[MonitorState["up"] = 2] = "up";
MonitorState[MonitorState["warn"] = 8] = "warn";
MonitorState[MonitorState["down"] = 9] = "down";
})(exports.MonitorState || (exports.MonitorState = {}));
(function (LogType) {
LogType[LogType["down"] = 1] = "down";
LogType[LogType["up"] = 2] = "up";
LogType[LogType["started"] = 98] = "started";
LogType[LogType["paused"] = 99] = "paused";
})(exports.LogType || (exports.LogType = {}));
(function (MonitorHttpMethod) {
MonitorHttpMethod[MonitorHttpMethod["head"] = 1] = "head";
MonitorHttpMethod[MonitorHttpMethod["get"] = 2] = "get";
MonitorHttpMethod[MonitorHttpMethod["post"] = 3] = "post";
MonitorHttpMethod[MonitorHttpMethod["put"] = 4] = "put";
MonitorHttpMethod[MonitorHttpMethod["patch"] = 5] = "patch";
MonitorHttpMethod[MonitorHttpMethod["delete"] = 6] = "delete";
MonitorHttpMethod[MonitorHttpMethod["options"] = 7] = "options";
})(exports.MonitorHttpMethod || (exports.MonitorHttpMethod = {}));
(function (MonitorHttpMethodPostType) {
MonitorHttpMethodPostType[MonitorHttpMethodPostType["keyValue"] = 1] = "keyValue";
MonitorHttpMethodPostType[MonitorHttpMethodPostType["rawData"] = 2] = "rawData";
})(exports.MonitorHttpMethodPostType || (exports.MonitorHttpMethodPostType = {}));
(function (MonitorHttpMethodContentType) {
/** text/html */
MonitorHttpMethodContentType[MonitorHttpMethodContentType["html"] = 0] = "html";
/** application/json */
MonitorHttpMethodContentType[MonitorHttpMethodContentType["json"] = 1] = "json";
})(exports.MonitorHttpMethodContentType || (exports.MonitorHttpMethodContentType = {}));
(function (MWindowType) {
MWindowType[MWindowType["once"] = 1] = "once";
MWindowType[MWindowType["daily"] = 2] = "daily";
MWindowType[MWindowType["weekly"] = 3] = "weekly";
MWindowType[MWindowType["monthly"] = 4] = "monthly";
})(exports.MWindowType || (exports.MWindowType = {}));
(function (MWindowState) {
MWindowState[MWindowState["paused"] = 0] = "paused";
MWindowState[MWindowState["active"] = 1] = "active";
})(exports.MWindowState || (exports.MWindowState = {}));
(function (PSPState) {
PSPState[PSPState["paused"] = 0] = "paused";
PSPState[PSPState["active"] = 1] = "active";
})(exports.PSPState || (exports.PSPState = {}));
(function (PSPSort) {
/** friendly name (a-z) */
PSPSort[PSPSort["friendlyNameAsc"] = 1] = "friendlyNameAsc";
/** friendly name (z-a) */
PSPSort[PSPSort["friendlyNameDesc"] = 2] = "friendlyNameDesc";
/** status (up-down-paused) */
PSPSort[PSPSort["statusDesc"] = 3] = "statusDesc";
/** status (down-up-paused) */
PSPSort[PSPSort["statusAsc"] = 4] = "statusAsc";
})(exports.PSPSort || (exports.PSPSort = {}));
(function (PSPType) {
/** for all monitors */
PSPType[PSPType["all"] = 1] = "all";
/** for selected monitors */
PSPType[PSPType["custom"] = 2] = "custom";
})(exports.PSPType || (exports.PSPType = {}));
const createErrorResponse = (err) => ({
stat: 'fail',
error: {
type: 'invalid_parameter',
parameter_name: 'Unhandled',
message: err.message,
},
});
class Client {
constructor(apiKey, axiosConfig) {
/** the axios instance */
this.client = null;
/** Returns a configured axios client */
this.createClient = (apiKey, axiosConfig) => axios.create(Object.assign({ baseURL: `https://${Client.DEFAULT_HOST}/${Client.DEFAULT_BASE_PATH}`, timeout: 1e3, headers: {
'Content-Type': 'application/x-www-form-urlencoded',
}, transformRequest: [data => qs.stringify(Object.assign(Object.assign({}, data), { api_key: apiKey }))] }, (axiosConfig || null)));
/**
* Creates a post request.
* Note: api failed/badRequest requests are returned as 200. Here we have
* intercept logic which looks to the Stat value of "fail" then force a
* reject on the promise.
*/
this.post = async (endpoint, params) => {
var _a, _b, _c, _d, _e;
try {
const response = await ((_a = this.client) === null || _a === void 0 ? void 0 : _a.post(endpoint, params));
if (((_b = response) === null || _b === void 0 ? void 0 : _b.data.stat) === 'fail') {
throw (_c = response) === null || _c === void 0 ? void 0 : _c.data;
}
return (_d = response) === null || _d === void 0 ? void 0 : _d.data;
}
catch (e) {
throw !((_e = e) === null || _e === void 0 ? void 0 : _e.stat) ? createErrorResponse(e) : e;
}
};
this.apiKey = apiKey;
this.client = this.createClient(this.apiKey, axiosConfig);
}
}
Client.DEFAULT_HOST = 'api.uptimerobot.com';
Client.DEFAULT_BASE_PATH = 'v2';
Client.DEFAULT_VERSION = 2;
// Models =================================================================== //
/**
* Uptimerobot.Account -> Account
*/
const getApiAccountToAccount = (account) => (Object.assign({}, account));
// Responses ================================================================ //
/**
* Uptimerobot.AccountListSuccessResponse -> AccountListResponse
*/
const getApiResponseToAccountListResponse = (response) => ({
stat: response.stat,
account: getApiAccountToAccount(response.account),
});
class Account extends Client {
constructor() {
super(...arguments);
/**
* Not implemented
*/
this.get = () => {
throw new Error('Not Implemented');
};
/**
* Account details (max number of monitors that can be added and number of
* up/down/paused monitors) can be grabbed using this method.
*/
this.list = async () => {
const response = await this.post('getAccountDetails');
return getApiResponseToAccountListResponse(response);
};
/**
* Not implemented
*/
this.create = () => {
throw new Error('Not Implemented');
};
/**
* Not implemented
*/
this.update = () => {
throw new Error('Not Implemented');
};
/**
* Not implemented
*/
this.delete = () => {
throw new Error('Not Implemented');
};
}
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
var _arrayPush = arrayPush;
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/** Built-in value references. */
var Symbol = _root.Symbol;
var _Symbol = Symbol;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
var _getRawTag = getRawTag;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$1.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag$1 && symToStringTag$1 in Object(value))
? _getRawTag(value)
: _objectToString(value);
}
var _baseGetTag = baseGetTag;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
}
var _baseIsArguments = baseIsArguments;
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
return isObjectLike_1(value) && hasOwnProperty$1.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
var isArguments_1 = isArguments;
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray_1 = isArray;
/** Built-in value references. */
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray_1(value) || isArguments_1(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
var _isFlattenable = isFlattenable;
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = _isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
_arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
var _baseFlatten = baseFlatten;
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? _baseFlatten(array, 1) : [];
}
var flatten_1 = flatten;
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}
var compact_1 = compact;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
var isObject_1 = isObject;
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject_1(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = _baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_1 = isFunction;
/** Used to detect overreaching core-js shims. */
var coreJsData = _root['__core-js_shared__'];
var _coreJsData = coreJsData;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
var _isMasked = isMasked;
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
var _toSource = toSource;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype,
objectProto$3 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject_1(value) || _isMasked(value)) {
return false;
}
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
return pattern.test(_toSource(value));
}
var _baseIsNative = baseIsNative;
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
var _getValue = getValue;
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = _getValue(object, key);
return _baseIsNative(value) ? value : undefined;
}
var _getNative = getNative;
/* Built-in method references that are verified to be native. */
var nativeCreate = _getNative(Object, 'create');
var _nativeCreate = nativeCreate;
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
this.size = 0;
}
var _hashClear = hashClear;
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
var _hashDelete = hashDelete;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (_nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
}
var _hashGet = hashGet;
/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
}
var _hashHas = hashHas;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
return this;
}
var _hashSet = hashSet;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = _hashClear;
Hash.prototype['delete'] = _hashDelete;
Hash.prototype.get = _hashGet;
Hash.prototype.has = _hashHas;
Hash.prototype.set = _hashSet;
var _Hash = Hash;
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
var _listCacheClear = listCacheClear;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
var eq_1 = eq;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq_1(array[length][0], key)) {
return length;
}
}
return -1;
}
var _assocIndexOf = assocIndexOf;
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
var _listCacheDelete = listCacheDelete;
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
var _listCacheGet = listCacheGet;
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return _assocIndexOf(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas;
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
var _listCacheSet = listCacheSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;
var _ListCache = ListCache;
/* Built-in method references that are verified to be native. */
var Map = _getNative(_root, 'Map');
var _Map = Map;
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new _Hash,
'map': new (_Map || _ListCache),
'string': new _Hash
};
}
var _mapCacheClear = mapCacheClear;
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
var _isKeyable = isKeyable;
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return _isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
var _getMapData = getMapData;
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = _getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
var _mapCacheDelete = mapCacheDelete;
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return _getMapData(this, key).get(key);
}
var _mapCacheGet = mapCacheGet;
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return _getMapData(this, key).has(key);
}
var _mapCacheHas = mapCacheHas;
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = _getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
var _mapCacheSet = mapCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = _mapCacheClear;
MapCache.prototype['delete'] = _mapCacheDelete;
MapCache.prototype.get = _mapCacheGet;
MapCache.prototype.has = _mapCacheHas;
MapCache.prototype.set = _mapCacheSet;
var _MapCache = MapCache;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED$2);
return this;
}
var _setCacheAdd = setCacheAdd;
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
var _setCacheHas = setCacheHas;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new _MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
SetCache.prototype.has = _setCacheHas;
var _SetCache = SetCache;
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
var _baseFindIndex = baseFindIndex;
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
var _baseIsNaN = baseIsNaN;
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
var _strictIndexOf = strictIndexOf;
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? _strictIndexOf(array, value, fromIndex)
: _baseFindIndex(array, _baseIsNaN, fromIndex);
}
var _baseIndexOf = baseIndexOf;
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && _baseIndexOf(array, value, 0) > -1;
}
var _arrayIncludes = arrayIncludes;
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
var _arrayIncludesWith = arrayIncludesWith;
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
var _cacheHas = cacheHas;
/* Built-in method references that are verified to be native. */
var Set = _getNative(_root, 'Set');
var _Set = Set;
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
var noop_1 = noop;
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
var _setToArray = setToArray;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(_Set && (1 / _setToArray(new _Set([,-0]))[1]) == INFINITY) ? noop_1 : function(values) {
return new _Set(values);
};
var _createSet = createSet;
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = _arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = _arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : _createSet(array);
if (set) {
return _setToArray(set);
}
isCommon = false;
includes = _cacheHas;
seen = new _SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
var _baseUniq = baseUniq;
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? _baseUniq(array) : [];
}
var uniq_1 = uniq;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor;
/**
* The base implementation of `_.repeat` which doesn't coerce arguments.
*
* @private
* @param {string} string The string to repeat.
* @param {number} n The number of times to repeat the string.
* @returns {string} Returns the repeated string.
*/
function baseRepeat(string, n) {
var result = '';
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
if (n % 2) {
result += string;
}
n = nativeFloor(n / 2);
if (n) {
string += string;
}
} while (n);
return result;
}
var _baseRepeat = baseRepeat;
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
var _arrayMap = arrayMap;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
}
var isSymbol_1 = isSymbol;
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray_1(value)) {
// Recursively convert values (susceptible to call stack limits).
return _arrayMap(value, baseToString) + '';
}
if (isSymbol_1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}
var _baseToString = baseToString;
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
var _baseSlice = baseSlice;
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : _baseSlice(array, start, end);
}
var _castSlice = castSlice;
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
var _hasUnicode = hasUnicode;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
var _baseProperty = baseProperty;
/**
* Gets the size of an ASCII `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
var asciiSize = _baseProperty('length');
var _asciiSize = asciiSize;
/** Used to compose unicode character classes. */
var rsAstralRange$1 = '\\ud800-\\udfff',
rsComboMarksRange$1 = '\\u0300-\\u036f',
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
rsVarRange$1 = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange$1 + ']',
rsCombo = '[' + rsComboRange$1 + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange$1 + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsZWJ$1 = '\\u200d';
/** Used to compose unicode regexes. */
var reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange$1 + ']?',
rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/**
* Gets the size of a Unicode `string`.
*
* @private
* @param {string} string The string inspect.
* @returns {number} Returns the string size.
*/
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}
var _unicodeSize = unicodeSize;
/**
* Gets the number of symbols in `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the string size.
*/
function stringSize(string) {
return _hasUnicode(string)
? _unicodeSize(string)
: _asciiSize(string);
}
var _stringSize = stringSize;
/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}
var _asciiToArray = asciiToArray;
/** Used to compose unicode character classes. */
var rsAstralRange$2 = '\\ud800-\\udfff',
rsComboMarksRange$2 = '\\u0300-\\u036f',
reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$2 = '\\u20d0-\\u20ff',
rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2,
rsVarRange$2 = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsAstral$1 = '[' + rsAstralRange$2 + ']',
rsCombo$1 = '[' + rsComboRange$2 + ']',
rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
rsNonAstral$1 = '[^' + rsAstralRange$2 + ']',
rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsZWJ$2 = '\\u200d';
/** Used to compose unicode regexes. */
var reOptMod$1 = rsModifier$1 + '?',
rsOptVar$1 = '[' + rsVarRange$2 + ']?',
rsOptJoin$1 = '(?:' + rsZWJ$2 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
rsSymbol$1 = '(?:' + [rsNonAstral$1 + rsCombo$1 + '?', rsCombo$1, rsRegional$1, rsSurrPair$1, rsAstral$1].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode$1 = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol$1 + rsSeq$1, 'g');
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode$1) || [];
}
var _unicodeToArray = unicodeToArray;
/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return _hasUnicode(string)
? _unicodeToArray(string)
: _asciiToArray(string);
}
var _stringToArray = stringToArray;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil;
/**
* Creates the padding for `string` based on `length`. The `chars` string
* is truncated if the number of characters exceeds `length`.
*
* @private
* @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
function createPadding(length, chars) {
chars = chars === undefined ? ' ' : _baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? _baseRepeat(chars, length) : chars;
}
var result = _baseRepeat(chars, nativeCeil(length / _stringSize(chars)));
return _hasUnicode(chars)
? _castSlice(_stringToArray(result), 0, length).join('')
: result.slice(0, length);
}
var _createPadding = createPadding;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol_1(value)) {
return NAN;
}
if (isObject_1(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject_1(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
var toNumber_1 = toNumber;
/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber_1(value);
if (value === INFINITY$2 || value === -INFINITY$2) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
var toFinite_1 = toFinite;
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite_1(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
var toInteger_1 = toInteger;
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : _baseToString(value);
}
var toString_1 = toString;
/**
* Pads `string` on the left side if it's shorter than `length`. Padding
* characters are truncated if they exceed `length`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.padStart('abc', 6);
* // => ' abc'
*
* _.padStart('abc', 6, '_-');
* // => '_-_abc'
*
* _.padStart('abc', 3);
* // => 'abc'
*/
function padStart(string, length, chars) {
string = toString_1(string);
length = toInteger_1(length);
var strLength = length ? _stringSize(string) : 0;
return (length && strLength < length)
? (_createPadding(length - strLength, chars) + string)
: string;
}
var padStart_1 = padStart;
/**
* Returns JSON string of an object
* @example
* getJSONToApiValue({ apple: 1 })
* > '{"apple":1}'
*/
const getJSONToApiValue = (obj) => obj ? JSON.stringify(obj) : obj;
/**
* Returns a JSON object from a string
* @example
* getApiValueToJSON('{"apple":1}')
* > { apple: 1 }
*/
const getApiValueToJSON = (value) => {
try {
return JSON.parse(value);
}
catch (e) {
return {};
}
};
/**
* Bi-directional conversion for api json values
* @example
* '{"apple":1}' -> { apple: 1 } -> '{"apple":1}'
*/
const applyJSONConversion = (value) => {
if (typeof value === 'string')
return getApiValueToJSON(value);
if (typeof value === 'object')
return getJSONToApiValue(value);
return value;
};
/**
* Returns a hyphen-delimited string of an array of number
* @example
* getArrayToApiValue([1,2,3])
* > '1-2-3'
*/
const getArrayToApiValue = (arr) => Array.isArray(arr) ? arr.join('-') : arr;
/**
* Returns an array of number from a hyphen-delimited string
* @example
* getApiValueToArray('1-2-3')
* > [1,2,3]
*/
const getApiValueToArray = (value) => value.split('-').map(Number);
/**
* Bi-directional conversion for api array values
* @example
* '1-23-88' -> [1, 23, 88] or [1, 23, 88] -> '1-23-88'
*/
const applyArrayConversion = (value) => {
if (typeof value === 'string')
return getApiValueToArray(value);
if (Array.isArray(value))
return getArrayToApiValue(value);
return value;
};
/**
* Returns "1" or "0" for "true" and "false" respectively
* @example
* getBoolToApiValue(false)
* > 0
*/
const getBoolToApiValue = (bool) => {
if (bool !== undefined)
return bool ? 1 : 0;
return bool;
};
/**
* Returns "true" or "false" for "1" or "0" respectively
* @example
* getApiValueToBool(0)
* > false
*/
const getApiValueToBool = (value) => value === 1;
/**
* Bi-directional conversion for api boolean values
* @example
* 1 -> true or true -> 1
*/
const applyBoolConversion = (value) => {
if (typeof value === 'string' || typeof value === 'number') {
return getApiValueToBool(value);
}
if (typeof value === 'boolean')
return getBoolToApiValue(value);
return value;
};
/**
* Returns unix timestamp for date object
* @example
* getDateToApiValue(new Date())
* > 1578082892915
*/
const getDateToApiValue = (d) => d instanceof Date ? d.getTime() : d;
/**
* Returns date object for unix timestamp
* @example
* getApiValueToDate(1578082892915)
* > new Date()
*/
const getApiValueToDate = (d) => new Date(d);
/**
* Bi-directional conversion for api date values
* @example
* new Date() -> 1578082892915 or 1578082892915 -> new Date()
*/
const applyDateConversion = (value) => {
if (typeof value === 'number')
return getApiValueToDate(Number(value));
if (value instanceof Date)
return getDateToApiValue(value);
return value;
};
/**
* Returns a hyphen-delimited string representation of TimeRange[].
* @example
* getTimeRangesToApiValue([
* { start: new Date(2019-12-01), end: new Date(2019-12-31) },
* { start: new Date(2020-01-01), end: new Date(2020-01-30) },
* ])
* > '1575158400000_1577750400000-1577836800000_1580342400000'
*/
const getTimeRangeToApiValue = (ranges) => {
if (Array.isArray(ranges)) {
return flatten_1([ranges])
.map(range => { var _a; return uniq_1(compact_1([range.start.getTime(), (_a = range.end) === null || _a === void 0 ? void 0 : _a.getTime()])).join('_'); })
.join('-');
}
return ranges;
};
/**
* Returns TimeRange[] for a time range string
* @example
* getApiValueToTimeRange('1575158400000_1577750400000-1577836800000_1580342400000')
* > [
* { start: new Date(2019-12-01), end: new Date(2019-12-31) },
* { start: new Date(2020-01-01), end: new Date(2020-01-30) },
* ])
*/
const getApiValueToTimeRange = (value) => value.split('-').map(range => {
const [rangeStart, rangeEnd] = range.split('_');
const start = new Date(+rangeStart);
const end = rangeEnd ? new Date(+rangeEnd) : start;
return { start, end };
});
/**
* Bi-directional conversion for api TimeRange values
* @example
* [
* { start: new Date(2019-12-01), end: new Date(2019-12-31) },
* { start: new Date(2020-01-01), end: new Date(2020-01-30) }
* ] -> '1575158400000_1577750400000-1577836800000_1580342400000'
*/
const applyTimeRangeConversion = (value) => {
if (typeof value === 'string')
return getApiValueToTimeRange(value);
if (Array.isArray(value))
return getTimeRangeToApiValue(value);
return value;
};
/**
* Returns a hyphen-delimited string for MonitorHttpCustomStatus[]
*/
const getMonitorHttpCustomStatusesToApiValue = (customStatuses) => Array.isArray(customStatuses)
? customStatuses.map(custom => `${custom.code}:${custom.status}`).join('-')
: customStatuses;
/** Returns a formatted string for MonitorAlertContactsNotification[] */
const getMonitorAlertContactsNotificationsToApiValue = (notifications) => Array.isArray(notifications)
? notifications
.map(n => `${n.id}_${n.threshold || 0}_${n.recurrence || 0}`)
.join('-')
: notifications;
/**
* Returns api value for MWindowStartTime
* @example
* { type: MWindowStartTime.daily, hour: 12, minute: 30 } -> "12:30"
* { type: MWindowStartTime.once, date: new Date() } -> "1575158400000"
*/
const getMWindowStartTimeToApiValue = (startTime) => {
var _a, _b, _c, _d, _e, _f;
if (((_a = startTime) === null || _a === void 0 ? void 0 : _a.type) === exports.MWindowType.daily ||
((_b = startTime) === null || _b === void 0 ? void 0 : _b.type) === exports.MWindowType.weekly ||
((_c = startTime) === null || _c === void 0 ? void 0 : _c.type) === exports.MWindowType.monthly) {
const hour = padStart_1(String((_d = startTime) === null || _d === void 0 ? void 0 : _d.hour), 2, '0');
const minute = padStart_1(String((_e = startTime) === null || _e === void 0 ? void 0 : _e.minute), 2, '0');
return `${hour}:${minute}`;
}
if (((_f = startTime) === null || _f === void 0 ? void 0 : _f.type) === exports.MWindowType.once) {
return String(startTime.date.getTime());
}
return undefined;
};
/**
* Api value for MWindow start_time can be either unix timestamp
* (for MWindowType.once) or "hh:mm" (for MWindowType.daily, MWindowType.weekly,
* MWindowType.monthly). Here, given then format of the value, we return either
* a <MWindowStartTimeRecurring> or a <MWindowStartTimeOnce>
* @example
* "12:30" -> { type: MWindowStartTime.daily, hour: 12, minute: 30 }
* "1575158400000" -> { type: MWindowStartTime.once, date: new Date() }
*/
const getApiValueForMWindowStartTime = (type, value) => {
if (type !== exports.MWindowType.once) {
const [hour, minute] = value.split(':');
return {
type: type,
hour: Number(hour),
minute: Number(minute),
};
}
return {
type: exports.MWindowType.once,
date: new Date(Number(value)),
};
};
/**
* Uptimerobot.Log -> Log
*/
const getApiLogToLog = (log) => (Object.assign(Object.assign({}, log), { datetime: applyDateConversion(log.datetime), type: log.type, reason: log.reason
? Object.assign(Object.assign({}, log.reason), { code: log.reason.code }) : undefined }));
/**
* Uptimerobot.Monitor -> Monitor
*/
const getApiMonitorToMonitor = (monitor) => {
var _a;
return (Object.assign(Object.assign({}, monitor), { type: monitor.type, sub_type: monitor.sub_type, keyword_type: monitor.keyword_type, status: monitor.status, create_datetime: new Date(monitor.create_datetime), logs: (_a = monitor.logs) === null || _a === void 0 ? void 0 : _a.map(getApiLogToLog), is_group_main: applyBoolConversion(monitor.is_group_main) }));
};
// Responses ================================================================ //
/**
* Uptimerobot.MonitorListSuccessResponse -> MonitorListSuccessResponse
*/
const getApiResponseToMonitorListResponse = (response) => ({
stat: response.stat,
pagination: response.pagination,
monitors: response.monitors.map(getApiMonitorToMonitor),
});
/**
* Uptimerobot.MonitorCreateSuccessResponse -> MonitorCreateSuccessResponse
*/
const getApiResponseToMonitorCreateResponse = (response) => ({
stat: response.stat,
monitor: {
id: response.monitor.id,
status: response.monitor.status,
},
});
/**
* Uptimerobot.MonitorEditSuccessResponse -> MonitorEditSuccessResponse
*/
const getApiResponseToMonitorEditResponse = (response) => ({
stat: response.stat,
monitor: {
id: response.monitor.id,
},
});
/**
* Uptimerobot.MonitorDeleteSuccessResponse -> MonitorDeleteSuccessResponse
*/
const getApiResponseToMonitorDeleteResponse = (response) => ({
stat: response.stat,
monitor: {
id: response.monitor.id,
},
});
/**
* Uptimerobot.MonitorResetSuccessResponse -> MonitorResetSuccessResponse
*/
const getApiResponseToMonitorResetResponse = (response) => ({
stat: response.stat,
monitor: {
id: response.monitor.id,
},
});
// Requests ================================================================= //
/**
* MonitorListRequest -> Uptimerobot.MonitorListRequest
*/
const getMonitorListRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { monitors: applyArrayConversion(request.monitors), types: applyArrayConversion(request.types), statuses: applyArrayConversion(request.statuses), custom_uptime_ratios: applyTimeRangeConversion(request.custom_uptime_ratios), custom_uptime_ranges: applyTimeRangeConversion(request.custom_uptime_ranges), all_time_uptime_ratio: applyBoolConversion(request.all_time_uptime_ratio), all_time_uptime_durations: applyBoolConversion(request.all_time_uptime_durations), logs: applyBoolConversion(request.logs), logs_start_date: applyDateConversion(request.logs_start_date), logs_end_date: applyDateConversion(request.logs_end_date), log_types: applyArrayConversion(request.log_types), response_times: applyBoolConversion(request.response_times), response_times_start_date: applyDateConversion(request.response_times_start_date), response_times_end_date: applyDateConversion(request.response_times_end_date), alert_contacts: applyBoolConversion(request.alert_contacts), mwindows: applyArrayConversion(request.mwindows), ssl: applyBoolConversion(request.ssl), custom_http_headers: applyBoolConversion(request.custom_http_headers), custom_http_statuses: applyBoolConversion(request.custom_http_statuses), timezone: applyBoolConversion(request.timezone) }));
/**
* MonitorCreateRequest -> Uptimerobot.MonitorCreateRequest
*/
const getMonitorCreateRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { alert_contacts: getMonitorAlertContactsNotificationsToApiValue(request.alert_contacts), post_value: applyJSONConversion(request.post_value), custom_http_headers: applyJSONConversion(request.custom_http_headers), custom_http_statuses: getMonitorHttpCustomStatusesToApiValue(request.custom_http_statuses), ignore_ssl_errors: applyBoolConversion(request.ignore_ssl_errors) }));
/**
* MonitorEditRequest -> Uptimerobot.MonitorEditRequest
*/
const getMonitorEditRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { alert_contacts: getMonitorAlertContactsNotificationsToApiValue(request.alert_contacts), post_value: applyJSONConversion(request.post_value), custom_http_headers: applyJSONConversion(request.custom_http_headers), custom_http_statuses: getMonitorHttpCustomStatusesToApiValue(request.custom_http_statuses), ignore_ssl_errors: applyBoolConversion(request.ignore_ssl_errors) }));
/**
* MonitorDeleteRequest -> Uptimerobot.MonitorDeleteRequest
*/
const getMonitorDeleteRequestToApiRequest = (request) => (Object.assign({}, request));
/**
* MonitorResetRequest -> Uptimerobot.MonitorResetRequest
*/
const getMonitorResetRequestToApiRequest = (request) => (Object.assign({}, request));
class Monitor extends Client {
constructor() {
super(...arguments);
/**
* Returns one or more specified Monitors.
* See Monitor#list method description.
*/
this.get = async (monitors, params) => {
const response = await this.post('getMonitors', params ? getMonitorListRequestToApiRequest(Object.assign(Object.assign({}, params), { monitors })) : {});
return getApiResponseToMonitorListResponse(response);
};
/**
* This is a Swiss-Army knife type of a method for getting any information on
* monitors.
* By default, it lists all the monitors in a user's account, their
* friendly names, types (http, keyword, port, etc.), statuses (up, down,
* etc.) and uptime ratios.
* There are optional parameters which lets the getMonitors method to output
* information on any given monitors rather than all of them.
* And also, parameters exist for getting the notification logs (alerts) for
* each monitor and even which alert contacts were alerted on each
* notification.
*/
this.list = async (params) => {
const response = await this.post('getMonitors', params ? getMonitorListRequestToApiRequest(params) : {});
return getApiResponseToMonitorListResponse(response);
};
/**
* New monitors of any type can be created using this method.
*/
this.create = async (params) => {
const response = await this.post('newMonitor', getMonitorCreateRequestToApiRequest(params));
return getApiResponseToMonitorCreateResponse(response);
};
/**
* Monitors can be edited using this method.
* Important: The type of a monitor can not be edited (like changing a HTTP
* monitor into a Port monitor). For such cases, deleting the monitor and
* re-creating a new one is advised.
*/
this.update = async (params) => {
const response = await this.post('editMonitor', getMonitorEditRequestToApiRequest(params));
return getApiResponseToMonitorEditResponse(response);
};
/**
* Monitors can be deleted using this method.
*/
this.delete = async (params) => {
const response = await this.post('deleteMonitor', getMonitorDeleteRequestToApiRequest(params));
return getApiResponseToMonitorDeleteResponse(response);
};
/**
* Monitors can be reset (deleting all stats and response time data) using this method.
*/
this.reset = async (params) => {
const response = await this.post('resetMonitor', getMonitorResetRequestToApiRequest(params));
return getApiResponseToMonitorResetResponse(response);
};
}
}
// Models =================================================================== //
/**
* Uptimerobot.AlertContact -> AlertContact
*/
const getApiAlertContactToAlertContact = (alertContact) => (Object.assign(Object.assign({}, alertContact), { status: alertContact.status, type: alertContact.type }));
// Responses ================================================================ //
/**
* Uptimerobot.AlertContactListSuccessResponse -> AlertContactListResponse
*/
const getApiResponseToAlertContactListResponse = (response) => ({
stat: response.stat,
pagination: {
limit: response.limit,
offset: response.offset,
total: response.total,
},
alert_contacts: response.alert_contacts.map(getApiAlertContactToAlertContact),
});
/**
* Uptimerobot.AlertContactCreateSuccessResponse -> AlertContactCreateSuccessResponse
*/
const getApiResponseToAlertContactCreateResponse = (response) => ({
stat: response.stat,
alertcontact: Object.assign(Object.assign({}, response.alertcontact), { status: response.alertcontact.status }),
});
/**
* Uptimerobot.AlertContactEditSuccessResponse -> AlertContactEditSuccessResponse
*/
const getApiResponseToAlertContactEditResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
/**
* Uptimerobot.AlertContactDeleteSuccessResponse -> AlertContactDeleteSuccessResponse
*/
const getApiResponseToAlertContactDeleteResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
// Requests ================================================================= //
/**
* AlertContactListRequest -> Uptimerobot.AlertContactListRequest
*/
const getAlertContactListRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { alert_contacts: applyArrayConversion(request.alert_contacts) }));
/**
* AlertContactCreateRequest -> Uptimerobot.AlertContactCreateRequest
*/
const getAlertContactCreateRequestToApiRequest = (request) => (Object.assign({}, request));
/**
* AlertContactEditRequest -> Uptimerobot.AlertContactEditRequest
*/
const getAlertContactEditRequestToApiRequest = (request) => (Object.assign({}, request));
/**
* AlertContactDeleteRequest -> Uptimerobot.AlertContactDeleteRequest
*/
const getAlertContactDeleteRequestToApiRequest = (request) => (Object.assign({}, request));
class AlertContact extends Client {
constructor() {
super(...arguments);
/**
* Returns one or more specified AlertContacts.
*/
this.get = async (alertContacts, params) => {
const response = await this.post('getAlertContacts', params
? getAlertContactListRequestToApiRequest(Object.assign(Object.assign({}, params), { alert_contacts: alertContacts }))
: {});
return getApiResponseToAlertContactListResponse(response);
};
/**
* The list of alert contacts can be called with this method.
*/
this.list = async (params) => {
const response = await this.post('getAlertContacts', params ? getAlertContactListRequestToApiRequest(params) : {});
return getApiResponseToAlertContactListResponse(response);
};
/**
* New alert contacts of any type (mobile/SMS alert contacts are not supported
* yet) can be created using this method.
* The alert contacts created using the API are validated with the same way as
* they were created from uptimerobot.com (activation link for e-mails, etc.).
*/
this.create = async (params) => {
const response = await this.post('newAlertContact', getAlertContactCreateRequestToApiRequest(params));
return getApiResponseToAlertContactCreateResponse(response);
};
/**
* Alert contacts can be edited using this method.
*/
this.update = async (params) => {
const response = await this.post('editAlertContact', getAlertContactEditRequestToApiRequest(params));
return getApiResponseToAlertContactEditResponse(response);
};
/**
* Alert contacts can be deleted using this method.
*/
this.delete = async (params) => {
const response = await this.post('deleteAlertContact', getAlertContactDeleteRequestToApiRequest(params));
return getApiResponseToAlertContactDeleteResponse(response);
};
}
}
// Models =================================================================== //
/**
* Uptimerobot.MWindow -> MWindow
*/
const getApiMWindowToMWindow = (mWindow) => (Object.assign(Object.assign({}, mWindow), { status: mWindow.status, type: mWindow.type, start_time: getApiValueForMWindowStartTime(mWindow.type, mWindow.start_time), value: applyArrayConversion(mWindow.value) }));
// Responses ================================================================ //
/**
* Uptimerobot.MWindowListSuccessResponse -> MWindowListSuccessResponse
*/
const getApiResponseToMWindowListResponse = (response) => ({
stat: response.stat,
pagination: response.pagination,
mwindows: response.mwindows.map(getApiMWindowToMWindow),
});
/**
* Uptimerobot.MWindowCreateSuccessResponse -> MWindowCreateSuccessResponse
*/
const getApiResponseToMWindowCreateResponse = (response) => ({
stat: response.stat,
mwindow: Object.assign(Object.assign({}, response.mwindow), { status: response.mwindow.status }),
});
/**
* Uptimerobot.MWindowEditSuccessResponse -> MWindowEditSuccessResponse
*/
const getApiResponseToMWindowEditResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
/**
* Uptimerobot.MWindowDeleteSuccessResponse -> MWindowDeleteSuccessResponse
*/
const getApiResponseToMWindowDeleteResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
// Requests ================================================================= //
/**
* MWindowListRequest -> Uptimerobot.MWindowListRequest
*/
const getMWindowListRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { mwindows: applyArrayConversion(request.mwindows) }));
/**
* MWindowCreateRequest -> Uptimerobot.MWindowCreateRequest
*/
const getMWindowCreateRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { start_time: getMWindowStartTimeToApiValue(request.start_time), value: applyArrayConversion(request.value) }));
/**
* MWindowEditRequest -> Uptimerobot.MWindowEditRequest
*/
const getMWindowEditRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { start_time: getMWindowStartTimeToApiValue(request.start_time) }));
/**
* MWindowDeleteRequest -> Uptimerobot.MWindowDeleteRequest
*/
const getMWindowDeleteRequestToApiRequest = (request) => (Object.assign({}, request));
class MWindow extends Client {
constructor() {
super(...arguments);
/**
* Returns one or more specified maintenance windows.
*/
this.get = async (mwindows, params) => {
const response = await this.post('getMWindows', params ? getMWindowListRequestToApiRequest(Object.assign(Object.assign({}, params), { mwindows })) : {});
return getApiResponseToMWindowListResponse(response);
};
/**
* The list of maintenance windows can be called with this method.
*/
this.list = async (params) => {
const response = await this.post('getMWindows', params ? getMWindowListRequestToApiRequest(params) : {});
return getApiResponseToMWindowListResponse(response);
};
/**
* New maintenance windows can be created using this method.
*/
this.create = async (params) => {
const response = await this.post('newMWindow', getMWindowCreateRequestToApiRequest(params));
return getApiResponseToMWindowCreateResponse(response);
};
/**
* Maintenance windows can be edited using this method.
*/
this.update = async (params) => {
const response = await this.post('editMWindow', getMWindowEditRequestToApiRequest(params));
return getApiResponseToMWindowEditResponse(response);
};
/**
* Maintenance windows can be deleted using this method.
*/
this.delete = async (params) => {
const response = await this.post('deleteMWindow', getMWindowDeleteRequestToApiRequest(params));
return getApiResponseToMWindowDeleteResponse(response);
};
}
}
// Models =================================================================== //
/**
* Uptimerobot.PSP -> PSP
*/
const getApiPSPToPSP = (psp) => (Object.assign(Object.assign({}, psp), { sort: psp.sort, status: psp.status, monitors: applyArrayConversion(psp.monitors) }));
// Responses ================================================================ //
/**
* Uptimerobot.PSPListSuccessResponse -> PSPListSuccessResponse
*/
const getApiResponseToPSPListResponse = (response) => ({
stat: response.stat,
pagination: {
limit: response.limit,
offset: response.offset,
total: response.total,
},
psps: response.psps.map(getApiPSPToPSP),
});
/**
* Uptimerobot.PSPCreateSuccessResponse -> PSPCreateSuccessResponse
*/
const getApiResponseToPSPCreateResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
/**
* Uptimerobot.PSPEditSuccessResponse -> PSPEditSuccessResponse
*/
const getApiResponseToPSPEditResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
/**
* Uptimerobot.PSPDeleteSuccessResponse -> PSPDeleteSuccessResponse
*/
const getApiResponseToPSPDeleteResponse = (response) => (Object.assign(Object.assign({}, response), { stat: response.stat }));
// Requests ================================================================= //
/**
* PSPListRequest -> Uptimerobot.PSPListRequest
*/
const getPSPListRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { psps: applyArrayConversion(request.psps) }));
/**
* PSPCreateRequest -> Uptimerobot.PSPCreateRequest
*/
const getPSPCreateRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { monitors: applyArrayConversion(request.monitors), hide_url_links: applyBoolConversion(request.hide_url_links) }));
/**
* PSPEditRequest -> Uptimerobot.PSPEditRequest
*/
const getPSPEditRequestToApiRequest = (request) => (Object.assign(Object.assign({}, request), { monitors: applyArrayConversion(request.monitors), hide_url_links: applyBoolConversion(request.hide_url_links) }));
/**
* PSPDeleteRequest -> Uptimerobot.PSPDeleteRequest
*/
const getPSPDeleteRequestToApiRequest = (request) => (Object.assign({}, request));
class PSP extends Client {
constructor() {
super(...arguments);
/**
* Returns one or more specified public status pages.
*/
this.get = async (psps, params) => {
const response = await this.post('getPSPs', params ? getPSPListRequestToApiRequest(Object.assign(Object.assign({}, params), { psps })) : {});
return getApiResponseToPSPListResponse(response);
};
/**
* The list of public status pages can be called with this method.
*/
this.list = async (params) => {
const response = await this.post('getPSPs', params ? getPSPListRequestToApiRequest(params) : {});
return getApiResponseToPSPListResponse(response);
};
/**
* New public status pages can be created using this method.
*/
this.create = async (params) => {
const response = await this.post('newPSP', getPSPCreateRequestToApiRequest(params));
return getApiResponseToPSPCreateResponse(response);
};
/**
* Public status pages can be edited using this method.
*/
this.update = async (params) => {
const response = await this.post('editPSP', getPSPEditRequestToApiRequest(params));
return getApiResponseToPSPEditResponse(response);
};
/**
* Public status pages can be deleted using this method.
*/
this.delete = async (params) => {
const response = await this.post('deletePSP', getPSPDeleteRequestToApiRequest(params));
return getApiResponseToPSPDeleteResponse(response);
};
}
}
class Api extends Client {
constructor(apiKey, axiosConfig) {
super(apiKey, axiosConfig);
this.account = new Account(apiKey, axiosConfig);
this.monitor = new Monitor(apiKey, axiosConfig);
this.alertContact = new AlertContact(apiKey, axiosConfig);
this.mWindow = new MWindow(apiKey, axiosConfig);
this.psp = new PSP(apiKey, axiosConfig);
}
}
exports.default = Api;
|
var YUITest = require('yuitest').YUITest;
var mockery = require('mockery');
var Sequelize = require('sequelize');
var Assert = YUITest.Assert;
var sutPath = '../../../middleware/airbrakeNotifier.js';
var AirbrakeNotifier = require(sutPath);
function FakeAirbrake() {
this.errorNotified = null;
this.notify = function (error, callback) {
this.errorNotified = error;
callback(null, null);
};
}
YUITest.TestRunner.add(new YUITest.TestCase({
name : 'middlewares/airbrakeNotifier',
setUp : function () {
var consoleLogTarget = function () {
console.log.apply(console, arguments);
};
this.context = {
logger : {
trace : consoleLogTarget,
info : consoleLogTarget,
warn : consoleLogTarget,
error : consoleLogTarget
},
config : {
airbrake : {
disabled : false
}
}
};
mockery.enable();
mockery.registerAllowable('util');
mockery.registerAllowable('sequelize');
mockery.registerAllowable(sutPath, true);
},
tearDown : function () {
mockery.deregisterAll();
mockery.disable();
},
testNotify : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {context : this.context},
errMsg = 'Error occured',
err = new Error(errMsg);
notify(err, request, null, function (err) {
Assert.isNotNull(airbrake.errorNotified);
Assert.areSame(errMsg, airbrake.errorNotified.message);
});
},
testNotifyIfStatusCodeIsSetTo500 : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {context : this.context},
errMsg = 'Error occured',
err = new Error(errMsg);
err.statusCode = 500;
notify(err, request, null, function (err) {
Assert.isNotNull(airbrake.errorNotified);
Assert.areSame(errMsg, airbrake.errorNotified.message);
});
},
testNotNotifyIfStatusCodeIsNotSetTo500 : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {context : this.context},
errMsg = 'Error occured',
err = new Error(errMsg);
err.statusCode = 400;
notify(err, request, null, function (err) {
Assert.isNull(airbrake.errorNotified);
});
},
testNotNotifyIfIgnoreAirbrakeIsTrue : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {context : this.context},
errMsg = 'Error occured',
err = new Error(errMsg);
err.ignoreAirbrake = true;
notify(err, request, null, function (err) {
Assert.isNull(airbrake.errorNotified);
});
},
testNotifyIfForceAirbrakeIsTrue : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {context : this.context},
errMsg = 'Error occured',
err = new Error(errMsg);
err.forceAirbrake = true;
err.statusCode = 400;
notify(err, request, null, function (err) {
Assert.isNotNull(airbrake.errorNotified);
Assert.areSame(errMsg, airbrake.errorNotified.message);
});
},
testNotNotifyIfAirbrakeIsDisabled : function () {
var self = this,
airbrake = new FakeAirbrake(),
notify = AirbrakeNotifier.notifyTo(airbrake),
request = {
context : {
config : {
airbrake : {
disabled : true
}
}
}
},
errMsg = 'Error occured',
err = new Error(errMsg);
notify(err, request, null, function (err) {
Assert.isNull(airbrake.errorNotified);
});
}
}));
|
// 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.
// A simple class to represent a database. Uses XMLHttpRequest to interface with
// the CouchDB server.
function CouchDB(name, httpHeaders) {
this.name = name;
this.uri = "/" + encodeURIComponent(name) + "/";
// The XMLHttpRequest object from the most recent request. Callers can
// use this to check result http status and headers.
this.last_req = null;
this.request = function(method, uri, requestOptions) {
requestOptions = requestOptions || {};
requestOptions.headers = combine(requestOptions.headers, httpHeaders);
return CouchDB.request(method, uri, requestOptions);
};
// Creates the database on the server
this.createDb = function() {
this.last_req = this.request("PUT", this.uri);
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// Deletes the database on the server
this.deleteDb = function() {
this.last_req = this.request("DELETE", this.uri);
if (this.last_req.status == 404) {
return false;
}
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// Save a document to the database
this.save = function(doc, options, http_headers) {
if (doc._id == undefined) {
doc._id = CouchDB.newUuids(1)[0];
}
http_headers = http_headers || {};
this.last_req = this.request("PUT", this.uri +
encodeURIComponent(doc._id) + encodeOptions(options),
{body: JSON.stringify(doc), headers: http_headers});
CouchDB.maybeThrowError(this.last_req);
var result = JSON.parse(this.last_req.responseText);
doc._rev = result.rev;
return result;
};
// Open a document from the database
this.open = function(docId, url_params, http_headers) {
this.last_req = this.request("GET", this.uri + encodeURIComponent(docId)
+ encodeOptions(url_params), {headers:http_headers});
if (this.last_req.status == 404) {
return null;
}
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// Deletes a document from the database
this.deleteDoc = function(doc) {
this.last_req = this.request("DELETE", this.uri + encodeURIComponent(doc._id)
+ "?rev=" + doc._rev);
CouchDB.maybeThrowError(this.last_req);
var result = JSON.parse(this.last_req.responseText);
doc._rev = result.rev; //record rev in input document
doc._deleted = true;
return result;
};
// Deletes an attachment from a document
this.deleteDocAttachment = function(doc, attachment_name) {
this.last_req = this.request("DELETE", this.uri + encodeURIComponent(doc._id)
+ "/" + attachment_name + "?rev=" + doc._rev);
CouchDB.maybeThrowError(this.last_req);
var result = JSON.parse(this.last_req.responseText);
doc._rev = result.rev; //record rev in input document
return result;
};
this.bulkSave = function(docs, options) {
// first prepoulate the UUIDs for new documents
var newCount = 0;
for (var i=0; i<docs.length; i++) {
if (docs[i]._id == undefined) {
newCount++;
}
}
var newUuids = CouchDB.newUuids(newCount);
var newCount = 0;
for (var i=0; i<docs.length; i++) {
if (docs[i]._id == undefined) {
docs[i]._id = newUuids.pop();
}
}
var json = {"docs": docs};
// put any options in the json
for (var option in options) {
json[option] = options[option];
}
this.last_req = this.request("POST", this.uri + "_bulk_docs", {
body: JSON.stringify(json)
});
if (this.last_req.status == 417) {
return {errors: JSON.parse(this.last_req.responseText)};
}
else {
CouchDB.maybeThrowError(this.last_req);
var results = JSON.parse(this.last_req.responseText);
for (var i = 0; i < docs.length; i++) {
if(results[i] && results[i].rev && results[i].ok) {
docs[i]._rev = results[i].rev;
}
}
return results;
}
};
this.ensureFullCommit = function() {
this.last_req = this.request("POST", this.uri + "_ensure_full_commit");
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// Applies the map function to the contents of database and returns the results.
this.query = function(mapFun, reduceFun, options, keys, language) {
var body = {language: language || "javascript"};
if(keys) {
body.keys = keys ;
}
if (typeof(mapFun) != "string") {
mapFun = mapFun.toSource ? mapFun.toSource() : "(" + mapFun.toString() + ")";
}
body.map = mapFun;
if (reduceFun != null) {
if (typeof(reduceFun) != "string") {
reduceFun = reduceFun.toSource ?
reduceFun.toSource() : "(" + reduceFun.toString() + ")";
}
body.reduce = reduceFun;
}
if (options && options.options != undefined) {
body.options = options.options;
delete options.options;
}
this.last_req = this.request("POST", this.uri + "_temp_view"
+ encodeOptions(options), {
headers: {"Content-Type": "application/json"},
body: JSON.stringify(body)
});
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.view = function(viewname, options, keys) {
var viewParts = viewname.split('/');
var viewPath = this.uri + "_design/" + viewParts[0] + "/_view/"
+ viewParts[1] + encodeOptions(options);
if(!keys) {
this.last_req = this.request("GET", viewPath);
} else {
this.last_req = this.request("POST", viewPath, {
headers: {"Content-Type": "application/json"},
body: JSON.stringify({keys:keys})
});
}
if (this.last_req.status == 404) {
return null;
}
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// gets information about the database
this.info = function() {
this.last_req = this.request("GET", this.uri);
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// gets information about a design doc
this.designInfo = function(docid) {
this.last_req = this.request("GET", this.uri + docid + "/_info");
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.allDocs = function(options,keys) {
if(!keys) {
this.last_req = this.request("GET", this.uri + "_all_docs"
+ encodeOptions(options));
} else {
this.last_req = this.request("POST", this.uri + "_all_docs"
+ encodeOptions(options), {
headers: {"Content-Type": "application/json"},
body: JSON.stringify({keys:keys})
});
}
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.designDocs = function() {
return this.allDocs({startkey:"_design", endkey:"_design0"});
};
this.changes = function(options) {
this.last_req = this.request("GET", this.uri + "_changes"
+ encodeOptions(options));
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.compact = function() {
this.last_req = this.request("POST", this.uri + "_compact");
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.viewCleanup = function() {
this.last_req = this.request("POST", this.uri + "_view_cleanup");
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.setDbProperty = function(propId, propValue) {
this.last_req = this.request("PUT", this.uri + propId,{
body:JSON.stringify(propValue)
});
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.getDbProperty = function(propId) {
this.last_req = this.request("GET", this.uri + propId);
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.setSecObj = function(secObj) {
this.last_req = this.request("PUT", this.uri + "_security",{
body:JSON.stringify(secObj)
});
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
this.getSecObj = function() {
this.last_req = this.request("GET", this.uri + "_security");
CouchDB.maybeThrowError(this.last_req);
return JSON.parse(this.last_req.responseText);
};
// Convert a options object to an url query string.
// ex: {key:'value',key2:'value2'} becomes '?key="value"&key2="value2"'
function encodeOptions(options) {
var buf = [];
if (typeof(options) == "object" && options !== null) {
for (var name in options) {
if (!options.hasOwnProperty(name)) { continue; };
var value = options[name];
if (name == "key" || name == "keys" || name == "startkey" || name == "endkey" || (name == "open_revs" && value !== "all")) {
value = toJSON(value);
}
buf.push(encodeURIComponent(name) + "=" + encodeURIComponent(value));
}
}
if (!buf.length) {
return "";
}
return "?" + buf.join("&");
}
function toJSON(obj) {
return obj !== null ? JSON.stringify(obj) : null;
}
function combine(object1, object2) {
if (!object2) {
return object1;
}
if (!object1) {
return object2;
}
for (var name in object2) {
object1[name] = object2[name];
}
return object1;
}
}
// this is the XMLHttpRequest object from last request made by the following
// CouchDB.* functions (except for calls to request itself).
// Use this from callers to check HTTP status or header values of requests.
CouchDB.last_req = null;
CouchDB.urlPrefix = '';
CouchDB.login = function(name, password) {
CouchDB.last_req = CouchDB.request("POST", "/_session", {
headers: {"Content-Type": "application/x-www-form-urlencoded",
"X-CouchDB-WWW-Authenticate": "Cookie"},
body: "name=" + encodeURIComponent(name) + "&password="
+ encodeURIComponent(password)
});
return JSON.parse(CouchDB.last_req.responseText);
}
CouchDB.logout = function() {
CouchDB.last_req = CouchDB.request("DELETE", "/_session", {
headers: {"Content-Type": "application/x-www-form-urlencoded",
"X-CouchDB-WWW-Authenticate": "Cookie"}
});
return JSON.parse(CouchDB.last_req.responseText);
};
CouchDB.session = function(options) {
options = options || {};
CouchDB.last_req = CouchDB.request("GET", "/_session", options);
CouchDB.maybeThrowError(CouchDB.last_req);
return JSON.parse(CouchDB.last_req.responseText);
};
CouchDB.allDbs = function() {
CouchDB.last_req = CouchDB.request("GET", "/_all_dbs");
CouchDB.maybeThrowError(CouchDB.last_req);
return JSON.parse(CouchDB.last_req.responseText);
};
CouchDB.allDesignDocs = function() {
var ddocs = {}, dbs = CouchDB.allDbs();
for (var i=0; i < dbs.length; i++) {
var db = new CouchDB(dbs[i]);
ddocs[dbs[i]] = db.designDocs();
};
return ddocs;
};
CouchDB.getVersion = function() {
CouchDB.last_req = CouchDB.request("GET", "/");
CouchDB.maybeThrowError(CouchDB.last_req);
return JSON.parse(CouchDB.last_req.responseText).version;
};
CouchDB.replicate = function(source, target, rep_options) {
rep_options = rep_options || {};
var headers = rep_options.headers || {};
var body = rep_options.body || {};
body.source = source;
body.target = target;
CouchDB.last_req = CouchDB.request("POST", "/_replicate", {
headers: headers,
body: JSON.stringify(body)
});
CouchDB.maybeThrowError(CouchDB.last_req);
return JSON.parse(CouchDB.last_req.responseText);
};
CouchDB.newXhr = function() {
if (typeof(XMLHttpRequest) != "undefined") {
return new XMLHttpRequest();
} else if (typeof(ActiveXObject) != "undefined") {
return new ActiveXObject("Microsoft.XMLHTTP");
} else {
throw new Error("No XMLHTTPRequest support detected");
}
};
CouchDB.xhrbody = function(xhr) {
if (xhr.responseText) {
return xhr.responseText;
} else if (xhr.body) {
return xhr.body
} else {
throw new Error("No XMLHTTPRequest support detected");
}
}
CouchDB.xhrheader = function(xhr, header) {
if(xhr.getResponseHeader) {
return xhr.getResponseHeader(header);
} else if(xhr.headers) {
return xhr.headers[header] || null;
} else {
throw new Error("No XMLHTTPRequest support detected");
}
}
CouchDB.request = function(method, uri, options) {
options = typeof(options) == 'object' ? options : {};
options.headers = typeof(options.headers) == 'object' ? options.headers : {};
options.headers["Content-Type"] = options.headers["Content-Type"] || options.headers["content-type"] || "application/json";
options.headers["Accept"] = options.headers["Accept"] || options.headers["accept"] || "application/json";
var req = CouchDB.newXhr();
if(uri.substr(0, CouchDB.protocol.length) != CouchDB.protocol) {
uri = CouchDB.urlPrefix + uri;
}
req.open(method, uri, false);
if (options.headers) {
var headers = options.headers;
for (var headerName in headers) {
if (!headers.hasOwnProperty(headerName)) { continue; }
req.setRequestHeader(headerName, headers[headerName]);
}
}
req.send(options.body || "");
return req;
};
CouchDB.requestStats = function(module, key, test) {
var query_arg = "";
if(test !== null) {
query_arg = "?flush=true";
}
var url = "/_stats/" + module + "/" + key + query_arg;
var stat = CouchDB.request("GET", url).responseText;
return JSON.parse(stat)[module][key];
};
CouchDB.uuids_cache = [];
CouchDB.newUuids = function(n, buf) {
buf = buf || 100;
if (CouchDB.uuids_cache.length >= n) {
var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n);
if(CouchDB.uuids_cache.length - n == 0) {
CouchDB.uuids_cache = [];
} else {
CouchDB.uuids_cache =
CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n);
}
return uuids;
} else {
CouchDB.last_req = CouchDB.request("GET", "/_uuids?count=" + (buf + n));
CouchDB.maybeThrowError(CouchDB.last_req);
var result = JSON.parse(CouchDB.last_req.responseText);
CouchDB.uuids_cache =
CouchDB.uuids_cache.concat(result.uuids.slice(0, buf));
return result.uuids.slice(buf);
}
};
CouchDB.maybeThrowError = function(req) {
if (req.status >= 400) {
try {
var result = JSON.parse(req.responseText);
} catch (ParseError) {
var result = {error:"unknown", reason:req.responseText};
}
throw (new CouchError(result));
}
}
CouchDB.params = function(options) {
options = options || {};
var returnArray = [];
for(var key in options) {
var value = options[key];
returnArray.push(key + "=" + value);
}
return returnArray.join("&");
};
// Used by replication test
if (typeof window == 'undefined' || !window) {
var hostRE = RegExp("https?://([^\/]+)");
var getter = function () {
return (new CouchHTTP).base_url.match(hostRE)[1];
};
if(Object.defineProperty) {
Object.defineProperty(CouchDB, "host", {
get : getter,
enumerable : true
});
} else {
CouchDB.__defineGetter__("host", getter);
}
CouchDB.protocol = "http://";
CouchDB.inBrowser = false;
} else {
CouchDB.host = window.location.host;
CouchDB.inBrowser = true;
CouchDB.protocol = window.location.protocol + "//";
}
// Turns an {error: ..., reason: ...} response into an Error instance
function CouchError(error) {
var inst = new Error(error.reason);
inst.name = 'CouchError';
inst.error = error.error;
inst.reason = error.reason;
return inst;
}
CouchError.prototype.constructor = CouchError;
|
let listaDeGanhos = [10, 30, -10, -5, -1, 40]
let totalNegativos = 0
//seu loop aqui:
for(let i = 0; i< listaDeGanhos.length; i++){
if(listaDeGanhos[i] < 0){
totalNegativos++;
console.log(totalNegativos)
}
}
|
var redis = require("ioredis");
var config = require("config");
var util = require("util");
//var resource = config.Host.resource;
//change and modify the secret
var redisip = config.Security.ip;
var redisport = config.Security.port;
var redispass = config.Security.password;
var redismode = config.Security.mode;
var redisdb = config.Security.db;
var redisSetting = {
port: redisport,
host: redisip,
family: 4,
db: redisdb,
password: redispass,
retryStrategy: function (times) {
var delay = Math.min(times * 50, 2000);
return delay;
},
reconnectOnError: function (err) {
return true;
},
};
if (redismode == "sentinel") {
if (
(config.Security.sentinels &&
config.Security.sentinels.hosts &&
config.Security.sentinels.port,
config.Security.sentinels.name)
) {
var sentinelHosts = config.Security.sentinels.hosts.split(",");
if (Array.isArray(sentinelHosts) && sentinelHosts.length > 2) {
var sentinelConnections = [];
sentinelHosts.forEach(function (item) {
sentinelConnections.push({
host: item,
port: config.Security.sentinels.port,
});
});
redisSetting = {
sentinels: sentinelConnections,
name: config.Security.sentinels.name,
password: redispass,
};
} else {
console.log("No enough sentinel servers found .........");
}
}
}
var redisClient = undefined;
if (redismode != "cluster") {
redisClient = new redis(redisSetting);
} else {
var redisHosts = redisip.split(",");
if (Array.isArray(redisHosts)) {
redisSetting = [];
redisHosts.forEach(function (item) {
redisSetting.push({
host: item,
port: redisport,
family: 4,
password: redispass,
});
});
var redisClient = new redis.Cluster([redisSetting]);
} else {
redisClient = new redis(redisSetting);
}
}
redisClient.on("error", function (err) {
console.log("Error " + err);
});
var Secret = function (req, payload, done) {
if (payload && payload.iss && payload.jti) {
var issuer = payload.iss;
var jti = payload.jti;
////////////////this is just for testing///////////////////
//req.user = payload;
redisClient
.multi()
.get(`token:iss:${issuer}:${jti}`)
.get(`claims:iss:${issuer}:${jti}`)
.exec(function (err, results) {
if (err) {
return done(err);
}
if (results && Array.isArray(results) && results.length > 1) {
if (results[1][0] == null) {
try {
req.scope = JSON.parse(results[1][1]);
} catch (ex) {
return done(new Error("scope_error"));
}
}
if (results[0][0] == null) {
return done(null, results[0][1]);
} else {
return done(new Error("missing_secret"));
}
}
return done(new Error("missing_secret"));
});
} else {
done(new Error("wrong token format"));
}
};
var CompanyChatSecret = function (req, payload, done) {
if (
payload &&
payload.iss &&
payload.jti &&
payload.company &&
payload.tenant
) {
var issuer = payload.iss;
var jti = payload.jti;
var chatKey = util.format(
"%d:%d:keys:chat:public",
payload.tenant,
payload.company
);
redisClient.get(chatKey, function (err, key) {
if (err) {
return done(err);
}
if (!key) {
return done(new Error("missing_secret"));
}
return done(null, key);
});
} else {
done(new Error("wrong token format"));
}
};
module.exports.Secret = Secret;
module.exports.CompanyChatSecret = CompanyChatSecret;
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var querystring_builder_1 = require("@aws-sdk/querystring-builder");
function formatUrl(request) {
var protocol = request.protocol, path = request.path, hostname = request.hostname, port = request.port, query = request.query;
if (protocol && protocol.substr(-1) !== ":") {
protocol += ":";
}
if (port) {
hostname += ":" + port;
}
if (path && path.charAt(0) !== "/") {
path = "/" + path;
}
var queryString = query ? querystring_builder_1.buildQueryString(query) : "";
if (queryString && queryString[0] !== "?") {
queryString = "?" + queryString;
}
return protocol + "//" + hostname + path + queryString;
}
exports.formatUrl = formatUrl;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxvRUFBZ0U7QUFFaEUsU0FBZ0IsU0FBUyxDQUFDLE9BQW9CO0lBQ3RDLElBQUEsMkJBQVEsRUFBRSxtQkFBSSxFQUFFLDJCQUFRLEVBQUUsbUJBQUksRUFBRSxxQkFBSyxDQUFhO0lBQ3hELElBQUksUUFBUSxJQUFJLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLEVBQUU7UUFDM0MsUUFBUSxJQUFJLEdBQUcsQ0FBQztLQUNqQjtJQUNELElBQUksSUFBSSxFQUFFO1FBQ1IsUUFBUSxJQUFJLE1BQUksSUFBTSxDQUFDO0tBQ3hCO0lBQ0QsSUFBSSxJQUFJLElBQUksSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLEVBQUU7UUFDbEMsSUFBSSxHQUFHLE1BQUksSUFBTSxDQUFDO0tBQ25CO0lBQ0QsSUFBSSxXQUFXLEdBQUcsS0FBSyxDQUFDLENBQUMsQ0FBQyxzQ0FBZ0IsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDO0lBQ3ZELElBQUksV0FBVyxJQUFJLFdBQVcsQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLEVBQUU7UUFDekMsV0FBVyxHQUFHLE1BQUksV0FBYSxDQUFDO0tBQ2pDO0lBQ0QsT0FBVSxRQUFRLFVBQUssUUFBUSxHQUFHLElBQUksR0FBRyxXQUFhLENBQUM7QUFDekQsQ0FBQztBQWhCRCw4QkFnQkMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBIdHRwUmVxdWVzdCB9IGZyb20gXCJAYXdzLXNkay90eXBlc1wiO1xuaW1wb3J0IHsgYnVpbGRRdWVyeVN0cmluZyB9IGZyb20gXCJAYXdzLXNkay9xdWVyeXN0cmluZy1idWlsZGVyXCI7XG5cbmV4cG9ydCBmdW5jdGlvbiBmb3JtYXRVcmwocmVxdWVzdDogSHR0cFJlcXVlc3QpOiBzdHJpbmcge1xuICBsZXQgeyBwcm90b2NvbCwgcGF0aCwgaG9zdG5hbWUsIHBvcnQsIHF1ZXJ5IH0gPSByZXF1ZXN0O1xuICBpZiAocHJvdG9jb2wgJiYgcHJvdG9jb2wuc3Vic3RyKC0xKSAhPT0gXCI6XCIpIHtcbiAgICBwcm90b2NvbCArPSBcIjpcIjtcbiAgfVxuICBpZiAocG9ydCkge1xuICAgIGhvc3RuYW1lICs9IGA6JHtwb3J0fWA7XG4gIH1cbiAgaWYgKHBhdGggJiYgcGF0aC5jaGFyQXQoMCkgIT09IFwiL1wiKSB7XG4gICAgcGF0aCA9IGAvJHtwYXRofWA7XG4gIH1cbiAgbGV0IHF1ZXJ5U3RyaW5nID0gcXVlcnkgPyBidWlsZFF1ZXJ5U3RyaW5nKHF1ZXJ5KSA6IFwiXCI7XG4gIGlmIChxdWVyeVN0cmluZyAmJiBxdWVyeVN0cmluZ1swXSAhPT0gXCI/XCIpIHtcbiAgICBxdWVyeVN0cmluZyA9IGA/JHtxdWVyeVN0cmluZ31gO1xuICB9XG4gIHJldHVybiBgJHtwcm90b2NvbH0vLyR7aG9zdG5hbWV9JHtwYXRofSR7cXVlcnlTdHJpbmd9YDtcbn1cbiJdfQ==
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var styled_icon_1 = require("@styled-icons/styled-icon");
exports.Wrench = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
"xmlns": "http://www.w3.org/2000/svg",
};
return (React.createElement(styled_icon_1.StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 24 24" }, props, { ref: ref }),
React.createElement("path", { d: "M21.512 6.112l-3.89 3.889-3.535-3.536 3.889-3.889a6.501 6.501 0 00-8.484 8.486l-6.276 6.275a.999.999 0 000 1.414l2.122 2.122a.999.999 0 001.414 0l6.275-6.276a6.501 6.501 0 007.071-1.414 6.504 6.504 0 001.414-7.071z", key: "k0" })));
});
exports.Wrench.displayName = 'Wrench';
exports.WrenchDimensions = { height: 24, width: 24 };
|
const express = require('express');
const mongoose = require('mongoose');
const routes = require('./routes')
const cors = require('cors')
const app = express();
mongoose.connect('mongodb+srv://omnistack:omnistack@cluster0-yv3gr.mongodb.net/week10?retryWrites=true&w=majority', {
useNewUrlParser: true,
useUnifiedTopology: true
})
app.use(cors())
app.use(express.json())
app.use(routes)
app.listen(3333);
|
"use strict";
require("./helpers/setup");
var actions = require('./helpers/actions');
var wd = require("wd"),
_ = require('underscore'),
serverConfigs = require('./helpers/appium-servers');
var TouchAction = require('wd').TouchAction;
var Q = require('q');
wd.addPromiseChainMethod('tap_once', actions.tap_once);
wd.addPromiseChainMethod('swipe', actions.swipe);
function sleep(sleepTime) {
for(var start = +new Date; +new Date - start <= sleepTime; ) { }
}
describe("android simple", function () {
this.timeout(300000);
var driver;
var allPassed = true;
before(function () {
var serverConfig = process.env.npm_package_config_sauce ?
serverConfigs.sauce : serverConfigs.local;
driver = wd.promiseChainRemote(serverConfig);
require("./helpers/logging").configure(driver);
// var desired = process.env.npm_package_config_sauce ?
// _.clone(require("./helpers/caps").android18) :
// _.clone(require("./helpers/caps").android19);
var desired = _.clone(require("./helpers/caps").android19);
// desired.app = require("./helpers/apps").androidApiDemos;
desired.appPackage = "org.hotshare.everywhere";
desired.appActivity = "org.hotshare.everywhere.MainActivity";
desired.appWaitActivity = "org.hotshare.everywhere.MainActivity";
if (process.env.npm_package_config_sauce) {
desired.name = 'android - simple';
desired.tags = ['sample'];
}
return driver
.init(desired)
.setImplicitWaitTimeout(300000);
});
after(function () {
return driver
.sleep(10000)
return driver
.quit()
.finally(function () {
if (process.env.npm_package_config_sauce) {
return driver.sauceJobStatus(allPassed);
}
});
});
afterEach(function () {
allPassed = allPassed && this.currentTest.state === 'passed';
});
it("case 1: do nothing, wait mainpage ...", function () {
// TODO: environment check
// return driver
// .getNetworkConnection()
// .should.eventually.deep.equal({value: 6})
return driver
.sleep(5000)
.waitForElementByAccessibilityId('故事贴')
.text().should.become('')
});
it("case 2: swipe (x, y) --> (x2, y2), swipe to make appium happy", function () {
return driver
.sleep(2000)
.swipe({
startX: 100, startY: 100,
endX: 100, endY: 1000,
duration: 1000
});
});
it("case 3: find and click 'ME'", function () {
return driver
.sleep(2000)
.waitForElementByAccessibilityId('ME')
.click()
.text().should.become('')
});
it("case 4: find and click 'MESSAGES'", function () {
return driver
.sleep(2000)
.waitForElementByAccessibilityId('MESSAGES')
.click()
.text().should.become('')
});
it("case 5: find and click '+'", function () {
var d = {x:0, y:0, w:0, h:0};
return driver
.sleep(2000)
.elementsByAccessibilityId('DISCOVER')
.then(function (els) {
return Q.all([
els[0].getLocation(),
els[0].getSize()
]).then(function (locs) {
d.x=locs[0].x;
d.y=locs[0].y;
d.w=locs[1].width;
d.h=locs[1].height;
return driver.tap_once({x: d.x + d.w + 20, y: d.y+20, duration: 500});
return;
});
});
});
it("case 6: find and click '+', to close import items", function () {
var d = {x:0, y:0, w:0, h:0};
return driver
.sleep(2000)
.elementsByAccessibilityId('DISCOVER')
.then(function (els) {
return Q.all([
els[0].getLocation(),
els[0].getSize()
]).then(function (locs) {
d.x=locs[0].x;
d.y=locs[0].y;
d.w=locs[1].width;
d.h=locs[1].height;
return driver.tap_once({x: d.x + d.w + 20, y: d.y+20, duration: 500});
return;
});
});
});
it("case 7: find and click 'DISCOVER'", function () {
return driver
.sleep(2000)
.waitForElementByAccessibilityId('DISCOVER')
.click()
.text().should.become('')
});
it("case 8: find and click 'Home'", function () {
return driver
.sleep(2000)
.waitForElementByAccessibilityId('HOME')
.click()
.text().should.become('')
});
it("case 9: open a '帖子', record how much time is consumed", function () {
var time1 = null;
var time2 = null;
driver
.sleep(2000)
.elementsByXPath("//android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.view.View/android.widget.Image[contains(@index,1)]")
.then(function (els) {
els[0].getLocation().click();
time1 = new Date();
console.log('1 ' +time1);
});
return driver
.waitForElementByAccessibilityId('ReadingRoom')
.then(function (els) {
time2 = new Date();
console.log('2 ' +time2);
});
});
it("case 10: exit from '帖子'", function () {
return driver
.sleep(2000)
.elementsByXPath("//android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.view.View/android.view.View[contains(@index,0)]")
.then(function (els) {
els[0].getLocation().click();
});
});
});
|
var assert = require('assert');
var revaluate = require('..');
var result = [];
for (var i = 0; i < 10; i++) {
var cls = revaluate([
'class Class {',
' set value(value) {',
' this[' + i + '] = value;',
' }',
'}',
'Class',
].join('\n'), __filename, function(output) {
return eval(output.toString());
});
result.push(new cls());
for (var j = 0; j < result.length; j++) {
result[j].value = i;
assert.equal(result[j][i], i);
}
}
|
Search.setIndex({docnames:["data_reader/convert_FIRE_data","data_reader/files","data_reader/fire_quickstart","data_reader/flask","data_reader/flask_tutorial","data_reader/index","data_reader/multiple_datasets","data_reader/multiple_datasets_tutorial","data_reader/reader","data_reader/reader_tutorial","data_reader/settings_tutorial","experimental","index","installation","reference/api/api","reference/api/classes/firefly.data_reader.ParticleGroup","reference/api/classes/firefly.data_reader.Reader","reference/api/classes/firefly.data_reader.Settings","reference/api/classes/firefly.data_reader.TweenParams","reference/api/readers/firefly.data_reader.ArrayReader","reference/api/readers/firefly.data_reader.FIREreader","reference/api/readers/firefly.data_reader.SimpleFIREreader","reference/api/readers/firefly.data_reader.SimpleReader","reference/api/server/Firefly.server.killAllFireflyServers","reference/api/server/Firefly.server.spawnFireflyServer","reference/api/server/Firefly.server.startFireflyServer","server","webapp/camera_controls","webapp/data_controls","webapp/index","webapp/particle_controls"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,nbsphinx:3,sphinx:56},filenames:["data_reader/convert_FIRE_data.ipynb","data_reader/files.rst","data_reader/fire_quickstart.rst","data_reader/flask.rst","data_reader/flask_tutorial.ipynb","data_reader/index.rst","data_reader/multiple_datasets.rst","data_reader/multiple_datasets_tutorial.ipynb","data_reader/reader.rst","data_reader/reader_tutorial.ipynb","data_reader/settings_tutorial.ipynb","experimental.rst","index.rst","installation.rst","reference/api/api.rst","reference/api/classes/firefly.data_reader.ParticleGroup.rst","reference/api/classes/firefly.data_reader.Reader.rst","reference/api/classes/firefly.data_reader.Settings.rst","reference/api/classes/firefly.data_reader.TweenParams.rst","reference/api/readers/firefly.data_reader.ArrayReader.rst","reference/api/readers/firefly.data_reader.FIREreader.rst","reference/api/readers/firefly.data_reader.SimpleFIREreader.rst","reference/api/readers/firefly.data_reader.SimpleReader.rst","reference/api/server/Firefly.server.killAllFireflyServers.rst","reference/api/server/Firefly.server.spawnFireflyServer.rst","reference/api/server/Firefly.server.startFireflyServer.rst","server.rst","webapp/camera_controls.rst","webapp/data_controls.rst","webapp/index.rst","webapp/particle_controls.rst"],objects:{"firefly.data_reader":{ArrayReader:[19,0,1,""],FIREreader:[20,0,1,""],ParticleGroup:[15,0,1,""],Reader:[16,0,1,""],Settings:[17,0,1,""],SimpleFIREreader:[21,0,1,""],SimpleReader:[22,0,1,""],TweenParams:[18,0,1,""]},"firefly.data_reader.ArrayReader":{__init__:[19,1,1,""]},"firefly.data_reader.FIREreader":{__init__:[20,1,1,""],loadData:[20,1,1,""]},"firefly.data_reader.ParticleGroup":{__getitem__:[15,1,1,""],__init__:[15,1,1,""],__repr__:[15,1,1,""],__setitem__:[15,1,1,""],__weakref__:[15,2,1,""],getDecimationIndexArray:[15,1,1,""],outputToDict:[15,1,1,""],outputToJSON:[15,1,1,""],trackArray:[15,1,1,""]},"firefly.data_reader.Reader":{__init__:[16,1,1,""],__repr__:[16,1,1,""],__weakref__:[16,2,1,""],addParticleGroup:[16,1,1,""],copyFireflySourceToTarget:[16,1,1,""],dumpToJSON:[16,1,1,""],outputToDict:[16,1,1,""],sendDataViaFlask:[16,1,1,""]},"firefly.data_reader.Settings":{UI_settings:[17,1,1,""],__getitem__:[17,1,1,""],__init__:[17,1,1,""],__setitem__:[17,1,1,""],__weakref__:[17,2,1,""],attachSettings:[17,1,1,""],camera_settings:[17,1,1,""],keys:[17,1,1,""],loadFromJSON:[17,1,1,""],outputToDict:[17,1,1,""],outputToJSON:[17,1,1,""],particle_UI_settings:[17,1,1,""],particle_colormap_settings:[17,1,1,""],particle_filter_settings:[17,1,1,""],particle_startup_settings:[17,1,1,""],printKeys:[17,1,1,""],startup_settings:[17,1,1,""],window_settings:[17,1,1,""]},"firefly.data_reader.SimpleFIREreader":{__init__:[21,1,1,""]},"firefly.data_reader.SimpleReader":{__init__:[22,1,1,""]},"firefly.data_reader.TweenParams":{__init__:[18,1,1,""],__weakref__:[18,2,1,""],addKeyframe:[18,1,1,""],outputToDict:[18,1,1,""],outputToJSON:[18,1,1,""]},"firefly.server":{killAllFireflyServers:[23,3,1,""],spawnFireflyServer:[24,3,1,""],startFireflyServer:[25,3,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","attribute","Python attribute"],"3":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:attribute","3":"py:function"},terms:{"0":[0,1,4,5,6,7,9,10,17,21],"015625":[10,17],"06":17,"09532231":10,"0953223144":10,"1":[0,1,4,6,7,9,10,15,17,18,19,20,21,24,25,26,28],"10":[0,4,7,9,10,15,16,21,24,28,29],"100":[0,17],"1000":[2,4,5],"10000":[5,15,16],"102":[7,10],"106666":0,"1066668":0,"11":10,"12":10,"1200":28,"13":10,"13068871810000002":10,"13068872":10,"14":10,"15":[0,4,21],"1920":28,"2":[0,4,6,7,9,10,26],"20":[4,7,9,10,17],"200":4,"2000":17,"24132833":10,"24132833010000002":10,"256":17,"3":[0,4,5,6,7,9,10,13,15,17,18,19,22],"30":[24,25],"34":7,"38517182":10,"38517182310000003":10,"39":[0,7,9,10],"3d":[4,7,9,10,15,27],"4":[0,4,7,9,10,15,16,17,21,26],"425649":4,"468730":9,"5":[0,4,7,9,10,15,17,18],"50":[0,17],"500":[2,4,5],"5000":[2,4,5,16,24,25],"51411":0,"514118":0,"5739038666":10,"57390387":10,"6":[4,7,9,10],"60":17,"7":[4,7,9,10],"700":26,"7999":[7,10],"8":[4,7,9,10,17],"800":9,"8000":[4,7,9,10],"9":[4,7,9,10],"9250688992":10,"9250689":10,"boolean":[8,26],"break":30,"case":[4,9],"class":[0,1,5,7,10,15,16,17,18,19,20,21,22],"default":[1,4,6,7,9,10,15,16,17,18,19,20,21,22,23,24,25,26,29,30],"do":[0,4,6,7,10,15,17,26,28],"export":16,"final":[2,5,11,27],"float":[15,17,18,24],"function":[4,8,10,11,15,16,17,26],"import":[0,2,4,5,7,8,9,13,26],"int":[15,16,17,19,20,21,23,24,25],"long":[1,4,15],"new":[3,4,6,7,9,10,11,15,16,18,26,30],"return":[4,7,9,10,15,16,17,18,23,24,27,29],"static":[0,1,4,6,7,9,10,15,17,28,30],"switch":[27,29,30],"true":[0,4,5,7,9,10,11,14,15,16,17,18,19,20,21,22],"try":[9,22,29],"while":[8,9,27,29],A:[2,4,7,8,9,10,11,16,17,18,19,20,21,22,29,30],And:29,As:[7,28],At:[9,28],Be:11,For:[1,6,7,8,9,11,26,27,28,29],If:[1,4,5,6,7,8,9,10,11,14,15,22,27,29,30],In:[0,4,6,8,9,16,28,30],It:[1,9,17,26,30],Its:8,OR:8,One:[4,9,10],Or:6,That:[4,26],The:[0,2,4,9,10,11,13,15,26,27,28,30],Then:[7,16],There:[1,7,10,11,27,28,30],These:[1,11,15,27,28,30],To:[0,3,4,6,8,9,10,26,29],With:26,_:[15,16],__getitem__:[15,17],__init__:[6,15,16,17,18,19,20,21,22],__repr__:[15,16],__setitem__:[15,17],__weakref__:[15,16,17,18],_also_:16,_asarrai:[7,10],_display_:17,abg_python:20,abil:10,abl:[0,4,6,11,26,30],about:[4,6,9,28,29],abov:[1,4,9,10,26,27,28,29,30],absolut:0,abspath:[0,9],accept:[15,17,18,22,26],access:[6,8,10,16,17,24,25,28,29],accomplish:[26,29],accord:[14,16,29],accordingli:30,achiev:11,across:[11,14,15],act:9,action:[4,7,9,10],activ:[3,8],actual:[18,26,29],ad:[7,10,15,26],add:[7,10,13,15,17,18],addit:[10,15,17,30],addkeyfram:18,addparticlegroup:[9,15,16],address:[4,11,13,26,29],adjust:[27,29,30],advanc:4,advantag:[4,8,9],aesthet:0,affect:[10,17],after:[2,5,8,10,15,16,18,27,28],agegyr:[20,21],agel:[0,4,13],agurvich:[0,4,7,9,10,20],ahead:10,alex:20,alia:26,all:[4,8,9,10,15,16,17,20,21,23,28,29,30],all_settings_dict:17,allow:[1,4,6,8,10,14,15,17,18,26,27,30],almost:29,alon:16,along:[1,21,26,30],alongsid:8,alreadi:[6,7,16,26],also:[4,6,7,8,12,13,15,16,30],alter:[15,16],altern:[2,5,6,13],alwai:[4,29],among:15,amount:24,an:[1,2,3,5,6,7,8,10,12,13,15,16,17,18,20,22,28,29,30],anaconda:13,analog:30,analysi:26,ani:[0,8,9,15,16,17,18,26,28,29],annot:[10,17],anoth:[9,29],anyon:[16,26],anyth:[16,18,19,22,26],api:[0,2,5,6,9,11,12,26,28,30],app:[3,10,15,17],appear:[8,9,10,14,27,30],append:[6,7,16],appli:[8,26,29,30],applic:[12,26],approach:18,appropri:[8,10,11,29],ar:[1,4,5,6,7,8,9,11,15,16,17,22,26,27,28,29,30],arang:15,argument:[1,6,7,9,10,22,26],around:[11,27,29],arr:15,arrai:[4,7,8,9,10,15,16,17,19,22],arrayread:[4,5,7,8,10,22],arrays_to_track:17,arrow:[17,27,28,29,30],aspect:1,associ:[9,15,23],assum:[4,7,9,10],attach:[8,9,15,16],attached_set:[8,10,15],attachset:[10,15,17],attempt:[1,4,6,10,16,22,26],attr:17,attribut:[8,10],audienc:8,automat:[6,7,8,9,10,13,15,18,26,28],autoreload:[0,4,7,9,10],avail:[2,4,6,7,8,9,10,15,24],avoid:0,axiserror:[18,19],back:[4,26,27,28],background:[3,24],backward:[29,30],bar:[1,30],base:[15,16,17,18,19,20,21,22],bash:26,bashrc:26,becaus:[4,7,9,10,26,29],becom:30,been:[3,4,9,20],befor:[4,10,16],begin:[7,9],behavior:10,being:[4,6,11,16,24,25,29],below:[1,8,13,27,30],benefit:26,bespok:10,best:[0,15,28],between:[1,4,7,8,16,17,18,20,27,30],big:9,big_json:9,bin:[16,26],bind:[15,20],bit:[4,9],black:[29,30],blend:11,blue:9,bool:[15,16,17,18,19,20,21,22],bottom:[11,17,30],box:[7,27,28,29,30],brief:9,brightest:11,browser:[1,2,4,5,6,10,13,17,26,28],build:[10,13,16],built:[13,26],builtin:[15,16,17],button:[6,17,26,27,28,29],calcul:17,call:[0,4,8,10,15,20,26],camera:[0,8,10,17,18,21,29],camera_set:17,camerarot:[10,17],can:[1,2,3,4,5,6,7,8,9,11,12,13,15,16,17,19,21,22,25,26,27,28,29,30],cannot:[16,19,20,21,27],canva:[28,29],cardboard:11,care:[10,15],cat:7,categori:10,cater:8,caus:28,caution:26,cdlognorm:17,cdmax:17,cdmin:17,center:[10,17,27,29],central:9,certainli:8,chang:[8,11,17,27,28,29,30],charact:[9,15],check:[4,5,9,14,18,30],checkbox:[14,27,30],choos:[6,9,15,30],chosen:15,chunk:1,circumv:[1,3],clean:[15,16],clean_jsondir:[15,16],click:[6,27,28,29,30],clone:13,close:26,cluster:26,code:[1,4,8,13],collabor:[20,21],collaps:[27,28,29],collect:[1,8,9],color:[0,9,10,15,17,21,29,30],colorbar:[11,30],colormap:[0,4,7,8,9,10,11,15,17,20],colormap_flag:15,colormapflag:[0,20],colormaplim:[10,15,17],colormapp:[15,17,30],colormapv:[10,15,17],colormapvari:[10,17],column:17,columndens:17,com:[13,16,20,21],com_offset:[20,21],combin:[7,29],command:26,common:[9,29],commonli:15,compat:[5,16,17,20],comprehens:8,comput:[6,11,26,28,29],concaten:17,concept:11,concern:0,configur:[1,7,28,29],confirm:10,confus:[7,29],conjunct:29,connect:[8,9,11,15,26],consequ:[17,26],consid:30,consist:9,consol:[10,15,16,17,18,19,22],constrain:29,consult:26,contain:[0,1,3,6,7,8,9,15,16,17,18,20,21,22,28,29,30],content:[7,8,28],control:[8,9,15,16,17,18,19,21],control_g4_20:0,conveni:[8,10,20],convert:[5,8,15,16,17,18,19,21,30],coord:[4,5,7,9,10,18],coordin:[1,7,8,10,15,17,18,19,20,21,22],cop:9,copi:[6,7,10,16],copyfireflysourcetotarget:[6,7,16,26],core:[2,7,10],corner:29,correctli:[1,15,16,26],correspond:[1,8,10,15,18,19,20,26,28,30],could:[6,17,26,28,29,30],coupl:[15,29],cours:10,creat:[0,1,3,6,8,10,12,13,15,16,17,18,19,25,26,28,30],create_firefly_object:8,critic:16,cross:16,csv:22,cube:[4,7,9,10,29],cubic:[11,14,15],culprit:29,current:[10,11,15,17,18,27,28,29,30],custom:[5,8,16,17,20,30],cwd:9,d1:18,d2:18,d:[1,3,4,9,15,16,18,19,20,26,29],data:[1,6,7,8,9,10,14,15,16,17,18,19,20,21,22,24,25,26,27,29,30],data_input:[3,4,24,25],data_read:[1,2,3,5,6,7,8,9,28],dataset:[1,4,5,8,9,15,26,28,29],date:13,dec_ind:15,decid:17,decim:[9,10,15,17,20,24,25,30],decimation_factor:[0,9,15,17,19,20,21,24,25],defeat:11,defens:4,defin:[8,10,15,16,17,18,28,29,30],degrad:11,delet:[15,16],demo:0,demonstr:[0,4,5,7,8,9,10,11],densiti:[0,17,20],depend:29,deprec:[7,10],depth:2,describ:[1,8,9],detail:[0,4,7,9,10,11,26,28,29],detect:[6,22],determin:15,devic:29,dict:[15,16,17,18],dictionari:[1,8,9,15,16,17,18],did:29,differ:[1,4,7,8,9,10,15,17,26,27,30],digit:26,dillig:11,dimens:28,dimension:15,dimmest:11,direct:30,directli:[4,9,13,15,16,27],directori:[0,1,2,7,9,10,13,15,16,17,18,20,21,22,26,28],disabl:6,disambigu:0,discourag:30,disk:[0,3,4,6,9,15,16,17,18,19,21],displai:[2,4,5,6,7,9,10,17,26,27,28],distanc:27,distribut:[15,26],divis:18,document:[0,4,7,8,9,10,11,26,29],doe:[6,11,16,17,18,19,20],doesn:[7,10,15,22],don:[4,9,15,16,29],done:[3,15,17,26],dosphrad:[11,14,15],down:29,download:28,downward:[27,28,30],drag:29,draggabl:30,draw:30,drawback:4,drawn:[28,30],dropdown:[1,7,15,17,20,29,30],dtype:[7,10],dummi:9,dump:[0,9,16],dump_data:16,dumptojson:[0,1,4,6,7,8,9,15,16],durat:18,e:[6,8,10,13,15,17,19,20,21,27,28],each:[1,4,6,7,8,9,10,15,17,19,22,29,30],easier:9,easiest:[1,17],easili:[7,16,26],edit:[6,27],editor:[8,9],effect:27,either:[8,10,15,17,18,19,22,26,28],elaps:24,element:[8,9,15,16,17],els:9,elsewher:6,emb:4,empti:[9,10],enabl:[1,6,7,9,16,17,26],encourag:9,endpoint:[3,4],enforc:[24,25],enhanc:17,enjoi:26,ensur:[11,16],enter:[9,29,30],enterpris:[9,30],entir:[3,12],entri:[1,6,15,16,27,28,30],env:[7,10],environ:[13,26],envis:6,equal:15,error:[6,16,18],es:7,escap:28,establish:26,even:[4,6,11,26,27,28],eventlet:13,ever:4,everi:8,exactli:15,exampl:[0,1,2,3,5,7,8,9,10,16,20,30],exampleset:10,except:26,excit:11,exclus:1,execut:13,exist:[0,6,7,10,11,13,16,17,18],expand:[27,28,30],experiment:[12,14,15,17,27],explain:4,explicilti:17,explor:[4,9,26],expos:[3,26,29],extens:22,extent:30,extra:17,extract:[0,15,20,22],ey:[17,27],f:[4,29],face:[11,14,27,28,29,30],facilit:[3,6],fact:[8,9,15],factor:[0,9,15,19,20,21,24,25,28,29],fake_read:7,fakedata:7,fall:[10,30],fals:[0,4,7,9,10,15,16,17,18,19,20,21,22],familiar:9,fashion:17,favorit:10,featur:[1,6,7,8,10,12,14,15,17,26,27,28],feed:16,feedback:1,fetch:0,few:9,field0:10,field1:10,field:[0,1,4,5,7,8,9,10,11,15,17,19,20,21,27,30],field_nam:[15,19,22],file:[0,3,4,5,6,7,9,11,14,15,16,17,18,20,21,22,24,25,26,28],filenam:[6,10,15,16,17,18,22],filenames_and_npart:15,filenotfounderror:[16,17,20],filepath:[16,17],fill:10,filter:[0,1,4,7,8,9,10,15,17,20],filter_flag:15,filterbl:17,filterflag:[0,20],filterlim:[10,15,17],filterv:[10,15,17],find:10,fine:[15,30],finger:29,fire:[5,8,20,21],firedata_50:[0,1],firefli:[9,13,28,30],firefox:28,fireread:[0,8,16,21],first:[6,9,11,17,30],fit:10,fix:29,flag:[6,8,11,14,15,16,17,18,19,20,21,22],flask:[5,6,9,11,13,16,23],flask_templ:16,flask_tutori:4,flatten:[4,7,9,10,18],flexibili:22,fly:[12,17,27],focu:17,folder:28,follow:[2,4,5,6,13,26],fork:13,form:15,format:[0,1,2,3,7,9,15,16,17,18,20,21,22],formatetd:22,forward:[6,29,30],found:[4,10,16,20],four:1,fp:[11,17,24,25],fraction:[9,17],frame:17,frames_per_second:[24,25],framework:16,free:[6,16],freedom:29,friction:[10,17],from:[0,1,2,4,5,6,7,8,9,11,12,17,18,19,20,21,22,27,28,29,30],frontend:[4,6,8,12,13,29],ft0y3xnjhl4:10,full:[15,17,26],fullscreen:17,fundament:26,further:6,g:[6,8,10,17,20],ga:[0,17,21,30],galaxi:20,galaxiesonfir:2,gcradiu:21,gener:[4,6,9,10,16,17,22,26],get:[8,9,11],getcwd:[0,9],getdecimationindexarrai:15,getsizeof:4,ghoauthtokenpath:[6,16],ghreponam:16,ghuser:16,git:13,github:[6,7,13,16,20,26,29],give:[1,15,29],given:0,glass:27,global:[8,17,25,30],go:[9,10,26,28],good:[15,16],googl:11,grid:[4,7,9,10,17],group:[7,8,9,10,11,14,15,17,19,20,22,29,30],gt:[4,10],gui:15,gurvich:20,h5py:13,ha:[4,7,8,9,10,15,17,20,26],hamburg:29,hand:29,handl:[15,17,30],handler:24,hard_data_path:15,hardcod:11,have:[0,4,6,8,9,10,11,13,14,15,16,18,19,20,26,29,30],hdf5:[0,20,21,22],header:22,height:[2,4,5,26,28],held:29,help:[13,29],here:[0,2,4,9,12,15,17,28,29],hide:[4,29],highli:15,histogram:11,hit:29,home:[0,6,9,16,17,18,21,26],hopefulli:4,host:[2,3,4,5,6,11,12,16,23,25,28,29],hostnam:26,how:[0,4,5,6,7,9,10,12,15,16,17,26,29],howev:4,html:[7,24,25],http:[2,4,5,13,16,20],i:[9,15,19,20,21,27,28],id:[4,23,26],ident:26,identifi:[1,29],ifram:[2,3,5],ignor:19,imag:[27,28,30],implement:[9,15,16,17],improv:1,includ:[5,7,17],increas:[9,30],index:[7,15,17,22],indic:[15,30],indiscrimin:[4,26],individu:[1,10,15,16,17],infer:21,inform:[8,10,15,16,17,18,19,22,28],inherit:8,init_gh_pag:[6,7,16,26],init_git_pag:16,initi:[1,6,7,8,9,10,15,16,17,20,24,26,27,29,30],inoper:7,input:[3,5,8,15,18,22,27,29,30],insert:[0,4,7,9],instal:[2,5,12,26],instanc:[1,3,4,6,8,10,12,13,15,16,17,19,20,28],instead:[3,6,8,9,16,24,30],instruct:[2,5,6,7,9],integ:1,intend:[15,16],interact:[9,11,15,21,22,26],interchang:4,interest:29,interfac:[6,10,15,17],internet:[6,7,16,28,29],interpol:8,interpret:[1,9,16,19,25],invalid:15,invert:30,involv:3,ip:[11,26,29],ipad:29,ipynb:[4,7,9,10],ipython:[2,4,5,7,9,10,26],isolated_disk:0,issu:29,item:30,iter:[0,6,9,10,15],its:[1,8,9,15,26,28],itself:[9,20],jag:19,javascript:[1,16],join:[0,9],js:[16,29],json:[0,3,4,5,15,16,17,18,19,20,21,28],json_arrai:15,json_name0:15,json_name1:15,json_prefix:[15,16,17,18,21],jsondir:[0,1,4,5,6,7,8,9,10,15,16,17,18,21],jsonprefix:9,jupyt:[2,4,5,7,9,10,12],just:[4,7,9,10],keep:[6,9],kei:[8,11,15,17,28,29],kernel:11,keyboard:[8,11,17,27],keyerror:15,keyfram:[8,18,29],keyword:[1,6,7,9,10,22,26],kill:[3,23,26],killallfireflyserv:[4,26],know:[4,26],kwarg:[15,17,19,20,21,22],l:26,label:27,larg:[1,9,15,16,17],larger:[17,28],last:[16,18],launch:[3,28,29],layer:30,learn:[4,12],leav:15,left:[9,29,30],len:[9,15,17,18,22],length:[7,10,11,14,15,17,19,20],less:[28,30],let:[4,7,9,10,30],level:[13,22],lib:[7,10],librari:29,life:[4,26],like:[0,1,16,17,26],limit:[11,15,17,29,30],line:[17,26,29,30],linear:17,linearli:8,link:[0,1,6,8,9,10,15,16,17],linspac:[4,7,9,10],list:[1,6,7,8,9,10,15,16,17,18,19,20,22,26],listen:4,live:[0,1,4,9],ll:[4,7,9,10,30],ln:6,load:[0,1,6,7,9,10,15,16,17,20,26,29],load_ext:[0,4,7,9,10],loaddata:[0,20],loadfromjson:[10,17],local:[3,5,6,11,16,28,29],localhost:[2,3,4,5,11,24,25,26,29],locat:[1,2,5,8,15,17,18,26,27,28,29,30],lock:[25,29],log10dens:17,log:[0,17,20],logflag:[0,20],login:26,look:[1,7,11,13,17,29],lookout:11,loop:18,lot:4,loud:[9,15,16,17,18,19,22],lower:30,ls:7,lt:[4,10],lypga6dibok:9,m12i_res7100:2,m:[9,19],machin:[4,11,26],made:[4,29],magflag:[0,20],magnitud:[0,17,20],magveloc:17,mai:[6,7,10,11,16,26,28,30],main:[1,9,26],maintain:8,make:[4,6,7,9,10,15,16,17,18,26],make_new_repo:16,manag:[5,8,26,28],mani:[6,10,15,19,28],manifest:6,manipul:10,manual:[6,7,8,9,10,15],map:[1,17,30],mark:27,match:[10,15,18,19,20],max:[15,17],max_npart_per_fil:[15,16],max_tim:24,maximum:[15,16,17,24],maxvrang:[10,17],mean:[9,17],meant:[7,10],menu:[6,17,30],meshgrid:[4,7,9,10],messag:[6,28],method:[1,3,4,6,7,8,9,10,15,16,17,20],might:[10,30],min:[15,17],miniconda3:[7,10],minim:[21,22],minimum:28,mix:10,mobil:11,mock:25,mode:[17,27,28,29],modern:13,modul:[3,4],more:[2,4,8,26,28,29,30],most:[6,8,9,13,28],mous:27,move:[11,18,27,28,29],much:26,multi:29,multipl:[0,1,4,5,15,18,26,28],multiple_dataset:4,multiple_datasets_tutori:7,multipli:17,must:[1,6,7,10,15,17,22,26,29],my:10,my_arrayread:[2,4,5,9],my_coord:[4,7,9,10],my_decimated_particlegroup:9,my_firefli:[7,16,26],my_particlegroup:9,my_read:9,mydirectori:6,mystr:[15,16],n:[19,22],n_f:19,n_m:19,name:[1,9,11,15,16,17,18,19,20,26,28,30],navig:[2,5,13,26],ndarrai:[7,10,15,17],necessari:[6,7,8,9,10,13,15,16,26],need:[1,2,3,4,10,13,15,18,28,30],nest:[7,10,17],network:[11,29],new_set:10,next:27,nfield:15,node:26,non:16,none:[4,7,10,15,16,17,18,19,20,21,22,23],nonetheless:30,normal:10,not_read:[15,17,18],note:[9,10,16,17,26],notebook:[0,2,3,5,6,8,12],noth:9,notic:[7,9,10],notimplementederror:18,now:[2,5,10,29],np:[0,4,5,7,9,10,15,17,18,19],npart:15,npart_this_fil:1,nparts_per_fil:[1,15],nparts_this_fil:15,nparts_this_file0:15,nparts_this_file1:15,ntbk:[4,7,9,10],null_read:7,nulldata:7,number:[0,1,15,16,17,18,19,24,25,26,28,29,30],numpi:[0,4,5,7,9,10,13,15,19],oauth:[6,16],object:[0,3,7,8,9,15,16,17,18,28],od598z7pqb0:4,off:30,offer:[6,8],offset:[20,21],often:15,okai:4,onc:[10,13,26,28],one:[0,4,6,9,10,14,15,16,17,26,29,30],ones:[10,26],onli:[0,2,4,5,6,7,8,9,10,14,15,16,17,18,19,21,22,24,25,26,27,28,29,30],onlin:28,opac:[11,14,15],open:[1,6,8,9,19,20,21,22,26,29],opensnapshot:20,oper:28,option:[0,1,6,8,9,10,15,16,17,18,19,20,21,22,23,24,25,26],option_kwarg:15,orbit:29,order:[0,7,9,10],org:26,organ:[8,9,10,15,17],orient:[17,29],origin:[10,26],os:[0,4,7,9,10],other:[4,7,10,15,16,29],otherwis:[16,28],our:[7,9,10],out:[4,5,15,29],outdict:15,outlin:9,output:[0,2,3,4,5,7,8,10,15,16,18],outputdict:16,outputtodict:[15,16,17,18],outputtojson:[1,10,15,16,17,18],outsid:[10,30],over:[7,16,26,29],overlai:27,overwrit:[0,7,16],overwritten:[4,10],own:[4,6,8,9,10,12,13,30],p:[11,17],packag:[7,10,13,26],page:[5,6,7,8,16,26],pan:29,panda:13,pane:[9,17],panel:[8,14,27,28,30],param:[3,16],paramet:[15,16,17,18,19,20,21,22,23,24,25,30],parent:22,pars:[4,8,28],part:9,particl:[0,3,4,5,7,8,9,10,14,15,16,17,19,20,28,29],particle_colormap_set:17,particle_filter_set:17,particle_group:22,particle_startup_set:17,particle_ui_set:17,particlegroup1:1,particlegroup1fil:1,particlegroup2:1,particlegroup2fil:1,particlegroup:[16,17,20],particular:[8,10],partnam:9,parttyp:[15,16,20],parttype0:20,parttype4:20,pass:[0,3,4,6,7,8,9,10,15,16,17,19,22,24,25],passthrough:[17,19],path:[0,4,5,7,8,9,15,21,22,26],path_to_data:[19,22],path_to_snapshot:21,pattern:[10,17],per:[15,16,17],perform:[0,1],perhap:[9,10],persist:[4,29],person:28,perspect:[4,27],pgroup_0:[4,7,9,10],pgroup_1:[7,10],phone:11,pick:[4,7,9,10],pid:[4,23,26],piec:9,pip:13,pitch:29,pixel:11,place:11,playback:30,pleas:[0,6,15],plot:[17,28],plotnmax:[10,17],png:[17,28,30],point:[4,6,7,9,10,11,15,17,19,29,30],polit:26,popen:24,port:[3,4,6,16,24,25,29],posit:[17,18,26,29,30],possibl:[3,4,8,9,30],post:[3,4],power:26,pre:8,prefer:[4,6,13],prefix:[15,16,17,18],prepend:[17,18],present:[7,17],preset:28,press:[8,11,17,18,27,29],pretti:[4,15,16,17],previou:[27,28],principl:26,print:[4,9,10,15,16,17,18,19,22],printkei:[10,17],probabl:30,problem:4,proce:26,procedur:[4,9,26],process:[0,2,3,5,6,23,24,25,26],produc:[4,5,7,9,16,17,20,27,28],program:27,project:[2,17],prompt:28,proof:11,properli:16,properti:5,provid:[0,3,6,7,8,9,15,16,30],pseudo:26,ptype:[0,20,21],purg:16,purpos:[9,10,11],purposefulli:1,put:[3,13,15],py:[7,10,13],python3:[7,10],python:[3,4,5,6,9,10,12,13,16,18,23,28],pythonpath:13,qualiti:[11,24,25],quantiti:20,quickli:[6,8,12,13],r:29,radian:17,rag:[7,10],rais:[6,15,16,17,18,19,20,21,22,24],random:[4,5,7,9,10,17],randomli:[15,19,20,21],rang:17,rate:27,rather:20,raw:19,re:[2,3,5,8,9,11,26],reach:18,react:29,read:[4,7,8,16,17,20,28],readabl:9,reader:[0,1,2,3,5,6,7,15,17,18,19,20,22,26,28],reader_tutori:[4,9],readi:9,reason:[11,15,28],receiv:30,recommend:[13,15],record:[4,7,9,10,29],redefin:30,reduc:[0,9,15,19,20,21,29],refer:[12,15,16,17,18,27,28,30],referenc:16,regardless:[2,5],region:[29,30],regist:29,rel:[0,1,9,16,17,18,21],releas:27,relev:[8,17],reliabl:26,remot:[11,29],renam:28,render:[15,16,26,27],renorm:17,repeat:[7,10,18],replac:[10,15,17,30],repo:[0,4,7,9,10,16],repositori:[6,7,13,16,26,28],repres:[9,29],reproduc:20,request:[3,4,13],requir:[5,8,16,17,18,26],research:[0,4,7,9,10],reset:28,resid:1,resiz:[11,28],resolv:16,respect:[9,28],respons:4,restart:28,result:[7,16,28],retreiv:15,return_cod:23,reveal:29,review:30,rgba:[9,15,17],right:[27,28,29,30],rotat:[17,27,29],router:[26,29],row:[22,30],rtype:15,rudimentari:15,run:[1,4,6,9,12,16],runtimeerror:24,s2firefli:26,s:[4,5,6,7,8,9,10,15,16,17,19,20,21,22,26,28,29,30],safest:4,sai:[8,29],same:[8,11,15,26,27,29],sampl:[4,7,9,10,15],save:[0,10,15,16,17,18,19,21,22],scale:14,scene:[17,29],scope:10,scratch:2,screen:[29,30],screenshot:17,script:7,scroll:[4,29],search:6,second:[4,6,7,9,17,18],section:[26,29,30],secur:[11,28],see:[0,4,6,7,8,9,10,11,16,26,27,28,29,30],seem:29,select:[1,6,7,28,29,30],self:[15,16,17,18,19,21],send:[2,5],senddataviaflask:[2,3,4,5,16],sensibl:10,sent:[4,16],separ:[0,17,22,27,30],sequenc:[7,10],sequenti:1,serv:[8,24,25,26],server:[2,5,6,11,16,29],servic:[6,16],session:26,set:[0,3,4,5,6,7,9,11,14,15,16,18,21,22,26,29],settings_default:[9,10],settings_filenam:[1,17,18],settings_kwarg:15,settings_tutori:[9,10],setup:[2,5,13,21],sh:16,shape:[7,10,15,17,19],share:[2,20,26],shift:29,ship:[1,4,8],short_data_path:15,shortcut:9,should:[0,1,4,7,8,9,10,11,15,16,17,20,26,28,30],show:[3,6,10,14,15,17,28,29,30],showcolormap:[10,17],showfp:17,shown:[4,27,28,30],showpart:[10,17],showvel:[10,17],shuffl:9,side:[27,28,30],signal:[8,20],simpl:[2,22,26],simplefireread:[2,8],simplehttpserv:26,simpleread:[8,16],simpli:[13,26],simplifi:0,simul:8,sinc:[9,15,16],singl:[7,8,9,16,17,18,19,26],site:[6,7,10,26,28],size:[0,4,5,7,9,10,17,30],sizemult:[0,9,10,17,21],skip:20,slide:30,slider:[15,17,27,28,29,30],small:[17,26],smooth:[11,14],smoothinglength:15,smoothli:[8,18,29],snap:0,snapdir:[0,20],snapdir_001:6,snapdir_002:6,snapdir_003:6,snapdir_004:6,snapdir_050:0,snapdir_600:2,snapdir_xxx:6,snapnum:[0,20,21],snapshot:[0,2,5,20,21],snapshot_050:0,snapshot_util:20,so:[6,7,9,10,13,15,16,26,28,30],socketio:13,soft:[0,16],some:[3,5,6,7,9,10,17,21,28],someon:[8,9],someth:[26,29,30],sometim:[4,9,26],somewher:6,sourc:[7,8,15,16,17,18,19,20,21,22,23,24,25,26],space:[0,4,15,17,29],spawn:[2,5],spawnfireflyserv:[2,4,5,26],special:[0,30],specif:[4,9,10,11,14,15,18],specifi:[1,3,4,6,7,8,9,10,11,17],speed:[27,29,30],sph:[11,15],spill:15,spline:[11,14,15],split:15,src:[0,4,7,9,10,26,30],ssh:26,stabil:0,stack:29,stampede2:[2,26],stand:16,standalon:6,standard:[0,21,28],star:[0,17,21,30],start:[3,5,6,7,9,11,15,17,24],start_tween:17,startfireflyserv:[11,24],startfli:[10,17],startup:[0,4,10,16,17,27,28,30],startup_set:17,state:[17,29],static_data_dir:16,statu:[15,16,17,18,19,22],step:2,stereo:[10,17],stereoscop:27,stereosep:[10,17],still:11,stop:27,store:[8,10,15,16,17,18,19,21,26],store_extra_kei:15,str:[15,16,17,18,19,20,21,22],stream:[24,25],streamlin:6,strictli:[15,16],string:[1,3,9,15,16,17,18,19,21,22],structur:16,style:30,sub:[0,1,6,7,8,10,14,15,16,17,18,21,26,27,28,30],subject:[9,11],submit:29,subprocess:24,subset:15,success:24,sum:15,suppli:4,support:27,sure:[4,7,9,10,16],surviv:[4,26],sy:[0,4,7,9,10],symbol:[6,29],symlink:[0,7,16],syntax:10,system:[6,26,28],t:[4,7,8,9,10,15,16,18,22,26,29,30],tab:[10,17],tacc:26,take:[0,4,8,9,10,16,19,22,26,30],taken:20,target:[11,16,26],tell:[7,9],temperatur:[0,20,21],templat:[16,29],termin:26,test:[9,10,13],testfield:9,text:[8,9,17,27,28,30],textur:[17,30],than:[15,16,20,22],thei:[1,4,6,8,9,15,16,27],them:[0,6,9,26],themselv:9,thi:[0,1,2,3,5,6,7,8,9,10,11,13,14,15,16,17,18,20,26,27,28,29,30],thing:[10,26],third:7,this_filenam:1,those:[10,17,26,27],though:27,three:[16,27,29],through:[3,5,9,12,15,24,25,26],time:[4,9,24,29],titl:[10,17],tmq3ivnxgy8:7,todo:[17,18],togeth:[9,30],toggl:17,toggleabl:8,token:[6,16],too:[9,15,16],tool:26,top:[11,13,17,22,28,30],toward:29,track:[0,4,7,9,10,15,16],trackarrai:15,trackbal:[17,27],tracked_arrai:[4,7,9,10,15],tracked_colormap_flag:[4,7,9,10,15],tracked_filter_flag:[4,7,9,10,15],tracked_nam:[9,15],transfer:26,transmit:9,transpar:30,treat:16,triangl:[17,30],troubl:[15,16],trust:[6,28],tune:[15,20],tupl:[7,10,15],turn:[10,30],tutori:[1,3,5,6,8],tween:[3,8,17,18],tween_params_dict:18,tweenparam:[16,17,29],two:[4,7,10,26,27,28,29,30],type:[0,15,16,17,18,20,23,24,30],typeerror:16,ui:[0,1,6,8,9,10,14,15,16,17,20,29,30],ui_set:17,uicameracontrol:[10,17],uicolorpick:[10,17],uidecim:[10,17],uidropdown:[10,17],uifullscreen:[10,17],uiloadnewdata:[10,17],uinam:[0,15,17,19,20,21],uiparticl:[10,17],uireset:[10,17],uisavepreset:[10,17],uisnapshot:[10,17],unam:26,uncheck:29,uncommon:4,under:4,understand:[5,8,26],undesir:15,unifi:16,unit:17,unless:[4,9],unnecessari:4,up:[4,7,10,13,15,16,17,29],updat:[2,4,5,8,10,15,16,27,29,30],upload:[4,6,28],upon:[27,28,30],url:[4,7,11,26],us:[1,3,4,5,6,7,12,15,16,17,20,21,24,25,27,28,30],usag:26,user:[0,1,4,6,7,8,9,10,11,16,17,18,21,22,26,30],usernam:16,util:29,valid:[9,10,15,17],valu:[1,4,7,9,10,15,16,17,22,27,28,29,30],valueerror:[15,19,20,21,22],vari:[8,11,14,15],variabl:[13,26],variou:[1,17],ve:[3,4,7,9,10],vector:[14,17,20,30],veloc:[0,17,20,21],veltyp:[10,17],veri:1,version:[0,13],vertic:29,vi:13,via:[4,5,7,11,16,25,29],view:[13,27,28,29],visibledeprecationwarn:[7,10],visit:[0,4,7,8,11,26,29],visitor:[7,8],visual:[0,3,4,10,13,14],vr:27,vs:[16,26],w:29,wa:[4,10,28],wai:[1,7,8,13,26],wait:[4,24],want:[0,6,10,15,17,27,28],warn:[6,15,17,18,28],we:[0,2,3,4,6,7,8,9,10,11,13,16,26,30],weak:[15,16,17,18],web:[1,2,5,12,13,15,16,17,23,25,26],webapp:[1,4,7,8,9,15,16,18,20],webgl:17,webhost:6,webpag:[4,17,26],webserv:[3,4,6,12,28,29],websit:28,well:[1,13,26],were:[9,16,28],what:[0,4,10,17,20,30],whatev:[1,7,15],wheel:29,when:[1,3,6,7,8,11,15,17,26,28,29,30],whenev:8,where:[0,9,15,16,26,30],wherev:28,whether:[8,15,16,17,18,19,20,21],which:[0,1,3,4,5,6,7,8,9,10,11,13,15,19,20,21,26,27,28,29,30],whiter:30,who:[8,9,26],whole:[10,17],width:[2,4,5,26,28],window:[2,4,5,10,17,26,28,29],window_set:17,within:[1,6,8,12,15,18,27,28,29,30],without:[4,6,8,15,19,24,26,28],won:26,word:29,work:[9,10,11,13,26,28,30],workflow:29,workhors:10,would:[0,3,6,8,9,26],wrap:[4,9],wrapper:[19,21,22,24,26],write:4,write_jsons_to_disk:[4,5,9,10,15,16,17,18,19,21,22],write_startup:[0,6,7,16],written:[3,9,15,16,17,18],x1:18,x2:18,x:[13,18,22,29],xs:[4,7,9,10],xsede:[2,26],xt1vce_2dyo:10,xxxx:[3,11,26,29],y1:18,y2:18,y:[18,22],yaw:29,you:[1,2,3,5,6,7,8,9,11,13,15,16,17,26,27,28,29,30],your:[2,4,6,7,8,9,10,12,13,15,16,17,18,21,26,27,28,29,30],yourself:[15,16],youtubevideo:[4,7,9,10],ys:[4,7,9,10],yyi:26,z1:18,z2:18,z:[18,22],zero:17,zoom:29,zs:[4,7,9,10]},titles:["Convert FIRE data","Understanding Firefly\u2019s input requirements","Using Firefly to view FIRE data","Sending data to a Firefly server via Flask","Tutorial notebook: Sending data to a local Firefly server through Flask","Creating your own instance of Firefly","Managing multiple datasets","Tutorial notebook: Managing multiple datasets with Firefly","Producing Firefly formatted <code class=\"code docutils literal notranslate\"><span class=\"pre\">.json</span></code> files using the <span class=\"xref std std-ref\">Python API</span>","Tutorial notebook: Using the <code class=\"docutils literal notranslate\"><span class=\"pre\">Reader</span></code> class","Tutorial notebook: Managing Custom Settings","Experimental features","Firefly: a browser-based interactive particle data visualization platform","Installation","API Reference","firefly.data_reader.ParticleGroup","firefly.data_reader.Reader","firefly.data_reader.Settings","firefly.data_reader.TweenParams","firefly.data_reader.ArrayReader","firefly.data_reader.FIREreader","firefly.data_reader.SimpleFIREreader","firefly.data_reader.SimpleReader","firefly.server.killAllFireflyServers","firefly.server.spawnFireflyServer","firefly.server.startFireflyServer","Hosting a Firefly webserver","Camera controls","Data controls","Interacting with a Firefly visualization","Particle controls"],titleterms:{"2d":11,"class":[8,9,14],"default":28,"import":10,"new":28,"static":26,The:[1,8,29],To:[2,5],With:6,access:26,accord:11,also:10,an:[4,9,26],api:[8,14],app:4,ar:10,arrayread:[9,19],attach:10,background:4,bar:29,base:[12,14],browser:12,built:14,camera:27,can:10,chang:10,collaps:30,colormap:30,connect:10,content:12,control:[27,28,29,30],convert:0,coordin:9,creat:[2,4,5,7,9],custom:10,data:[0,2,3,4,5,12,28],data_read:[0,4,10,15,16,17,18,19,20,21,22],dataset:[6,7],decim:28,dictionari:10,directori:6,done:4,easili:2,edit:7,embed:26,entri:7,exampl:4,execut:26,experiment:11,featur:11,field:14,file:[1,8,10],filenam:1,filenumb:1,filter:30,fire:[0,2],firefli:[0,1,2,3,4,5,6,7,8,10,11,12,15,16,17,18,19,20,21,22,23,24,25,26,29],fireread:20,flask:[3,4,26,29],fly:29,format:[5,8],forward:26,friction:27,from:[10,13,26],fullscreen:28,group:1,gui:29,host:26,html:26,http:26,ifram:[4,26],index:26,input:1,instal:13,instanc:[5,9],interact:[12,29],interfac:29,internet:26,iter:7,json:[1,6,7,8,9,10],jupyt:26,kei:10,keyboard:29,kill:4,killallfireflyserv:23,latest:13,launch:26,load:28,local:[4,26],lock:27,m:26,manag:[6,7,10],manifest:1,most:10,mous:29,multipl:[6,7],n:30,name:14,next:5,notebook:[4,7,9,10,26],object:[4,10],output:9,own:5,panel:29,particl:[1,11,12,30],particlegroup:[1,8,9,10,15],platform:12,plot:30,port:26,pre:14,prefix:1,process:4,produc:8,project:11,put:4,py:26,python:[8,26],quickstart:[2,5],re:4,reader:[4,8,9,10,14,16],recent:27,refer:14,releas:13,remot:26,render:11,requir:[1,13],reset:27,run_serv:26,s:1,same:10,save:[27,28],scale:11,send:[3,4],separ:6,server:[3,4,14,23,24,25,26],set:[1,8,10,17,28],show:4,simplefireread:[0,21],simpleread:22,size:11,smoothinglength:[11,14],snapshot:28,some:4,sourc:[6,13],spawnfireflyserv:24,special:14,split:29,stabl:13,standalon:7,start:4,startfireflyserv:25,startup:[1,6,7],step:5,stereo:27,store:9,stream:11,sub:[9,29],support:11,take:28,thi:4,through:4,top:29,trackbal:29,tutori:[4,7,9,10],tween:29,tweenparam:[8,18],understand:1,us:[0,2,8,9,10,26,29],user:29,utit:14,veloc:[14,30],version:26,via:[3,26],view:[2,5,11,30],viewer:29,visual:[2,5,12,29],volum:11,vr:11,wai:10,webserv:26,when:[4,10],within:26,would:10,you:[4,10],your:5,yt:8}})
|
let
images = document.images ,
images_total_count = images.length ,
images_loaded_count = 0 ;
for (let i = 0; i < images_total_count; i++)
{
image_clone = new Image();
image_clone.onload = image_loaded;
image_clone.onerror = image_loaded;
image_clone.src = images[i].src;
}
function image_loaded() {
images_loaded_count++;
if ( images_loaded_count >= images_total_count )
{
setTimeout(function() {
let preloader = document.getElementById('preloader');
if (!preloader.classList.contains('done')) {
preloader.classList.add('done');
}
}, 1000);
}
}
|
import React from 'react';
import Radio from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import FormControl from '@material-ui/core/FormControl';
import FormLabel from '@material-ui/core/FormLabel';
function FormControlLabelPosition() {
const [value, setValue] = React.useState('female');
function handleChange(event) {
setValue(event.target.value);
}
return (
<FormControl component="fieldset">
<FormLabel component="legend">labelPlacement</FormLabel>
<RadioGroup aria-label="position" name="position" value={value} onChange={handleChange} row>
<FormControlLabel
value="top"
control={<Radio color="primary" />}
label="Top"
labelPlacement="top"
/>
<FormControlLabel
value="start"
control={<Radio color="primary" />}
label="Start"
labelPlacement="start"
/>
<FormControlLabel
value="bottom"
control={<Radio color="primary" />}
label="Bottom"
labelPlacement="bottom"
/>
<FormControlLabel
value="end"
control={<Radio color="primary" />}
label="End"
labelPlacement="end"
/>
</RadioGroup>
</FormControl>
);
}
export default FormControlLabelPosition;
|
var group___s_t_m8_a_f___s_t_m8_s_struct___c_a_n__t_8_page_8_p_a_g_e__0_8_m_d_a_r1 =
[
[ "DATA", "group___s_t_m8_a_f___s_t_m8_s.html#ae44f9e348e41cb272efa87387728571b", null ]
];
|
const util = require('../../utils/util.js');
const api = require('../../config/api.js');
const user = require('../../services/user.js');
import _gsTracker from '../../utils/gs_v3.8.5.15.js';
//获取应用实例
const app = getApp()
const options = {
data: {
floorGoods: [],
openAttr: false,
showChannel: 0,
showBanner: 0,
showBannerImg: 0,
banner: [],
index_banner_img: 0,
userInfo: {},
imgurl: '',
sysHeight: 0,
loading: 0,
autoplay:true,
showContact:1,
},
onPageScroll: function (e) {
let scrollTop = e.scrollTop;
let that = this;
if (scrollTop >= 2000) {
that.setData({
showContact: 0
})
} else {
that.setData({
showContact: 1
})
}
},
onHide:function(){
this.setData({
autoplay:false
})
},
goSearch: function () {
wx.navigateTo({
url: '/pages/search/search',
})
},
goCategory: function (e) {
let id = e.currentTarget.dataset.cateid;
wx.setStorageSync('categoryId', id);
wx.switchTab({
url: '/pages/category/index',
})
},
handleTap: function (event) {
//阻止冒泡
},
onShareAppMessage: function () {
let info = wx.getStorageSync('userInfo');
return {
title: '海风小店',
desc: '开源微信小程序商城',
path: '/pages/index/index?id=' + info.id
}
},
toDetailsTap: function () {
wx.navigateTo({
url: '/pages/goods-details/index',
});
},
getIndexData: function () {
let that = this;
util.request(api.IndexUrl).then(function (res) {
if (res.errno === 0) {
that.setData({
floorGoods: res.data.categoryList,
banner: res.data.banner,
channel: res.data.channel,
notice: res.data.notice,
loading: 1,
});
let cartGoodsCount = '';
if (res.data.cartCount == 0) {
wx.removeTabBarBadge({
index: 2,
})
} else {
cartGoodsCount = res.data.cartCount + '';
wx.setTabBarBadge({
index: 2,
text: cartGoodsCount
})
}
}
});
},
onLoad: function (options) {
this.getChannelShowInfo();
},
onShow: function () {
_gsTracker.setPageTitle('首页');
this.getIndexData();
var that = this;
let userInfo = wx.getStorageSync('userInfo');
if (userInfo != '') {
that.setData({
userInfo: userInfo,
});
};
let info = wx.getSystemInfoSync();
let sysHeight = info.windowHeight - 100;
this.setData({
sysHeight: sysHeight,
autoplay:true
});
wx.removeStorageSync('categoryId');
},
getChannelShowInfo: function (e) {
let that = this;
util.request(api.ShowSettings).then(function (res) {
if (res.errno === 0) {
let show_channel = res.data.channel;
let show_banner = res.data.banner;
let show_notice = res.data.notice;
let index_banner_img = res.data.index_banner_img;
that.setData({
show_channel: show_channel,
show_banner: show_banner,
show_notice: show_notice,
index_banner_img: index_banner_img
});
}
});
},
onPullDownRefresh: function () {
wx.showNavigationBarLoading()
this.getIndexData();
this.getChannelShowInfo();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
}
Page(_gsTracker.getGridsumPage(options))
|
function setHdrSectionPropFun() {
// ---------- Set ObjProperties
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec1');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec2');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec3');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec4');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec5');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec6');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec7');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec8');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec9');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec10');
setHdrSectionProp('', viewBag.ObjKy, '', 'HdrSec16');
SetHandlingEnterKeyEvent('', viewBag.ObjKy);
//$("#HdrSec1_InptDocNo_Val").focus();
//-- Set Foucs event based on ObjMas and UsrObj
SetFirstFocusObj();
HideSectnFrmtGrp();
}
function AdrByAccDatasource(AccKy) {
var data = new Array();
$.ajax({
url: urlOrder.GetAdrByAcc,
dataType: "json",
type: "POST",
data: JSON.stringify({
AccKy: AccKy
}),
contentType: 'application/json; charset=utf-8',
success: function (list) {
if (list.length == 1) {
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(null);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(null);
for (i = 0; i < list.length; i++) {
var AdrKy = list[0].AdrKy;
var AdrNm = list[0].AdrNm;
var AdrID = list[0].AdrID;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy);
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").text(AdrID);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").text(AdrNm);
}
// alert("Cannot find the item !");
} else if (list.length == 2) {
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").setDataSource(list);
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(null);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").setDataSource(list);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(null);
for (i = 0; i < list.length; i++) {
var AdrKy = list[1].AdrKy;
var AdrNm = list[1].AdrNm;
var AdrID = list[1].AdrID;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy);
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").text(AdrID);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").text(AdrNm);
}
}
else {
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(null);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(null);
for (i = 0; i < list.length; i++) {
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").setDataSource(list);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").setDataSource(list);
}
}
},
error: function (e) {
}
});
}
function GetAdrKyByAccKy(AccKy) {
$.ajax({
url: urlTransaction.GetAdrKy,
data: JSON.stringify({
AccKy: AccKy
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
for (i = 0; i < data.length; i++) {
var AdrKy = data[0].AdrKy;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy);
//$("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy);
}
},
error: function (e) {
return false;
}
});
}
function GetAccKyByAdrKy(AdrKy) {
$.ajax({
url: urlTransaction.GetAccKy,
data: JSON.stringify({
AdrKy: AdrKy
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
for (i = 0; i < data.length; i++) {
var AccKy = data[0].AccKy;
// $("#HdrSec2_CmbAcc_Nm").data("kendoComboBox").value(AccKy);
$("#HdrSec2_CmbAcc_Cd").data("kendoComboBox").value(AccKy);
}
},
error: function (e) {
return false;
}
});
}
function Load_ItmTransferGrid() {
var ItmTransferColumn = [
{ field: "ItmTrnKy", title: "Ref ##", width: "100px", hidden: true },
{ field: "ToItmTrnKy", title: "Ref #", width: "100px", hidden: true },
{ field: "FrmItmTrnKy", title: "Ref #", width: "100px", hidden: true },
{ field: "OrdDetKy", title: "OrdDetKy", width: "100px", hidden: true },
{ field: "LiNo", title: "Ref #", width: "100px" },
{ field: "ItmKy", title: "Ref #", width: "100px", hidden: true },
{ field: "ItmCd", title: "Item Cd", width: "150px" },
{ field: "ItmNm", title: "Item Name", width: "150px" },
{ field: "Unit", title: "Unit", width: "100px" },
{
field: "UnitKy", title: "Unit", width: "100px", hidden: true,
editor: function (container, options) { var model = options.model; }
},
{
field: "POQty", title: "POQty", width: "150px",
editor: function (container, options) {
var model = options.model;
}
},
{
field: "ReMnQty", title: "ReMnQty", width: "150px",
editor: function (container, options) {
var model = options.model;
}
},
{
field: "TrnQty", title: "Qty", width: "150px",
editor: function (container, options) { var model = options.model; }
},
{ field: "AvlStk", title: "AvlStk", width: "100px" },
{
field: "TrnRate", title: "Rate", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "SubTotal", title: "SubTotal", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "DisPer", title: "Discount %", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "DisAmt", title: "Discount", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "VAT", title: "VAT %", width: "150px", hidden: false, format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "VatAmt", title: "VAT Amount", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "WHT", title: "WHT %", width: "150px", hidden: false, format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "WHTAmt", title: "WHT Amount", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "NBT", title: "NBT %", width: "150px", hidden: false, format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "NBTAmt", title: "NBT Amount", width: "150px", hidden: false, format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "SVAT", title: "SVAT %", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{
field: "SVatAmt", title: "SVAT Amount", width: "150px", format: "{0:N2}",
editor: function (container, options) { var model = options.model; }
},
{ field: "Des", title: "Description", width: "150px" },
{ field: "Rem", title: "Remarks", width: "150px" },
{
field: "Anl3Ky", title: "IssuTo", width: "150px", hidden: true,
editor: function (container, options) { }
},
{
field: "Anl3Cd", title: "Analysis3", width: "150px",
editor: function (container, options) { }
},
{
field: "isApr", title: "isApr", width: "50px", hidden: true,
editor: function (container, options) { }
},
{
field: "PrcsDetKy", title: "TaskID", width: "50px", hidden:true,
},
{
field: "isAct", title: "IsAct", width: "50px", hidden: true,
editor: function (container, options) { }
},
{ field: "PreItmTrnKy", title: "Ref #", width: "100px", hidden: true },
{ field: "IsAlwMinusStk", title: "IsAlwMinusStk", width: "100px" },
{ width: "60px", template: kendo.template($("#command-template").html()) },
];
var gridNo = 1;
var FinalItmTransferColumn = setColumnProp(ItmTransferColumn, viewBag.ObjKy, '', 'FormGrd', gridNo);
}
function LoadGridWithColumnProp(columnsFinal, gridNo) {
if (gridNo == 1) {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
dataType: "json"
}
},
batch: true,
sort: ({ field: "LiNo", dir: "desc" }),// "asc"
pageSize: 10,
schema: {
model: {
id: "ItmTrnKy",
fields: //Relavent fields of the grid should be bind with following model items
{
FrmItmTrnKy: { editable: true, nullable: false, type: "number" },
ToItmTrnKy: { editable: true, nullable: false, type: "number" },
LiNo: { editable: false, nullable: false, type: "number" },
ItmKy: { editable: false, nullable: false, type: "number" },
OrdDetKy: { editable: false, nullable: false, type: "number" },
ItmCd: { editable: false, nullable: false, type: "string" },
ItmNm: { editable: false, nullable: false, type: "string" },
Unit: { editable: false, nullable: false },
UnitKy: { editable: true, nullable: false },
Des: { editable: true },
PrcsDetKy: { editable: true, type: "number"},
POQty: { editable: true, nullable: false, type: "number" },
ReMnQty: { editable: true, nullable: false, type: "number" },
TrnQty: { editable: true, nullable: false },
AvlStk: { editable: true, nullable: false },
TrnRate: { editable: true, nullable: false, type: "number" },
SubTotal: { editable: true, nullable: false, type: "number" },
DisAmt: { editable: true, nullable: false, type: "number" },
DisPer: { editable: true, nullable: false, type: "number" },
VatAmt: { editable: true, nullable: false, type: "number" },
VAT: { editable: true, nullable: false, type: "number" },
WHT: { editable: true, nullable: false, type: "number" },
WHTAmt: { editable: true, nullable: false, type: "number" },
NBTAmt: { editable: true, nullable: false, type: "number" },
NBT: { editable: true, nullable: false, type: "number" },
SVatAmt: { editable: true, nullable: false, type: "number" },
SVAT: { editable: true, nullable: false, type: "number" },
Rem: { editable: true },
Anl3Ky: { editable: true, nullable: false, type: "number" },
Anl3Cd: { editable: true, nullable: false, type: "string" },
isApr: { editable: true, nullable: false, type: "number" },
isAct: { editable: true, nullable: false, type: "number" },
PreItmTrnKy: { editable: true, nullable: false, type: "number" },
IsAlwMinusStk: { editable: true, nullable: false, type: "number" },
}
}
}
});
var id = ("#" + viewBag.OurCd);
$(id).kendoGrid({
dataSource: dataSource,
autobind: true,
navigatable: true,
filterable: {
mode: "row"
},
pageable: true,
sortable: true,
reorderable: true,
columnMenu: true,
selectable: "row",
pageable: { refresh: true, pageSizes: [5, 10, 20, 50, 100] },
columns: columnsFinal,
resizable: true,
dataBound: onDataBound,
dataBinding: function () {
record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
},
editable: true,
});
function CaluculateSubTotal() {
var newSubTValue = 0;
$.each(dataSource.data(), function (index, model) {
newSubTValue += model.get("SubTotal");
});
SetTotalSubTotalVal(newSubTValue);
}
function SetTotalSubTotalVal(newSubTValue) {
var newSubTValueDoble = (newSubTValue).toFixed(2);
$("#HdrSec4_InptSubTot_Val").data("kendoNumericTextBox").value(newSubTValueDoble);
}
function CaluculateDisAmt() {
var newDisTValue = 0;
$.each(dataSource.data(), function (index, model) {
newDisTValue += model.get("DisAmt");
});
SetTotalDisAmtVal(newDisTValue);
}
function SetTotalDisAmtVal(newDisTValue) {
var newDisTValueDoble = (newDisTValue).toFixed(2);
$("#HdrSec4_InptDisc_Val").data("kendoNumericTextBox").value(newDisTValueDoble);
}
function CaluculateVatAmt() {
var newVatTValue = 0;
$.each(dataSource.data(), function (index, model) {
newVatTValue += model.get("VatAmt");
});
SetTotalVatAmtVal(newVatTValue);
}
function SetTotalVatAmtVal(newVatTValue) {
var newVatTValueDoble = (newVatTValue).toFixed(2);
$("#HdrSec4_InptVat_Val").data("kendoNumericTextBox").value(newVatTValueDoble);
}
function CaluculateWHTAmt() {
var newWhtTValue = 0;
$.each(dataSource.data(), function (index, model) {
newWhtTValue += model.get("WHTAmt");
});
SetTotalWHTAmtVal(newWhtTValue);
}
function SetTotalWHTAmtVal(newWhtTValue) {
var newWhtTValueDoble = (newWhtTValue).toFixed(2);
$("#HdrSec4_InptWHT_Val").data("kendoNumericTextBox").value(newWhtTValueDoble);
}
function CaluculateNBTAmt() {
var newNbtTValue = 0;
$.each(dataSource.data(), function (index, model) {
newNbtTValue += model.get("NBTAmt");
});
SetTotalNBTAmtVal(newNbtTValue);
}
function SetTotalNBTAmtVal(newNbtTValue) {
var newNbtTValueDoble = (newNbtTValue).toFixed(2);
$("#HdrSec4_InptNBT_Val").data("kendoNumericTextBox").value(newNbtTValueDoble);
}
function CaluculateSVATAmt() {
var newSvatTValue = 0;
$.each(dataSource.data(), function (index, model) {
newSvatTValue += model.get("SVatAmt");
});
SetTotalSVatAmtVal(newSvatTValue);
}
function SetTotalSVatAmtVal(newSvatTValue) {
var newSvatTValueDoble = (newSvatTValue).toFixed(2);
$("#HdrSec4_InptSVAT_Val").data("kendoNumericTextBox").value(newSvatTValueDoble);
}
function CaluculateTotal() {
var subtotal = $("#HdrSec4_InptSubTot_Val").data("kendoNumericTextBox").value();
var Discount = $("#HdrSec4_InptDisc_Val").data("kendoNumericTextBox").value();
var NBT = $("#HdrSec4_InptNBT_Val").data("kendoNumericTextBox").value();
var Vat = $("#HdrSec4_InptVat_Val").data("kendoNumericTextBox").value();
var WHT = $("#HdrSec4_InptWHT_Val").data("kendoNumericTextBox").value();
var Svat = $("#HdrSec4_InptSVAT_Val").data("kendoNumericTextBox").value();
if (subtotal == null) {
subtotal = 0;
}
if (Discount == null) {
Discount = 0;
}
if (NBT == null) {
NBT = 0;
}
if (Vat == null) {
Vat = 0;
}
if (WHT == null) {
WHT = 0;
}
if (Svat == null) {
Svat = 0;
}
var TotalVal = Number(subtotal) + Number(NBT) + Number(Vat) + Number(WHT) + Number(Svat);
var FinalTotal = TotalVal - Number(Discount);
var FinalTotalDoble = (FinalTotal).toFixed(2);
var FinalTotalDoubleSeperate = FinalTotalDoble.toLocaleString();
$("#HdrSec4_InptTotal_Val").data("kendoNumericTextBox").value(FinalTotalDoubleSeperate);
}
}
}
function LoadGridView1(PrjKy) {
}
function sendPrjKy() {
$.ajax({
type: "POST",
dataType: "json",
url: urlTransaction.sendPrjKy,
data: {
strPrjKy: $("#HdrSec2_CmbFrmPrj_Cd").val(),
},
success: function (data) {
}
})
}
function Remember() {
//alert("here..");
var grid = $("#grid").data("kendoGrid");
dataView = grid.dataSource.view();
var rowObjs = grid.tbody[0].rows;
var today = new Date();
var d = new Date();
var month = d.getMonth() + 1;
var day = d.getDate();
var output = (day < 10 ? '0' : '') + day + '/' + (month < 10 ? '0' : '') + month + '/' + d.getFullYear();
for (var i = 0; i < dataView.length; i++) {
var row = rowObjs[i];
if (dataView[i].NxtActDt === dt) {
}
}
}
function GridOnDataBinding(arg) {
record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
}
function CallItmNmWindow() {
$("#ResourceAnalysisWinForChild").show().kendoWindow({
width: "1000px",
height: "500px",
modal: true,
title: "Find"
});
$('#ResourceAnalysisWinForChild').data('kendoWindow').center().open();
}
function GetInvoiceGridDetail(ordKy) {
$.ajax({
url: urlInvoice.GetGridInvoiceDetail,
data: JSON.stringify({
ordKy: ordKy
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
for (i = 0; i < data.length; i++) {
var TrnNo = data[0].TrnNo;
$("#OrdNo1").val(TrnNo);
var PrefixTrnNo = data[0].PrefixTrnNo;
$("#PrefixOrdNo1").val(PrefixTrnNo);
var TrnTypKy = data[0].TrnTypKy;
$("#OrdTypKy1").val(TrnTypKy);
var TrnPreFixKy = data[0].TrnPreFixKy;
$("#OrdPrefixKy1").val(TrnPreFixKy);
var TrnKy = data[0].TrnKy;
$("#OrdKy1").val(TrnKy);
var LocKy = data[0].LocKy;
$("#cmbFmLocId").data("kendoComboBox").value(LocKy);
$("#cmbFmLocNm").data("kendoComboBox").value(LocKy);
var SlsAccKy = data[0].SlsAccKy;
$("#cmbSlsACId").data("kendoComboBox").value(SlsAccKy);
$("#cmbSlsACCd").data("kendoComboBox").value(SlsAccKy);
var AccKy = data[0].AccKy;
$("#HdrSec2_CmbAcc_Cd").data("kendoComboBox").value(AccKy);
//$("#HdrSec2_CmbAcc_Nm").data("kendoComboBox").value(AccKy);
var TrnDt = data[0].TrnDt;
$('#HdrSec1_DatPicDate_Val').data("kendoDatePicker").value(TrnDt);
var PmtTrmKy = data[0].PmtTrmKy;
$("#HdrSec3_CmbPmtTerm_Cd").data("kendoComboBox").value(PmtTrmKy);
var TrnCrnKy = data[0].TrnCrnKy;
$("#HdrSec3_CmbCurrency_Cd").data("kendoComboBox").value(TrnCrnKy);
var ExRate = data[0].TrnExRate;
$("#HdrSec3_InptExRate_Val").val(ExRate);
var Yurref = data[0].YurRef;
$("#HdrSec1_InptYurRef_Val").val();
var YurRefDate = data[0].YurRefDt;
$("#YurRefDate").val(YurRefDate);
var DocNo = data[0].DocNo;
$("#HdrSec1_InptDocNo_Val").val(DocNo);
var disamt = data[0].Dsicount;
$("#HdrSec4_InptDisc_Val").data("kendoNumericTextBox").value(disamt);
var NBT = data[0].NBT;
$("#HdrSec4_InptNBT_Val").data("kendoNumericTextBox").value(NBT);
var Vat = data[0].Vat;
$("#HdrSec4_InptVat_Val").data("kendoNumericTextBox").value(Vat);
var Wht = data[0].Wht;
$("#HdrSec4_InptWHT_Val").data("kendoNumericTextBox").value(Wht);
var Svat = data[0].Svat;
$("#HdrSec4_InptSVAT_Val").data("kendoNumericTextBox").value(Svat);
var Total = data[0].Total;
$("#HdrSec4_InptTotal_Val").data("kendoNumericTextBox").value(Total);
var SubTotal = Number(data[0].Total) - Number(data[0].Svat) - Number(data[0].Wht) - Number(data[0].Vat) - Number(data[0].NBT) + Number(data[0].Dsicount);
$("#HdrSec4_InptSubTot_Val").data("kendoNumericTextBox").value(SubTotal);
GetInvoiceItemsDetail(ordKy);
}
},
error: function (e) {
return false;
}
});
}
function GetInvoiceItemsDetail(ordKy) {
$.ajax({
url: urlInvoice.GetInvoiceItemsDetail,
data: JSON.stringify({
ordKy: ordKy,
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.filter(null);
var grid = $(id).data("kendoGrid");
grid.dataSource.data([]);
for (i = 0; i < data.length; i++) {
var PrjKy = data[0].PrjKy;
$("#cmbPrjId").data("kendoComboBox").value(PrjKy);
$("#cmbPrjNm").data("kendoComboBox").value(PrjKy);
var LocKy2 = data[0].LocKy;
$("#cmbFmLocId").data("kendoComboBox").value(LocKy2);
$("#cmbFmLocNm").data("kendoComboBox").value(LocKy2);
var AdrKy1 = data[0].AdrKy;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy1);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy1);
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.add({
ItmTrnKy: data[i].ItmTrnKy,
LiNo: data[i].LiNo,
ItmKy: data[i].ItmKy,
ItmCd: data[i].ItmCd,
ItmNm: data[i].ItmNm,
Unit: data[i].Unit,
UnitKy: data[i].UnitKy,
Des: data[i].Des,
DisAmt: data[i].DisAmt,
DisPer: data[i].DisPer,
Rem: data[i].Rem,
TrnQty: data[i].TrnQty,
TrnRate: data[i].TrnRate,
SubTotal: data[i].TrnRate * data[i].TrnQty,
VatAmt: data[i].VatAmt,
WHTAmt: data[i].WHTAmt,
NBTAmt: data[i].NBTAmt,
SVatAmt: data[i].SVatAmt,
VAT: (data[i].VatAmt / (data[i].TrnRate * data[i].TrnQty)) * 100,
WHT: (data[i].WHTAmt / (data[i].TrnRate * data[i].TrnQty)) * 100,
NBT: (data[i].NBTAmt / (data[i].TrnRate * data[i].TrnQty)) * 100,
SVAT: (data[i].SVatAmt / (data[i].TrnRate * data[i].TrnQty)) * 100,
Anl3Ky: data[i].Anl3Ky,
Anl3Cd: data[i].Anl3Cd
});
CreateNewGridRow();
}
},
error: function (e) {
return false;
}
});
}
function GetInvoiceAccountsDetail(ordKy) {
$.ajax({
url: urlInvoice.GetInvoiceAccountsDetail,
data: JSON.stringify({
ordKy: ordKy
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.filter(null);
var grid = $(id).data("kendoGrid");
grid.dataSource.data([]);
for (i = 0; i < data.length; i++) {
var LocKy2 = data[0].LocKy;
$("#cmbFmLocId").data("kendoComboBox").value(LocKy2);
$("#cmbFmLocNm").data("kendoComboBox").value(LocKy2);
var PrjKy = data[0].PrjKy;
$("#HdrSec2_CmbFrmPrj_Cd").data("kendoComboBox").value(PrjKy);
$("#cmbFmPrjNm").data("kendoComboBox").value(PrjKy);
var AccKy = data[0].AccKy;
$("#HdrSec2_CmbAcc_Cd").data("kendoComboBox").value(AccKy);
//$("#HdrSec2_CmbAcc_Nm").data("kendoComboBox").value(AccKy);
var BuKy = data[0].BuKy;
$("#cmbBUId").data("kendoComboBox").value(BuKy);
$("#cmbBUCd").data("kendoComboBox").value(BuKy);
var AdrKy1 = data[0].AdrKy;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy1);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy1);
// GetGridDetail(ordKy);
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.add({
ItmTrnKy: data[i].ItmTrnKy,
ItmKy: data[i].ItmKy,
ItmCd: data[i].ItmCd,
ItmNm: data[i].ItmNm,
Unit: data[i].Unit,
UnitKy: data[i].UnitKy,
Des: data[i].Des,
DisAmt: data[i].DisAmt,
DisPer: data[i].DisPer,
Rem: data[i].Rem,
TrnQty: data[i].Qty,
TrnRate: data[i].Rate,
SubTotal: data[i].Rate * data[i].Qty,
ReqDt: data[i].ReqDt,
});
}
},
error: function (e) {
return false;
}
});
}
function GetGrnItemsDetail(ordKy) {
$.ajax({
url: urlTransaction.GetGRNItemsDetail,
data: JSON.stringify({
ordKy: ordKy
}),
contentType: 'application/json; charset=utf-8',
dataType: "Json",
type: "POST",
success: function (data) {
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.filter(null);
var grid = $(id).data("kendoGrid");
grid.dataSource.data([]);
for (i = 0; i < data.length; i++) {
var LocKy2 = data[0].LocKy;
$("#cmbFmLocId").data("kendoComboBox").value(LocKy2);
$("#cmbFmLocNm").data("kendoComboBox").value(LocKy2);
var PrjKy = data[0].PrjKy;
$("#cmbPrjId").data("kendoComboBox").value(PrjKy);
$("#cmbPrjNm").data("kendoComboBox").value(PrjKy);
var AdrKy1 = data[0].AdrKy;
$("#HdrSec2_CmbAdr_Cd").data("kendoComboBox").value(AdrKy1);
// $("#HdrSec2_CmbAdr_Nm").data("kendoComboBox").value(AdrKy1);
// GetGridDetail(ordKy);
var id = ("#" + viewBag.OurCd);
$(id).data("kendoGrid").dataSource.add({
ItmTrnKy: data[i].ItmTrnKy,
LiNo: data[i].LiNo,
ItmKy: data[i].ItmKy,
ItmCd: data[i].ItmCd,
ItmNm: data[i].ItmNm,
Unit: data[i].Unit,
UnitKy: data[i].UnitKy,
PrcsId: data[i].PrcsID,
PrcsDetKy: data[i].PrcsDetKy,
Des: data[i].Des,
DisAmt: data[i].Dsicount,
DisPer: data[i].DisPer,
Rem: data[i].Rem,
TrnQty: data[i].Qty,
TrnRate: data[i].Rate,
SubTotal: data[i].Rate * data[i].Qty,
VatAmt: data[i].Vat,
WHTAmt: data[i].Wht,
NBTAmt: data[i].NBT,
SVatAmt: data[i].Svat,
VAT: (data[i].Vat / (data[i].Rate * data[i].Qty)) * 100,
WHT: (data[i].Wht / (data[i].Rate * data[i].Qty)) * 100,
NBT: (data[i].NBT / (data[i].Rate * data[i].Qty)) * 100,
SVAT: (data[i].Svat / (data[i].Rate * data[i].Qty)) * 100,
});
}
CreateNewGridRow();
},
error: function (e) {
return false;
}
});
}
function ItemFromPurOrd() {
$("#FindFormPo").show().kendoWindow({
width: "800px",
height: "550px",
modal: true,
title: "New From PurchesOrd"
});
$('#FindFormPo').data('kendoWindow').center().open();
}
var id = ("#" + viewBag.OurCd);
$(id).on("click", ".k-grid-evenselect", function () {
DeleteFromItmTrfrGrid(this);
});
// Delete Button For Details Grid.
$("#" + viewBag.OurCd).on("keydown", function (event) {
if ((event.keyCode == 46) || (event.which == 46)) {
RemoveFromGridByDelKey();
}
});
function DeleteFromItmTrfrGrid(clickId) {
//var answer = $(id).data("kendoGrid").removeRow($("#" + viewBag.OurCd).data("kendoGrid").select());
var id = ("#" + viewBag.OurCd);
var grid = $(id).data("kendoGrid");
var answer = grid.tbody.find($(clickId).closest("tr")).hide();
var selectedItem = grid.dataItem($(clickId).closest("tr"));
selectedItem.set("isAct", 0);
grid.refresh();
Calculatetotal();
}
function onDataBound(e) {
var id = ("#" + viewBag.OurCd);
var grid = $(id).data("kendoGrid");
var dataSource = grid.dataSource.data();
for (var i = 0; i < dataSource.length; i++) {
if (dataSource[i].isAct == 0) {
grid.tbody.find("[data-uid='" + dataSource[i].uid + "']").hide();
}
}
}
function RemoveFromGridByDelKey() {
var id = ("#" + viewBag.OurCd);
var grid = $(id).data("kendoGrid");
var answer = grid.tbody.find(grid.select()).hide();
var selectedItem = grid.dataItem(grid.select());
selectedItem.set("isAct", 0);
grid.refresh();
Calculatetotal();
}
|
const mongoose = require("mongoose");
const { Schema } = mongoose;
const moment = require("moment");
const commentSchema = new Schema({
commentBody: {
type: String,
required: true,
minlength: 1,
maxlength: 300,
},
createdAt: {
type: Date,
default: Date.now,
get: (timestamp) => moment(timestamp).format("MMM Do, YYYY [at] hh:mm a"),
},
firstName: {
type: String,
required: true,
},
});
module.exports = mongoose.model("Comment", commentSchema);
|
import { init } from "./classEditor";
import { init as serverInit } from "./server";
import { configureToasts } from "./toast";
configureToasts({
topOrigin: -48
});
window.addEventListener("load", () => {
serverInit(data => init(data));
});
|
/**
* @license Highstock JS v7.2.1 (2019-10-31)
*
* Parabolic SAR Indicator for Highstock
*
* (c) 2010-2019 Grzegorz Blachliński
*
* License: www.highcharts.com/license
*/
'use strict';
(function (factory) {
if (typeof module === 'object' && module.exports) {
factory['default'] = factory;
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
define('highcharts/indicators/psar', ['highcharts', 'highcharts/modules/stock'], function (Highcharts) {
factory(Highcharts);
factory.Highcharts = Highcharts;
return factory;
});
} else {
factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
}
}(function (Highcharts) {
var _modules = Highcharts ? Highcharts._modules : {};
function _registerModule(obj, path, args, fn) {
if (!obj.hasOwnProperty(path)) {
obj[path] = fn.apply(null, args);
}
}
_registerModule(_modules, 'indicators/psar.src.js', [_modules['parts/Globals.js']], function (H) {
/* *
*
* Parabolic SAR indicator for Highstock
*
* (c) 2010-2019 Grzegorz Blachliński
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
/* eslint-disable require-jsdoc */
// Utils:
function toFixed(a, n) {
return parseFloat(a.toFixed(n));
}
function calculateDirection(previousDirection, low, high, PSAR) {
if ((previousDirection === 1 && low > PSAR) ||
(previousDirection === -1 && high > PSAR)) {
return 1;
}
return -1;
}
/* *
* Method for calculating acceleration factor
* dir - direction
* pDir - previous Direction
* eP - extreme point
* pEP - previous extreme point
* inc - increment for acceleration factor
* maxAcc - maximum acceleration factor
* initAcc - initial acceleration factor
*/
function getAccelerationFactor(dir, pDir, eP, pEP, pAcc, inc, maxAcc, initAcc) {
if (dir === pDir) {
if (dir === 1 && (eP > pEP)) {
return (pAcc === maxAcc) ? maxAcc : toFixed(pAcc + inc, 2);
}
if (dir === -1 && (eP < pEP)) {
return (pAcc === maxAcc) ? maxAcc : toFixed(pAcc + inc, 2);
}
return pAcc;
}
return initAcc;
}
function getExtremePoint(high, low, previousDirection, previousExtremePoint) {
if (previousDirection === 1) {
return (high > previousExtremePoint) ? high : previousExtremePoint;
}
return (low < previousExtremePoint) ? low : previousExtremePoint;
}
function getEPMinusPSAR(EP, PSAR) {
return EP - PSAR;
}
function getAccelerationFactorMultiply(accelerationFactor, EPMinusSAR) {
return accelerationFactor * EPMinusSAR;
}
/* *
* Method for calculating PSAR
* pdir - previous direction
* sDir - second previous Direction
* PSAR - previous PSAR
* pACCMultiply - previous acceleration factor multiply
* sLow - second previous low
* pLow - previous low
* sHigh - second previous high
* pHigh - previous high
* pEP - previous extreme point
*/
function getPSAR(pdir, sDir, PSAR, pACCMulti, sLow, pLow, pHigh, sHigh, pEP) {
if (pdir === sDir) {
if (pdir === 1) {
return (PSAR + pACCMulti < Math.min(sLow, pLow)) ?
PSAR + pACCMulti :
Math.min(sLow, pLow);
}
return (PSAR + pACCMulti > Math.max(sHigh, pHigh)) ?
PSAR + pACCMulti :
Math.max(sHigh, pHigh);
}
return pEP;
}
/* eslint-enable require-jsdoc */
/**
* The Parabolic SAR series type.
*
* @private
* @class
* @name Highcharts.seriesTypes.psar
*
* @augments Highcharts.Series
*/
H.seriesType('psar', 'sma',
/**
* Parabolic SAR. This series requires `linkedTo`
* option to be set and should be loaded
* after `stock/indicators/indicators.js` file.
*
* @sample stock/indicators/psar
* Parabolic SAR Indicator
*
* @extends plotOptions.sma
* @since 6.0.0
* @product highstock
* @requires stock/indicators/indicators
* @requires stock/indicators/psar
* @optionparent plotOptions.psar
*/
{
lineWidth: 0,
marker: {
enabled: true
},
states: {
hover: {
lineWidthPlus: 0
}
},
/**
* @excluding period
*/
params: {
/**
* The initial value for acceleration factor.
* Acceleration factor is starting with this value
* and increases by specified increment each time
* the extreme point makes a new high.
* AF can reach a maximum of maxAccelerationFactor,
* no matter how long the uptrend extends.
*/
initialAccelerationFactor: 0.02,
/**
* The Maximum value for acceleration factor.
* AF can reach a maximum of maxAccelerationFactor,
* no matter how long the uptrend extends.
*/
maxAccelerationFactor: 0.2,
/**
* Acceleration factor increases by increment each time
* the extreme point makes a new high.
*
* @since 6.0.0
*/
increment: 0.02,
/**
* Index from which PSAR is starting calculation
*
* @since 6.0.0
*/
index: 2,
/**
* Number of maximum decimals that are used in PSAR calculations.
*
* @since 6.0.0
*/
decimals: 4
}
}, {
nameComponents: false,
getValues: function (series, params) {
var xVal = series.xData, yVal = series.yData,
// Extreme point is the lowest low for falling and highest high
// for rising psar - and we are starting with falling
extremePoint = yVal[0][1], accelerationFactor = params.initialAccelerationFactor, maxAccelerationFactor = params.maxAccelerationFactor, increment = params.increment,
// Set initial acc factor (for every new trend!)
initialAccelerationFactor = params.initialAccelerationFactor, PSAR = yVal[0][2], decimals = params.decimals, index = params.index, PSARArr = [], xData = [], yData = [], previousDirection = 1, direction, EPMinusPSAR, accelerationFactorMultiply, newDirection, prevLow, prevPrevLow, prevHigh, prevPrevHigh, newExtremePoint, high, low, ind;
if (index >= yVal.length) {
return false;
}
for (ind = 0; ind < index; ind++) {
extremePoint = Math.max(yVal[ind][1], extremePoint);
PSAR = Math.min(yVal[ind][2], toFixed(PSAR, decimals));
}
direction = (yVal[ind][1] > PSAR) ? 1 : -1;
EPMinusPSAR = getEPMinusPSAR(extremePoint, PSAR);
accelerationFactor = params.initialAccelerationFactor;
accelerationFactorMultiply = getAccelerationFactorMultiply(accelerationFactor, EPMinusPSAR);
PSARArr.push([xVal[index], PSAR]);
xData.push(xVal[index]);
yData.push(toFixed(PSAR, decimals));
for (ind = index + 1; ind < yVal.length; ind++) {
prevLow = yVal[ind - 1][2];
prevPrevLow = yVal[ind - 2][2];
prevHigh = yVal[ind - 1][1];
prevPrevHigh = yVal[ind - 2][1];
high = yVal[ind][1];
low = yVal[ind][2];
// Null points break PSAR
if (prevPrevLow !== null &&
prevPrevHigh !== null &&
prevLow !== null &&
prevHigh !== null &&
high !== null &&
low !== null) {
PSAR = getPSAR(direction, previousDirection, PSAR, accelerationFactorMultiply, prevPrevLow, prevLow, prevHigh, prevPrevHigh, extremePoint);
newExtremePoint = getExtremePoint(high, low, direction, extremePoint);
newDirection = calculateDirection(previousDirection, low, high, PSAR);
accelerationFactor = getAccelerationFactor(newDirection, direction, newExtremePoint, extremePoint, accelerationFactor, increment, maxAccelerationFactor, initialAccelerationFactor);
EPMinusPSAR = getEPMinusPSAR(newExtremePoint, PSAR);
accelerationFactorMultiply = getAccelerationFactorMultiply(accelerationFactor, EPMinusPSAR);
PSARArr.push([xVal[ind], toFixed(PSAR, decimals)]);
xData.push(xVal[ind]);
yData.push(toFixed(PSAR, decimals));
previousDirection = direction;
direction = newDirection;
extremePoint = newExtremePoint;
}
}
return {
values: PSARArr,
xData: xData,
yData: yData
};
}
});
/**
* A `PSAR` series. If the [type](#series.psar.type) option is not specified, it
* is inherited from [chart.type](#chart.type).
*
* @extends series,plotOptions.psar
* @since 6.0.0
* @product highstock
* @excluding dataParser, dataURL
* @requires stock/indicators/indicators
* @requires stock/indicators/psar
* @apioption series.psar
*/
''; // to include the above in the js output
});
_registerModule(_modules, 'masters/indicators/psar.src.js', [], function () {
});
}));
|
import AlertingModel from "./model";
import AlertingTemplate from "text-loader!./template.html";
import "bootstrap/js/alert";
/**
* @member AlertingTemplate
* @description Template used to create the alert message
* @memberof Alerting
*/
const AlertingView = Backbone.View.extend(/** @lends AlertingView.prototype */{
events: {
"click .close": "alertClosed",
"click .alert-confirm": "alertConfirmed"
},
/**
* @class AlertingView
* @extends Backbone.View
* @memberof Alerting
* @constructs
* @fires Alerting#RadioTriggerAlertClosed
* @fires Alerting#RadioTriggerAlertConfirmed
* @listens Alerting#render
* @listens Alerting#changePosition
* @listens Alerting#RadioTriggerAlertAlertRemove
*/
initialize: function () {
this.listenTo(this.model.get("channel"), {
"alert:remove": this.removeAll
}, this);
this.listenTo(this.model, {
"render": this.render,
"change:position": this.positionAlerts
}, this);
$("body").prepend(this.$el);
},
id: "messages",
className: "top-center",
model: new AlertingModel(),
template: _.template(AlertingTemplate),
/**
* Renders the data to DOM.
* @return {AlertingView} returns this
*/
render: function () {
var attr = this.model.toJSON();
this.$el.append(this.template(attr));
if (_.has(attr, "animation") && attr.animation !== false) {
this.$el.find(".alert").last().fadeOut(attr.animation, function () {
$(this).remove();
});
}
return this;
},
/**
* Reacts to click on dismiss button.
* @param {Event} evt Click event on dismissable alert
* @fires AlertingView#RadioTriggerAlertClosed
* @return {void}
*/
alertClosed: function (evt) {
var div = $(evt.currentTarget).parent(),
isDismissable = div.length > 0 ? $(div[0]).hasClass("alert-dismissable") : false;
if (isDismissable === true) {
Radio.trigger("Alert", "closed", $(div[0]).attr("id"));
}
},
/**
* Reacts to click on confirm button.
* @param {Event} evt Click event on confirmable alert
* @fires AlertingView#RadioTriggerAlertConfirmed
* @return {void}
*/
alertConfirmed: function (evt) {
var div = $(evt.currentTarget).parent();
Radio.trigger("Alert", "confirmed", $(div[0]).attr("id"));
this.model.setIsConfirmable(false);
},
/**
* Sets position of alert via css-classes.
* @param {Backbone.Model} model - this.model
* @param {String} value - this.model.get("position")
* @returns {void}
*/
positionAlerts: function (model, value) {
var currentClassName = this.$el.attr("class");
this.$el.removeClass(currentClassName);
this.$el.addClass(value);
},
/**
* Removes all alerts
* @returns {void}
*/
removeAll: function () {
this.$el.find(".alert").remove();
}
});
export default AlertingView;
|
import DistanceItem from './DistanceItem'
export default DistanceItem
|
const ast = ["svg",{"attrs":{"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","class":"feather feather-inbox"}},[["polyline",{"attrs":{"points":"22 12 16 12 14 15 10 15 8 12 2 12"}},[]],["path",{"attrs":{"d":"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}},[]]]]
export default {
install (Vue, options) {
Vue.component('f-inbox', {
render (h) {
const r = ast => {
const [tag, attrs, children] = ast
return h(tag, attrs, children ? children.map(r) : [])
}
return r(ast)
}
})
}
}
|
var searchData=
[
['saph_5fa',['saph_a',['../group__saph__a__api.html',1,'']]],
['saph',['saph',['../group__saph__api.html',1,'']]],
['sdhs',['sdhs',['../group__sdhs__api.html',1,'']]],
['sfr',['sfr',['../group__sfr__api.html',1,'']]],
['sysctl',['sysctl',['../group__sysctl__api.html',1,'']]]
];
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
require('./body.css');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Body = function (_Component) {
_inherits(Body, _Component);
function Body() {
_classCallCheck(this, Body);
return _possibleConstructorReturn(this, (Body.__proto__ || Object.getPrototypeOf(Body)).apply(this, arguments));
}
_createClass(Body, [{
key: 'render',
value: function render() {
var style2 = this.props.style;
return _react2.default.createElement(
'div',
{ className: 'body', style: style2 },
this.props.children
);
}
}]);
return Body;
}(_react.Component);
exports.default = Body;
|
import React from 'react';
import AppBar from '@material-ui/core/AppBar';
import CssBaseline from '@material-ui/core/CssBaseline';
import Drawer from '@material-ui/core/Drawer';
import Hidden from '@material-ui/core/Hidden';
import IconButton from '@material-ui/core/IconButton';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import MenuIcon from '@material-ui/icons/Menu';
import CloseIcon from '@material-ui/icons/Close';
import Toolbar from '@material-ui/core/Toolbar';
import { Grid, Typography } from '@material-ui/core';
import Box from '@material-ui/core/Box';
import Link from '@material-ui/core/Link';
import { makeStyles } from '@material-ui/core/styles';
import logo from '../images/mylogo.svg';
const useStyles = makeStyles((theme) => ({
root: {
display: 'flex',
backgroundColor: 'white',
flexDirection: 'column',
justifyContent: 'flex-start',
overflow: 'hidden'
},
navBar: {
justifyContent: 'flex-start',
paddingTop: '20px',
[theme.breakpoints.down('xs')]: {
// justifyContent: 'space-between',
},
},
drawer: {
[theme.breakpoints.up('sm')]: {
width: 200,
flexShrink: 0,
},
},
appBar: {
boxShadow: 'none',
zIndex: theme.zIndex.drawer + 1,
display: 'flex',
height: '10vh',
justifyContent: 'center',
backgroundColor: '#F9FE12',
color: '#000',
[theme.breakpoints.down('xs')]: {
height: '11vh',
backgroundColor: '#F9FE12',
},
},
menuButton: {
fontSize:'3rem',
[theme.breakpoints.up('md')]: {
display: 'none',
color: '#FFA500',
},
padding: '0',
margin: '5px'
},
toolbar: theme.mixins.toolbar,
drawerPaper: {
width: 220,
backgroundColor: 'black',
paddingTop:'30px',
},
toolbar:{
paddingBottom:'15px'
},
navLink: {
color: `black`,
paddingRight: 40,
fontSize: '16px',
textDecoration:'none',
fontWeight:'600',
paddingTop:'10px',
letterSpacing: '.1em',
[theme.breakpoints.down('sm')]: {
color:'#F9FE12',
fontWeight:'bold',
}
},
linkButton: {
padding:'8px 10px 8px 10px',
color:'black'
},
signUpLink:{
color:'white'
},
purpleButton: {
[theme.breakpoints.down('sm')]:{
display:'none'
},
backgroundColor: `black`,
'&:hover': {
backgroundColor: `black`,
},
display: 'inline-flex',
alignItems: 'right',
justifyContent: 'center',
borderRadius: '4em',
padding: '10px 10px',
textDecoration: 'none',
fontWeight:'bold'
},
mainText: {
color: `rgba(81, 51, 171, 1)`,
fontWeight: '400',
marginBottom: 10,
fontSize: 22,
[theme.breakpoints.down('xs')]: {
marginBottom: 15,
},
},
logoContainer:{
paddingTop:'5px'
},
subText: {
color: `rgba(81, 51, 171, 1)`,
marginBottom: 20,
fontSize: 18,
fontWeight: '300',
[theme.breakpoints.down('xs')]: {
marginBottom: 25,
},
},
closeMenuButton: {
marginRight: 'auto',
marginLeft: 0,
color: '#F9FE12'
},
menuIcon:{
fontSize:'2.5rem'
},
headerTitle: {
paddingRight: 40,
fontWeight:600
},
logo:{
padding: '0',
marginRight:'15px',
[theme.breakpoints.down('sm')]:{
width:'40%',
padding: '8px 15px 8px 15px'
},
[theme.breakpoints.up('md')]: {
width:'35%'
},
[theme.breakpoints.down('xs')]: {
width:'70%'
}
},
closeMenuButton:{
fontSize:'3rem'
},
})); // NavBar
const NavBar = () => {
const drawerLinks = [
{ text: 'HOME', href: '/' },
{ text: 'SERVICES', href: '' },
{ text: 'WORK', href: '#projects' },
];
const classes = useStyles();
const [mobileOpen, setMobileOpen] = React.useState(false);
function handleDrawerToggle() {
setMobileOpen(!mobileOpen);
}
const drawer = (
<div>
<List>
{drawerLinks.map((link) => (
<ListItem button key={link.text}>
<Link href={link.href} target='_blank' className={classes.navLink}>
<ListItemText primary={link.text} />
</Link>
</ListItem>
))}
</List>
</div>
);
return (
<React.Fragment>
<div className={classes.root}>
<CssBaseline />
<AppBar position='fixed' className={classes.appBar}>
<Toolbar>
<Grid container className={classes.navBar} md={6} direction='row'>
<Box display='flex' className={classes.logoContainer}>
<img style={{ height: 'auto' }} src={logo} alt='logo' className={classes.logo} />
</Box>
</Grid>
<Grid container md={6} justify="flex-end">
<Grid container direction='row' md={9} justify="flex-end">
<Hidden smDown>
{drawerLinks.map(
(link, i) =>
i !== drawerLinks.length + 1 && (
<Link key={i} href={link.href} target='_blank' className={classes.navLink}>
{link.text}
</Link>
)
)}
</Hidden>
</Grid>
<Grid container className={classes.purpleButton} md={3}>
<Link
href='https://meetings.hubspot.com/vasiliki-robles'
target='_blank'
className={classes.signUpLink}
style={{ textDecoration: 'none' }}>
GET STARTED
</Link>
</Grid>
<IconButton
color='inherit'
aria-label='Open drawer'
edge='start'
onClick={handleDrawerToggle}
className={classes.menuButton}>
<MenuIcon className={classes.menuIcon}/>
</IconButton>
</Grid>
</Toolbar>
</AppBar>
{/* CODE FOR WHEN DRAWER IS OPEN 0 20 50 rgba(0 0 0 , .5)*/}
</div>
<nav className={classes.drawer}>
<Hidden smUp implementation='css'>
<Drawer
variant='temporary'
anchor={'right'}
open={mobileOpen}
onClose={handleDrawerToggle}
classes={{
paper: classes.drawerPaper,
}}
// Better open performance on mobile. >
ModalProps={{ keepMounted: true }}>
<IconButton onClick={handleDrawerToggle} className={classes.closeMenuButton} size={'large'}>
<CloseIcon />
</IconButton>
{drawer}
</Drawer>
</Hidden>
</nav>
</React.Fragment>
);
};
export default NavBar;
|
import React from 'react'
const About = () => (
<div>
<br/>
<h3>About Recipe Box: </h3>
<p>Recipe Box is a cookbook in your pocket. Our service allows you to add and remove any recipes and saves all your recipes in our database so that they will never be lost. We hope to provide the best experience in the kitchen.</p>
</div>
)
export default About
|
const puppeteer = require('puppeteer');
/**
* To have Puppeteer fetch a Firefox binary for you, first run:
*
* PUPPETEER_PRODUCT=firefox npm install
*
* To get additional logging about which browser binary is executed,
* run this example as:
*
* DEBUG=puppeteer:launcher NODE_PATH=../ node examples/cross-browser.js
*
* You can set a custom binary with the `executablePath` launcher option.
*
*
*/
const firefoxOptions = {
product: 'firefox',
extraPrefsFirefox: {
// Enable additional Firefox logging from its protocol implementation
// 'remote.log.level': 'Trace',
},
// Make browser logs visible
dumpio: true,
};
(async () => {
const browser = await puppeteer.launch(firefoxOptions);
const page = await browser.newPage();
console.log(await browser.version());
await page.goto('https://news.ycombinator.com/');
// Extract articles from the page.
const resultsSelector = '.storylink';
const links = await page.evaluate((resultsSelector) => {
const anchors = Array.from(document.querySelectorAll(resultsSelector));
return anchors.map((anchor) => {
const title = anchor.textContent.trim();
return `${title} - ${anchor.href}`;
});
}, resultsSelector);
console.log(links.join('\n'));
await browser.close();
})();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.